@simondotm/nx-firebase 2.1.2 → 2.3.0
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.
- package/README.md +106 -21
- package/executors.json +2 -2
- package/generators.json +1 -1
- package/package.json +8 -10
- package/src/__generated__/nx-firebase-versions.d.ts +11 -0
- package/src/__generated__/nx-firebase-versions.js +19 -0
- package/src/__generated__/nx-firebase-versions.js.map +1 -0
- package/src/executors/serve/schema.json +3 -3
- package/src/generators/application/application.d.ts +6 -6
- package/src/generators/application/application.js +65 -36
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/application/files/firestore.indexes.json +25 -2
- package/src/generators/application/files/firestore.rules +10 -6
- package/src/generators/application/files/public/404.html +33 -0
- package/src/generators/application/files/public/index.html +11 -11
- package/src/generators/application/files/storage.rules +6 -3
- package/src/generators/application/lib/create-files.d.ts +2 -2
- package/src/generators/application/lib/create-files.js +11 -0
- package/src/generators/application/lib/create-files.js.map +1 -1
- package/src/generators/application/schema.d.ts +9 -4
- package/src/generators/application/schema.json +14 -9
- package/src/generators/function/files/package.json__tmpl__ +1 -1
- package/src/generators/function/files/src/main.ts__tmpl__ +4 -7
- package/src/generators/function/function.d.ts +6 -6
- package/src/generators/function/function.js +63 -26
- package/src/generators/function/function.js.map +1 -1
- package/src/generators/function/lib/add-function-config.d.ts +2 -2
- package/src/generators/function/lib/add-function-config.js +2 -2
- package/src/generators/function/lib/add-function-config.js.map +1 -1
- package/src/generators/function/lib/create-files.d.ts +3 -3
- package/src/generators/function/lib/create-files.js +16 -5
- package/src/generators/function/lib/create-files.js.map +1 -1
- package/src/generators/function/lib/delete-files.d.ts +3 -3
- package/src/generators/function/lib/delete-files.js +3 -3
- package/src/generators/function/lib/delete-files.js.map +1 -1
- package/src/generators/function/lib/update-project.d.ts +2 -2
- package/src/generators/function/lib/update-project.js +4 -4
- package/src/generators/function/lib/update-project.js.map +1 -1
- package/src/generators/function/schema.d.ts +15 -11
- package/src/generators/function/schema.json +12 -6
- package/src/generators/init/init.d.ts +4 -8
- package/src/generators/init/init.js +12 -15
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/lib/add-dependencies.js +27 -27
- package/src/generators/init/lib/add-dependencies.js.map +1 -1
- package/src/generators/init/lib/index.d.ts +0 -1
- package/src/generators/init/lib/index.js +0 -1
- package/src/generators/init/lib/index.js.map +1 -1
- package/src/generators/init/schema.d.ts +1 -4
- package/src/generators/init/schema.json +0 -11
- package/src/generators/migrate/schema.json +1 -2
- package/src/utils/index.d.ts +0 -1
- package/src/utils/index.js +0 -1
- package/src/utils/index.js.map +1 -1
- package/src/utils/update-tsconfig.d.ts +1 -0
- package/src/utils/update-tsconfig.js +13 -3
- package/src/utils/update-tsconfig.js.map +1 -1
- package/src/utils/workspace.js +5 -3
- package/src/utils/workspace.js.map +1 -1
- package/src/generators/init/lib/normalize-options.d.ts +0 -2
- package/src/generators/init/lib/normalize-options.js +0 -9
- package/src/generators/init/lib/normalize-options.js.map +0 -1
- package/src/utils/versions.d.ts +0 -13
- package/src/utils/versions.js +0 -33
- package/src/utils/versions.js.map +0 -1
|
@@ -12,24 +12,29 @@
|
|
|
12
12
|
"$source": "argv",
|
|
13
13
|
"index": 0
|
|
14
14
|
},
|
|
15
|
-
"x-prompt": "What name would you like to use for the firebase
|
|
15
|
+
"x-prompt": "What name would you like to use for the firebase application?"
|
|
16
16
|
},
|
|
17
17
|
"directory": {
|
|
18
|
-
"description": "
|
|
19
|
-
"type": "string"
|
|
18
|
+
"description": "A directory where the application is placed.",
|
|
19
|
+
"type": "string",
|
|
20
|
+
"alias": "d"
|
|
20
21
|
},
|
|
21
22
|
"tags": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Add tags to the project (used for linting)",
|
|
25
|
+
"alias": "t"
|
|
26
|
+
},
|
|
27
|
+
"projectNameAndRootFormat": {
|
|
28
|
+
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
29
|
+
"type": "string",
|
|
30
|
+
"enum": ["as-provided", "derived"]
|
|
24
31
|
},
|
|
25
32
|
"project": {
|
|
26
33
|
"type": "string",
|
|
27
|
-
"description": "The firebase project that should be associated with this application",
|
|
34
|
+
"description": "The firebase CLI project that should be associated with this application",
|
|
28
35
|
"default": ""
|
|
29
36
|
}
|
|
30
37
|
},
|
|
31
38
|
"additionalProperties": false,
|
|
32
|
-
"required": [
|
|
33
|
-
"name"
|
|
34
|
-
]
|
|
39
|
+
"required": ["name"]
|
|
35
40
|
}
|
|
@@ -10,13 +10,10 @@
|
|
|
10
10
|
import {onRequest} from "firebase-functions/v2/https";
|
|
11
11
|
import * as logger from "firebase-functions/logger";
|
|
12
12
|
|
|
13
|
-
// import { initializeApp } from "firebase-admin/app";
|
|
14
|
-
// initializeApp()
|
|
15
|
-
|
|
16
13
|
// Start writing functions
|
|
17
14
|
// https://firebase.google.com/docs/functions/typescript
|
|
18
15
|
|
|
19
|
-
export const helloWorld = onRequest((request, response) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
16
|
+
// export const helloWorld = onRequest((request, response) => {
|
|
17
|
+
// logger.info("Hello logs!", {structuredData: true});
|
|
18
|
+
// response.send("Hello from Firebase!");
|
|
19
|
+
// });
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function normalizeOptions(
|
|
2
|
+
import type { Schema, NormalizedSchema } from './schema';
|
|
3
|
+
export declare function normalizeOptions(host: Tree, options: Schema, callingGenerator?: string): Promise<NormalizedSchema>;
|
|
4
4
|
/**
|
|
5
5
|
* Firebase 'functions' application generator
|
|
6
6
|
* Uses the `@nx/node` application generator as a base implementation
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
8
|
+
* @param host
|
|
9
|
+
* @param schema
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
export declare function functionGenerator(
|
|
12
|
+
export declare function functionGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
13
13
|
export default functionGenerator;
|
|
14
|
-
export declare const functionSchematic: (generatorOptions:
|
|
14
|
+
export declare const functionSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -7,46 +7,83 @@ const node_1 = require("@nx/node");
|
|
|
7
7
|
const init_1 = require("../init/init");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const lib_1 = require("./lib");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
11
|
+
const nx_firebase_versions_1 = require("../../__generated__/nx-firebase-versions");
|
|
12
|
+
function normalizeOptions(host, options, callingGenerator = '@simondotm/nx-firebase:function') {
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const { projectName: appProjectName, projectRoot, projectNameAndRootFormat, } = yield (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
15
|
+
name: options.name,
|
|
16
|
+
projectType: 'application',
|
|
17
|
+
directory: options.directory,
|
|
18
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
19
|
+
rootProject: options.rootProject,
|
|
20
|
+
callingGenerator,
|
|
21
|
+
});
|
|
22
|
+
options.rootProject = projectRoot === '.';
|
|
23
|
+
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
24
|
+
const parsedTags = options.tags
|
|
25
|
+
? options.tags.split(',').map((s) => s.trim())
|
|
26
|
+
: [];
|
|
27
|
+
// const { projectName, projectRoot } = getProjectName(
|
|
28
|
+
// host,
|
|
29
|
+
// options.name,
|
|
30
|
+
// options.directory,
|
|
31
|
+
// )
|
|
32
|
+
// get & validate the firebase app project this function will be attached to
|
|
33
|
+
const firebaseApp = (0, devkit_1.names)(options.app).fileName;
|
|
34
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
35
|
+
if (!projects.has(firebaseApp)) {
|
|
36
|
+
throw new Error(`A firebase application project called '${firebaseApp}' was not found in this workspace.`);
|
|
37
|
+
}
|
|
38
|
+
const firebaseAppProject = (0, devkit_1.readProjectConfiguration)(host, firebaseApp);
|
|
39
|
+
// read the firebase config used by the parent app project
|
|
40
|
+
const firebaseConfigName = (0, utils_1.getFirebaseConfigFromProject)(host, firebaseAppProject);
|
|
41
|
+
return Object.assign(Object.assign({}, options), { name: (0, devkit_1.names)(options.name).fileName, projectName: appProjectName, projectRoot,
|
|
42
|
+
parsedTags,
|
|
43
|
+
firebaseConfigName,
|
|
44
|
+
firebaseAppProject });
|
|
45
|
+
// return {
|
|
46
|
+
// ...options,
|
|
47
|
+
// runTime: options.runTime || '16',
|
|
48
|
+
// format: options.format || 'esm',
|
|
49
|
+
// projectRoot,
|
|
50
|
+
// projectName,
|
|
51
|
+
// firebaseConfigName,
|
|
52
|
+
// firebaseAppProject,
|
|
53
|
+
// }
|
|
54
|
+
});
|
|
25
55
|
}
|
|
26
56
|
exports.normalizeOptions = normalizeOptions;
|
|
27
57
|
/**
|
|
28
58
|
* Firebase 'functions' application generator
|
|
29
59
|
* Uses the `@nx/node` application generator as a base implementation
|
|
30
60
|
*
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
61
|
+
* @param host
|
|
62
|
+
* @param schema
|
|
33
63
|
* @returns
|
|
34
64
|
*/
|
|
35
|
-
function functionGenerator(
|
|
65
|
+
function functionGenerator(host, schema) {
|
|
36
66
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
67
|
const tasks = [];
|
|
38
|
-
const options = normalizeOptions(
|
|
68
|
+
const options = yield normalizeOptions(host, Object.assign({
|
|
69
|
+
// set default options
|
|
70
|
+
projectNameAndRootFormat: 'derived', runTime: nx_firebase_versions_1.packageVersions.nodeEngine }, schema));
|
|
71
|
+
if (!options.runTime) {
|
|
72
|
+
throw new Error('No runtime specified for the function app');
|
|
73
|
+
}
|
|
74
|
+
// const options = normalizeOptions(host, schema)
|
|
39
75
|
// initialise plugin
|
|
40
|
-
const initTask = yield (0, init_1.initGenerator)(
|
|
76
|
+
const initTask = yield (0, init_1.initGenerator)(host, {});
|
|
41
77
|
tasks.push(initTask);
|
|
42
78
|
// We use @nx/node:app to scaffold our function application, then modify as required
|
|
43
79
|
// `nx g @nx/node:app function-name --directory functions/dir --e2eTestRunner=none --framework=none --unitTestRunner=jest --bundler=esbuild --tags=firebase:firebase-app`
|
|
44
80
|
// Function apps are tagged so that they can built/watched with run-many
|
|
45
81
|
const tags = `firebase:function,firebase:name:${options.projectName},firebase:dep:${options.firebaseAppProject.name}` +
|
|
46
82
|
(options.tags ? `,${options.tags}` : '');
|
|
47
|
-
const nodeApplicationTask = yield (0, node_1.applicationGenerator)(
|
|
83
|
+
const nodeApplicationTask = yield (0, node_1.applicationGenerator)(host, {
|
|
48
84
|
name: options.name,
|
|
49
85
|
directory: options.directory,
|
|
86
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
50
87
|
tags,
|
|
51
88
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
52
89
|
skipFormat: options.skipFormat,
|
|
@@ -57,16 +94,16 @@ function functionGenerator(tree, rawOptions) {
|
|
|
57
94
|
});
|
|
58
95
|
tasks.push(nodeApplicationTask);
|
|
59
96
|
// generate function app specific files
|
|
60
|
-
(0, lib_1.createFiles)(
|
|
97
|
+
(0, lib_1.createFiles)(host, options);
|
|
61
98
|
// update TS config for esm or cjs
|
|
62
|
-
(0, utils_1.updateTsConfig)(
|
|
99
|
+
(0, utils_1.updateTsConfig)(host, options.projectRoot, options.runTime, options.format);
|
|
63
100
|
// reconfigure the @nx/node:app to suit firebase functions
|
|
64
|
-
(0, lib_1.updateProject)(
|
|
101
|
+
(0, lib_1.updateProject)(host, options);
|
|
65
102
|
// update firebase functions config
|
|
66
|
-
(0, lib_1.addFunctionConfig)(
|
|
103
|
+
(0, lib_1.addFunctionConfig)(host, options);
|
|
67
104
|
// ensures newly added files are formatted to match workspace style
|
|
68
105
|
if (!options.skipFormat) {
|
|
69
|
-
yield (0, devkit_1.formatFiles)(
|
|
106
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
70
107
|
}
|
|
71
108
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
72
109
|
});
|
|
@@ -1 +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,
|
|
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,uCAA0E;AAE1E,+BAAqE;AAErE,uGAA0G;AAC1G,mFAA0E;AAE1E,SAAsB,gBAAgB,CACpC,IAAU,EACV,OAAe,EACf,gBAAgB,GAAG,iCAAiC;;QAEpD,MAAM,EACJ,WAAW,EAAE,cAAc,EAC3B,WAAW,EACX,wBAAwB,GACzB,GAAG,MAAM,IAAA,gEAAkC,EAAC,IAAI,EAAE;YACjD,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,aAAa;YAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,wBAAwB,EAAE,OAAO,CAAC,wBAAwB;YAC1D,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,gBAAgB;SACjB,CAAC,CAAA;QAEF,OAAO,CAAC,WAAW,GAAG,WAAW,KAAK,GAAG,CAAA;QACzC,OAAO,CAAC,wBAAwB,GAA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,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;QAE1E,0DAA0D;QAC1D,IAAA,mBAAa,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAE5B,mCAAmC;QACnC,IAAA,uBAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAEhC,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;AAhED,8CAgEC;AAED,kBAAe,iBAAiB,CAAA;AACnB,QAAA,iBAAiB,GAAG,IAAA,2BAAkB,EAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function addFunctionConfig(
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
|
+
export declare function addFunctionConfig(host: Tree, options: NormalizedSchema): void;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addFunctionConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function addFunctionConfig(
|
|
6
|
-
(0, devkit_1.updateJson)(
|
|
5
|
+
function addFunctionConfig(host, options) {
|
|
6
|
+
(0, devkit_1.updateJson)(host, options.firebaseConfigName, (json) => {
|
|
7
7
|
const functionConfig = {
|
|
8
8
|
codebase: options.projectName,
|
|
9
9
|
source: (0, devkit_1.joinPathFragments)('dist', options.projectRoot),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-function-config.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/add-function-config.ts"],"names":[],"mappings":";;;AAAA,uCAAgE;AAIhE,SAAgB,iBAAiB,CAAC,IAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"add-function-config.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/add-function-config.ts"],"names":[],"mappings":";;;AAAA,uCAAgE;AAIhE,SAAgB,iBAAiB,CAAC,IAAU,EAAE,OAAyB;IACrE,IAAA,mBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,EAAE,CAAC,IAAoB,EAAE,EAAE;QACpE,MAAM,cAAc,GAAG;YACrB,QAAQ,EAAE,OAAO,CAAC,WAAW;YAC7B,MAAM,EAAE,IAAA,0BAAiB,EAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC;YACtD,OAAO,EAAE,SAAS,OAAO,CAAC,OAAO,EAAE;YACnC,MAAM,EAAE,CAAC,SAAS,CAAC;SACpB,CAAA;QAED,kEAAkE;QAClE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YAClC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;YAC1D,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;YACnB,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,EAAE;gBACxC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;aACtC;SACF;QACD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QACnC,uCAAuC;QACvC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAmB,EAAE,CAAmB,EAAE,EAAE;YAC/D,OAAO,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACvE,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC;AAxBD,8CAwBC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
3
|
/**
|
|
4
4
|
* Generate the firebase app specific files
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
6
|
+
* @param host
|
|
7
7
|
* @param options
|
|
8
8
|
*/
|
|
9
|
-
export declare function createFiles(
|
|
9
|
+
export declare function createFiles(host: Tree, options: NormalizedSchema): void;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createFiles = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const nx_firebase_versions_1 = require("../../../__generated__/nx-firebase-versions");
|
|
6
6
|
/**
|
|
7
7
|
* Generate the firebase app specific files
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param host
|
|
10
10
|
* @param options
|
|
11
11
|
*/
|
|
12
|
-
function createFiles(
|
|
12
|
+
function createFiles(host, options) {
|
|
13
13
|
const firebaseAppConfig = options.firebaseConfigName;
|
|
14
|
-
const firebaseAppConfigPath = (0,
|
|
14
|
+
const firebaseAppConfigPath = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.projectRoot), firebaseAppConfig);
|
|
15
15
|
const substitutions = {
|
|
16
16
|
tmpl: '',
|
|
17
17
|
projectName: options.projectName,
|
|
@@ -31,7 +31,18 @@ function createFiles(tree, options) {
|
|
|
31
31
|
// Rules and index files also get generated in the application folder;
|
|
32
32
|
// 1. so that they dont clutter up the root workspace
|
|
33
33
|
// 2. so that they are located within the nx firebase application project they relate to
|
|
34
|
-
(0,
|
|
34
|
+
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '..', 'files'), options.projectRoot, substitutions);
|
|
35
|
+
// set dependencies for the firebase function
|
|
36
|
+
const firebasePackageDependencies = {};
|
|
37
|
+
if ((0, devkit_1.detectPackageManager)() === 'pnpm') {
|
|
38
|
+
firebasePackageDependencies['@google-cloud/functions-framework'] = `^${nx_firebase_versions_1.packageVersions.googleCloudFunctionsFramework}`;
|
|
39
|
+
}
|
|
40
|
+
if (Object.keys(firebasePackageDependencies).length > 0) {
|
|
41
|
+
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
|
|
42
|
+
json.dependencies = firebasePackageDependencies;
|
|
43
|
+
return json;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
exports.createFiles = createFiles;
|
|
37
48
|
//# sourceMappingURL=create-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/create-files.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"create-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/create-files.ts"],"names":[],"mappings":";;;AAAA,uCAOmB;AAEnB,sFAA6E;AAE7E;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAyB;IAC/D,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;IAED,6CAA6C;IAC7C,MAAM,2BAA2B,GAAG,EAAE,CAAA;IACtC,IAAI,IAAA,6BAAoB,GAAE,KAAK,MAAM,EAAE;QACrC,2BAA2B,CACzB,mCAAmC,CACpC,GAAG,IAAI,sCAAe,CAAC,6BAA6B,EAAE,CAAA;KACxD;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACvD,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,EACtD,CAAC,IAAI,EAAE,EAAE;YACP,IAAI,CAAC,YAAY,GAAG,2BAA2B,CAAA;YAC/C,OAAO,IAAI,CAAA;QACb,CAAC,CACF,CAAA;KACF;AACH,CAAC;AAxDD,kCAwDC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
3
|
/**
|
|
4
4
|
* Delete unwanted files created by the node generator
|
|
5
|
-
* @param
|
|
5
|
+
* @param host
|
|
6
6
|
* @param options
|
|
7
7
|
*/
|
|
8
|
-
export declare function deleteFiles(
|
|
8
|
+
export declare function deleteFiles(host: Tree, options: NormalizedSchema): void;
|
|
@@ -4,10 +4,10 @@ exports.deleteFiles = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
/**
|
|
6
6
|
* Delete unwanted files created by the node generator
|
|
7
|
-
* @param
|
|
7
|
+
* @param host
|
|
8
8
|
* @param options
|
|
9
9
|
*/
|
|
10
|
-
function deleteFiles(
|
|
10
|
+
function deleteFiles(host, options) {
|
|
11
11
|
const nodeFilesToDelete = [
|
|
12
12
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'main.ts'),
|
|
13
13
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'app', '.gitkeep'),
|
|
@@ -16,7 +16,7 @@ function deleteFiles(tree, options) {
|
|
|
16
16
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'environments', 'environment.ts'),
|
|
17
17
|
];
|
|
18
18
|
for (const path of nodeFilesToDelete) {
|
|
19
|
-
|
|
19
|
+
host.delete(path);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.deleteFiles = deleteFiles;
|
|
@@ -1 +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,
|
|
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,OAAyB;IAC/D,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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function updateProject(
|
|
2
|
+
import type { NormalizedSchema } from '../schema';
|
|
3
|
+
export declare function updateProject(host: Tree, options: NormalizedSchema): void;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateProject = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function updateProject(
|
|
6
|
-
const project = (0, devkit_1.readProjectConfiguration)(
|
|
5
|
+
function updateProject(host, options) {
|
|
6
|
+
const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
|
|
7
7
|
const firebaseAppProject = options.firebaseAppProject;
|
|
8
8
|
// replace the default node build target with a simplified version
|
|
9
9
|
// we dont need dev/production build configurations for firebase functions since its a confined secure environment
|
|
@@ -51,12 +51,12 @@ function updateProject(tree, options) {
|
|
|
51
51
|
// No serve target for functions, since we may have multiple functions in a firebase project
|
|
52
52
|
// Instead we serve at the firebase app project
|
|
53
53
|
delete project.targets.serve;
|
|
54
|
-
(0, devkit_1.updateProjectConfiguration)(
|
|
54
|
+
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
|
|
55
55
|
// Add function project as implicit dep of firebase app project
|
|
56
56
|
firebaseAppProject.implicitDependencies || (firebaseAppProject.implicitDependencies = []);
|
|
57
57
|
firebaseAppProject.implicitDependencies.push(options.projectName);
|
|
58
58
|
firebaseAppProject.implicitDependencies.sort();
|
|
59
|
-
(0, devkit_1.updateProjectConfiguration)(
|
|
59
|
+
(0, devkit_1.updateProjectConfiguration)(host, options.app, firebaseAppProject);
|
|
60
60
|
}
|
|
61
61
|
exports.updateProject = updateProject;
|
|
62
62
|
//# sourceMappingURL=update-project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-project.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/update-project.ts"],"names":[],"mappings":";;;AAAA,uCAImB;AAInB,SAAgB,aAAa,CAAC,IAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"update-project.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/function/lib/update-project.ts"],"names":[],"mappings":";;;AAAA,uCAImB;AAInB,SAAgB,aAAa,CAAC,IAAU,EAAE,OAAyB;IACjE,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAEnE,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;IAErD,kEAAkE;IAClE,kHAAkH;IAClH,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG;QACtB,QAAQ,EAAE,qBAAqB;QAC/B,OAAO,EAAE,CAAC,sBAAsB,CAAC;QACjC,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU;YACpD,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI;YACxC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ;YAChD,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;YAC5C,mBAAmB,EAAE,IAAI;YACzB,g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AAE,CAAA;IAC9C,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAA;AACnE,CAAC;AA9DD,sCA8DC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProjectConfiguration } from '@nx/devkit'
|
|
2
|
+
import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils'
|
|
2
3
|
|
|
3
4
|
// export interface Schema {
|
|
4
5
|
// name: string;
|
|
@@ -23,29 +24,32 @@ import { ProjectConfiguration } from '@nx/devkit'
|
|
|
23
24
|
// isNest?: boolean;
|
|
24
25
|
// }
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
export interface Schema {
|
|
28
|
+
// standard nx generator options
|
|
29
|
+
name: string
|
|
30
|
+
directory?: string
|
|
31
|
+
tags?: string
|
|
32
|
+
projectNameAndRootFormat?: ProjectNameAndRootFormat
|
|
33
|
+
rootProject?: boolean
|
|
34
|
+
|
|
35
|
+
// subset of @nx/node:application options that we forward to node app generator
|
|
28
36
|
setParserOptionsProject?: boolean
|
|
29
37
|
skipFormat?: boolean
|
|
30
38
|
// unitTestRunner is always jest
|
|
31
39
|
// bundler is always esbuild
|
|
32
40
|
// linter is always eslint
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface FunctionGeneratorOptions
|
|
36
|
-
extends SupportedNodeGeneratorOptions {
|
|
37
|
-
name: string
|
|
38
|
-
directory?: string
|
|
39
|
-
tags?: string
|
|
40
41
|
|
|
42
|
+
// nx-firebase:function generator specific options
|
|
41
43
|
app: string
|
|
42
44
|
runTime?: '16' | '18' | '20'
|
|
43
45
|
format?: 'esm' | 'cjs'
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
interface
|
|
47
|
-
projectRoot: Path
|
|
48
|
+
interface NormalizedSchema extends Schema {
|
|
48
49
|
projectName: string
|
|
50
|
+
projectRoot: string
|
|
51
|
+
parsedTags: string[]
|
|
52
|
+
|
|
49
53
|
firebaseConfigName: string
|
|
50
54
|
firebaseAppProject: ProjectConfiguration
|
|
51
55
|
}
|
|
@@ -16,12 +16,19 @@
|
|
|
16
16
|
"x-prompt": "What name would you like to use for the firebase function project?"
|
|
17
17
|
},
|
|
18
18
|
"directory": {
|
|
19
|
-
"description": "
|
|
20
|
-
"type": "string"
|
|
19
|
+
"description": "A directory where the function is placed.",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"alias": "d"
|
|
21
22
|
},
|
|
22
23
|
"tags": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Add tags to the project (used for linting)",
|
|
26
|
+
"alias": "t"
|
|
27
|
+
},
|
|
28
|
+
"projectNameAndRootFormat": {
|
|
29
|
+
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"enum": ["as-provided", "derived"]
|
|
25
32
|
},
|
|
26
33
|
"setParserOptionsProject": {
|
|
27
34
|
"type": "boolean",
|
|
@@ -43,14 +50,13 @@
|
|
|
43
50
|
"description": "The name of the parent Nx firebase application project this function will be added to.",
|
|
44
51
|
"type": "string",
|
|
45
52
|
"x-prompt": "Which firebase Nx application project will this function be created for?"
|
|
46
|
-
},
|
|
53
|
+
},
|
|
47
54
|
"runTime": {
|
|
48
55
|
"description": "The node runtime target for this function.",
|
|
49
56
|
"type": "string",
|
|
50
57
|
"enum": ["16", "18", "20"],
|
|
51
58
|
"default": "16"
|
|
52
59
|
}
|
|
53
|
-
|
|
54
60
|
},
|
|
55
61
|
"additionalProperties": false,
|
|
56
62
|
"required": ["name", "app"]
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
2
|
import type { InitGeneratorOptions } from './schema';
|
|
3
3
|
/**
|
|
4
|
-
* `nx g @simondotm/nx-firebase:init`
|
|
5
|
-
* which in turn is based on the `@nx/node` plugin
|
|
4
|
+
* `nx g @simondotm/nx-firebase:init`
|
|
6
5
|
*
|
|
7
6
|
* Ensures the necessary firebase packages are installed in the nx workspace
|
|
8
|
-
*
|
|
7
|
+
* It also adds `@nx/node` if it is not already installed
|
|
9
8
|
*
|
|
10
|
-
* Docs say its for internal use only, but nest uses it, so we use it :)
|
|
11
|
-
* https://nx.dev/packages/node/generators/init
|
|
12
9
|
*/
|
|
13
|
-
export declare function initGenerator(
|
|
10
|
+
export declare function initGenerator(host: Tree, schema: InitGeneratorOptions): Promise<GeneratorCallback>;
|
|
14
11
|
export default initGenerator;
|
|
15
|
-
export declare const initSchematic: (generatorOptions: InitGeneratorOptions) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const node_1 = require("@nx/node");
|
|
7
6
|
const lib_1 = require("./lib");
|
|
8
7
|
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
9
8
|
/**
|
|
10
|
-
* `nx g @simondotm/nx-firebase:init`
|
|
11
|
-
* which in turn is based on the `@nx/node` plugin
|
|
9
|
+
* `nx g @simondotm/nx-firebase:init`
|
|
12
10
|
*
|
|
13
11
|
* Ensures the necessary firebase packages are installed in the nx workspace
|
|
14
|
-
*
|
|
12
|
+
* It also adds `@nx/node` if it is not already installed
|
|
15
13
|
*
|
|
16
|
-
* Docs say its for internal use only, but nest uses it, so we use it :)
|
|
17
|
-
* https://nx.dev/packages/node/generators/init
|
|
18
14
|
*/
|
|
19
|
-
function initGenerator(
|
|
15
|
+
function initGenerator(host, schema) {
|
|
20
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
const tasks = [];
|
|
18
|
+
(0, add_git_ignore_entry_1.addGitIgnore)(host);
|
|
19
|
+
(0, add_git_ignore_entry_1.addNxIgnore)(host);
|
|
20
|
+
if (!schema.skipFormat) {
|
|
21
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
22
|
+
}
|
|
23
|
+
tasks.push((0, lib_1.addDependencies)(host));
|
|
24
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
exports.initGenerator = initGenerator;
|
|
30
28
|
exports.default = initGenerator;
|
|
31
|
-
exports.initSchematic = (0, devkit_1.convertNxGenerator)(initGenerator);
|
|
32
29
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/generators/init/init.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,uCAKmB;AACnB,+BAAuC;AACvC,qEAAsE;AAGtE;;;;;;GAMG;AACH,SAAsB,aAAa,CACjC,IAAU,EACV,MAA4B;;QAE5B,MAAM,KAAK,GAAwB,EAAE,CAAA;QACrC,IAAA,mCAAY,EAAC,IAAI,CAAC,CAAA;QAClB,IAAA,kCAAW,EAAC,IAAI,CAAC,CAAA;QACjB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;SACxB;QACD,KAAK,CAAC,IAAI,CAAC,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAC,CAAA;QACjC,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAA;IACnC,CAAC;CAAA;AAZD,sCAYC;AAED,kBAAe,aAAa,CAAA"}
|