@simondotm/nx-firebase 1.1.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +14 -27
  2. package/executors.json +0 -8
  3. package/generators.json +11 -0
  4. package/package.json +5 -4
  5. package/src/generators/application/application.d.ts +3 -3
  6. package/src/generators/application/application.js +119 -19
  7. package/src/generators/application/application.js.map +1 -1
  8. package/src/generators/application/files/readme.md__tmpl__ +12 -9
  9. package/src/generators/application/files_firebase/firebase.json__tmpl__ +6 -13
  10. package/src/generators/application/files_workspace/{firebase.__name__.json__tmpl__ → firebase.__projectName__.json__tmpl__} +6 -13
  11. package/src/generators/application/lib/create-files.js +10 -25
  12. package/src/generators/application/lib/create-files.js.map +1 -1
  13. package/src/generators/application/lib/index.d.ts +0 -3
  14. package/src/generators/application/lib/index.js +0 -3
  15. package/src/generators/application/lib/index.js.map +1 -1
  16. package/src/generators/application/schema.d.ts +3 -11
  17. package/src/generators/application/schema.json +0 -41
  18. package/src/generators/function/files/package.json__tmpl__ +19 -0
  19. package/src/generators/function/files/readme.md__tmpl__ +31 -0
  20. package/src/generators/function/function.d.ts +14 -0
  21. package/src/generators/function/function.js +77 -0
  22. package/src/generators/function/function.js.map +1 -0
  23. package/src/generators/function/lib/add-function.d.ts +3 -0
  24. package/src/generators/function/lib/add-function.js +29 -0
  25. package/src/generators/function/lib/add-function.js.map +1 -0
  26. package/src/generators/function/lib/create-files.d.ts +9 -0
  27. package/src/generators/function/lib/create-files.js +37 -0
  28. package/src/generators/function/lib/create-files.js.map +1 -0
  29. package/src/generators/function/lib/delete-files.js.map +1 -0
  30. package/src/generators/function/lib/index.d.ts +3 -0
  31. package/src/generators/function/lib/index.js +7 -0
  32. package/src/generators/function/lib/index.js.map +1 -0
  33. package/src/generators/function/lib/update-project.d.ts +3 -0
  34. package/src/generators/function/lib/update-project.js +52 -0
  35. package/src/generators/function/lib/update-project.js.map +1 -0
  36. package/src/generators/function/schema.d.ts +51 -0
  37. package/src/generators/function/schema.json +57 -0
  38. package/src/generators/init/init.d.ts +1 -1
  39. package/src/generators/init/init.js +2 -6
  40. package/src/generators/init/init.js.map +1 -1
  41. package/src/generators/init/lib/add-dependencies.js +3 -4
  42. package/src/generators/init/lib/add-dependencies.js.map +1 -1
  43. package/src/generators/init/lib/add-git-ignore-entry.d.ts +1 -1
  44. package/src/generators/init/lib/add-git-ignore-entry.js +1 -0
  45. package/src/generators/init/lib/add-git-ignore-entry.js.map +1 -1
  46. package/src/generators/init/schema.d.ts +4 -4
  47. package/src/generators/init/schema.json +8 -7
  48. package/src/generators/sync/lib/firebase-changes.d.ts +3 -0
  49. package/src/generators/sync/lib/firebase-changes.js +102 -0
  50. package/src/generators/sync/lib/firebase-changes.js.map +1 -0
  51. package/src/generators/sync/lib/firebase-configs.d.ts +3 -0
  52. package/src/generators/sync/lib/firebase-configs.js +61 -0
  53. package/src/generators/sync/lib/firebase-configs.js.map +1 -0
  54. package/src/generators/sync/lib/firebase-projects.d.ts +20 -0
  55. package/src/generators/sync/lib/firebase-projects.js +75 -0
  56. package/src/generators/sync/lib/firebase-projects.js.map +1 -0
  57. package/src/generators/sync/lib/firebase-workspace.d.ts +3 -0
  58. package/src/generators/sync/lib/firebase-workspace.js +15 -0
  59. package/src/generators/sync/lib/firebase-workspace.js.map +1 -0
  60. package/src/generators/sync/lib/index.d.ts +7 -0
  61. package/src/generators/sync/lib/index.js +11 -0
  62. package/src/generators/sync/lib/index.js.map +1 -0
  63. package/src/generators/sync/lib/tags.d.ts +14 -0
  64. package/src/generators/sync/lib/tags.js +43 -0
  65. package/src/generators/sync/lib/tags.js.map +1 -0
  66. package/src/generators/sync/lib/types.d.ts +46 -0
  67. package/src/generators/sync/lib/types.js +5 -0
  68. package/src/generators/sync/lib/types.js.map +1 -0
  69. package/src/generators/sync/schema.d.ts +5 -0
  70. package/src/generators/sync/schema.json +19 -0
  71. package/src/generators/sync/sync.d.ts +8 -0
  72. package/src/generators/sync/sync.js +170 -0
  73. package/src/generators/sync/sync.js.map +1 -0
  74. package/src/utils/debug.d.ts +4 -0
  75. package/src/utils/debug.js +25 -0
  76. package/src/utils/debug.js.map +1 -0
  77. package/src/utils/firebase-config.d.ts +77 -0
  78. package/src/utils/firebase-config.js +52 -0
  79. package/src/utils/firebase-config.js.map +1 -0
  80. package/src/utils/index.d.ts +3 -0
  81. package/src/utils/index.js +3 -0
  82. package/src/utils/index.js.map +1 -1
  83. package/src/utils/project-name.d.ts +5 -0
  84. package/src/utils/project-name.js +38 -0
  85. package/src/utils/project-name.js.map +1 -0
  86. package/src/utils/types.d.ts +1 -1
  87. package/src/{generators/application/lib → utils}/update-tsconfig.d.ts +1 -2
  88. package/src/{generators/application/lib → utils}/update-tsconfig.js +5 -5
  89. package/src/utils/update-tsconfig.js.map +1 -0
  90. package/src/utils/versions.d.ts +1 -0
  91. package/src/utils/versions.js +5 -4
  92. package/src/utils/versions.js.map +1 -1
  93. package/src/utils/workspace.d.ts +1 -1
  94. package/src/executors/build/build.d.ts +0 -8
  95. package/src/executors/build/build.js +0 -82
  96. package/src/executors/build/build.js.map +0 -1
  97. package/src/executors/build/lib/copy-dependencies.d.ts +0 -3
  98. package/src/executors/build/lib/copy-dependencies.js +0 -53
  99. package/src/executors/build/lib/copy-dependencies.js.map +0 -1
  100. package/src/executors/build/lib/firebase-build.d.ts +0 -2
  101. package/src/executors/build/lib/firebase-build.js +0 -16
  102. package/src/executors/build/lib/firebase-build.js.map +0 -1
  103. package/src/executors/build/lib/get-dependencies.d.ts +0 -8
  104. package/src/executors/build/lib/get-dependencies.js +0 -87
  105. package/src/executors/build/lib/get-dependencies.js.map +0 -1
  106. package/src/executors/build/lib/index.d.ts +0 -1
  107. package/src/executors/build/lib/index.js +0 -5
  108. package/src/executors/build/lib/index.js.map +0 -1
  109. package/src/executors/build/lib/rewrite-package.d.ts +0 -8
  110. package/src/executors/build/lib/rewrite-package.js +0 -44
  111. package/src/executors/build/lib/rewrite-package.js.map +0 -1
  112. package/src/executors/build/schema.d.ts +0 -1
  113. package/src/executors/build/schema.json +0 -167
  114. package/src/generators/application/files/package.json__tmpl__ +0 -21
  115. package/src/generators/application/lib/add-project.d.ts +0 -39
  116. package/src/generators/application/lib/add-project.js +0 -115
  117. package/src/generators/application/lib/add-project.js.map +0 -1
  118. package/src/generators/application/lib/delete-files.js.map +0 -1
  119. package/src/generators/application/lib/normalize-options.d.ts +0 -5
  120. package/src/generators/application/lib/normalize-options.js +0 -44
  121. package/src/generators/application/lib/normalize-options.js.map +0 -1
  122. package/src/generators/application/lib/update-tsconfig.js.map +0 -1
  123. package/src/utils/e2ePatch.d.ts +0 -2
  124. package/src/utils/e2ePatch.js +0 -135
  125. package/src/utils/e2ePatch.js.map +0 -1
  126. /package/src/generators/{application/files/src/index.ts__tmpl__ → function/files/src/main.ts__tmpl__} +0 -0
  127. /package/src/generators/{application → function}/lib/delete-files.d.ts +0 -0
  128. /package/src/generators/{application → function}/lib/delete-files.js +0 -0
