{"id":18974682,"url":"https://github.com/snorreks/nx-cloud-functions-deployer","last_synced_at":"2025-07-15T04:31:50.541Z","repository":{"id":59145128,"uuid":"532599022","full_name":"snorreks/nx-cloud-functions-deployer","owner":"snorreks","description":"Plugin for Nx that adds support for deploying Cloud Functions for Firebase.","archived":false,"fork":false,"pushed_at":"2025-05-16T08:17:30.000Z","size":2923,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-03T09:43:41.279Z","etag":null,"topics":["cache","cloud","cloud-functions-for-firebase","cloudfunctions","deploy","esbuild","firebase","functions","monorepo","node","node-14","node-16","node-18","nx","script","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snorreks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-04T16:46:13.000Z","updated_at":"2025-05-16T08:17:34.000Z","dependencies_parsed_at":"2023-11-10T14:43:16.806Z","dependency_job_id":"bb4e2bba-c974-429e-a461-2ab053ced338","html_url":"https://github.com/snorreks/nx-cloud-functions-deployer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snorreks/nx-cloud-functions-deployer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snorreks%2Fnx-cloud-functions-deployer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snorreks%2Fnx-cloud-functions-deployer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snorreks%2Fnx-cloud-functions-deployer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snorreks%2Fnx-cloud-functions-deployer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snorreks","download_url":"https://codeload.github.com/snorreks/nx-cloud-functions-deployer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snorreks%2Fnx-cloud-functions-deployer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265402833,"owners_count":23759237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","cloud","cloud-functions-for-firebase","cloudfunctions","deploy","esbuild","firebase","functions","monorepo","node","node-14","node-16","node-18","nx","script","typescript"],"created_at":"2024-11-08T15:15:48.896Z","updated_at":"2025-07-15T04:31:50.518Z","avatar_url":"https://github.com/snorreks.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nx-cloud-functions-deployer\u003c!-- omit in toc --\u003e\n\n[![npm (nx-cloud-functions-deployer)](https://img.shields.io/npm/v/nx-cloud-functions-deployer)](https://www.npmjs.com/package/nx-cloud-functions-deployer)\n\nThis is a plugin for [Nx](https://nx.dev) that adds support for deploying [Cloud Functions for Firebase](https://firebase.google.com/products/functions?gclsrc=ds\u0026gclsrc=ds\u0026gclid=CNmq16LU-_kCFa5IwgodA9cF8A).\n\nFrom version 2.0.0 this plugin only supports cloud functions v2, if you want v1 support use version 1.2.2.\n\n- [Features](#features)\n- [Install](#install)\n- [Description](#description)\n- [Prerequisites](#prerequisites)\n- [Helper Functions](#helper-functions)\n    - [Schedule Example](#schedule-example)\n    - [Auth Example](#auth-example)\n    - [Database Example](#database-example)\n    - [Firestore Example](#firestore-example)\n    - [Https Example](#https-example)\n    - [Assets and external dependencies](#assets-and-external-dependencies)\n    - [Limitations](#limitations)\n- [Folder Structure](#folder-structure)\n    - [Firestore Structure](#firestore-structure)\n    - [Custom Structure](#custom-structure)\n- [Cloud cache](#cloud-cache)\n- [Logger](#logger)\n- [Executors](#executors)\n    - [deploy](#deploy) - [deploy options](#deploy-options) - [deploy examples](#deploy-examples)\n    - [script](#script) - [script options](#script-options) - [script examples](#script-examples)\n    - [delete](#delete) - [delete options](#delete-options)\n    - [emulate](#emulate) - [emulate options](#emulate-options)\n    - [read-env](#read-env) - [read-env options](#read-env-options)\n    - [rules](#rules)\n    - [sam](#sam)\n\n## Features\n\n- Auto alias support\n- Support for multiple [environments](https://firebase.google.com/docs/functions/config-env)\n- Esbuild for faster builds\n- Detect changes and only deploy changed functions\n- No longer export all functions in a index.ts file, but deploy each function individually for smaller bundles\n- Configurable deploy options\n- Deploy with Node 14/16/18/20/22 and esm\n- Cloud functions v2 support\n- Deploy rules and indexes\n- Execute scripts locally\n- Read env file and copy to clipboard\n- Cloud cache support\n- Run emulators locally\n- AWS SAM: build, deploy and watch logs for lambda functions\n\n## Install\n\n```bash\npnpm i -D nx-cloud-functions-deployer\n```\n\n## Description\n\nThis plugin adds a `deploy` executor that will build and deploy your cloud functions.\n\nIt uses esbuild to bundle your functions and then uses the [firebase-tools](https://www.npmjs.com/package/firebase-tools) to deploy them.\n\n## Prerequisites\n\n- You will need to have the [firebase-tools](https://www.npmjs.com/package/firebase-tools) installed. Either globally or locally in your project. If you install it globally you have to set `packageManager` option to `global`.\n\n```bash\npnpm i -D firebase-tools\n```\n\nIf you want to use [Cloud cache](#cloud-cache) or run [scripts](#script) you will also need [tsx](https://www.npmjs.com/package/tsx) installed.\n\n```bash\npnpm i -D tsx\n```\n\n## Helper Functions\n\nYou need to import the helper functions from `nx-cloud-functions-deployer`. This will allow you to configure your functions and make the functions stronger typed.\n\n### Schedule Example\n\nFor schedule functions options.schedule is required.\n\n```typescript\nimport { onSchedule } from 'nx-cloud-functions-deployer';\n\nexport default onSchedule(\n\t(context) =\u003e {\n\t\tconsole.log('daily', context);\n\t},\n\t{\n\t\tschedule: 'every day 00:00',\n\t},\n);\n```\n\n### Auth Example\n\nAuth triggers have the following functions: `onAuthCreate`, `onAuthDeleted`,`beforeAuthCreate` and `beforeAuthDeleted`.\n\n```typescript\nimport { onAuthCreate } from 'nx-cloud-functions-deployer';\n\nexport default onAuthCreate(({ uid }) =\u003e {\n\tconsole.log('New user created: uid', uid);\n});\n```\n\n### Database Example\n\nDatabase triggers have the following functions: `onValueCreated`, `onValueDeleted`, `onValueUpdated` and `onValueWritten`. You must always add the `ref` for each database function.\n\n```typescript\nimport { onValueCreated } from 'nx-cloud-functions-deployer';\n\nexport default onValueCreated(\n\t({ data }) =\u003e {\n\t\tconsole.log('New gmail user created:', data.val());\n\t},\n\t{\n\t\tref: '/user/{data.key=*@gmail.com}',\n\t},\n);\n```\n\n### Firestore Example\n\nWhen you use the `onWritten`, `onCreated`, `onUpdated` or `onDeleted` helper functions for firestore. The data will automatically convert the snapshot to\n\n```typescript\n{\n ...documentSnapshot.data(),\n id: documentSnapshot.id,\n}\n```\n\n```typescript\n// shared lib\nimport type { CoreData } from 'nx-cloud-functions-deployer';\nexport interface UserData extends CoreData {\n\temail: string;\n}\n```\n\n```typescript\nimport { onCall } from 'nx-cloud-functions-deployer';\nimport type { UserData } from '@my-project/shared';\n\nexport default onCreated\u003cUserData\u003e(({ data }) =\u003e {\n\tconsole.log(`User ${data.email} created`);\n});\n```\n\n### Https Example\n\nonCall and onRequest can give even better typing with frontend. By importing a interface from a shared file.\n\n```typescript\n// shared lib\nexport type MyFunctions = {\n\tmy_function_name: [\n\t\t{\n\t\t\tmessage: string; // request data\n\t\t},\n\t\t{\n\t\t\tresponse: boolean; // response data\n\t\t},\n\t];\n};\n```\n\n```typescript\nimport { onCall } from 'nx-cloud-functions-deployer';\nimport type { MyFunctions } from '@my-project/shared';\n\nexport default onCall\u003cMyFunctions, 'my_function_name'\u003e(({ data }) =\u003e {\n\tconsole.log(data); // { message: string }\n\treturn { response: true };\n});\n```\n\n### Assets and external dependencies\n\nTo include assets and external dependencies you can use the `assets` and `external` options.\n\nExternal will install the dependencies in the function folder and add them to the package.json. This is useful for dependencies that do not work with bundle.\n\nAssets will copy the files from src/assets to the dist folder (right next to index.js)\n\n```typescript\nimport { onCall } from 'nx-cloud-functions-deployer';\n\nexport default onCall(\n\t({ data }) =\u003e {\n\t\treturn { response: true };\n\t},\n\t{\n\t\tassets: ['test.png'],\n\t\texternal: ['sharp'],\n\t\tkeepNames: true,\n\t},\n);\n```\n\nAlso note that if you use sharp, you need keepNames: true. See [documentation](https://esbuild.github.io/api/#keep-names)\n\n### Limitations\n\nYou cannot have comments, variables or [numeric separators](https://mariusschulz.com/blog/numeric-separators-in-typescript) in the options section. If the options section is invalid it will skip the options and deploy as default.\n\nAll these lines in the options are not allowed:\n\n```typescript\nimport { onCall } from 'nx-cloud-functions-deployer';\n\nconst region = 'europe-west1';\nconst memory = '2GB';\n\nexport default onCall(\n\t(data, context) =\u003e {\n\t\treturn { response: true };\n\t},\n\t{\n\t\tregion,\n\t\ttimeoutSeconds: 1_800,\n\t\tmemory: memory,\n\t\t// a random comment\n\t},\n);\n```\n\n## Folder Structure\n\nSee the [example](https://github.com/snorreks/nx-cloud-functions-deployer/tree/master/example/apps/functions/src/controllers) for a better understanding of the folder structure.\n\nIt is recommend to have the following folder structure, but it is not required.\n\n```bash\n\n├── your-nx-project\n│   ├──src\n│   │  ├── controllers\n│   │  │  ├── https\n│   │  │  │  ├── callable\n│   │  │  │  ├── request\n│   │  │  ├── database\n│   │  │  ├── firestore\n│   │  │  ├── storage\n|   |  |  ├── auth\n│   │  │  ├── pubsub\n│   │  │  │  ├── schedule\n│   │  │  │  ├── topic\n\n```\n\nThe folders in controllers will different deployment types:\n\n- `request` - [HTTP requests](https://firebase.google.com/docs/functions/http-events)\n- `callable` - [Callable functions](https://firebase.google.com/docs/functions/callable)\n- `firestore` - [Cloud Firestore triggers](https://firebase.google.com/docs/functions/firestore-events)\n- `database` - [Cloud Firestore triggers](https://firebase.google.com/docs/functions/firestore-events)\n- `schedule` - [Scheduled functions](https://firebase.google.com/docs/functions/schedule-functions)\n- `storage` - [Cloud Storage triggers](https://firebase.google.com/docs/functions/gcp-storage-events)\n- `auth` - [Auth triggers](https://firebase.google.com/docs/functions/auth-events)\n\nThe default function names will be the path from the `api/callable/database/scheduler` folder to the file. For example, the function `controllers/api/stripe/webhook_endpoint.ts` will be deployed as `stripe_webhook_endpoint`.\n\n### Firestore Structure\n\nThe firestore structure is a little different. It is recommend the folder structure to match to structure in the firestore. For example, if you have a firestore structure like this:\n\n```bash\n├── users # collection\n│   ├── uid # a user document\n│   │  ├── notifications # a sub collection\n│   │  │  ├── notificationId # a notification document in the sub collection\n```\n\nThen you would have the following folder structure:\n\n```bash\n├── firestore\n│  ├── users\n│  │  ├── [uid]\n│  │  │  ├── created.ts # will be called every time a user document is created.\n│  │  │  ├── updated.ts # will be called every time a user document is updated.\n│  │  │  ├── deleted.ts # will be called every time a user document is deleted.\n│  │  │  ├── notifications\n│  │  │  │  ├── [notificationId]\n│  │  │  │  │  ├── created.ts # will be called every time a notification document is created.\n```\n\nThe default function name for database/firestore functions will omit `[id]`. Example: `controllers/database/users/[id]/created.ts` will be deployed as `users_created`.\n\n### Custom Structure\n\nTo customize the folder structure, change the `functionsDirectory` in options.\nIf you change the structure you have to specify the `document` for firestore functions and `ref` for database functions.\n\nExample:\n\n```typescript\n// controllers/firestore/my-custom-user-created-file.ts\nimport { onCreated } from 'nx-cloud-functions-deployer';\nimport type { UserData } from '@my-project/shared';\n\nexport default onCreated\u003cUserData\u003e(\n\t({ data }) =\u003e {\n\t\tconsole.log(`User ${data.email} created`);\n\t},\n\t{\n\t\tfunctionName: 'custom_function_name',\n\t\tdocument: 'users/{id}',\n\t},\n);\n```\n\n## Cloud cache\n\nThe plugin will detect changes on the deployed functions locally. But it is also possible to cache the changes for the deployed functions on your own server. To do this create a file in the project directory called `functions-cache.ts`.\nThe file needs to export two function `fetch` and `update` which will be called by the plugin. Note you will also get the environments, so you can use process.env, if you want to hide production secrets for fetching/updating the cache.\n\n```typescript\nimport type {\n\tFunctionsCacheFetch,\n\tFunctionsCacheUpdate,\n} from 'nx-cloud-functions-deployer';\n\nexport const fetch: FunctionsCacheFetch = async ({ flavor }) =\u003e {\n\t// fetch the cache from the cloud\n};\n\nexport const update: FunctionsCacheUpdate = async ({\n\tflavor,\n\tnewFunctionsCache,\n}) =\u003e {\n\t// update the cache in the cloud\n};\n```\n\nSee the [example](https://github.com/snorreks/nx-cloud-functions-deployer/blob/master/example/apps/functions/functions-cache.ts) for how to setup cloud cache with [jsonbin](https://jsonbin.io/)\n\n## Logger\n\nIf you want to see metric for each function (like opentelemetry or sentry) , add a logger.ts file in the src folder (see [example](https://github.com/snorreks/nx-cloud-functions-deployer/blob/master/example/apps/functions/src/logger.ts)). The logger will be build and added for each function.\n\n## Executors\n\n### deploy\n\n```json\n...\n \"targets\": {\n  \"deploy\": {\n   \"executor\": \"nx-cloud-functions-deployer:deploy\",\n   \"options\": {\n    \"flavors\": {\n     \"development\": \"firebase-project-development-id\",\n     \"production\": \"firebase-project-production-id\"\n    }\n   }\n  },\n```\n\n#### deploy options\n\n| Option               | Description                                                                                                                                                          | Default                           | Alias            |\n| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ---------------- |\n| `flavors`            | A object of the flavors to use, the key is the flavor name and value is the firebase project id.                                                                     | required                          |                  |\n| `flavor`             | The flavor to use, default will be the first key in the `flavors` object                                                                                             |                                   |                  |\n| `production`         | If true, the `flavor` will be 'production' if `flavor` is not defined                                                                                                | `false`                           | `prod`           |\n| `development`        | If true, the `flavor` will be 'development' if `flavor` is not defined                                                                                               | `false`                           | `dev`            |\n| `outputDirectory`    | The output directory.                                                                                                                                                | `dist/\u003crelative-path-to-project\u003e` | `outDir`         |\n| `envFiles`           | the key is the flavor name and value is path to the env file, default is `.env.${flavor}`                                                                            |                                   |                  |\n| `tsconfig`           | The tsconfig file to use for the build in the project directory.                                                                                                     | `tsconfig.json`                   | `tsconfig`       |\n| `region`             | The default region to deploy the functions, if it is not set in the deploy file. See [Cloud Functions Locations](https://cloud.google.com/functions/docs/locations). | `us-central1`                     | `location`       |\n| `silent`             | Whether to suppress all logs.                                                                                                                                        | `false`                           | `s`              |\n| `verbose`            | Whether to run the command with verbose logging.                                                                                                                     | `false`                           | `v`              |\n| `concurrency`        | The number of functions to deploy in parallel                                                                                                                        | `5`                               | `c`              |\n| `envString`          | Stringify version of the environment. This is useful when you want to deploy using CI/CD.                                                                            | undefined                         | `ciEnv`          |\n| `only`               | Only deploy the given function names separated by comma                                                                                                              | undefined                         | `o`              |\n| `force`              | Force deploy all functions, even if no files changed                                                                                                                 | `false`                           | `f`              |\n| `packageManager`     | The package manager to use for deploying with firebase-tools. Either: `pnpm`, `npm`, `yarn` or `global`.                                                             | `pnpm`                            | `pm`             |\n| `dryRun`             | If true, then it will only build the function and not deploy them.                                                                                                   | `false`                           | `d`, `dry`       |\n| `functionsDirectory` | Relative path from the project root to the functions directory.                                                                                                      | `src/controllers`                 | `inputDirectory` |\n| `nodeVersion`        | The node version to use for the functions.                                                                                                                           | `20`                              | `node`           |\n| `minify`             | Whether to minify the functions                                                                                                                                      | `true`                            |                  |\n\n#### deploy examples\n\n```bash\npnpm nx deploy functions --flavor production\n```\n\n```bash\npnpm nx deploy functions --development\n```\n\n```bash\npnpm nx deploy functions --development --only my_function,my_other_function --f\n# will deploy only the functions my_function and my_other_function\n# and deploy them even if no files have changed\n```\n\n### script\n\nThe plugin also provide support to run scripts locally. The plugin will run any files in the `scripts` directory. The files needs to export default a function.\n\n```ts\nimport { firestore } from '$configs/firestore';\nimport type { ScriptFunction } from 'nx-cloud-functions-deployer';\n\nexport default (async ({ prompt }) =\u003e {\n\tconsole.log('prompt', prompt);\n\tconst { uid } = await prompt\u003c{ uid: string }\u003e({\n\t\ttype: 'input',\n\t\tname: 'uid',\n\t\tmessage: 'Enter the uid',\n\t\tvalidate: (value) =\u003e {\n\t\t\tif (value.length === 20) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn 'The uid must be 20 characters long';\n\t\t},\n\t});\n\n\tconst documentSnap = await firestore.collection('users').doc(uid).get();\n\n\tif (!documentSnap.exists) {\n\t\tthrow new Error('User not found');\n\t}\n\treturn { id: documentSnap.id, ...documentSnap.data() };\n}) satisfies ScriptFunction;\n```\n\nYou can also add a `script-config.{flavor}.ts` file in the project root. In these files you can execute code before before running a script.\n\nTo make firebase work locally see [example](https://github.com/snorreks/nx-cloud-functions-deployer/blob/master/example/apps/functions/src/configs/app.ts).\n\n```json\n...\n \"targets\": {\n  \"script\": {\n   \"executor\": \"nx-cloud-functions-deployer:script\",\n   \"options\": {\n    \"flavors\": {\n     \"development\": \"firebase-project-development-id\",\n     \"production\": \"firebase-project-production-id\"\n    }\n   }\n  },\n```\n\n#### script options\n\n| Option        | Description                                                                                      | Default         | Alias      |\n| ------------- | ------------------------------------------------------------------------------------------------ | --------------- | ---------- |\n| `flavors`     | A object of the flavors to use, the key is the flavor name and value is the firebase project id. | required        |            |\n| `flavor`      | The flavor to use, default will be the first key in the `flavors` object                         |                 |            |\n| `production`  | If true, the `flavor` will be 'production' if not defined                                        | `false`         | `prod`     |\n| `development` | If true, the `flavor` will be 'development' if not defined                                       | `false`         | `dev`      |\n| `envFiles`    | the key is the flavor name and value is path to the env file, default is `.env.${flavor}`        |                 |            |\n| `tsconfig`    | The tsconfig file to use for the script in the project directory.                                | `tsconfig.json` | `tsconfig` |\n| `silent`      | Whether to suppress all logs.                                                                    | `false`         | `s`        |\n| `verbose`     | Whether to run the command with verbose logging.                                                 | `false`         | `v`        |\n| `scriptsRoot` | Relative path from the project root to the scripts directory.                                    | `scripts`       |            |\n| `runPrevious` | Rerun the last executed script.                                                                  | `false`         | `p`        |\n| `script`      | The name of the script to run. If not set, it will prompt you to select from a list.             | undefined       | `file`     |\n\n#### script examples\n\n```bash\npnpm nx script functions --production\n```\n\n```bash\npnpm nx script functions --flavor development\n```\n\n```bash\npnpm nx script functions --development -p\n# will run the last executed script in development\n```\n\n### delete\n\nThe plugin provide support to delete unused function that are not in the project anymore. The plugin will delete any functions that are not in the `functions` directory.\n\n```json\n...\n \"targets\": {\n  \"delete-unused\": {\n   \"executor\": \"nx-cloud-functions-deployer:delete\",\n   \"options\": {\n    \"flavors\": {\n     \"development\": \"firebase-project-development-id\",\n     \"production\": \"firebase-project-production-id\"\n    }\n   }\n  },\n```\n\n#### delete options\n\n| Option        | Description                                                                                      | Default         | Alias      |\n| ------------- | ------------------------------------------------------------------------------------------------ | --------------- | ---------- |\n| `flavors`     | A object of the flavors to use, the key is the flavor name and value is the firebase project id. | required        |            |\n| `flavor`      | The flavor to use, default will be the first key in the `flavors` object                         |                 |            |\n| `production`  | If true, the `flavor` will be 'production' if not defined                                        | `false`         | `prod`     |\n| `development` | If true, the `flavor` will be 'development' if not defined                                       | `false`         | `dev`      |\n| `envFiles`    | the key is the flavor name and value is path to the env file, default is `.env.${flavor}`        |                 |            |\n| `tsconfig`    | The tsconfig file to use for the script in the project directory.                                | `tsconfig.json` | `tsconfig` |\n| `silent`      | Whether to suppress all logs.                                                                    | `false`         | `s`        |\n| `verbose`     | Whether to run the command with verbose logging.                                                 | `false`         | `v`        |\n| `deleteAll`   | Whether to delete all functions even if they are in your project.                                | `false`         |            |\n\n### emulate\n\nThe plugin provide support to emulate functions locally. The plugin will emulate any functions that are in the `functions` directory.\n\n```json\n...\n \"targets\": {\n  \"emulate\": {\n   \"executor\": \"nx-cloud-functions-deployer:emulate\",\n   \"options\": {\n    \"flavors\": {\n      \"development\": \"firebase-project-development-id\",\n      \"production\": \"firebase-project-production-id\"\n    },\n \"only\": [\"functions\"],\n \"packageManager\": \"global\",\n \"minify\": false\n   }\n  },\n```\n\n#### emulate options\n\n| Option     | Description                                                                                                     | Default         | Alias      |\n| ---------- | --------------------------------------------------------------------------------------------------------------- | --------------- | ---------- |\n| `flavors`  | A object of the flavors to use, the key is the flavor name and value is the firebase project id.                | required        |            |\n| `flavor`   | The flavor to use, default will be the first key in the `flavors` object                                        |                 |            |\n| `envFiles` | the key is the flavor name and value is path to the env file, default is `.env.${flavor}`                       |                 |            |\n| `tsconfig` | The tsconfig file to use for the script in the project directory.                                               | `tsconfig.json` | `tsconfig` |\n| `silent`   | Whether to suppress all logs.                                                                                   | `false`         | `s`        |\n| `verbose`  | Whether to run the command with verbose logging.                                                                | `false`         | `v`        |\n| `only`     | Only emulate the given services separated by comma \"auth\", \"functions\",\"firestore\",\"hosting\",\"pubsub\",\"storage\" | undefined       | `o`        |\n| `minify`   | Whether to minify the functions                                                                                 | `true`          |            |\n\n### read-env\n\nThis will read your .env file in your selected flavor, copy it to the clipboard and print it in console. This is so you can use `envString` when you deploy your functions in CI.\n\n```json\n...\n \"targets\": {\n  \"delete-unused\": {\n   \"executor\": \"nx-cloud-functions-deployer:read-env\",\n   \"options\": {\n    \"flavors\": {\n     \"development\": \"firebase-project-development-id\",\n     \"production\": \"firebase-project-production-id\"\n    }\n   }\n  },\n```\n\n#### read-env options\n\n| Option     | Description                                                                                      | Default  | Alias |\n| ---------- | ------------------------------------------------------------------------------------------------ | -------- | ----- |\n| `flavors`  | A object of the flavors to use, the key is the flavor name and value is the firebase project id. | required |       |\n| `flavor`   | The flavor to use, default will be the first key in the `flavors` object                         |          |       |\n| `envFiles` | the key is the flavor name and value is path to the env file, default is `.env.${flavor}`        |          |       |\n| `silent`   | Whether to suppress all logs.                                                                    | `false`  | `s`   |\n| `verbose`  | Whether to run the command with verbose logging.                                                 | `false`  | `v`   |\n\n### rules\n\nSee the example [here](https://github.com/snorreks/nx-cloud-functions-deployer/tree/master/example/apps/rules).\n\n### sam\n\nThere is now also support for aws sam to deploy and watch logs. You need the SAM CLI installed to use this feature. See the example [here](https://github.com/snorreks/nx-cloud-functions-deployer/tree/master/example/apps/aws).\n\n```json\n...\n  \"deploy\": {\n   \"executor\": \"nx-cloud-functions-deployer:sam-deploy\",\n   \"options\": {\n    \"flavors\": {\n     \"development\": \"example-dev-test\"\n    },\n    \"bucket\": \"test\"\n   }\n  },\n  \"logs\": {\n   \"executor\": \"nx-cloud-functions-deployer:sam-logs\",\n   \"options\": {\n    \"flavors\": {\n     \"development\": \"example-dev-test\"\n    },\n    \"name\": \"ExampleFunction\",\n    \"tail\": true\n   }\n  }\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnorreks%2Fnx-cloud-functions-deployer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnorreks%2Fnx-cloud-functions-deployer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnorreks%2Fnx-cloud-functions-deployer/lists"}