@simondotm/nx-firebase 1.1.0-beta.0 → 2.0.0-beta.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 +10 -10
- package/executors.json +0 -8
- package/generators.json +11 -0
- package/package.json +7 -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 +25 -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/{application → function}/lib/delete-files.d.ts +1 -1
- package/src/generators/{application → function}/lib/delete-files.js +1 -1
- 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.js +1 -5
- 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 +167 -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/update-tsconfig.d.ts +8 -0
- 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/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.d.ts +0 -9
- 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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Tree, ProjectConfiguration } from '@nx/devkit';
|
|
2
|
+
export interface FirebaseFunction {
|
|
3
|
+
predeploy?: string[];
|
|
4
|
+
source: string;
|
|
5
|
+
codebase: string;
|
|
6
|
+
runtime: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FirebaseConfig {
|
|
9
|
+
database: {
|
|
10
|
+
rules: string;
|
|
11
|
+
};
|
|
12
|
+
firestore: {
|
|
13
|
+
rules: string;
|
|
14
|
+
indexes: string;
|
|
15
|
+
};
|
|
16
|
+
hosting: {
|
|
17
|
+
target: string;
|
|
18
|
+
public: string;
|
|
19
|
+
ignore: string[];
|
|
20
|
+
rewrites: {
|
|
21
|
+
source: string;
|
|
22
|
+
destination: string;
|
|
23
|
+
}[];
|
|
24
|
+
headers: [
|
|
25
|
+
{
|
|
26
|
+
source: string;
|
|
27
|
+
headers: {
|
|
28
|
+
key: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
}[];
|
|
34
|
+
storage: {
|
|
35
|
+
rules: string;
|
|
36
|
+
};
|
|
37
|
+
functions: FirebaseFunction | FirebaseFunction[];
|
|
38
|
+
emulators: {
|
|
39
|
+
functions: {
|
|
40
|
+
port: number;
|
|
41
|
+
};
|
|
42
|
+
firestore: {
|
|
43
|
+
port: number;
|
|
44
|
+
};
|
|
45
|
+
hosting: {
|
|
46
|
+
port: number;
|
|
47
|
+
};
|
|
48
|
+
auth: {
|
|
49
|
+
port: number;
|
|
50
|
+
};
|
|
51
|
+
pubsub: {
|
|
52
|
+
port: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Return the config file from the provided firebase target command
|
|
58
|
+
* This can be used to parse commands in additional configurations
|
|
59
|
+
* @param project
|
|
60
|
+
* @param command
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
export declare function getFirebaseConfigFromCommand(tree: Tree, project: ProjectConfiguration, command: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Return the config file used by the `firebase` target command of the provided firebase app project
|
|
66
|
+
* @param command
|
|
67
|
+
* @param project
|
|
68
|
+
* @param firebaseConfigs
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
export declare function getFirebaseConfigFromProject(tree: Tree, project: ProjectConfiguration): string;
|
|
72
|
+
/**
|
|
73
|
+
* Modify the config file used by the `firebase` target command of the provided firebase app project
|
|
74
|
+
* @param project
|
|
75
|
+
* @param configFileName
|
|
76
|
+
*/
|
|
77
|
+
export declare function setFirebaseConfigFromCommand(project: ProjectConfiguration, configFileName: string): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setFirebaseConfigFromCommand = exports.getFirebaseConfigFromProject = exports.getFirebaseConfigFromCommand = void 0;
|
|
4
|
+
const FIREBASE_TARGET_CONFIG_MATCHER = /(--config[ =])([^\s]+)/;
|
|
5
|
+
/**
|
|
6
|
+
* Return the config file from the provided firebase target command
|
|
7
|
+
* This can be used to parse commands in additional configurations
|
|
8
|
+
* @param project
|
|
9
|
+
* @param command
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
function getFirebaseConfigFromCommand(tree, project, command) {
|
|
13
|
+
const match = command.match(FIREBASE_TARGET_CONFIG_MATCHER);
|
|
14
|
+
if (match && match.length === 3) {
|
|
15
|
+
const configName = match[2];
|
|
16
|
+
// check the config we've parsed actually resolves to a firebase config file in the workspace
|
|
17
|
+
if (!tree.exists(configName)) {
|
|
18
|
+
throw new Error(`Firebase app project ${project.name} is using a firebase config file ${configName} that does not exist in the workspace.`);
|
|
19
|
+
}
|
|
20
|
+
return configName;
|
|
21
|
+
}
|
|
22
|
+
throw new Error(`Firebase app project ${project.name} does not have --config set in its 'firebase' target.`);
|
|
23
|
+
}
|
|
24
|
+
exports.getFirebaseConfigFromCommand = getFirebaseConfigFromCommand;
|
|
25
|
+
/**
|
|
26
|
+
* Return the config file used by the `firebase` target command of the provided firebase app project
|
|
27
|
+
* @param command
|
|
28
|
+
* @param project
|
|
29
|
+
* @param firebaseConfigs
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
function getFirebaseConfigFromProject(tree, project) {
|
|
33
|
+
return getFirebaseConfigFromCommand(tree, project, project.targets.firebase.options.command);
|
|
34
|
+
}
|
|
35
|
+
exports.getFirebaseConfigFromProject = getFirebaseConfigFromProject;
|
|
36
|
+
/**
|
|
37
|
+
* Modify the config file used by the `firebase` target command of the provided firebase app project
|
|
38
|
+
* @param project
|
|
39
|
+
* @param configFileName
|
|
40
|
+
*/
|
|
41
|
+
function setFirebaseConfigFromCommand(project, configFileName) {
|
|
42
|
+
// we've already checked that firebase target exists when setting up workspace
|
|
43
|
+
const firebaseTarget = project.targets.firebase;
|
|
44
|
+
firebaseTarget.options.command = firebaseTarget.options.command.replace(FIREBASE_TARGET_CONFIG_MATCHER, '$1' + configFileName);
|
|
45
|
+
// do this for all other configurations on this target too
|
|
46
|
+
const configurations = firebaseTarget.configurations;
|
|
47
|
+
for (const configuration in configurations) {
|
|
48
|
+
configurations[configuration].command = configurations[configuration].command.replace(FIREBASE_TARGET_CONFIG_MATCHER, '$1' + configFileName);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.setFirebaseConfigFromCommand = setFirebaseConfigFromCommand;
|
|
52
|
+
//# sourceMappingURL=firebase-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebase-config.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/firebase-config.ts"],"names":[],"mappings":";;;AAEA,MAAM,8BAA8B,GAAG,wBAAwB,CAAA;AA0D/D;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAC1C,IAAU,EACV,OAA6B,EAC7B,OAAe;IAEf,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;IAC3D,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAC3B,6FAA6F;QAC7F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CACb,wBAAwB,OAAO,CAAC,IAAI,oCAAoC,UAAU,wCAAwC,CAC3H,CAAA;SACF;QACD,OAAO,UAAU,CAAA;KAClB;IACD,MAAM,IAAI,KAAK,CACb,wBAAwB,OAAO,CAAC,IAAI,uDAAuD,CAC5F,CAAA;AACH,CAAC;AAnBD,oEAmBC;AAED;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAC1C,IAAU,EACV,OAA6B;IAE7B,OAAO,4BAA4B,CACjC,IAAI,EACJ,OAAO,EACP,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CACzC,CAAA;AACH,CAAC;AATD,oEASC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,OAA6B,EAC7B,cAAsB;IAEtB,8EAA8E;IAC9E,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAA;IAC/C,cAAc,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CACrE,8BAA8B,EAC9B,IAAI,GAAG,cAAc,CACtB,CAAA;IACD,0DAA0D;IAC1D,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAA;IACpD,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE;QAC1C,cAAc,CAAC,aAAa,CAAC,CAAC,OAAO,GAAG,cAAc,CACpD,aAAa,CACd,CAAC,OAAO,CAAC,OAAO,CAAC,8BAA8B,EAAE,IAAI,GAAG,cAAc,CAAC,CAAA;KACzE;AACH,CAAC;AAjBD,oEAiBC"}
|
package/src/utils/index.d.ts
CHANGED
package/src/utils/index.js
CHANGED
|
@@ -4,4 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./types"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./versions"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./workspace"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./update-tsconfig"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./project-name"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./firebase-config"), exports);
|
|
7
10
|
//# sourceMappingURL=index.js.map
|
package/src/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAuB;AACvB,qDAA0B;AAC1B,sDAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/index.ts"],"names":[],"mappings":";;;AAAA,kDAAuB;AACvB,qDAA0B;AAC1B,sDAA2B;AAC3B,4DAAiC;AACjC,yDAA8B;AAC9B,4DAAiC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectName = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function getProjectName(tree, name, directory) {
|
|
6
|
+
// console.log(`name ${name}`)
|
|
7
|
+
// console.log(`directory ${directory}`)
|
|
8
|
+
const { layoutDirectory, projectDirectory } = (0, devkit_1.extractLayoutDirectory)(directory);
|
|
9
|
+
// console.log(`layoutDirectory ${layoutDirectory}`)
|
|
10
|
+
// console.log(`projectDirectory ${projectDirectory}`)
|
|
11
|
+
const appsDir = layoutDirectory !== null && layoutDirectory !== void 0 ? layoutDirectory : (0, devkit_1.getWorkspaceLayout)(tree).appsDir;
|
|
12
|
+
// console.log(`appsDir ${appsDir}`)
|
|
13
|
+
const appDirectory = projectDirectory
|
|
14
|
+
? `${(0, devkit_1.names)(projectDirectory).fileName}/${(0, devkit_1.names)(name).fileName}`
|
|
15
|
+
: (0, devkit_1.names)(name).fileName;
|
|
16
|
+
// console.log(`appDirectory ${appDirectory}`)
|
|
17
|
+
const appProjectName = appDirectory.replace(new RegExp('/', 'g'), '-');
|
|
18
|
+
// console.log(`appProjectName ${appProjectName}`)
|
|
19
|
+
const appProjectRoot = (0, devkit_1.joinPathFragments)(appsDir, appDirectory);
|
|
20
|
+
// console.log(`appProjectRoot ${appProjectRoot}`)
|
|
21
|
+
// // see https://github.com/nrwl/nx/blob/84cbcb7e105cd2b3bf5b3d84a519e5c52951e0f3/packages/js/src/generators/library/library.ts#L332
|
|
22
|
+
// // for how the project name is derived from options.name and --directory
|
|
23
|
+
// const fileName = names(name).fileName
|
|
24
|
+
// const projectDirectory = directory
|
|
25
|
+
// ? `${names(directory).fileName}/${fileName}`
|
|
26
|
+
// : name
|
|
27
|
+
// const projectRoot = joinPathFragments(
|
|
28
|
+
// getWorkspaceLayout(tree).appsDir,
|
|
29
|
+
// projectDirectory,
|
|
30
|
+
// )
|
|
31
|
+
// const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-')
|
|
32
|
+
return {
|
|
33
|
+
projectRoot: appProjectRoot,
|
|
34
|
+
projectName: appProjectName,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
exports.getProjectName = getProjectName;
|
|
38
|
+
//# sourceMappingURL=project-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-name.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/project-name.ts"],"names":[],"mappings":";;;AAAA,yCAMqB;AAErB,SAAgB,cAAc,CAAC,IAAU,EAAE,IAAY,EAAE,SAAkB;IACzE,8BAA8B;IAC9B,wCAAwC;IAExC,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,GACzC,IAAA,+BAAsB,EAAC,SAAS,CAAC,CAAA;IAEnC,oDAAoD;IACpD,sDAAsD;IAEtD,MAAM,OAAO,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC,OAAO,CAAA;IAEnE,oCAAoC;IAEpC,MAAM,YAAY,GAAG,gBAAgB;QACnC,CAAC,CAAC,GAAG,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC,QAAQ,IAAI,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAC/D,CAAC,CAAC,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC,QAAQ,CAAA;IAExB,8CAA8C;IAE9C,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;IAEtE,kDAAkD;IAElD,MAAM,cAAc,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAE/D,kDAAkD;IAElD,qIAAqI;IACrI,2EAA2E;IAC3E,wCAAwC;IACxC,qCAAqC;IACrC,iDAAiD;IACjD,WAAW;IAEX,yCAAyC;IACzC,sCAAsC;IACtC,sBAAsB;IACtB,IAAI;IAEJ,0EAA0E;IAC1E,OAAO;QACL,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,cAAc;KAC5B,CAAA;AACH,CAAC;AA7CD,wCA6CC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Tree } from '@nrwl/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* With firebase cli > 10.0.1 now compatible with node versions >=14 we can use es modules rather than commonjs
|
|
4
|
+
*
|
|
5
|
+
* @param tree
|
|
6
|
+
* @param options
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateTsConfig(tree: Tree, projectRoot: string, runTime: string, format: 'esm' | 'cjs'): void;
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateTsConfig = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const versions_1 = require("./versions");
|
|
6
6
|
/**
|
|
7
7
|
* With firebase cli > 10.0.1 now compatible with node versions >=14 we can use es modules rather than commonjs
|
|
8
8
|
*
|
|
9
9
|
* @param tree
|
|
10
10
|
* @param options
|
|
11
11
|
*/
|
|
12
|
-
function updateTsConfig(tree,
|
|
13
|
-
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(
|
|
14
|
-
json.compilerOptions.
|
|
15
|
-
json.compilerOptions.
|
|
12
|
+
function updateTsConfig(tree, projectRoot, runTime, format) {
|
|
13
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.app.json'), (json) => {
|
|
14
|
+
json.compilerOptions.target = versions_1.nodeEsVersion[runTime];
|
|
15
|
+
json.compilerOptions.module = format === 'esm' ? 'es2020' : 'commonjs';
|
|
16
16
|
return json;
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-tsconfig.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/update-tsconfig.ts"],"names":[],"mappings":";;;AACA,uCAA0D;AAC1D,yCAA0C;AAE1C;;;;;GAKG;AACH,SAAgB,cAAc,CAC5B,IAAU,EACV,WAAmB,EACnB,OAAe,EACf,MAAqB;IAErB,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,WAAW,EAAE,mBAAmB,CAAC,EACnD,CAAC,IAAI,EAAE,EAAE;QACP,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,wBAAa,CAAC,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAA;QACtE,OAAO,IAAI,CAAA;IACb,CAAC,CACF,CAAA;AACH,CAAC;AAfD,wCAeC"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export declare const firebaseVersion = "^9.14.0";
|
|
|
8
8
|
export declare const firebaseFunctionsTestVersion = "^0.2.0";
|
|
9
9
|
export declare const firebaseNodeEngine = "16";
|
|
10
10
|
export declare const firebaseNodeRuntime: string;
|
|
11
|
+
export declare const nodeEsVersion: Record<string, string>;
|
|
11
12
|
export declare const tsConfigTarget: string;
|
|
12
13
|
export declare const killportVersion = "^2.0.1";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.killportVersion = exports.tsConfigTarget = exports.firebaseNodeRuntime = exports.firebaseNodeEngine = exports.firebaseFunctionsTestVersion = exports.firebaseVersion = exports.firebaseToolsVersion = exports.firebaseFunctionsVersion = exports.firebaseAdminVersion = exports.tsLibVersion = exports.pluginNxVersionMajor = exports.pluginNxVersion = void 0;
|
|
3
|
+
exports.killportVersion = exports.tsConfigTarget = exports.nodeEsVersion = exports.firebaseNodeRuntime = exports.firebaseNodeEngine = exports.firebaseFunctionsTestVersion = exports.firebaseVersion = exports.firebaseToolsVersion = exports.firebaseFunctionsVersion = exports.firebaseAdminVersion = exports.tsLibVersion = exports.pluginNxVersionMajor = exports.pluginNxVersion = void 0;
|
|
4
4
|
// Declare target version of Nx that the plugin is currently compatible with
|
|
5
5
|
exports.pluginNxVersion = '^16.1.1';
|
|
6
6
|
exports.pluginNxVersionMajor = 16;
|
|
@@ -17,13 +17,14 @@ exports.firebaseFunctionsTestVersion = '^0.2.0';
|
|
|
17
17
|
exports.firebaseNodeEngine = '16';
|
|
18
18
|
exports.firebaseNodeRuntime = `nodejs${exports.firebaseNodeEngine}`;
|
|
19
19
|
// https://stackoverflow.com/questions/59787574/typescript-tsconfig-settings-for-node-js-12
|
|
20
|
-
|
|
20
|
+
exports.nodeEsVersion = {
|
|
21
21
|
'12': 'es2019',
|
|
22
22
|
'14': 'es2020',
|
|
23
|
-
'16': '
|
|
23
|
+
'16': 'es2020',
|
|
24
24
|
'18': 'es2022',
|
|
25
|
+
'20': 'es2022',
|
|
25
26
|
};
|
|
26
|
-
exports.tsConfigTarget =
|
|
27
|
+
exports.tsConfigTarget = exports.nodeEsVersion[exports.firebaseNodeEngine];
|
|
27
28
|
if (!exports.tsConfigTarget) {
|
|
28
29
|
throw new Error('Undefined tsConfigTarget');
|
|
29
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/versions.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AAC/D,QAAA,eAAe,GAAG,SAAS,CAAA;AAC3B,QAAA,oBAAoB,GAAG,EAAE,CAAA;AAEtC,6CAA6C;AAChC,QAAA,YAAY,GAAG,QAAQ,CAAA;AAEpC,kDAAkD;AAClD,mEAAmE;AACtD,QAAA,oBAAoB,GAAG,SAAS,CAAA;AAChC,QAAA,wBAAwB,GAAG,QAAQ,CAAA;AACnC,QAAA,oBAAoB,GAAG,UAAU,CAAA;AACjC,QAAA,eAAe,GAAG,SAAS,CAAA;AAC3B,QAAA,4BAA4B,GAAG,QAAQ,CAAA;AAEpD,+CAA+C;AAClC,QAAA,kBAAkB,GAAG,IAAI,CAAA;AACzB,QAAA,mBAAmB,GAAG,SAAS,0BAAkB,EAAE,CAAA;AAEhE,2FAA2F;
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/versions.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AAC/D,QAAA,eAAe,GAAG,SAAS,CAAA;AAC3B,QAAA,oBAAoB,GAAG,EAAE,CAAA;AAEtC,6CAA6C;AAChC,QAAA,YAAY,GAAG,QAAQ,CAAA;AAEpC,kDAAkD;AAClD,mEAAmE;AACtD,QAAA,oBAAoB,GAAG,SAAS,CAAA;AAChC,QAAA,wBAAwB,GAAG,QAAQ,CAAA;AACnC,QAAA,oBAAoB,GAAG,UAAU,CAAA;AACjC,QAAA,eAAe,GAAG,SAAS,CAAA;AAC3B,QAAA,4BAA4B,GAAG,QAAQ,CAAA;AAEpD,+CAA+C;AAClC,QAAA,kBAAkB,GAAG,IAAI,CAAA;AACzB,QAAA,mBAAmB,GAAG,SAAS,0BAAkB,EAAE,CAAA;AAEhE,2FAA2F;AAE9E,QAAA,aAAa,GAA2B;IACnD,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,cAAc,GAAG,qBAAa,CAAC,0BAAkB,CAAC,CAAA;AAE/D,IAAI,CAAC,sBAAc,EAAE;IACnB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;CAC5C;AAED,iDAAiD;AACpC,QAAA,eAAe,GAAG,QAAQ,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import type { ExecutorOptions } from '@nx/js/src/utils/schema';
|
|
3
|
-
/**
|
|
4
|
-
* @simondotm/nx-firebase:build executor is a
|
|
5
|
-
* customized version of @nx/js:tsc executor
|
|
6
|
-
*/
|
|
7
|
-
export declare function runExecutor(options: ExecutorOptions, context: ExecutorContext): AsyncGenerator<import("@nx/js/src/utils/typescript/compile-typescript-files").TypescriptCompilationResult, void, unknown>;
|
|
8
|
-
export default runExecutor;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runExecutor = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// import '../../utils/e2ePatch' // intentional side effects
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const tsc_impl_1 = require("@nx/js/src/executors/tsc/tsc.impl");
|
|
8
|
-
const lib_1 = require("./lib");
|
|
9
|
-
const utils_1 = require("../../utils");
|
|
10
|
-
/**
|
|
11
|
-
* @simondotm/nx-firebase:build executor is a
|
|
12
|
-
* customized version of @nx/js:tsc executor
|
|
13
|
-
*/
|
|
14
|
-
function runExecutor(options, context) {
|
|
15
|
-
return tslib_1.__asyncGenerator(this, arguments, function* runExecutor_1() {
|
|
16
|
-
var _a, e_1, _b, _c;
|
|
17
|
-
(0, utils_1.checkNxVersion)();
|
|
18
|
-
if (process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
19
|
-
devkit_1.logger.warn(`WARNING: @simondotm/nx-firebase plugin is located outside this workspace, NX_WORKSPACE_ROOT_PATH has been set to ${process.env.NX_WORKSPACE_ROOT_PATH}`);
|
|
20
|
-
}
|
|
21
|
-
/*
|
|
22
|
-
// --updateBuildableProjectDepsInPackageJson is true by default for @nx/js:tsc
|
|
23
|
-
// https://nx.dev/packages/js/executors/tsc
|
|
24
|
-
// but we havent programmed our executor schema to match yet, so hack them in here.
|
|
25
|
-
const customOptions: ExecutorOptions = {
|
|
26
|
-
...options,
|
|
27
|
-
updateBuildableProjectDepsInPackageJson: true,
|
|
28
|
-
clean: true,
|
|
29
|
-
}
|
|
30
|
-
*/
|
|
31
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
32
|
-
devkit_1.logger.info(`options=${JSON.stringify(options, null, 3)}`);
|
|
33
|
-
}
|
|
34
|
-
// console.log(`NX_WORKSPACE_ROOT_PATH=${process.env.NX_WORKSPACE_ROOT_PATH}`)
|
|
35
|
-
// logger.info(`process.env.CI=${process.env.CI}`)
|
|
36
|
-
// logger.info(`process.env.NX_DAEMON=${process.env.CI}`)
|
|
37
|
-
// // SM: recompute the project graph on every iteration so that --watch will work,
|
|
38
|
-
// // since the context.projectGraph is only a snapshot
|
|
39
|
-
if (options.watch) {
|
|
40
|
-
// const projectGraph = await createProjectGraphAsync()
|
|
41
|
-
yield tslib_1.__await((0, devkit_1.createProjectGraphAsync)()
|
|
42
|
-
// logger.info(JSON.stringify(graph, null, 3))
|
|
43
|
-
);
|
|
44
|
-
// logger.info(JSON.stringify(graph, null, 3))
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
// iterate the tscExecutor generator until it completes
|
|
48
|
-
// this approach allows us to add a custom post-compile process.
|
|
49
|
-
//
|
|
50
|
-
// with --watch enabled, this loop will run until the process terminates
|
|
51
|
-
// https://github.com/nrwl/nx/blob/8bfc0b5527e3ea3acd14e4a11254505f02046d98/packages/js/src/executors/tsc/tsc.impl.ts#L176
|
|
52
|
-
for (var _d = true, _e = tslib_1.__asyncValues((0, tsc_impl_1.tscExecutor)(options, context)), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a;) {
|
|
53
|
-
_c = _f.value;
|
|
54
|
-
_d = false;
|
|
55
|
-
try {
|
|
56
|
-
const output = _c;
|
|
57
|
-
// logger.info(output)
|
|
58
|
-
if (output.success) {
|
|
59
|
-
// Post-process Firebase Functions dependencies if compilation succeeded
|
|
60
|
-
yield tslib_1.__await((0, lib_1.firebaseBuildExecutor)(context, options.outputPath));
|
|
61
|
-
}
|
|
62
|
-
yield yield tslib_1.__await(output);
|
|
63
|
-
}
|
|
64
|
-
finally {
|
|
65
|
-
_d = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
70
|
-
finally {
|
|
71
|
-
try {
|
|
72
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
|
73
|
-
}
|
|
74
|
-
finally { if (e_1) throw e_1.error; }
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
exports.runExecutor = runExecutor;
|
|
79
|
-
//SM: no idea what this shenanigans is for
|
|
80
|
-
//export default convertNxExecutor(runExecutor);
|
|
81
|
-
exports.default = runExecutor;
|
|
82
|
-
//# sourceMappingURL=build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../../../packages/nx-firebase/src/executors/build/build.ts"],"names":[],"mappings":";;;;AAAA,4DAA4D;AAC5D,uCAA6E;AAE7E,gEAA+D;AAC/D,+BAA6C;AAC7C,uCAA4C;AAE5C;;;GAGG;AACH,SAAuB,WAAW,CAChC,OAAwB,EACxB,OAAwB;;;QAExB,IAAA,sBAAc,GAAE,CAAA;QAEhB,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE;YACtC,eAAM,CAAC,IAAI,CACT,oHAAoH,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CACzJ,CAAA;SACF;QAED;;;;;;;;;UASE;QACF,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;YAClC,eAAM,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;SAC3D;QAED,8EAA8E;QAE9E,kDAAkD;QAClD,yDAAyD;QAEzD,mFAAmF;QACnF,wDAAwD;QACxD,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,uDAAuD;YACvD,sBAAM,IAAA,gCAAuB,GAAE;YAC/B,8CAA8C;aADf,CAAA;YAC/B,8CAA8C;SAC/C;;YAED,uDAAuD;YACvD,gEAAgE;YAChE,EAAE;YACF,wEAAwE;YACxE,0HAA0H;YAC1H,KAA2B,eAAA,KAAA,sBAAA,IAAA,sBAAW,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA,IAAA;gBAA7B,cAA6B;gBAA7B,WAA6B;;oBAA7C,MAAM,MAAM,KAAA,CAAA;oBACrB,sBAAsB;oBACtB,IAAI,MAAM,CAAC,OAAO,EAAE;wBAClB,wEAAwE;wBACxE,sBAAM,IAAA,2BAAqB,EAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA,CAAA;qBACzD;oBACD,4BAAM,MAAM,CAAA,CAAA;;;;;aACb;;;;;;;;;IACH,CAAC;CAAA;AApDD,kCAoDC;AAED,0CAA0C;AAC1C,gDAAgD;AAChD,kBAAe,WAAW,CAAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { DependentBuildableProjectNode } from '@nx/workspace/src/utilities/buildable-libs-utils';
|
|
2
|
-
export declare const FIREBASE_DEPS_DIR = "libs";
|
|
3
|
-
export declare function copyFirebaseDependencies(outputPath: string, workspaceRoot: string, projectDependencies: DependentBuildableProjectNode[]): Promise<Record<string, DependentBuildableProjectNode>>;
|
|
@@ -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;
|