@@ -0,0 +1,31 @@
1
+ # <%= projectName %>
2
+
3
+ This Nx Firebase function was generated by [@simondotm/nx-firebase](https://github.com/simondotm/nx-firebase).
4
+
5
+ ## Generated Application Files
6
+
7
+ * `src/main.ts` - Default Firebase Functions entry point
8
+
9
+ ## Generated Workspace Root Files
10
+
11
+ * `<%= firebaseAppConfig %>` - Firebase CLI Configuration for this project
12
+ * `.firebaserc` - Default Firebase CLI Deployment Targets Configuration
13
+ * `firebase.json` - Intentionally Empty Firebase CLI Configuration (only needed to allow Firebase CLI to run in your workspace)
14
+
15
+ ## Generated modules
16
+
17
+ Nx-Firebase will add `firebase-admin` and `firebase-functions` to your workspace `package.json` at the `'latest'` version. You may wish to set these to a specific version.
18
+
19
+ ## Next Steps
20
+
21
+ * `npm install -g firebase-tools` - Install the [Firebase CLI](https://firebase.google.com/docs/cli)
22
+ * `firebase login` - Authenticate the Firebase CLI
23
+ * `firebase use --add` - Add your Firebase Project as a target to `.firebaserc`
24
+ * You do not need to `npm install` in the app project directory, but can still add and run custom npm scripts to the app `package.json` if you wish
25
+
26
+
27
+
28
+ See the plugin [README](https://github.com/simondotm/nx-firebase/blob/main/README.md) for more information.
29
+
30
+
31
+
@@ -0,0 +1,14 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import type { FunctionGeneratorOptions, NormalizedOptions } from './schema';
3
+ export declare function normalizeOptions(tree: Tree, options: FunctionGeneratorOptions): NormalizedOptions;
4
+ /**
5
+ * Firebase 'functions' application generator
6
+ * Uses the `@nx/node` application generator as a base implementation
7
+ *
8
+ * @param tree
9
+ * @param rawOptions
10
+ * @returns
11
+ */
12
+ export declare function functionGenerator(tree: Tree, rawOptions: FunctionGeneratorOptions): Promise<GeneratorCallback>;
13
+ export default functionGenerator;
14
+ export declare const functionSchematic: (generatorOptions: FunctionGeneratorOptions) => (tree: any, context: any) => Promise<any>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.functionSchematic = exports.functionGenerator = exports.normalizeOptions = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const node_1 = require("@nx/node");
7
+ const init_1 = require("../init/init");
8
+ const utils_1 = require("../../utils");
9
+ const lib_1 = require("./lib");
10
+ function normalizeOptions(tree, options) {
11
+ const { projectName, projectRoot } = (0, utils_1.getProjectName)(tree, options.name, options.directory);
12
+ // get & validate the firebase app project this function will be attached to
13
+ const firebaseApp = (0, devkit_1.names)(options.app).fileName;
14
+ const projects = (0, devkit_1.getProjects)(tree);
15
+ if (!projects.has(firebaseApp)) {
16
+ throw new Error(`A firebase application project called '${firebaseApp}' was not found in this workspace.`);
17
+ }
18
+ const firebaseAppProject = (0, devkit_1.readProjectConfiguration)(tree, firebaseApp);
19
+ // read the firebase config used by the parent app project
20
+ const firebaseConfigName = (0, utils_1.getFirebaseConfigFromProject)(tree, firebaseAppProject);
21
+ return Object.assign(Object.assign({}, options), { runTime: options.runTime || '16', format: options.format || 'esm', projectRoot,
22
+ projectName,
23
+ firebaseConfigName,
24
+ firebaseAppProject });
25
+ }
26
+ exports.normalizeOptions = normalizeOptions;
27
+ /**
28
+ * Firebase 'functions' application generator
29
+ * Uses the `@nx/node` application generator as a base implementation
30
+ *
31
+ * @param tree
32
+ * @param rawOptions
33
+ * @returns
34
+ */
35
+ function functionGenerator(tree, rawOptions) {
36
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
+ const tasks = [];
38
+ const options = normalizeOptions(tree, rawOptions);
39
+ // initialise plugin
40
+ const initTask = yield (0, init_1.initGenerator)(tree, {});
41
+ tasks.push(initTask);
42
+ // We use @nx/node:app to scaffold our function application, then modify as required
43
+ // `nx g @nx/node:app function-name --directory functions/dir --e2eTestRunner=none --framework=none --unitTestRunner=jest --bundler=esbuild --tags=firebase:firebase-app`
44
+ // Function apps are tagged so that they can built/watched with run-many
45
+ const tags = `firebase:function,firebase:name:${options.projectName},firebase:dep:${options.firebaseAppProject.name}` +
46
+ (options.tags ? `,${options.tags}` : '');
47
+ const nodeApplicationTask = yield (0, node_1.applicationGenerator)(tree, {
48
+ name: options.name,
49
+ directory: options.directory,
50
+ tags,
51
+ setParserOptionsProject: options.setParserOptionsProject,
52
+ skipFormat: options.skipFormat,
53
+ e2eTestRunner: 'none',
54
+ bundler: 'esbuild',
55
+ framework: 'none',
56
+ unitTestRunner: 'jest',
57
+ });
58
+ tasks.push(nodeApplicationTask);
59
+ // generate function app specific files
60
+ (0, lib_1.createFiles)(tree, options);
61
+ // update TS config for esm or cjs
62
+ (0, utils_1.updateTsConfig)(tree, options.projectRoot, options.runTime, options.format);
63
+ // reconfigure the @nx/node:app to suit firebase functions
64
+ (0, lib_1.updateProject)(tree, options);
65
+ // update firebase functions config
66
+ (0, lib_1.addFunction)(tree, options);
67
+ // ensures newly added files are formatted to match workspace style
68
+ if (!options.skipFormat) {
69
+ yield (0, devkit_1.formatFiles)(tree);
70
+ }
71
+ return (0, devkit_1.runTasksInSerial)(...tasks);
72
+ });
73
+ }
74
+ exports.functionGenerator = functionGenerator;
75
+ exports.default = functionGenerator;
76
+ exports.functionSchematic = (0, devkit_1.convertNxGenerator)(functionGenerator);
77
+ //# sourceMappingURL=function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/generators/function/function.ts"],"names":[],"mappings":";;;;AAAA,uCASmB;AACnB,mCAA2E;AAE3E,uCAA4C;AAC5C,uCAIoB;AAEpB,+BAA+D;AAG/D,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAiC;IAEjC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAA,sBAAc,EACjD,IAAI,EACJ,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,SAAS,CAClB,CAAA;IAED,4EAA4E;IAC5E,MAAM,WAAW,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAA;IAC/C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;IAClC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CACb,0CAA0C,WAAW,oCAAoC,CAC1F,CAAA;KACF;IAED,MAAM,kBAAkB,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IAEtE,0DAA0D;IAC1D,MAAM,kBAAkB,GAAG,IAAA,oCAA4B,EACrD,IAAI,EACJ,kBAAkB,CACnB,CAAA;IAED,uCACK,OAAO,KACV,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI,EAChC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK,EAC/B,WAAW;QACX,WAAW;QACX,kBAAkB;QAClB,kBAAkB,IACnB;AACH,CAAC;AApCD,4CAoCC;AAED;;;;;;;GAOG;AACH,SAAsB,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,IAAA,iBAAW,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAE1B,mEAAmE;QACnE,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;SACxB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAA;IACnC,CAAC;CAAA;AAlDD,8CAkDC;AAED,kBAAe,iBAAiB,CAAA;AACnB,QAAA,iBAAiB,GAAG,IAAA,2BAAkB,EAAC,iBAAiB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedOptions } from '../schema';
3
+ export declare function addFunction(tree: Tree, options: NormalizedOptions): void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addFunction = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function addFunction(tree, options) {
6
+ (0, devkit_1.updateJson)(tree, options.firebaseConfigName, (json) => {
7
+ const functionConfig = {
8
+ codebase: options.projectName,
9
+ source: (0, devkit_1.joinPathFragments)('dist', options.projectRoot),
10
+ runtime: `nodejs${options.runTime}`,
11
+ };
12
+ // console.log(`json.functions=${JSON.stringify(json.functions)}`)
13
+ if (!Array.isArray(json.functions)) {
14
+ const existingFunction = Object.assign({}, json.functions);
15
+ json.functions = [];
16
+ if (Object.keys(existingFunction).length) {
17
+ json.functions.push(existingFunction);
18
+ }
19
+ }
20
+ json.functions.push(functionConfig);
21
+ // sort the codebases to be neat & tidy
22
+ json.functions.sort((a, b) => {
23
+ return a.codebase < b.codebase ? -1 : a.codebase > b.codebase ? 1 : 0;
24
+ });
25
+ return json;
26
+ });
27
+ }
28
+ exports.addFunction = addFunction;
29
+ //# sourceMappingURL=add-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-function.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/add-function.ts"],"names":[],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NormalizedOptions } from '../schema';
3
+ /**
4
+ * Generate the firebase app specific files
5
+ *
6
+ * @param tree
7
+ * @param options
8
+ */
9
+ export declare function createFiles(tree: Tree, options: NormalizedOptions): void;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFiles = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const devkit_2 = require("@nx/devkit");
6
+ /**
7
+ * Generate the firebase app specific files
8
+ *
9
+ * @param tree
10
+ * @param options
11
+ */
12
+ function createFiles(tree, options) {
13
+ const firebaseAppConfig = options.firebaseConfigName;
14
+ const firebaseAppConfigPath = (0, devkit_2.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.projectRoot), firebaseAppConfig);
15
+ const substitutions = {
16
+ tmpl: '',
17
+ projectName: options.projectName,
18
+ projectRoot: options.projectRoot,
19
+ firebaseAppName: options.app,
20
+ firebaseAppConfig,
21
+ firebaseAppConfigPath,
22
+ firebaseNodeEngine: options.runTime,
23
+ // firebaseNodeRuntime,
24
+ // firebaseNodeEngine,
25
+ moduleType: options.format === 'esm' ? 'module' : 'commonjs',
26
+ };
27
+ // The default functions package.json & templated typescript source files are added here
28
+ // to match the `firebase init` cli setup
29
+ // if the user isn't using functions, they can just delete and update their firebase config accordingly
30
+ //
31
+ // Rules and index files also get generated in the application folder;
32
+ // 1. so that they dont clutter up the root workspace
33
+ // 2. so that they are located within the nx firebase application project they relate to
34
+ (0, devkit_2.generateFiles)(tree, (0, devkit_2.joinPathFragments)(__dirname, '..', 'files'), options.projectRoot, substitutions);
35
+ }
36
+ exports.createFiles = createFiles;
37
+ //# sourceMappingURL=create-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/create-files.ts"],"names":[],"mappings":";;;AAAA,uCAAiD;AACjD,uCAA6D;AAG7D;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAA0B;IAChE,MAAM,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAA;IACpD,MAAM,qBAAqB,GAAG,IAAA,0BAAiB,EAC7C,IAAA,uBAAc,EAAC,OAAO,CAAC,WAAW,CAAC,EACnC,iBAAiB,CAClB,CAAA;IAED,MAAM,aAAa,GAAG;QACpB,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,WAAW,EAAE,OAAO,CAAC,WAAW;QAEhC,eAAe,EAAE,OAAO,CAAC,GAAG;QAC5B,iBAAiB;QACjB,qBAAqB;QAErB,kBAAkB,EAAE,OAAO,CAAC,OAAO;QAEnC,uBAAuB;QACvB,sBAAsB;QAEtB,UAAU,EAAE,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU;KAC7D,CAAA;IAED,wFAAwF;IACxF,yCAAyC;IACzC,uGAAuG;IACvG,EAAE;IACF,sEAAsE;IACtE,qDAAqD;IACrD,wFAAwF;IACxF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,EAC3C,OAAO,CAAC,WAAW,EACnB,aAAa,CACd,CAAA;AACH,CAAC;AArCD,kCAqCC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/delete-files.ts"],"names":[],"mappings":";;;AACA,uCAA8C;AAG9C;;;;GAIG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAA0B;IAChE,MAAM,iBAAiB,GAAG;QACxB,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC;QACxD,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;QAChE,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC;QACnE,IAAA,0BAAiB,EACf,OAAO,CAAC,WAAW,EACnB,KAAK,EACL,cAAc,EACd,qBAAqB,CACtB;QACD,IAAA,0BAAiB,EACf,OAAO,CAAC,WAAW,EACnB,KAAK,EACL,cAAc,EACd,gBAAgB,CACjB;KACF,CAAA;IAED,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE;QACpC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAClB;AACH,CAAC;AAtBD,kCAsBC"}
@@ -0,0 +1,3 @@
1
+ export * from './add-function';
2
+ export * from './create-files';
3
+ export * from './update-project';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./add-function"), exports);
5
+ tslib_1.__exportStar(require("./create-files"), exports);
6
+ tslib_1.__exportStar(require("./update-project"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8B;AAC9B,yDAA8B;AAC9B,2DAAgC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import type { NormalizedOptions } from '../schema';
3
+ export declare function updateProject(tree: Tree, options: NormalizedOptions): void;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateProject = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function updateProject(tree, options) {
6
+ const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
7
+ const firebaseAppProject = options.firebaseAppProject;
8
+ // replace the default node build target with a simplified version
9
+ // we dont need dev/production build configurations for firebase functions since its a confined secure environment
10
+ project.targets.build = {
11
+ executor: '@nx/esbuild:esbuild',
12
+ outputs: ['{options.outputPath}'],
13
+ options: {
14
+ outputPath: project.targets.build.options.outputPath,
15
+ main: project.targets.build.options.main,
16
+ tsConfig: project.targets.build.options.tsConfig,
17
+ assets: project.targets.build.options.assets,
18
+ generatePackageJson: true,
19
+ // these are the defaults for esbuild, but let's set them anyway
20
+ platform: 'node',
21
+ bundle: true,
22
+ thirdParty: false,
23
+ dependenciesFieldType: 'dependencies',
24
+ target: 'node16',
25
+ format: [options.format || 'esm'],
26
+ esbuildOptions: {
27
+ logLevel: 'info',
28
+ },
29
+ },
30
+ };
31
+ project.targets.deploy = {
32
+ executor: 'nx:run-commands',
33
+ options: {
34
+ // command: `firebase deploy${firebaseProject} --config=${firebaseConfig}`,
35
+ // use the firebase app to deploy, this way the function does not need to know the project or config
36
+ command: `nx run ${firebaseAppProject.name}:deploy --only functions:${options.projectName}`,
37
+ },
38
+ dependsOn: ['build'],
39
+ };
40
+ // Remove default node app serve target
41
+ // No serve target for functions, since we may have multiple functions in a firebase project
42
+ // Instead we serve at the firebase app project
43
+ delete project.targets.serve;
44
+ (0, devkit_1.updateProjectConfiguration)(tree, options.projectName, project);
45
+ // Add function project as implicit dep of firebase app project
46
+ firebaseAppProject.implicitDependencies || (firebaseAppProject.implicitDependencies = []);
47
+ firebaseAppProject.implicitDependencies.push(options.projectName);
48
+ firebaseAppProject.implicitDependencies.sort();
49
+ (0, devkit_1.updateProjectConfiguration)(tree, options.app, firebaseAppProject);
50
+ }
51
+ exports.updateProject = updateProject;
52
+ //# sourceMappingURL=update-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-project.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/update-project.ts"],"names":[],"mappings":";;;AAAA,uCAImB;AAGnB,SAAgB,aAAa,CAAC,IAAU,EAAE,OAA0B;IAClE,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAEnE,MAAM,kBAAkB,GAAG,OA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AAvC,kBAAkB,CAAC,oBAAoB,GAAK,EAAE,EAAA;IAC9C,kBAAkB,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACjE,kBAAkB,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAA;IAC9C,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAA;AACnE,CAAC;AAlDD,sCAkDC"}
@@ -0,0 +1,51 @@
1
+ import { ProjectConfiguration } from '@nx/devkit'
2
+
3
+ // export interface Schema {
4
+ // name: string;
5
+ // skipFormat?: boolean;
6
+ // skipPackageJson?: boolean;
7
+ // directory?: string;
8
+ // unitTestRunner?: 'jest' | 'none';
9
+ // e2eTestRunner?: 'jest' | 'none';
10
+ // linter?: Linter;
11
+ // tags?: string;
12
+ // frontendProject?: string;
13
+ // babelJest?: boolean;
14
+ // js?: boolean;
15
+ // pascalCaseFiles?: boolean;
16
+ // setParserOptionsProject?: boolean;
17
+ // standaloneConfig?: boolean;
18
+ // bundler?: 'esbuild' | 'webpack';
19
+ // framework?: NodeJsFrameWorks;
20
+ // port?: number;
21
+ // rootProject?: boolean;
22
+ // docker?: boolean;
23
+ // isNest?: boolean;
24
+ // }
25
+
26
+ // subset of @nx/node:application options that we forward to node app generator
27
+ interface SupportedNodeGeneratorOptions {
28
+ setParserOptionsProject?: boolean
29
+ skipFormat?: boolean
30
+ // unitTestRunner is always jest
31
+ // bundler is always esbuild
32
+ // linter is always eslint
33
+ }
34
+
35
+ export interface FunctionGeneratorOptions
36
+ extends SupportedNodeGeneratorOptions {
37
+ name: string
38
+ directory?: string
39
+ tags?: string
40
+
41
+ app: string
42
+ runTime?: '16' | '18' | '20'
43
+ format?: 'esm' | 'cjs'
44
+ }
45
+
46
+ interface NormalizedOptions extends FunctionGeneratorOptions {
47
+ projectRoot: Path
48
+ projectName: string
49
+ firebaseConfigName: string
50
+ firebaseAppProject: ProjectConfiguration
51
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxFirebaseFunctionGenerator",
4
+ "title": "Nx Firebase Function Options Schema",
5
+ "description": "Nx Firebase Function Options Schema.",
6
+ "cli": "nx",
7
+ "type": "object",
8
+ "properties": {
9
+ "name": {
10
+ "description": "The name of the firebase function project.",
11
+ "type": "string",
12
+ "$default": {
13
+ "$source": "argv",
14
+ "index": 0
15
+ },
16
+ "x-prompt": "What name would you like to use for the firebase function project?"
17
+ },
18
+ "directory": {
19
+ "description": "The directory of the new function project.",
20
+ "type": "string"
21
+ },
22
+ "tags": {
23
+ "description": "Add tags to the application (used for linting).",
24
+ "type": "string"
25
+ },
26
+ "setParserOptionsProject": {
27
+ "type": "boolean",
28
+ "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
29
+ "default": false
30
+ },
31
+ "skipFormat": {
32
+ "description": "Skip formatting files.",
33
+ "type": "boolean",
34
+ "default": false
35
+ },
36
+ "format": {
37
+ "description": "The module format for this function (esm or cjs).",
38
+ "type": "string",
39
+ "enum": ["esm", "cjs"],
40
+ "default": "esm"
41
+ },
42
+ "app": {
43
+ "description": "The name of the parent Nx firebase application project this function will be added to.",
44
+ "type": "string",
45
+ "x-prompt": "Which firebase Nx application project will this function be created for?"
46
+ },
47
+ "runTime": {
48
+ "description": "The node runtime target for this function.",
49
+ "type": "string",
50
+ "enum": ["16", "18", "20"],
51
+ "default": "16"
52
+ }
53
+
54
+ },
55
+ "additionalProperties": false,
56
+ "required": ["name", "app"]
57
+ }
@@ -1,7 +1,7 @@
1
1
  import type { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import type { InitGeneratorOptions } from './schema';
3
3
  /**
4
- * `nx g @simondotm/nx-firebase:init` is based on the `@nrwl/nest` plugin
4
+ * `nx g @simondotm/nx-firebase:init` is based on the `@nx/nest` plugin
5
5
  * which in turn is based on the `@nx/node` plugin
6
6
  *
7
7
  * Ensures the necessary firebase packages are installed in the nx workspace
@@ -4,11 +4,10 @@ exports.initSchematic = exports.initGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const node_1 = require("@nx/node");
7
- // import { runTasksInSerial } from '@nx/workspace/src/utilities/run-tasks-in-serial'
8
7
  const lib_1 = require("./lib");
9
8
  const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
10
9
  /**
11
- * `nx g @simondotm/nx-firebase:init` is based on the `@nrwl/nest` plugin
10
+ * `nx g @simondotm/nx-firebase:init` is based on the `@nx/nest` plugin
12
11
  * which in turn is based on the `@nx/node` plugin
13
12
  *
14
13
  * Ensures the necessary firebase packages are installed in the nx workspace
@@ -19,13 +18,10 @@ const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
19
18
  */
20
19
  function initGenerator(tree, rawOptions) {
21
20
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
- (0, add_git_ignore_entry_1.addGitIgnoreEntry)(tree);
23
21
  const options = (0, lib_1.normalizeOptions)(rawOptions);
24
22
  const nodeInitTask = yield (0, node_1.initGenerator)(tree, options);
25
23
  const installPackagesTask = (0, lib_1.addDependencies)(tree);
26
- if (!options.skipFormat) {
27
- yield (0, devkit_1.formatFiles)(tree);
28
- }
24
+ (0, add_git_ignore_entry_1.addGitIgnoreEntry)(tree);
29
25
  return (0, devkit_1.runTasksInSerial)(nodeInitTask, installPackagesTask);
30
26
  });
31
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAEA,uCAA8E;AAC9E,mCAA6D;AAC7D,qFAAqF;AACrF,+BAAyD;AACzD,qEAA8D;AAG9D;;;;;;;;;GASG;AACH,SAAsB,aAAa,CACjC,IAAU,EACV,UAAgC;;QAEhC,IAAA,wCAAiB,EAAC,IAAI,CAAC,CAAA;QAEvB,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,UAAU,CAAC,CAAA;QAC5C,MAAM,YAAY,GAAG,MAAM,IAAA,oBAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC3D,MAAM,mBAAmB,GAAG,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAA;QAEjD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;SACxB;QAED,OAAO,IAAA,yBAAgB,EAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;IAC5D,CAAC;CAAA;AAfD,sCAeC;AAED,kBAAe,aAAa,CAAA;AAEf,QAAA,aAAa,GAAG,IAAA,2BAAkB,EAAC,aAAa,CAAC,CAAA"}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/generators/init/init.ts"],"names":[],"mappings":";;;;AACA,uCAAiE;AACjE,mCAA6D;AAC7D,+BAAyD;AACzD,qEAA8D;AAG9D;;;;;;;;;GASG;AACH,SAAsB,aAAa,CACjC,IAAU,EACV,UAAgC;;QAEhC,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,UAAU,CAAC,CAAA;QAC5C,MAAM,YAAY,GAAG,MAAM,IAAA,oBAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC3D,MAAM,mBAAmB,GAAG,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAA;QACjD,IAAA,wCAAiB,EAAC,IAAI,CAAC,CAAA;QAEvB,OAAO,IAAA,yBAAgB,EAAC,YAAY,EAAE,mBAAmB,CAAC,CAAA;IAC5D,CAAC;CAAA;AAVD,sCAUC;AAED,kBAAe,aAAa,CAAA;AAEf,QAAA,aAAa,GAAG,IAAA,2BAAkB,EAAC,aAAa,CAAC,CAAA"}
@@ -44,12 +44,11 @@ function addDependencies(tree) {
44
44
  // but add them if not. They are added with the same version that the host workspace is using.
45
45
  // This is cleaner than using peerDeps.
46
46
  addDevDependencyIfNotPresent('@nx/devkit', utils_1.workspaceNxVersion.version);
47
- // used by the plugin application generator
47
+ // used by the plugin function generator as a proxy for creating a typescript app
48
+ addDevDependencyIfNotPresent('@nx/node', utils_1.workspaceNxVersion.version);
48
49
  addDevDependencyIfNotPresent('@nx/linter', utils_1.workspaceNxVersion.version);
49
50
  addDevDependencyIfNotPresent('@nx/jest', utils_1.workspaceNxVersion.version);
50
- // used by the plugin application generator as a proxy for creating a typescript app
51
- addDevDependencyIfNotPresent('@nx/node', utils_1.workspaceNxVersion.version);
52
- // used by the plugin application builder
51
+ addDevDependencyIfNotPresent('@nx/esbuild', utils_1.workspaceNxVersion.version);
53
52
  addDevDependencyIfNotPresent('@nx/js', utils_1.workspaceNxVersion.version);
54
53
  return (0, devkit_2.addDependenciesToPackageJson)(tree, dependencies, devDependencies);
55
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"add-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-dependencies.ts"],"names":[],"mappings":";;;AAAA,uCAA8D;AAC9D,uCAAyD;AACzD,0CAAmD;AACnD,sDAQgC;AAEhC,SAAgB,eAAe,CAAC,IAAU;IACxC,MAAM,YAAY,GAA2B,EAAE,CAAA;IAC/C,MAAM,eAAe,GAA2B,EAAE,CAAA;IAElD,0EAA0E;IAC1E,8EAA8E;IAC9E,gGAAgG;IAChG,2EAA2E;IAC3E,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAA,CAAC,uBAAuB;IAE1E,SAAS,yBAAyB,CAChC,WAAmB,EACnB,cAAsB;QAEtB,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YAC1C,YAAY,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;SAC3C;IACH,CAAC;IACD,SAAS,4BAA4B,CACnC,WAAmB,EACnB,cAAsB;QAEtB,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE;YAC7C,eAAe,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;SAC9C;IACH,CAAC;IAED,wBAAwB;IACxB,yBAAyB,CAAC,UAAU,EAAE,0BAAe,CAAC,CAAA;IACtD,yBAAyB,CAAC,gBAAgB,EAAE,+BAAoB,CAAC,CAAA;IACjE,yBAAyB,CAAC,oBAAoB,EAAE,mCAAwB,CAAC,CAAA;IAEzE,4DAA4D;IAC5D,kDAAkD;IAElD,4BAA4B;IAC5B,4BAA4B,CAAC,gBAAgB,EAAE,+BAAoB,CAAC,CAAA;IACpE,4BAA4B,CAC1B,yBAAyB,EACzB,uCAA4B,CAC7B,CAAA;IAED,2EAA2E;IAC3E,8CAA8C;IAC9C,4BAA4B,CAAC,WAAW,EAAE,0BAAe,CAAC,CAAA;IAE1D,6EAA6E;IAC7E,2GAA2G;IAC3G,QAAQ;IACR,yHAAyH;IACzH,EAAE;IAEF,qGAAqG;IACrG,8FAA8F;IAC9F,uCAAuC;IACvC,4BAA4B,CAAC,YAAY,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAEtE,2CAA2C;IAC3C,4BAA4B,CAAC,YAAY,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IACtE,4BAA4B,CAAC,UAAU,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAEpE,oFAAoF;IACpF,4BAA4B,CAAC,UAAU,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAEpE,yCAAyC;IACzC,4BAA4B,CAAC,QAAQ,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAElE,OAAO,IAAA,qCAA4B,EAAC,IAAI,EAAE,YAAY,EAAE,eAAe,CAAC,CAAA;AAC1E,CAAC;AApED,0CAoEC"}
1
+ {"version":3,"file":"add-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-dependencies.ts"],"names":[],"mappings":";;;AAAA,uCAA8D;AAC9D,uCAAyD;AACzD,0CAAmD;AACn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F;IACjF,4BAA4B,CAAC,UAAU,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IACpE,4BAA4B,CAAC,YAAY,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IACtE,4BAA4B,CAAC,UAAU,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IACpE,4BAA4B,CAAC,aAAa,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IACvE,4BAA4B,CAAC,QAAQ,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAElE,OAAO,IAAA,qCAA4B,EAAC,IAAI,EAAE,YAAY,EAAE,eAAe,CAAC,CAAA;AAC1E,CAAC;AAjED,0CAiEC"}
@@ -1,3 +1,3 @@
1
1
  import { Tree } from '@nx/devkit';
