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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +14 -27
  2. package/executors.json +0 -8
  3. package/generators.json +11 -0
  4. package/package.json +5 -4
  5. package/src/generators/application/application.d.ts +3 -3
  6. package/src/generators/application/application.js +119 -19
  7. package/src/generators/application/application.js.map +1 -1
  8. package/src/generators/application/files/readme.md__tmpl__ +12 -9
  9. package/src/generators/application/files_firebase/firebase.json__tmpl__ +6 -13
  10. package/src/generators/application/files_workspace/{firebase.__name__.json__tmpl__ → firebase.__projectName__.json__tmpl__} +6 -13
  11. package/src/generators/application/lib/create-files.js +10 -25
  12. package/src/generators/application/lib/create-files.js.map +1 -1
  13. package/src/generators/application/lib/index.d.ts +0 -3
  14. package/src/generators/application/lib/index.js +0 -3
  15. package/src/generators/application/lib/index.js.map +1 -1
  16. package/src/generators/application/schema.d.ts +3 -11
  17. package/src/generators/application/schema.json +0 -41
  18. package/src/generators/function/files/package.json__tmpl__ +19 -0
  19. package/src/generators/function/files/readme.md__tmpl__ +31 -0
  20. package/src/generators/function/function.d.ts +14 -0
  21. package/src/generators/function/function.js +77 -0
  22. package/src/generators/function/function.js.map +1 -0
  23. package/src/generators/function/lib/add-function.d.ts +3 -0
  24. package/src/generators/function/lib/add-function.js +29 -0
  25. package/src/generators/function/lib/add-function.js.map +1 -0
  26. package/src/generators/function/lib/create-files.d.ts +9 -0
  27. package/src/generators/function/lib/create-files.js +37 -0
  28. package/src/generators/function/lib/create-files.js.map +1 -0
  29. package/src/generators/function/lib/delete-files.js.map +1 -0
  30. package/src/generators/function/lib/index.d.ts +3 -0
  31. package/src/generators/function/lib/index.js +7 -0
  32. package/src/generators/function/lib/index.js.map +1 -0
  33. package/src/generators/function/lib/update-project.d.ts +3 -0
  34. package/src/generators/function/lib/update-project.js +52 -0
  35. package/src/generators/function/lib/update-project.js.map +1 -0
  36. package/src/generators/function/schema.d.ts +51 -0
  37. package/src/generators/function/schema.json +57 -0
  38. package/src/generators/init/init.d.ts +1 -1
  39. package/src/generators/init/init.js +2 -6
  40. package/src/generators/init/init.js.map +1 -1
  41. package/src/generators/init/lib/add-dependencies.js +3 -4
  42. package/src/generators/init/lib/add-dependencies.js.map +1 -1
  43. package/src/generators/init/lib/add-git-ignore-entry.d.ts +1 -1
  44. package/src/generators/init/lib/add-git-ignore-entry.js +1 -0
  45. package/src/generators/init/lib/add-git-ignore-entry.js.map +1 -1
  46. package/src/generators/init/schema.d.ts +4 -4
  47. package/src/generators/init/schema.json +8 -7
  48. package/src/generators/sync/lib/firebase-changes.d.ts +3 -0
  49. package/src/generators/sync/lib/firebase-changes.js +102 -0
  50. package/src/generators/sync/lib/firebase-changes.js.map +1 -0
  51. package/src/generators/sync/lib/firebase-configs.d.ts +3 -0
  52. package/src/generators/sync/lib/firebase-configs.js +61 -0
  53. package/src/generators/sync/lib/firebase-configs.js.map +1 -0
  54. package/src/generators/sync/lib/firebase-projects.d.ts +20 -0
  55. package/src/generators/sync/lib/firebase-projects.js +75 -0
  56. package/src/generators/sync/lib/firebase-projects.js.map +1 -0
  57. package/src/generators/sync/lib/firebase-workspace.d.ts +3 -0
  58. package/src/generators/sync/lib/firebase-workspace.js +15 -0
  59. package/src/generators/sync/lib/firebase-workspace.js.map +1 -0
  60. package/src/generators/sync/lib/index.d.ts +7 -0
  61. package/src/generators/sync/lib/index.js +11 -0
  62. package/src/generators/sync/lib/index.js.map +1 -0
  63. package/src/generators/sync/lib/tags.d.ts +14 -0
  64. package/src/generators/sync/lib/tags.js +43 -0
  65. package/src/generators/sync/lib/tags.js.map +1 -0
  66. package/src/generators/sync/lib/types.d.ts +46 -0
  67. package/src/generators/sync/lib/types.js +5 -0
  68. package/src/generators/sync/lib/types.js.map +1 -0
  69. package/src/generators/sync/schema.d.ts +5 -0
  70. package/src/generators/sync/schema.json +19 -0
  71. package/src/generators/sync/sync.d.ts +8 -0
  72. package/src/generators/sync/sync.js +170 -0
  73. package/src/generators/sync/sync.js.map +1 -0
  74. package/src/utils/debug.d.ts +4 -0
  75. package/src/utils/debug.js +25 -0
  76. package/src/utils/debug.js.map +1 -0
  77. package/src/utils/firebase-config.d.ts +77 -0
  78. package/src/utils/firebase-config.js +52 -0
  79. package/src/utils/firebase-config.js.map +1 -0
  80. package/src/utils/index.d.ts +3 -0
  81. package/src/utils/index.js +3 -0
  82. package/src/utils/index.js.map +1 -1
  83. package/src/utils/project-name.d.ts +5 -0
  84. package/src/utils/project-name.js +38 -0
  85. package/src/utils/project-name.js.map +1 -0
  86. package/src/utils/types.d.ts +1 -1
  87. package/src/{generators/application/lib → utils}/update-tsconfig.d.ts +1 -2
  88. package/src/{generators/application/lib → utils}/update-tsconfig.js +5 -5
  89. package/src/utils/update-tsconfig.js.map +1 -0
  90. package/src/utils/versions.d.ts +1 -0
  91. package/src/utils/versions.js +5 -4
  92. package/src/utils/versions.js.map +1 -1
  93. package/src/utils/workspace.d.ts +1 -1
  94. package/src/executors/build/build.d.ts +0 -8
  95. package/src/executors/build/build.js +0 -82
  96. package/src/executors/build/build.js.map +0 -1
  97. package/src/executors/build/lib/copy-dependencies.d.ts +0 -3
  98. package/src/executors/build/lib/copy-dependencies.js +0 -53
  99. package/src/executors/build/lib/copy-dependencies.js.map +0 -1
  100. package/src/executors/build/lib/firebase-build.d.ts +0 -2
  101. package/src/executors/build/lib/firebase-build.js +0 -16
  102. package/src/executors/build/lib/firebase-build.js.map +0 -1
  103. package/src/executors/build/lib/get-dependencies.d.ts +0 -8
  104. package/src/executors/build/lib/get-dependencies.js +0 -87
  105. package/src/executors/build/lib/get-dependencies.js.map +0 -1
  106. package/src/executors/build/lib/index.d.ts +0 -1
  107. package/src/executors/build/lib/index.js +0 -5
  108. package/src/executors/build/lib/index.js.map +0 -1
  109. package/src/executors/build/lib/rewrite-package.d.ts +0 -8
  110. package/src/executors/build/lib/rewrite-package.js +0 -44
  111. package/src/executors/build/lib/rewrite-package.js.map +0 -1
  112. package/src/executors/build/schema.d.ts +0 -1
  113. package/src/executors/build/schema.json +0 -167
  114. package/src/generators/application/files/package.json__tmpl__ +0 -21
  115. package/src/generators/application/lib/add-project.d.ts +0 -39
  116. package/src/generators/application/lib/add-project.js +0 -115
  117. package/src/generators/application/lib/add-project.js.map +0 -1
  118. package/src/generators/application/lib/delete-files.js.map +0 -1
  119. package/src/generators/application/lib/normalize-options.d.ts +0 -5
  120. package/src/generators/application/lib/normalize-options.js +0 -44
  121. package/src/generators/application/lib/normalize-options.js.map +0 -1
  122. package/src/generators/application/lib/update-tsconfig.js.map +0 -1
  123. package/src/utils/e2ePatch.d.ts +0 -2
  124. package/src/utils/e2ePatch.js +0 -135
  125. package/src/utils/e2ePatch.js.map +0 -1
  126. /package/src/generators/{application/files/src/index.ts__tmpl__ → function/files/src/main.ts__tmpl__} +0 -0
  127. /package/src/generators/{application → function}/lib/delete-files.d.ts +0 -0
  128. /package/src/generators/{application → function}/lib/delete-files.js +0 -0
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFirebaseChanges = void 0;
4
+ const debug_1 = require("../../../utils/debug");
5
+ const tags_1 = require("./tags");
6
+ /**
7
+ * Check if the given firebase project has been renamed by checking its `firebase:name` tag
8
+ * @param project - Firebase project to be checked
9
+ * @returns the previous project name if renamed, otherwise undefined/falsy
10
+ */
11
+ function isRenamed(project) {
12
+ const { tagValue } = (0, tags_1.getFirebaseScopeFromTag)(project, 'firebase:name');
13
+ (0, debug_1.debugInfo)(`- checking if project ${project.name} is renamed, will be different to ${tagValue}`);
14
+ if (tagValue !== project.name) {
15
+ (0, debug_1.debugInfo)(`- firebase project ${tagValue} has been renamed to ${project.name} `);
16
+ return tagValue;
17
+ }
18
+ return undefined;
19
+ }
20
+ function getFirebaseChanges(tree, projects, configs) {
21
+ // map of project name -> deletion status
22
+ const deletedApps = new Map();
23
+ const deletedFunctions = new Map();
24
+ // map of previous name -> new name
25
+ const renamedApps = new Map();
26
+ const renamedFunctions = new Map();
27
+ // 1. determine renamed apps using the firebase:name tag
28
+ function checkRenamedProject(project, renamedCollection) {
29
+ const renamedProject = isRenamed(project);
30
+ if (renamedProject) {
31
+ (0, debug_1.debugInfo)(`- ${renamedProject} has been renamed to ${project.name} `);
32
+ renamedCollection.set(renamedProject, project);
33
+ }
34
+ }
35
+ (0, debug_1.debugInfo)(`- checking for renamed apps & functions`);
36
+ projects.firebaseAppProjects.forEach((project) => checkRenamedProject(project, renamedApps));
37
+ projects.firebaseFunctionProjects.forEach((project) => checkRenamedProject(project, renamedFunctions));
38
+ // 2. determine deleted functions
39
+ // do this either by detecting a dependency
40
+ (0, debug_1.debugInfo)(`- checking apps for deleted function deps`);
41
+ projects.firebaseAppProjects.forEach((firebaseAppProject, firebaseAppProjectName) => {
42
+ var _a;
43
+ // check the implicitDependencies for each app first
44
+ (_a = firebaseAppProject.implicitDependencies) === null || _a === void 0 ? void 0 : _a.map((dep) => {
45
+ if (!projects.firebaseFunctionProjects.has(dep) &&
46
+ !renamedFunctions.has(dep)) {
47
+ (0, debug_1.debugInfo)(`- function ${dep} is a dep, but cannot be located so function is deleted`);
48
+ deletedFunctions.set(dep, true);
49
+ }
50
+ });
51
+ // functions may also be removed using nx g rm <function> --forceRemove
52
+ // which removes the implicitDep from the app, but doesnt update the firebase config
53
+ // so we need to check the firebase config too, and determine any projects that are in there
54
+ // but not in the workspace and mark them as deleted
55
+ const firebaseConfigName = configs.firebaseAppConfigs.get(firebaseAppProjectName);
56
+ (0, debug_1.debugInfo)(`- checking config ${firebaseConfigName} to see if it contains a function that doesnt exist`);
57
+ const config = configs.firebaseConfigs.get(firebaseConfigName);
58
+ if (!config) {
59
+ throw new Error(`Could not get firebase config '${firebaseConfigName}'`);
60
+ }
61
+ // ensure config functions is always an array, even if only 1 function
62
+ // just in case user has modified this.
63
+ if (!Array.isArray(config.functions)) {
64
+ config.functions = [config.functions];
65
+ }
66
+ // remove deleted functions
67
+ config.functions.forEach((func) => {
68
+ const funcName = func.codebase;
69
+ if (!projects.firebaseFunctionProjects.has(funcName) &&
70
+ !renamedFunctions.has(funcName)) {
71
+ (0, debug_1.debugInfo)(`- function ${funcName} is in config ${firebaseConfigName}, but cannot be located so function must be deleted`);
72
+ deletedFunctions.set(funcName, true);
73
+ }
74
+ });
75
+ });
76
+ // nx g mv --project=source --destination=dstname
77
+ // DOES update implicitDeps
78
+ // Again, this means implicitDep wont be wrong, but we cant use it to detect renames
79
+ // This is ok though because we detect renamed functions via tags
80
+ // determine deleted apps
81
+ (0, debug_1.debugInfo)(`- checking functions for deleted apps`);
82
+ projects.firebaseFunctionProjects.forEach((firebaseFunctionProject, firebaseFunctionName) => {
83
+ const { tagValue } = (0, tags_1.getFirebaseScopeFromTag)(firebaseFunctionProject, 'firebase:dep');
84
+ if (!projects.firebaseAppProjects.has(tagValue) &&
85
+ !renamedApps.has(tagValue)) {
86
+ (0, debug_1.debugInfo)(`- function ${firebaseFunctionName} points to app ${tagValue} which doesnt exist, so app must be deleted`);
87
+ deletedApps.set(tagValue, true);
88
+ }
89
+ });
90
+ (0, debug_1.debugInfo)(`- deletedApps=${(0, debug_1.mapKeys)(deletedApps)}`);
91
+ (0, debug_1.debugInfo)(`- deletedFunctions=${(0, debug_1.mapKeys)(deletedFunctions)}`);
92
+ (0, debug_1.debugInfo)(`- renamedApps=${(0, debug_1.mapKeys)(renamedApps)}`);
93
+ (0, debug_1.debugInfo)(`- renamedFunctions=${(0, debug_1.mapKeys)(renamedFunctions)}`);
94
+ return {
95
+ deletedApps,
96
+ deletedFunctions,
97
+ renamedApps,
98
+ renamedFunctions,
99
+ };
100
+ }
101
+ exports.getFirebaseChanges = getFirebaseChanges;
102
+ //# sourceMappingURL=firebase-changes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-changes.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/sync/lib/firebase-changes.ts"],"names":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AAA,eAAO,EAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IAClD,IAAA,iBAAS,EAAC,sBAAsB,IAAA,eAAO,EAAC,gBAAgB,CAAC,EAAE,CAAC,CAAA;IAE5D,OAAO;QACL,WAAW;QACX,gBAAgB;QAChB,WAAW;QACX,gBAAgB;KACjB,CAAA;AACH,CAAC;AA5HD,gDA4HC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { FirebaseConfigs, FirebaseProjects } from './types';
3
+ export declare function getFirebaseConfigs(tree: Tree, projects: FirebaseProjects): FirebaseConfigs;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFirebaseConfigs = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const utils_1 = require("../../../utils");
6
+ const types_1 = require("./types");
7
+ const debug_1 = require("../../../utils/debug");
8
+ const FIREBASE_CONFIG_FILE_MATCHER = /(firebase)(\S*)(.json)/;
9
+ function getFirebaseConfigs(tree, projects) {
10
+ const firebaseConfigs = new Map();
11
+ const firebaseAppConfigs = new Map();
12
+ const firebaseConfigProjects = new Map();
13
+ (0, debug_1.debugInfo)(`- firebaseAppProjects=${(0, debug_1.mapKeys)(projects.firebaseAppProjects)}`);
14
+ (0, debug_1.debugInfo)(`- firebaseFunctionProjects=${(0, debug_1.mapKeys)(projects.firebaseFunctionProjects)}`);
15
+ // collect all firebase[.*].json config files in workspace
16
+ const rootFiles = tree.children('');
17
+ rootFiles.map((child) => {
18
+ if (tree.isFile(child)) {
19
+ if (child.match(FIREBASE_CONFIG_FILE_MATCHER)) {
20
+ firebaseConfigs.set(child, (0, devkit_1.readJson)(tree, child));
21
+ // set an firebaseConfigProjects as null for now, later we will add the project
22
+ firebaseConfigProjects.set(child, types_1.CONFIG_NO_APP);
23
+ }
24
+ }
25
+ });
26
+ (0, debug_1.debugInfo)(`- firebaseConfigs=${(0, debug_1.mapKeys)(firebaseConfigs)}`);
27
+ // map firebase configs to their apps
28
+ // we do this by reading the --config setting directly from each firebase app's firebase target
29
+ // this is more robust & flexible than using filename assumptions for configs
30
+ // it also means users can freely rename their firebase configs and the plugin will work
31
+ projects.firebaseAppProjects.forEach((project, name) => {
32
+ const firebaseTarget = project.targets.firebase;
33
+ if (!firebaseTarget) {
34
+ throw new Error(`Firebase app project ${name} does not have a 'firebase' target. Sync will no longer work.`);
35
+ }
36
+ const firebaseConfigName = (0, utils_1.getFirebaseConfigFromProject)(tree, project);
37
+ firebaseAppConfigs.set(name, firebaseConfigName);
38
+ firebaseConfigProjects.set(firebaseConfigName, name);
39
+ // bit opinionated, but we need to sanity check that
40
+ // production configurations on this target use the same config file.
41
+ // since we cant rename configs safely with this scenario
42
+ // different build configs should only differ in --project
43
+ const configurations = firebaseTarget.configurations;
44
+ for (const configuration in configurations) {
45
+ const additionalConfigName = (0, utils_1.getFirebaseConfigFromCommand)(tree, project, configurations[configuration].command);
46
+ if (additionalConfigName !== firebaseConfigName) {
47
+ throw new Error(`Firebase app project ${name} target firebase.configurations.${configuration} has a different --config setting which is unsupported by this plugin.`);
48
+ }
49
+ }
50
+ });
51
+ (0, debug_1.debugInfo)(`- firebaseAppConfigs=${(0, debug_1.mapEntries)(firebaseAppConfigs)}`);
52
+ (0, debug_1.debugInfo)(`- firebaseConfigProjects=${(0, debug_1.mapEntries)(firebaseConfigProjects)},
53
+ )}`);
54
+ return {
55
+ firebaseConfigs,
56
+ firebaseAppConfigs,
57
+ firebaseConfigProjects,
58
+ };
59
+ }
60
+ exports.getFirebaseConfigs = getFirebaseConfigs;
61
+ //# sourceMappingURL=firebase-configs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-configs.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/sync/lib/firebase-configs.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAE3C,0CAIuB;AACvB,mCAA0E;AAC1E,gDAAqE;AAErE,MAAM,4BAA4B,GAAG,wBAA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DAA+D,CAC5F,CAAA;SACF;QACD,MAAM,kBAAkB,GAAG,IAAA,oCAA4B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACtE,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;QAChD,sBAAsB,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAA;QAEpD,oDAAoD;QACpD,qEAAqE;QACrE,yDAAyD;QACzD,0DAA0D;QAC1D,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAA;QACpD,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE;YAC1C,MAAM,oBAAoB,GAAG,IAAA,oCAA4B,EACvD,IAAI,EACJ,OAAO,EACP,cAAc,CAAC,aAAa,CAAC,CAAC,OAAO,CACtC,CAAA;YACD,IAAI,oBAAoB,KAAK,kBAAkB,EAAE;gBAC/C,MAAM,IAAI,KAAK,CACb,wBAAwB,IAAI,mCAAmC,aAAa,wEAAwE,CACrJ,CAAA;aACF;SACF;IACH,CAAC,CAAC,CAAA;IAEF,IAAA,iBAAS,EAAC,wBAAwB,IAAA,kBAAU,EAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;IACnE,IAAA,iBAAS,EACP,4BAA4B,IAAA,kBAAU,EAAC,sBAAsB,CAAC;OAC3D,CACJ,CAAA;IAED,OAAO;QACL,eAAe;QACf,kBAAkB;QAClB,sBAAsB;KACvB,CAAA;AACH,CAAC;AAvED,gDAuEC"}
@@ -0,0 +1,20 @@
1
+ import { ProjectConfiguration, TargetConfiguration, Tree } from '@nx/devkit';
2
+ import { SyncGeneratorSchema } from '../schema';
3
+ import { FirebaseProjects } from './types';
4
+ export declare function isFirebaseApp(project: ProjectConfiguration): boolean;
5
+ export declare function isFirebaseFunction(project: ProjectConfiguration): boolean;
6
+ /**
7
+ * Scan the workspace, identifying firebase projects managed by this plugin by their tags:
8
+ * - firebase:app
9
+ * - firebase:function
10
+ * @param tree - host workspace
11
+ * @returns FirebaseProjects object
12
+ */
13
+ export declare function getFirebaseProjects(tree: Tree): FirebaseProjects;
14
+ /**
15
+ * Rewrite the firebase deploy command for the given function deploy target
16
+ * to either add or update the --project cli parameter
17
+ * @param target - deploy target in the function
18
+ * @param options -
19
+ */
20
+ export declare function updateFirebaseAppDeployProject(target: TargetConfiguration, options: SyncGeneratorSchema): boolean;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateFirebaseAppDeployProject = exports.getFirebaseProjects = exports.isFirebaseFunction = exports.isFirebaseApp = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const debug_1 = require("../../../utils/debug");
6
+ const FIREBASE_PROJECT_MATCHER = /(--project[ =])([^\s]+)/;
7
+ const FIREBASE_COMMAND_MATCHER = /(firebase)/;
8
+ function isFirebaseApp(project) {
9
+ var _a;
10
+ return (_a = project.tags) === null || _a === void 0 ? void 0 : _a.includes('firebase:app');
11
+ }
12
+ exports.isFirebaseApp = isFirebaseApp;
13
+ function isFirebaseFunction(project) {
14
+ var _a;
15
+ return (_a = project.tags) === null || _a === void 0 ? void 0 : _a.includes('firebase:function');
16
+ }
17
+ exports.isFirebaseFunction = isFirebaseFunction;
18
+ /**
19
+ * Scan the workspace, identifying firebase projects managed by this plugin by their tags:
20
+ * - firebase:app
21
+ * - firebase:function
22
+ * @param tree - host workspace
23
+ * @returns FirebaseProjects object
24
+ */
25
+ function getFirebaseProjects(tree) {
26
+ const projects = (0, devkit_1.getProjects)(tree);
27
+ const firebaseAppProjects = new Map();
28
+ const firebaseFunctionProjects = new Map();
29
+ (0, debug_1.debugInfo)('- building list of firebase apps & functions');
30
+ projects.forEach((project, projectName) => {
31
+ if (isFirebaseApp(project)) {
32
+ firebaseAppProjects.set(projectName, project);
33
+ }
34
+ if (isFirebaseFunction(project)) {
35
+ firebaseFunctionProjects.set(projectName, project);
36
+ }
37
+ });
38
+ return {
39
+ firebaseAppProjects,
40
+ firebaseFunctionProjects,
41
+ };
42
+ }
43
+ exports.getFirebaseProjects = getFirebaseProjects;
44
+ /**
45
+ * Rewrite the firebase deploy command for the given function deploy target
46
+ * to either add or update the --project cli parameter
47
+ * @param target - deploy target in the function
48
+ * @param options -
49
+ */
50
+ function updateFirebaseAppDeployProject(target, options) {
51
+ const command = target.options.command;
52
+ if (command.includes('firebase')) {
53
+ (0, debug_1.debugInfo)('- found firebase target command');
54
+ (0, debug_1.debugInfo)(`- command=${command}`);
55
+ if (command.includes('--project')) {
56
+ (0, debug_1.debugInfo)('- found --project in firebase target command');
57
+ // already set, so update
58
+ target.options.command = command.replace(FIREBASE_PROJECT_MATCHER, '$1' + options.project);
59
+ (0, debug_1.debugInfo)(`- new command: ${target.options.command}`);
60
+ devkit_1.logger.info(`CHANGE updating firebase target --project for '${options.app}' to '--project=${options.project}'`);
61
+ return true;
62
+ }
63
+ else {
64
+ (0, debug_1.debugInfo)('- did not find --project in deploy command');
65
+ // no set, so add
66
+ target.options.command = command.replace(FIREBASE_COMMAND_MATCHER, '$1' + ' ' + `--project=${options.project}`);
67
+ (0, debug_1.debugInfo)(`- new command: ${target.options.command}`);
68
+ devkit_1.logger.info(`CHANGE setting firebase target --project for '${options.app}' to '--project=${options.project}'`);
69
+ return true;
70
+ }
71
+ }
72
+ return false;
73
+ }
74
+ exports.updateFirebaseAppDeployProject = updateFirebaseAppDeployProject;
75
+ //# sourceMappingURL=firebase-projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-projects.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/sync/lib/firebase-projects.ts"],"names":[],"mappings":";;;AAAA,uCAMmB;AAGnB,gDAAgD;AAGhD,MAAM,wBAAwB,GAAG,yBAAyB,CAAA;AAC1D,MAAM,wBAAwB,GAAG,YAAY,CAAA;AAE7C,SAAgB,aAAa,CAAC,OAA6B;;IACzD,OAAO,MAAA,OAAO,CAAC,IAAI,0CAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;AAC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AAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CACtC,wBAAwB,EACxB,IAAI,GAAG,OAAO,CAAC,OAAO,CACvB,CAAA;YACD,IAAA,iBAAS,EAAC,kBAAkB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;YAErD,eAAM,CAAC,IAAI,CACT,kDAAkD,OAAO,CAAC,GAAG,mBAAmB,OAAO,CAAC,OAAO,GAAG,CACnG,CAAA;YACD,OAAO,IAAI,CAAA;SACZ;aAAM;YACL,IAAA,iBAAS,EAAC,4CAA4C,CAAC,CAAA;YAEvD,iBAAiB;YACjB,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CACtC,wBAAwB,EACxB,IAAI,GAAG,GAAG,GAAG,aAAa,OAAO,CAAC,OAAO,EAAE,CAC5C,CAAA;YACD,IAAA,iBAAS,EAAC,kBAAkB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;YACrD,eAAM,CAAC,IAAI,CACT,iDAAiD,OAAO,CAAC,GAAG,mBAAmB,OAAO,CAAC,OAAO,GAAG,CAClG,CAAA;YACD,OAAO,IAAI,CAAA;SACZ;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AArCD,wEAqCC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { FirebaseWorkspace } from './types';
3
+ export declare function getFirebaseWorkspace(tree: Tree): FirebaseWorkspace;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFirebaseWorkspace = void 0;
4
+ const firebase_changes_1 = require("./firebase-changes");
5
+ const firebase_projects_1 = require("./firebase-projects");
6
+ const firebase_configs_1 = require("./firebase-configs");
7
+ function getFirebaseWorkspace(tree) {
8
+ // build list of firebase apps and functions in the workspace
9
+ const projects = (0, firebase_projects_1.getFirebaseProjects)(tree);
10
+ const configs = (0, firebase_configs_1.getFirebaseConfigs)(tree, projects);
11
+ const changes = (0, firebase_changes_1.getFirebaseChanges)(tree, projects, configs);
12
+ return Object.assign(Object.assign(Object.assign({}, projects), changes), configs);
13
+ }
14
+ exports.getFirebaseWorkspace = getFirebaseWorkspace;
15
+ //# sourceMappingURL=firebase-workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase-workspace.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/sync/lib/firebase-workspace.ts"],"names":[],"mappings":";;;AACA,yDAAuD;AACvD,2DAAyD;AAEzD,yDAAuD;AAEvD,SAAgB,oBAAoB,CAAC,IAAU;IAC7C,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,IAAA,uCAAmB,EAAC,IAAI,CAAC,CAAA;IAC1C,MAAM,OAAO,GAAG,IAAA,qCAAkB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAClD,MAAM,OAAO,GAAG,IAAA,qCAAkB,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAE3D,qDACK,QAAQ,GACR,OAAO,GACP,OAAO,EACX;AACH,CAAC;AAXD,oDAWC"}
@@ -0,0 +1,7 @@
1
+ export * from '../../../utils/debug';
2
+ export * from './firebase-changes';
3
+ export * from './firebase-configs';
4
+ export * from './firebase-projects';
5
+ export * from './firebase-workspace';
6
+ export * from './tags';
7
+ export * from './types';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("../../../utils/debug"), exports);
5
+ tslib_1.__exportStar(require("./firebase-changes"), exports);
6
+ tslib_1.__exportStar(require("./firebase-configs"), exports);
7
+ tslib_1.__exportStar(require("./firebase-projects"), exports);
8
+ tslib_1.__exportStar(require("./firebase-workspace"), exports);
9
+ tslib_1.__exportStar(require("./tags"), exports);
10
+ tslib_1.__exportStar(require("./types"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/sync/lib/index.ts"],"names":[],"mappings":";;;AAAA,+DAAoC;AACpC,6DAAkC;AAClC,6DAAkC;AAClC,8DAAmC;AACnC,+DAAoC;AACpC,iDAAsB;AACtB,kDAAuB"}
@@ -0,0 +1,14 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ /**
3
+ * Parse a firebase tag value for the given scope
4
+ * Expected to find tag of format: `firebase:name:<projectname>` or `firebase:dep:<appname>`
5
+ * @param project - Project to be checked
6
+ * @param scope - `firebase:name` or `firebase:dep`
7
+ * @returns value part of tag
8
+ * @throws if requested tag is missing, or malformed
9
+ */
10
+ export declare function getFirebaseScopeFromTag(project: ProjectConfiguration, scope: 'firebase:name' | 'firebase:dep'): {
11
+ tagValue: string;
12
+ tagIndex: number;
13
+ };
14
+ export declare function updateFirebaseProjectNameTag(tree: Tree, project: ProjectConfiguration): void;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateFirebaseProjectNameTag = exports.getFirebaseScopeFromTag = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const debug_1 = require("../../../utils/debug");
6
+ /**
7
+ * Parse a firebase tag value for the given scope
8
+ * Expected to find tag of format: `firebase:name:<projectname>` or `firebase:dep:<appname>`
9
+ * @param project - Project to be checked
10
+ * @param scope - `firebase:name` or `firebase:dep`
11
+ * @returns value part of tag
12
+ * @throws if requested tag is missing, or malformed
13
+ */
14
+ function getFirebaseScopeFromTag(project, scope) {
15
+ const tags = project.tags;
16
+ if (tags) {
17
+ for (let i = 0; i < tags.length; ++i) {
18
+ const tag = tags[i];
19
+ (0, debug_1.debugInfo)(`- checking tag '${tag}' for scope '${scope}'`);
20
+ if (tag.includes(scope)) {
21
+ (0, debug_1.debugInfo)(`- matched tag '${tag}' for scope '${scope}'`);
22
+ const scopes = tag.split(':');
23
+ if (scopes.length === 3) {
24
+ (0, debug_1.debugInfo)(`- returning tagValue '${scopes[2]}' tagIndex '${i}'`);
25
+ return { tagValue: scopes[2], tagIndex: i };
26
+ }
27
+ else {
28
+ throw new Error(`Malformed '${scope}' tag in project '${project.name}', expected '${scope}:<value>', found '${tag}'`);
29
+ }
30
+ }
31
+ }
32
+ }
33
+ throw new Error(`Project '${project.name}' has a missing '${scope}' tag in project. Ensure this is set correctly.`);
34
+ }
35
+ exports.getFirebaseScopeFromTag = getFirebaseScopeFromTag;
36
+ function updateFirebaseProjectNameTag(tree, project) {
37
+ const appNameTag = getFirebaseScopeFromTag(project, 'firebase:name');
38
+ const newAppNameTag = `firebase:name:${project.name}`;
39
+ project.tags[appNameTag.tagIndex] = newAppNameTag;
40
+ (0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
41
+ }
42
+ exports.updateFirebaseProjectNameTag = updateFirebaseProjectNameTag;
43
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/sync/lib/tags.ts"],"names":[],"mappings":";;;AAAA,uCAImB;AACnB,gDAAgD;AAEhD;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CACrC,OAA6B,EAC7B,KAAuC;IAEvC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IACzB,IAAI,IAAI,EAAE;QACR,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACnB,IAAA,iBAAS,EAAC,mBAAmB,GAAG,gBAAgB,KAAK,GAAG,CAAC,CAAA;YACzD,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBACvB,IAAA,iBAAS,EAAC,kBAAkB,GAAG,gBAAgB,KAAK,GAAG,CAAC,CAAA;gBACxD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;oBACvB,IAAA,iBAAS,EAAC,yBAAyB,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;oBAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAA;iBAC5C;qBAAM;oBACL,MAAM,IAAI,KAAK,CACb,cAAc,KAAK,qBAAqB,OAAO,CAAC,IAAI,gBAAgB,KAAK,qBAAqB,GAAG,GAAG,CACrG,CAAA;iBACF;aACF;SACF;KACF;IACD,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,CAAC,IAAI,oBAAoB,KAAK,iDAAiD,CACnG,CAAA;AACH,CAAC;AA1BD,0DA0BC;AAED,SAAgB,4BAA4B,CAC1C,IAAU,EACV,OAA6B;IAE7B,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;IACpE,MAAM,aAAa,GAAG,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAA;IACrD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAA;IACjD,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AACzD,CAAC;AARD,oEAQC"}
@@ -0,0 +1,46 @@
1
+ import { ProjectConfiguration } from '@nx/devkit';
2
+ import { FirebaseConfig } from '../../../utils';
3
+ export declare const CONFIG_NO_APP = "CONFIG_NO_APP";
4
+ export interface FirebaseProjects {
5
+ /**
6
+ * app projectName -> ProjectConfig
7
+ */
8
+ firebaseAppProjects: Map<string, ProjectConfiguration>;
9
+ /**
10
+ * function projectName -> ProjectConfig
11
+ */
12
+ firebaseFunctionProjects: Map<string, ProjectConfiguration>;
13
+ }
14
+ export interface FirebaseConfigs {
15
+ /**
16
+ * configFilename -> FirebaseConfig
17
+ */
18
+ firebaseConfigs: Map<string, FirebaseConfig>;
19
+ /**
20
+ * projectName -> configFileName
21
+ */
22
+ firebaseAppConfigs: Map<string, string>;
23
+ /**
24
+ * configFilename -> Project Name (or MISSING_CONFIG if config is not referenced by an app)
25
+ */
26
+ firebaseConfigProjects: Map<string, string>;
27
+ }
28
+ export interface FirebaseChanges {
29
+ /**
30
+ * map of app project name -> deletion status
31
+ */
32
+ deletedApps: Map<string, boolean>;
33
+ /**
34
+ * map of function project name -> deletion status
35
+ */
36
+ deletedFunctions: Map<string, boolean>;
37
+ /**
38
+ * map of previous app name -> new app project
39
+ */
40
+ renamedApps: Map<string, ProjectConfiguration>;
41
+ /**
42
+ * map of previous function name -> new function project
43
+ */
44
+ renamedFunctions: Map<string, ProjectConfiguration>;
45
+ }
46
+ export declare type FirebaseWorkspace = FirebaseProjects & FirebaseChanges & FirebaseConfigs;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONFIG_NO_APP = void 0;
4
+ exports.CONFIG_NO_APP = 'CONFIG_NO_APP';
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/sync/lib/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,aAAa,GAAG,eAAe,CAAA"}
@@ -0,0 +1,5 @@
1
+ export interface SyncGeneratorSchema {
2
+ app?: string
3
+ project?: string
4
+ // functions?: boolean
5
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "Sync",
4
+ "title": "",
5
+ "type": "object",
6
+ "properties": {
7
+ "app": {
8
+ "type": "string",
9
+ "description": "The Nx firebase application you would like to sync",
10
+ "default": ""
11
+ },
12
+ "project": {
13
+ "type": "string",
14
+ "description": "The firebase project that should be associated with this application",
15
+ "default": ""
16
+ }
17
+ },
18
+ "required": []
19
+ }
@@ -0,0 +1,8 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { SyncGeneratorSchema } from './schema';
3
+ /**
4
+ * Sync firebase workspace
5
+ *
6
+ */
7
+ export declare function syncGenerator(tree: Tree, options: SyncGeneratorSchema): Promise<GeneratorCallback>;
8
+ export default syncGenerator;