@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.
- package/README.md +14 -27
- package/executors.json +0 -8
- package/generators.json +11 -0
- package/package.json +5 -4
- package/src/generators/application/application.d.ts +3 -3
- package/src/generators/application/application.js +119 -19
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/application/files/readme.md__tmpl__ +12 -9
- package/src/generators/application/files_firebase/firebase.json__tmpl__ +6 -13
- package/src/generators/application/files_workspace/{firebase.__name__.json__tmpl__ → firebase.__projectName__.json__tmpl__} +6 -13
- package/src/generators/application/lib/create-files.js +10 -25
- package/src/generators/application/lib/create-files.js.map +1 -1
- package/src/generators/application/lib/index.d.ts +0 -3
- package/src/generators/application/lib/index.js +0 -3
- package/src/generators/application/lib/index.js.map +1 -1
- package/src/generators/application/schema.d.ts +3 -11
- package/src/generators/application/schema.json +0 -41
- package/src/generators/function/files/package.json__tmpl__ +19 -0
- package/src/generators/function/files/readme.md__tmpl__ +31 -0
- package/src/generators/function/function.d.ts +14 -0
- package/src/generators/function/function.js +77 -0
- package/src/generators/function/function.js.map +1 -0
- package/src/generators/function/lib/add-function.d.ts +3 -0
- package/src/generators/function/lib/add-function.js +29 -0
- package/src/generators/function/lib/add-function.js.map +1 -0
- package/src/generators/function/lib/create-files.d.ts +9 -0
- package/src/generators/function/lib/create-files.js +37 -0
- package/src/generators/function/lib/create-files.js.map +1 -0
- package/src/generators/function/lib/delete-files.js.map +1 -0
- package/src/generators/function/lib/index.d.ts +3 -0
- package/src/generators/function/lib/index.js +7 -0
- package/src/generators/function/lib/index.js.map +1 -0
- package/src/generators/function/lib/update-project.d.ts +3 -0
- package/src/generators/function/lib/update-project.js +52 -0
- package/src/generators/function/lib/update-project.js.map +1 -0
- package/src/generators/function/schema.d.ts +51 -0
- package/src/generators/function/schema.json +57 -0
- package/src/generators/init/init.d.ts +1 -1
- package/src/generators/init/init.js +2 -6
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/lib/add-dependencies.js +3 -4
- package/src/generators/init/lib/add-dependencies.js.map +1 -1
- package/src/generators/init/lib/add-git-ignore-entry.d.ts +1 -1
- package/src/generators/init/lib/add-git-ignore-entry.js +1 -0
- package/src/generators/init/lib/add-git-ignore-entry.js.map +1 -1
- package/src/generators/init/schema.d.ts +4 -4
- package/src/generators/init/schema.json +8 -7
- package/src/generators/sync/lib/firebase-changes.d.ts +3 -0
- package/src/generators/sync/lib/firebase-changes.js +102 -0
- package/src/generators/sync/lib/firebase-changes.js.map +1 -0
- package/src/generators/sync/lib/firebase-configs.d.ts +3 -0
- package/src/generators/sync/lib/firebase-configs.js +61 -0
- package/src/generators/sync/lib/firebase-configs.js.map +1 -0
- package/src/generators/sync/lib/firebase-projects.d.ts +20 -0
- package/src/generators/sync/lib/firebase-projects.js +75 -0
- package/src/generators/sync/lib/firebase-projects.js.map +1 -0
- package/src/generators/sync/lib/firebase-workspace.d.ts +3 -0
- package/src/generators/sync/lib/firebase-workspace.js +15 -0
- package/src/generators/sync/lib/firebase-workspace.js.map +1 -0
- package/src/generators/sync/lib/index.d.ts +7 -0
- package/src/generators/sync/lib/index.js +11 -0
- package/src/generators/sync/lib/index.js.map +1 -0
- package/src/generators/sync/lib/tags.d.ts +14 -0
- package/src/generators/sync/lib/tags.js +43 -0
- package/src/generators/sync/lib/tags.js.map +1 -0
- package/src/generators/sync/lib/types.d.ts +46 -0
- package/src/generators/sync/lib/types.js +5 -0
- package/src/generators/sync/lib/types.js.map +1 -0
- package/src/generators/sync/schema.d.ts +5 -0
- package/src/generators/sync/schema.json +19 -0
- package/src/generators/sync/sync.d.ts +8 -0
- package/src/generators/sync/sync.js +170 -0
- package/src/generators/sync/sync.js.map +1 -0
- package/src/utils/debug.d.ts +4 -0
- package/src/utils/debug.js +25 -0
- package/src/utils/debug.js.map +1 -0
- package/src/utils/firebase-config.d.ts +77 -0
- package/src/utils/firebase-config.js +52 -0
- package/src/utils/firebase-config.js.map +1 -0
- package/src/utils/index.d.ts +3 -0
- package/src/utils/index.js +3 -0
- package/src/utils/index.js.map +1 -1
- package/src/utils/project-name.d.ts +5 -0
- package/src/utils/project-name.js +38 -0
- package/src/utils/project-name.js.map +1 -0
- package/src/utils/types.d.ts +1 -1
- package/src/{generators/application/lib → utils}/update-tsconfig.d.ts +1 -2
- package/src/{generators/application/lib → utils}/update-tsconfig.js +5 -5
- package/src/utils/update-tsconfig.js.map +1 -0
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +5 -4
- package/src/utils/versions.js.map +1 -1
- package/src/utils/workspace.d.ts +1 -1
- package/src/executors/build/build.d.ts +0 -8
- package/src/executors/build/build.js +0 -82
- package/src/executors/build/build.js.map +0 -1
- package/src/executors/build/lib/copy-dependencies.d.ts +0 -3
- package/src/executors/build/lib/copy-dependencies.js +0 -53
- package/src/executors/build/lib/copy-dependencies.js.map +0 -1
- package/src/executors/build/lib/firebase-build.d.ts +0 -2
- package/src/executors/build/lib/firebase-build.js +0 -16
- package/src/executors/build/lib/firebase-build.js.map +0 -1
- package/src/executors/build/lib/get-dependencies.d.ts +0 -8
- package/src/executors/build/lib/get-dependencies.js +0 -87
- package/src/executors/build/lib/get-dependencies.js.map +0 -1
- package/src/executors/build/lib/index.d.ts +0 -1
- package/src/executors/build/lib/index.js +0 -5
- package/src/executors/build/lib/index.js.map +0 -1
- package/src/executors/build/lib/rewrite-package.d.ts +0 -8
- package/src/executors/build/lib/rewrite-package.js +0 -44
- package/src/executors/build/lib/rewrite-package.js.map +0 -1
- package/src/executors/build/schema.d.ts +0 -1
- package/src/executors/build/schema.json +0 -167
- package/src/generators/application/files/package.json__tmpl__ +0 -21
- package/src/generators/application/lib/add-project.d.ts +0 -39
- package/src/generators/application/lib/add-project.js +0 -115
- package/src/generators/application/lib/add-project.js.map +0 -1
- package/src/generators/application/lib/delete-files.js.map +0 -1
- package/src/generators/application/lib/normalize-options.d.ts +0 -5
- package/src/generators/application/lib/normalize-options.js +0 -44
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/application/lib/update-tsconfig.js.map +0 -1
- package/src/utils/e2ePatch.d.ts +0 -2
- package/src/utils/e2ePatch.js +0 -135
- package/src/utils/e2ePatch.js.map +0 -1
- /package/src/generators/{application/files/src/index.ts__tmpl__ → function/files/src/main.ts__tmpl__} +0 -0
- /package/src/generators/{application → function}/lib/delete-files.d.ts +0 -0
- /package/src/generators/{application → function}/lib/delete-files.js +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.copyFirebaseDependencies = exports.FIREBASE_DEPS_DIR = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const fs_extra_1 = require("fs-extra");
|
|
7
|
-
exports.FIREBASE_DEPS_DIR = 'libs';
|
|
8
|
-
function copyFirebaseDependencies(outputPath, workspaceRoot, projectDependencies) {
|
|
9
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
-
// final custom step for building firebase functions applications is to:
|
|
11
|
-
// - identify any workspace library dependencies
|
|
12
|
-
// - copy them to the application dist folder
|
|
13
|
-
// - update the output "package.json" to use local file references to these libraries
|
|
14
|
-
//
|
|
15
|
-
// This ensures that:
|
|
16
|
-
// - the firebase CLI deploy command will work correctly
|
|
17
|
-
// - all code for the functions is self contained with the dist/app/<firebaseapp> folder
|
|
18
|
-
// - all local code for the functions will be uploaded to GCP without any need to faff with private npm packages
|
|
19
|
-
// copy each of their build outputs in dist to a "libs" sub directory in our application dist output folder
|
|
20
|
-
const localLibraries = {};
|
|
21
|
-
for (const dep of projectDependencies) {
|
|
22
|
-
const localPackageName = dep.name; // the library dependency package name
|
|
23
|
-
const localLibraryName = dep.node.name; // the library dependency project name
|
|
24
|
-
localLibraries[localPackageName] = dep;
|
|
25
|
-
const srcDir = (0, devkit_1.joinPathFragments)(workspaceRoot, dep.outputs[0]);
|
|
26
|
-
const outDir = (0, devkit_1.joinPathFragments)(workspaceRoot, outputPath, exports.FIREBASE_DEPS_DIR, localLibraryName);
|
|
27
|
-
// we also copy libraries to node_modules in dist, because the Firebase CLI also runs the entry point script during a deploy to determine the exported functions
|
|
28
|
-
// however, firebase does NOT upload node_modules to GCP, so we have to make two copies of each dependent local library package
|
|
29
|
-
// see: https://firebase.google.com/docs/functions/handle-dependencies
|
|
30
|
-
// SM: Nov'22, this policy has changed - local libs should NOT be in the `node_modules` folder.
|
|
31
|
-
// https://firebase.google.com/docs/functions/handle-dependencies#including_local_nodejs_modules
|
|
32
|
-
// SM: Dec'22, this is not correct, we DO need to copy to `node_modules` also, because the firebase CLI script
|
|
33
|
-
// uses `require(distDir)` to determine the entry point, and nodeJS require has to be able to resolve our libs to the local node_modules
|
|
34
|
-
// however, for external deps like `firebase-functions` nodeJS will not find it here, but will move up a folder until it hits our nx root node_modules
|
|
35
|
-
const nodeModulesDir = (0, devkit_1.joinPathFragments)(workspaceRoot, outputPath, 'node_modules', localPackageName);
|
|
36
|
-
try {
|
|
37
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
38
|
-
devkit_1.logger.info(`- Copying dependent workspace library '${dep.node.name}' from '${srcDir}' to '${outDir}'`);
|
|
39
|
-
devkit_1.logger.info(`- Copying dependent workspace library '${dep.node.name}' from '${srcDir}' to '${nodeModulesDir}'`);
|
|
40
|
-
}
|
|
41
|
-
yield (0, fs_extra_1.copy)(srcDir, outDir);
|
|
42
|
-
yield (0, fs_extra_1.copy)(srcDir, nodeModulesDir);
|
|
43
|
-
devkit_1.logger.log(` - Copied 'lib' dependency '${dep.name}'`);
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
devkit_1.logger.error(err.message);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return localLibraries;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
exports.copyFirebaseDependencies = copyFirebaseDependencies;
|
|
53
|
-
//# sourceMappingURL=copy-dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/executors/build/lib/copy-dependencies.ts"],"names":[],"mappings":";;;;AAAA,uCAAsD;AAEtD,uCAA+B;AAElB,QAAA,iBAAiB,GAAG,MAAM,CAAA;AAEvC,SAAsB,wBAAwB,CAC5C,UAAkB,EAClB,aAAqB,EACrB,mBAAoD;;QAEpD,wEAAwE;QACxE,gDAAgD;QAChD,6CAA6C;QAC7C,qFAAqF;QACrF,EAAE;QACF,qBAAqB;QACrB,wDAAwD;QACxD,wFAAwF;QACxF,gHAAgH;QAEhH,2GAA2G;QAC3G,MAAM,cAAc,GAAkD,EAAE,CAAA;QACxE,KAAK,MAAM,GAAG,IAAI,mBAAmB,EAAE;YACrC,MAAM,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAA,CAAC,sCAAsC;YACxE,MAAM,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAA,CAAC,sCAAsC;YAC7E,cAAc,CAAC,gBAAgB,CAAC,GAAG,GAAG,CAAA;YACtC,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAAC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAC9B,aAAa,EACb,UAAU,EACV,yBAAiB,EACjB,gBAAgB,CACjB,CAAA;YACD,gKAAgK;YAChK,+HAA+H;YAC/H,sEAAsE;YACtE,+FAA+F;YAC/F,gGAAgG;YAChG,8GAA8G;YAC9G,wIAAwI;YACxI,sJAAsJ;YAEtJ,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,aAAa,EACb,UAAU,EACV,cAAc,EACd,gBAAgB,CACjB,CAAA;YACD,IAAI;gBACF,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;oBAClC,eAAM,CAAC,IAAI,CACT,0CAA0C,GAAG,CAAC,IAAI,CAAC,IAAI,WAAW,MAAM,SAAS,MAAM,GAAG,CAC3F,CAAA;oBACD,eAAM,CAAC,IAAI,CACT,0CAA0C,GAAG,CAAC,IAAI,CAAC,IAAI,WAAW,MAAM,SAAS,cAAc,GAAG,CACnG,CAAA;iBACF;gBACD,MAAM,IAAA,eAAI,EAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAC1B,MAAM,IAAA,eAAI,EAAC,MAAM,EAAE,cAAc,CAAC,CAAA;gBAClC,eAAM,CAAC,GAAG,CAAC,+BAA+B,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA;aACvD;YAAC,OAAO,GAAG,EAAE;gBACZ,eAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;aAC1B;SACF;QAED,OAAO,cAAc,CAAA;IACvB,CAAC;CAAA;AA7DD,4DA6DC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.firebaseBuildExecutor = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const copy_dependencies_1 = require("./copy-dependencies");
|
|
6
|
-
const get_dependencies_1 = require("./get-dependencies");
|
|
7
|
-
const rewrite_package_1 = require("./rewrite-package");
|
|
8
|
-
function firebaseBuildExecutor(context, outputPath) {
|
|
9
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
-
const firebaseDependencies = yield (0, get_dependencies_1.getFirebaseDependencies)(context);
|
|
11
|
-
const localLibraries = yield (0, copy_dependencies_1.copyFirebaseDependencies)(outputPath, context.root, firebaseDependencies.projectDependencies);
|
|
12
|
-
(0, rewrite_package_1.rewriteFirebasePackage)(outputPath, localLibraries);
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
exports.firebaseBuildExecutor = firebaseBuildExecutor;
|
|
16
|
-
//# sourceMappingURL=firebase-build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-build.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/executors/build/lib/firebase-build.ts"],"names":[],"mappings":";;;;AAEA,2DAA8D;AAC9D,yDAA4D;AAC5D,uDAA0D;AAE1D,SAAsB,qBAAqB,CACzC,OAAwB,EACxB,UAAkB;;QAElB,MAAM,oBAAoB,GAAG,MAAM,IAAA,0CAAuB,EAAC,OAAO,CAAC,CAAA;QACnE,MAAM,cAAc,GAAG,MAAM,IAAA,4CAAwB,EACnD,UAAU,EACV,OAAO,CAAC,IAAI,EACZ,oBAAoB,CAAC,mBAAmB,CACzC,CAAA;QACD,IAAA,wCAAsB,EAAC,UAAU,EAAE,cAAc,CAAC,CAAA;IACpD,CAAC;CAAA;AAXD,sDAWC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext, ProjectGraphProjectNode } from '@nx/devkit';
|
|
2
|
-
import { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
|
|
3
|
-
export type FirebaseDependencies = {
|
|
4
|
-
projectDependencies: DependentBuildableProjectNode[];
|
|
5
|
-
npmDependencies: DependentBuildableProjectNode[];
|
|
6
|
-
target: ProjectGraphProjectNode;
|
|
7
|
-
};
|
|
8
|
-
export declare function getFirebaseDependencies(context: ExecutorContext): Promise<FirebaseDependencies>;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFirebaseDependencies = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
7
|
-
function getFirebaseDependencies(context) {
|
|
8
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
-
devkit_1.logger.log(`- Processing dependencies for firebase functions app '${context.projectName}':`);
|
|
10
|
-
// NX 14/15 ONLY
|
|
11
|
-
// createProjectGraphAsync for Nx13 does not work with newer versions of Nx workspaces due to `root` field no longer being in the `project.json` files
|
|
12
|
-
// See https://github.com/e-square-io/nx-github-actions/issues/53
|
|
13
|
-
// This means our Nx 13 version of the plugin cannot support project graph changes
|
|
14
|
-
// SM: recompute the project graph on every iteration so that --watch will work,
|
|
15
|
-
// since the context.projectGraph is only a snapshot of dependencies at the time the plugin was run
|
|
16
|
-
// seems like 14.1.10 is when this started being compatible.
|
|
17
|
-
// SM: update, cant see why this would be true if we're using the same Nx devkit version as the Nx workspace
|
|
18
|
-
// NX 13.x file - https://github.com/nrwl/nx/blob/1b0092c69f64e77abd5fc54bc034ba45267c8f91/packages/nx/src/project-graph/project-graph.ts#L87
|
|
19
|
-
// const projectGraph = await createProjectGraphAsync()
|
|
20
|
-
// SM: in Nx 14.5.x projectGraph is passed in via context
|
|
21
|
-
// @nx/js:tsc executor uses readCachedProjectGraph, so we'll use it too
|
|
22
|
-
// https://github.com/nrwl/nx/blob/13.10.x/packages/js/src/utils/check-dependencies.ts
|
|
23
|
-
// https://github.com/nrwl/nx/blob/14.5.x/packages/js/src/utils/check-dependencies.ts
|
|
24
|
-
// const projectGraph = readCachedProjectGraph()
|
|
25
|
-
const { target, dependencies, nonBuildableDependencies, topLevelDependencies, } = (0, buildable_libs_utils_1.calculateProjectDependencies)(context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
|
|
26
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
27
|
-
devkit_1.logger.info('calculated dependencies=' + JSON.stringify(dependencies, null, 3));
|
|
28
|
-
devkit_1.logger.info('target=' + JSON.stringify(target, null, 3));
|
|
29
|
-
devkit_1.logger.info('nonBuildableDependencies=' +
|
|
30
|
-
JSON.stringify(nonBuildableDependencies, null, 3));
|
|
31
|
-
devkit_1.logger.info('topLevelDependencies=' + JSON.stringify(topLevelDependencies, null, 3));
|
|
32
|
-
}
|
|
33
|
-
// filter dependencies that are nx workspace libraries, sorted alphabetically
|
|
34
|
-
const projectDependencies = dependencies
|
|
35
|
-
.filter((dep) => {
|
|
36
|
-
return dep.node.type === 'lib';
|
|
37
|
-
})
|
|
38
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
39
|
-
// filter npm dependencies, sorted alphabetically
|
|
40
|
-
const npmDependencies = dependencies
|
|
41
|
-
.filter((dep) => dep.node.type === 'npm')
|
|
42
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
43
|
-
// Run dep checks before we compile for:
|
|
44
|
-
// 1) non-buildable libraries
|
|
45
|
-
// 2) nested libraries generated without `--importPath`
|
|
46
|
-
// These are both show-stoppers for successful Firebase functions compilation
|
|
47
|
-
// If any bad dependencies were found, report and throw
|
|
48
|
-
// detect any non-npm compatible nested libraries - eg. @proj/dir/lib
|
|
49
|
-
const incompatibleNestedDependencies = [];
|
|
50
|
-
for (const dep of projectDependencies) {
|
|
51
|
-
const name = dep.name;
|
|
52
|
-
if (name.split('/').length > 2) {
|
|
53
|
-
// TODO: check this is platform independent
|
|
54
|
-
incompatibleNestedDependencies.push(name);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Non-buildable or nested library dependencies are a show stopper
|
|
58
|
-
// If any bad dependencies were found, report and throw
|
|
59
|
-
if (nonBuildableDependencies.length ||
|
|
60
|
-
incompatibleNestedDependencies.length) {
|
|
61
|
-
// Sniff out any dependencies of this application that are
|
|
62
|
-
// non-buildable libraries
|
|
63
|
-
// These won't show up in `dependencies` because they don't have a `build` target
|
|
64
|
-
//
|
|
65
|
-
// Probably added as user error (done it myself) so better to warn here explicitly
|
|
66
|
-
// than ignore it and allow wierd side-effects to happen if we proceed.
|
|
67
|
-
for (const dep of nonBuildableDependencies) {
|
|
68
|
-
devkit_1.logger.error(`ERROR: Found non-buildable library dependency '${dep}' in Firebase Application. Imported libraries must be created with '--buildable'.`);
|
|
69
|
-
}
|
|
70
|
-
for (const dep of incompatibleNestedDependencies) {
|
|
71
|
-
devkit_1.logger.error(`ERROR: Found incompatible nested library dependency '${dep}' in Firebase Application. Imported nested libraries must be created with npm compatible '--importPath'.`);
|
|
72
|
-
}
|
|
73
|
-
throw new Error('ERROR: Firebase Application contains references to non-buildable or incompatible nested libraries, please fix in order to proceed with build.');
|
|
74
|
-
}
|
|
75
|
-
for (const d of npmDependencies) {
|
|
76
|
-
const type = d.node.type;
|
|
77
|
-
devkit_1.logger.log(` - Added '${type}' dependency '${d.name}'`);
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
projectDependencies,
|
|
81
|
-
npmDependencies,
|
|
82
|
-
target,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
exports.getFirebaseDependencies = getFirebaseDependencies;
|
|
87
|
-
//# sourceMappingURL=get-dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/executors/build/lib/get-dependencies.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './firebase-build';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/executors/build/lib/index.ts"],"names":[],"mappings":";;;AAAA,2DAAgC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DependentBuildableProjectNode } from '@nx/workspace/src/utilities/buildable-libs-utils';
|
|
2
|
-
/**
|
|
3
|
-
* rewrite references to library packages in the functions package.json
|
|
4
|
-
* to be local package references to the copies we made
|
|
5
|
-
* @param outputPath
|
|
6
|
-
* @param localLibraries
|
|
7
|
-
*/
|
|
8
|
-
export declare function rewriteFirebasePackage(outputPath: string, localLibraries: Record<string, DependentBuildableProjectNode>): void;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rewriteFirebasePackage = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const copy_dependencies_1 = require("./copy-dependencies");
|
|
6
|
-
/**
|
|
7
|
-
* rewrite references to library packages in the functions package.json
|
|
8
|
-
* to be local package references to the copies we made
|
|
9
|
-
* @param outputPath
|
|
10
|
-
* @param localLibraries
|
|
11
|
-
*/
|
|
12
|
-
function rewriteFirebasePackage(outputPath, localLibraries) {
|
|
13
|
-
const functionsPackageFile = (0, devkit_1.joinPathFragments)(outputPath, 'package.json');
|
|
14
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
15
|
-
devkit_1.logger.info(`- functions PackageFile '${functionsPackageFile}'`);
|
|
16
|
-
}
|
|
17
|
-
const functionsPackageJson = (0, devkit_1.readJsonFile)(functionsPackageFile);
|
|
18
|
-
const functionsPackageDeps = functionsPackageJson.dependencies;
|
|
19
|
-
if (functionsPackageDeps) {
|
|
20
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
21
|
-
devkit_1.logger.info('- Updating local dependencies for Firebase functions package.json');
|
|
22
|
-
}
|
|
23
|
-
for (const d in functionsPackageDeps) {
|
|
24
|
-
const localDep = localLibraries[d];
|
|
25
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
26
|
-
devkit_1.logger.info(`- Checking dependency '${d}', isLocalDep=${localDep !== undefined}`);
|
|
27
|
-
}
|
|
28
|
-
if (localDep) {
|
|
29
|
-
const localRef = `file:${(0, devkit_1.joinPathFragments)('.', copy_dependencies_1.FIREBASE_DEPS_DIR, localDep.node.name)}`;
|
|
30
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
31
|
-
devkit_1.logger.info(` - Replacing '${d}' with '${localRef}'`);
|
|
32
|
-
}
|
|
33
|
-
functionsPackageDeps[d] = localRef;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
(0, devkit_1.writeJsonFile)(functionsPackageFile, functionsPackageJson);
|
|
38
|
-
devkit_1.logger.log('- Updated firebase functions package.json');
|
|
39
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
40
|
-
devkit_1.logger.info(`functions package deps = ${JSON.stringify(functionsPackageDeps, null, 3)}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.rewriteFirebasePackage = rewriteFirebasePackage;
|
|
44
|
-
//# sourceMappingURL=rewrite-package.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-package.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/executors/build/lib/rewrite-package.ts"],"names":[],"mappings":";;;AAAA,uCAKmB;AAEnB,2DAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,UAAkB,EAClB,cAA6D;IAE7D,MAAM,oBAAoB,GAAG,IAAA,0BAAiB,EAAC,UAAU,EAAE,cAAc,CAAC,CAAA;IAE1E,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;QAClC,eAAM,CAAC,IAAI,CAAC,4BAA4B,oBAAoB,GAAG,CAAC,CAAA;KACjE;IACD,MAAM,oBAAoB,GAAG,IAAA,qBAAY,EAAC,oBAAoB,CAAC,CAAA;IAC/D,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,YAAY,CAAA;IAC9D,IAAI,oBAAoB,EAAE;QACxB,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;YAClC,eAAM,CAAC,IAAI,CACT,mEAAmE,CACpE,CAAA;SACF;QACD,KAAK,MAAM,CAAC,IAAI,oBAAoB,EAAE;YACpC,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;YAClC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;gBAClC,eAAM,CAAC,IAAI,CACT,0BAA0B,CAAC,iBAAiB,QAAQ,KAAK,SAAS,EAAE,CACrE,CAAA;aACF;YACD,IAAI,QAAQ,EAAE;gBACZ,MAAM,QAAQ,GAAG,QAAQ,IAAA,0BAAiB,EACxC,GAAG,EACH,qCAAiB,EACjB,QAAQ,CAAC,IAAI,CAAC,IAAI,CACnB,EAAE,CAAA;gBACH,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;oBAClC,eAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,QAAQ,GAAG,CAAC,CAAA;iBACtD;gBACD,oBAAoB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAA;aACnC;SACF;KACF;IACD,IAAA,sBAAa,EAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAA;IACzD,eAAM,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAA;IACvD,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;QAClC,eAAM,CAAC,IAAI,CACT,4BAA4B,IAAI,CAAC,SAAS,CACxC,oBAAoB,EACpB,IAAI,EACJ,CAAC,CACF,EAAE,CACJ,CAAA;KACF;AACH,CAAC;AAhDD,wDAgDC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export interface BuildExecutorSchema {} // eslint-disable-line
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"version": 2,
|
|
4
|
-
"outputCapture": "direct-nodejs",
|
|
5
|
-
"title": "Typescript Build Target",
|
|
6
|
-
"description": "Builds using TypeScript.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"main": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "The name of the main entry-point file.",
|
|
12
|
-
"x-completion-type": "file",
|
|
13
|
-
"x-completion-glob": "main@(.js|.ts|.jsx|.tsx)"
|
|
14
|
-
},
|
|
15
|
-
"rootDir": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"description": "Sets the rootDir for TypeScript compilation. When not defined, it uses the root of project."
|
|
18
|
-
},
|
|
19
|
-
"outputPath": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "The output path of the generated files.",
|
|
22
|
-
"x-completion-type": "directory"
|
|
23
|
-
},
|
|
24
|
-
"tsConfig": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "The path to the Typescript configuration file.",
|
|
27
|
-
"x-completion-type": "file",
|
|
28
|
-
"x-completion-glob": "tsconfig.*.json"
|
|
29
|
-
},
|
|
30
|
-
"assets": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"description": "List of static assets.",
|
|
33
|
-
"default": [],
|
|
34
|
-
"items": {
|
|
35
|
-
"$ref": "#/definitions/assetPattern"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"watch": {
|
|
39
|
-
"type": "boolean",
|
|
40
|
-
"description": "Enable re-building when files change.",
|
|
41
|
-
"default": false
|
|
42
|
-
},
|
|
43
|
-
"clean": {
|
|
44
|
-
"type": "boolean",
|
|
45
|
-
"description": "Remove previous output before build.",
|
|
46
|
-
"default": true
|
|
47
|
-
},
|
|
48
|
-
"transformers": {
|
|
49
|
-
"type": "array",
|
|
50
|
-
"description": "List of TypeScript Transformer Plugins.",
|
|
51
|
-
"default": [],
|
|
52
|
-
"items": {
|
|
53
|
-
"$ref": "#/definitions/transformerPattern"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"updateBuildableProjectDepsInPackageJson": {
|
|
57
|
-
"type": "boolean",
|
|
58
|
-
"description": "Whether to update the buildable project dependencies in `package.json`.",
|
|
59
|
-
"default": true
|
|
60
|
-
},
|
|
61
|
-
"buildableProjectDepsInPackageJsonType": {
|
|
62
|
-
"type": "string",
|
|
63
|
-
"description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
|
|
64
|
-
"enum": [
|
|
65
|
-
"dependencies",
|
|
66
|
-
"peerDependencies"
|
|
67
|
-
],
|
|
68
|
-
"default": "dependencies"
|
|
69
|
-
},
|
|
70
|
-
"external": {
|
|
71
|
-
"description": "A list projects to be treated as external. This feature is experimental",
|
|
72
|
-
"oneOf": [
|
|
73
|
-
{
|
|
74
|
-
"type": "string",
|
|
75
|
-
"enum": [
|
|
76
|
-
"all",
|
|
77
|
-
"none"
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"type": "array",
|
|
82
|
-
"items": {
|
|
83
|
-
"type": "string"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
"externalBuildTargets": {
|
|
89
|
-
"type": "array",
|
|
90
|
-
"items": {
|
|
91
|
-
"type": "string"
|
|
92
|
-
},
|
|
93
|
-
"description": "List of target names that annotate a build target for a project",
|
|
94
|
-
"default": [
|
|
95
|
-
"build"
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"required": [
|
|
100
|
-
"main",
|
|
101
|
-
"outputPath",
|
|
102
|
-
"tsConfig"
|
|
103
|
-
],
|
|
104
|
-
"definitions": {
|
|
105
|
-
"assetPattern": {
|
|
106
|
-
"oneOf": [
|
|
107
|
-
{
|
|
108
|
-
"type": "object",
|
|
109
|
-
"properties": {
|
|
110
|
-
"glob": {
|
|
111
|
-
"type": "string",
|
|
112
|
-
"description": "The pattern to match."
|
|
113
|
-
},
|
|
114
|
-
"input": {
|
|
115
|
-
"type": "string",
|
|
116
|
-
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
|
|
117
|
-
},
|
|
118
|
-
"ignore": {
|
|
119
|
-
"description": "An array of globs to ignore.",
|
|
120
|
-
"type": "array",
|
|
121
|
-
"items": {
|
|
122
|
-
"type": "string"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"output": {
|
|
126
|
-
"type": "string",
|
|
127
|
-
"description": "Absolute path within the output."
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
"additionalProperties": false,
|
|
131
|
-
"required": [
|
|
132
|
-
"glob",
|
|
133
|
-
"input",
|
|
134
|
-
"output"
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"type": "string"
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
|
-
"transformerPattern": {
|
|
143
|
-
"oneOf": [
|
|
144
|
-
{
|
|
145
|
-
"type": "string"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"type": "object",
|
|
149
|
-
"properties": {
|
|
150
|
-
"name": {
|
|
151
|
-
"type": "string"
|
|
152
|
-
},
|
|
153
|
-
"options": {
|
|
154
|
-
"type": "object",
|
|
155
|
-
"additionalProperties": true
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
"additionalProperties": false,
|
|
159
|
-
"required": [
|
|
160
|
-
"name"
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"examplesFile": "../../../docs/tsc-examples.md"
|
|
167
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "<%= name %>",
|
|
3
|
-
"description": "Firebase Functions package, auto generated by @simondotm/nx-firebase",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"lint": "nx lint <%= name %>",
|
|
6
|
-
"build": "nx build <%= name %>",
|
|
7
|
-
"serve": "npm run build && firebase emulators:start --only functions --config <%= firebaseAppConfig %>",
|
|
8
|
-
"shell": "npm run build && firebase functions:shell",
|
|
9
|
-
"start": "npm run shell",
|
|
10
|
-
"deploy": "firebase deploy --only functions --config <%= firebaseAppConfig %>",
|
|
11
|
-
"logs": "firebase functions:log"
|
|
12
|
-
},
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": " <%= firebaseNodeEngine %>"
|
|
15
|
-
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
},
|
|
20
|
-
"private": true
|
|
21
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ProjectConfiguration, Tree } from '@nx/devkit';
|
|
2
|
-
import type { NormalizedOptions } from '../schema';
|
|
3
|
-
export declare function getBuildTarget(project: ProjectConfiguration): {
|
|
4
|
-
executor: string;
|
|
5
|
-
outputs: string[];
|
|
6
|
-
options: {
|
|
7
|
-
outputPath: string;
|
|
8
|
-
main: string;
|
|
9
|
-
tsConfig: string;
|
|
10
|
-
packageJson: string;
|
|
11
|
-
assets: any[];
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export declare function getDeployTarget(options: NormalizedOptions): {
|
|
15
|
-
executor: string;
|
|
16
|
-
options: {
|
|
17
|
-
command: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare function getConfigTarget(projectRoot: string, options: NormalizedOptions): {
|
|
21
|
-
executor: string;
|
|
22
|
-
options: {
|
|
23
|
-
command: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export declare function getEmulateTarget(options: NormalizedOptions, project: ProjectConfiguration): {
|
|
27
|
-
executor: string;
|
|
28
|
-
options: {
|
|
29
|
-
commands: string[];
|
|
30
|
-
parallel: boolean;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare function getServeTarget(options: NormalizedOptions): {
|
|
34
|
-
executor: string;
|
|
35
|
-
options: {
|
|
36
|
-
commands: string[];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export declare function addProject(tree: Tree, options: NormalizedOptions): void;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addProject = exports.getServeTarget = exports.getEmulateTarget = exports.getConfigTarget = exports.getDeployTarget = exports.getBuildTarget = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
/**
|
|
8
|
-
* Return run-commands executor that is most compatible with host workspace version
|
|
9
|
-
*/
|
|
10
|
-
function getRunCommandsExecutor() {
|
|
11
|
-
// `nx:run-commands` executor is supported from Nx 14.8.0+
|
|
12
|
-
const supportsNxRunCommands = utils_1.workspaceNxVersion.versionCode >= 140800;
|
|
13
|
-
return supportsNxRunCommands
|
|
14
|
-
? 'nx:run-commands'
|
|
15
|
-
: '@nx/workspace:run-commands';
|
|
16
|
-
}
|
|
17
|
-
function getFirebaseProject(options) {
|
|
18
|
-
if (options.project) {
|
|
19
|
-
return ` --project ${options.project}`;
|
|
20
|
-
}
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
function getFirebaseConfig(options) {
|
|
24
|
-
if (options.firebaseConfigName) {
|
|
25
|
-
return ` --config ${options.firebaseConfigName}`;
|
|
26
|
-
}
|
|
27
|
-
return '';
|
|
28
|
-
}
|
|
29
|
-
function getBuildTarget(project) {
|
|
30
|
-
return {
|
|
31
|
-
executor: '@simondotm/nx-firebase:build',
|
|
32
|
-
outputs: ['{options.outputPath}'],
|
|
33
|
-
options: {
|
|
34
|
-
outputPath: (0, devkit_1.joinPathFragments)('dist', project.root),
|
|
35
|
-
main: (0, devkit_1.joinPathFragments)(project.sourceRoot, 'index.ts'),
|
|
36
|
-
tsConfig: (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.app.json'),
|
|
37
|
-
packageJson: (0, devkit_1.joinPathFragments)(project.root, 'package.json'),
|
|
38
|
-
// no need to copy these assets anymore.
|
|
39
|
-
// .runtimeconfig.json cant be copied at build time because it is .gitignored and Nx also ignores it.
|
|
40
|
-
assets: [
|
|
41
|
-
// joinPathFragments(project.root, '*.md'),
|
|
42
|
-
// joinPathFragments(project.root, '.runtimeconfig.json'),
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
exports.getBuildTarget = getBuildTarget;
|
|
48
|
-
function getDeployTarget(options) {
|
|
49
|
-
return {
|
|
50
|
-
executor: getRunCommandsExecutor(),
|
|
51
|
-
options: {
|
|
52
|
-
command: `firebase deploy${getFirebaseConfig(options)}${getFirebaseProject(options)}`,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
exports.getDeployTarget = getDeployTarget;
|
|
57
|
-
function getConfigTarget(projectRoot, options) {
|
|
58
|
-
return {
|
|
59
|
-
executor: getRunCommandsExecutor(),
|
|
60
|
-
options: {
|
|
61
|
-
command: `firebase functions:config:get${getFirebaseConfig(options)}${getFirebaseProject(options)} > ${projectRoot}/.runtimeconfig.json`,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
exports.getConfigTarget = getConfigTarget;
|
|
66
|
-
function getEmulateTarget(options, project) {
|
|
67
|
-
return {
|
|
68
|
-
executor: getRunCommandsExecutor(),
|
|
69
|
-
options: {
|
|
70
|
-
commands: [
|
|
71
|
-
`node -e "setTimeout(()=>{},5000)"`,
|
|
72
|
-
`kill-port --port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500`,
|
|
73
|
-
`firebase functions:config:get ${getFirebaseConfig(options)}${getFirebaseProject(options)} > ${(0, devkit_1.joinPathFragments)('dist', project.root)}/.runtimeconfig.json`,
|
|
74
|
-
`firebase emulators:start ${getFirebaseConfig(options)}${getFirebaseProject(options)}`,
|
|
75
|
-
],
|
|
76
|
-
parallel: false,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
exports.getEmulateTarget = getEmulateTarget;
|
|
81
|
-
function getServeTarget(options) {
|
|
82
|
-
const workspaceSupportsNxWatch = utils_1.workspaceNxVersion.major >= 15 && utils_1.workspaceNxVersion.minor >= 4;
|
|
83
|
-
// From Nx 15.4.x+ we can use the new watch command which gives us the ability to rebuild the main project
|
|
84
|
-
// if any dependent libraries change.
|
|
85
|
-
// We have to do an initial build first to create the dist output, and then we watch for further changes, but with --clean, so that we dont delete the
|
|
86
|
-
// dist folder every build, because thats also being watched by the emulator.
|
|
87
|
-
// Otherwise, the only option is to just use `tsc --watch` which only detects changes to the main project.
|
|
88
|
-
const commands = workspaceSupportsNxWatch
|
|
89
|
-
? [
|
|
90
|
-
`nx run ${options.projectName}:build && nx watch --projects=${options.projectName} --includeDependentProjects -- nx build ${options.projectName} --clean=false`,
|
|
91
|
-
`nx run ${options.projectName}:emulate`,
|
|
92
|
-
]
|
|
93
|
-
: [
|
|
94
|
-
`nx run ${options.projectName}:build --watch`,
|
|
95
|
-
`nx run ${options.projectName}:emulate`,
|
|
96
|
-
];
|
|
97
|
-
return {
|
|
98
|
-
executor: getRunCommandsExecutor(),
|
|
99
|
-
options: {
|
|
100
|
-
commands,
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
exports.getServeTarget = getServeTarget;
|
|
105
|
-
function addProject(tree, options) {
|
|
106
|
-
const project = (0, devkit_2.readProjectConfiguration)(tree, options.projectName);
|
|
107
|
-
project.targets.build = getBuildTarget(project);
|
|
108
|
-
project.targets.deploy = getDeployTarget(options);
|
|
109
|
-
project.targets.getconfig = getConfigTarget(project.root, options);
|
|
110
|
-
project.targets.emulate = getEmulateTarget(options, project);
|
|
111
|
-
project.targets.serve = getServeTarget(options);
|
|
112
|
-
(0, devkit_2.updateProjectConfiguration)(tree, options.projectName, project);
|
|
113
|
-
}
|
|
114
|
-
exports.addProject = addProject;
|
|
115
|
-
//# sourceMappingURL=add-project.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/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"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import type { Schema as NodeApplicationGeneratorOptions } from '@nx/node/src/generators/application/schema';
|
|
3
|
-
import type { ApplicationGeneratorOptions, NormalizedOptions } from '../schema';
|
|
4
|
-
export declare function normalizeOptions(tree: Tree, options: ApplicationGeneratorOptions): NormalizedOptions;
|
|
5
|
-
export declare function toNodeApplicationGeneratorOptions(options: NormalizedOptions): NodeApplicationGeneratorOptions;
|