2
- export declare const gitIgnoreEntries = "\n\n# Nx-Firebase\n.runtimeconfig.json\n**/.emulators/*\n**/.firebase/*\ndatabase-debug.log\nfirebase-debug.log\nfirestore-debug.log\npubsub-debug.log\nui-debug.log\n\n";
2
+ export declare const gitIgnoreEntries = "\n\n# Nx-Firebase\n.runtimeconfig.json\n**/.emulators/*\n**/.firebase/*\ndatabase-debug.log\nfirebase-debug.log\nfirestore-debug.log\npubsub-debug.log\nui-debug.log\nfirebase-export*\n\n";
3
3
  export declare function addGitIgnoreEntry(host: Tree): void;
@@ -12,6 +12,7 @@ firebase-debug.log
12
12
  firestore-debug.log
13
13
  pubsub-debug.log
14
14
  ui-debug.log
15
+ firebase-export*
15
16
 
16
17
  `;
17
18
  function addGitIgnoreEntry(host) {
@@ -1 +1 @@
1
- {"version":3,"file":"add-git-ignore-entry.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-git-ignore-entry.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG;;;;;;;;;;;;CAY/B,CAAA;AAED,SAAgB,iBAAiB,CAAC,IAAU;;IAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC9B,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,wBAAgB,CAAC,CAAA;QAC1C,OAAM;KACP;IAED,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,EAAE;QACvC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC,CAAA;KAC3D;AACH,CAAC;AAVD,8CAUC"}
1
+ {"version":3,"file":"add-git-ignore-entry.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-git-ignore-entry.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;CAa/B,CAAA;AAED,SAAgB,iBAAiB,CAAC,IAAU;;IAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC9B,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,wBAAgB,CAAC,CAAA;QAC1C,OAAM;KACP;IAED,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,EAAE;QACvC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC,CAAA;KAC3D;AACH,CAAC;AAVD,8CAUC"}
@@ -1,6 +1,6 @@
1
- import { UnitTestRunner } from '../../utils'
2
-
3
1
  export interface InitGeneratorOptions {
4
- skipFormat?: boolean
5
- unitTestRunner?: UnitTestRunner
2
+ unitTestRunner?: 'jest' | 'none';
3
+ skipFormat?: boolean;
4
+ js?: boolean;
5
+ rootProject?: boolean;
6
6
  }
@@ -8,18 +8,19 @@
8
8
  "unitTestRunner": {
9
9
  "description": "Adds the specified unit test runner.",
10
10
  "type": "string",
11
- "enum": [
12
- "jest",
13
- "none"
14
- ],
15
- "default": "none"
11
+ "enum": ["jest", "none"],
12
+ "default": "jest"
16
13
  },
17
14
  "skipFormat": {
18
15
  "description": "Skip formatting files.",
19
16
  "type": "boolean",
20
- "default": true
17
+ "default": false
18
+ },
19
+ "js": {
20
+ "type": "boolean",
21
+ "default": false,
22
+ "description": "Use JavaScript instead of TypeScript"
21
23
  }
22
24
  },
23
- "additionalProperties": false,
24
25
  "required": []
25
26
  }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { FirebaseProjects, FirebaseChanges, FirebaseConfigs } from './types';
3
+ export declare function getFirebaseChanges(tree: Tree, projects: FirebaseProjects, configs: FirebaseConfigs): FirebaseChanges;