Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ysarock/fetch-firestore-types
Generate Typescript file from Firestore Databases from CLI
https://github.com/ysarock/fetch-firestore-types
cli firebase firestore typescript
Last synced: 4 months ago
JSON representation
Generate Typescript file from Firestore Databases from CLI
- Host: GitHub
- URL: https://github.com/ysarock/fetch-firestore-types
- Owner: YsarocK
- License: mit
- Created: 2023-04-03T20:04:47.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-03T17:28:18.000Z (12 months ago)
- Last Synced: 2024-10-19T02:15:17.562Z (4 months ago)
- Topics: cli, firebase, firestore, typescript
- Language: TypeScript
- Homepage:
- Size: 1.18 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Generate Typesript types from Appwrite Databases

## Quick usage
Make sure ton add the following values to your ```.env``` :
```FIREBASE_PROJECT_ID```
```FIREBASE_PRIVATE_KEY```
```FIREBASE_CLIENT_EMAIL```Then run the following command :
```bash
npx fetch-firestore-types
```## Installation
```bash
# yarn
yarn add fetch-firestore-types# npm
npm install fetch-firestore-types
```Make sure ton add the following values to your ```.env``` :
```FIREBASE_PROJECT_ID```
```FIREBASE_PRIVATE_KEY```
```FIREBASE_CLIENT_EMAIL``````javascript
import { FetchNewTypes } from "fetch-firestore-types/dist/main";await FetchNewTypes();
```## Parameters
| Name | Default value | Description |
|----------|----------------|----------------------------------------------------|
| outDir | ```"/types"``` | The folder where the type file will be generated |
| queryResultsLength | ```25``` | Number of items per collection to creates types on |### Usage
#### CLI
Params can be passed as arguments in any order, except for the outDir which might be followed by the path.
```bash
npx fetch-appwrite-types includeDBName outDir /types queryResultsLength 50
```#### Library
```javascript
await FetchNewTypes({
outDir: "/types",
queryResultsLength: 50,
})
```## Handled types
| Appwrite type | Generated type (simple) |
|------------------|-------------------------|
| String | ```string``` |
| Integer / Double | ```integer``` |
| Boolean | ```boolean``` |
| Null | ```null``` |
| Array | ```Array``` |
| Object | ```Object``` |