@simondotm/nx-firebase 0.13.0-beta.0 → 0.13.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![npm](https://img.shields.io/npm/dw/@simondotm/nx-firebase.svg)
4
4
 
5
- A plugin for [Nx](https://nx.dev) >= 12.1.1 that provides support for Firebase projects in an Nx monorepo workspace.
5
+ A plugin for [Nx](https://nx.dev) that provides support for Firebase projects in an Nx monorepo workspace.
6
6
 
7
7
  See [CHANGELOG](https://github.com/simondotm/nx-firebase/blob/main/CHANGELOG.md) for release notes.
8
8
 
@@ -19,12 +19,11 @@ Nx provides a great way to manage monorepo workflows and this plugin helps to in
19
19
 
20
20
  Supports:
21
21
 
22
- - Typescript Firebase functions
22
+ - Typescript Firebase functions as Nx applications
23
23
  - Single or multiple Firebase projects in one Nx workspace
24
- - Firebase applications in app subdirectories
25
24
  - Use of shared Nx buildable libraries in Firebase functions
26
25
  - Nx provides automatic dependency checking for builds
27
- - Building functions with `tsc` `--watch` mode
26
+ - Building & serving functions with watch mode
28
27
  - Firebase Emulators
29
28
  - Convenience Nx `getconfig` target to fetch remote firebase functions configuration variables to local `.runtimeconfig.json` file
30
29
  - Convenience Nx `deploy`, `emulate`, and `serve` targets for functions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simondotm/nx-firebase",
3
- "version": "0.13.0-beta.0",
3
+ "version": "0.13.0-beta.1",
4
4
  "description": "A Firebase plugin for Nx monorepo workspaces.",
5
5
  "author": "Simon Morris",
6
6
  "license": "MIT",
@@ -13,7 +13,6 @@
13
13
  "engines": {
14
14
  "node": " <%= firebaseNodeEngine %>"
15
15
  },
16
- "main": "src/index.js",
17
16
  "dependencies": {
18
17
  },
19
18
  "devDependencies": {
@@ -8,7 +8,7 @@ export declare function getBuildTarget(project: ProjectConfiguration): {
8
8
  main: string;
9
9
  tsConfig: string;
10
10
  packageJson: string;
11
- assets: string[];
11
+ assets: any[];
12
12
  };
13
13
  };
14
14
  export declare function getDeployTarget(options: NormalizedOptions): {
@@ -23,14 +23,14 @@ export declare function getConfigTarget(projectRoot: string, options: Normalized
23
23
  command: string;
24
24
  };
25
25
  };
26
- export declare function getEmulateTarget(options: NormalizedOptions): {
26
+ export declare function getEmulateTarget(options: NormalizedOptions, project: ProjectConfiguration): {
27
27
  executor: string;
28
28
  options: {
29
29
  commands: string[];
30
30
  parallel: boolean;
31
31
  };
32
32
  };
33
- export declare function getServeTarget(project: ProjectConfiguration): {
33
+ export declare function getServeTarget(options: NormalizedOptions): {
34
34
  executor: string;
35
35
  options: {
36
36
  commands: string[];
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = exports.getServeTarget = exports.getEmulateTarget = exports.getConfigTarget = exports.getDeployTarget = exports.getBuildTarget = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
5
  const devkit_2 = require("@nrwl/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
+ : '@nrwl/workspace:run-commands';
16
+ }
6
17
  function getFirebaseProject(options) {
7
18
  if (options.project) {
8
19
  return ` --project ${options.project}`;
@@ -24,9 +35,11 @@ function getBuildTarget(project) {
24
35
  main: (0, devkit_1.joinPathFragments)(project.sourceRoot, 'index.ts'),
25
36
  tsConfig: (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.app.json'),
26
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.
27
40
  assets: [
28
- (0, devkit_1.joinPathFragments)(project.root, '*.md'),
29
- (0, devkit_1.joinPathFragments)(project.root, '.runtimeconfig.json'),
41
+ // joinPathFragments(project.root, '*.md'),
42
+ // joinPathFragments(project.root, '.runtimeconfig.json'),
30
43
  ],
31
44
  },
32
45
  };
@@ -34,7 +47,7 @@ function getBuildTarget(project) {
34
47
  exports.getBuildTarget = getBuildTarget;
35
48
  function getDeployTarget(options) {
36
49
  return {
37
- executor: 'nx:run-commands',
50
+ executor: getRunCommandsExecutor(),
38
51
  options: {
39
52
  command: `firebase deploy${getFirebaseConfig(options)}${getFirebaseProject(options)}`,
40
53
  },
@@ -43,19 +56,21 @@ function getDeployTarget(options) {
43
56
  exports.getDeployTarget = getDeployTarget;
44
57
  function getConfigTarget(projectRoot, options) {
45
58
  return {
46
- executor: 'nx:run-commands',
59
+ executor: getRunCommandsExecutor(),
47
60
  options: {
48
61
  command: `firebase functions:config:get${getFirebaseConfig(options)}${getFirebaseProject(options)} > ${projectRoot}/.runtimeconfig.json`,
49
62
  },
50
63
  };
51
64
  }
52
65
  exports.getConfigTarget = getConfigTarget;
53
- function getEmulateTarget(options) {
66
+ function getEmulateTarget(options, project) {
54
67
  return {
55
- executor: 'nx:run-commands',
68
+ executor: getRunCommandsExecutor(),
56
69
  options: {
57
70
  commands: [
58
- `npx kill-port --port 9099,5001,8080,9000,5000,8085,9199,9299`,
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`,
59
74
  `firebase emulators:start ${getFirebaseConfig(options)}${getFirebaseProject(options)}`,
60
75
  ],
61
76
  parallel: false,
@@ -63,14 +78,26 @@ function getEmulateTarget(options) {
63
78
  };
64
79
  }
65
80
  exports.getEmulateTarget = getEmulateTarget;
66
- function getServeTarget(project) {
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
+ ];
67
97
  return {
68
- executor: 'nx:run-commands',
98
+ executor: getRunCommandsExecutor(),
69
99
  options: {
70
- commands: [
71
- `nx run ${project.name}:build --watch`,
72
- `nx run ${project.name}:emulate`,
73
- ],
100
+ commands,
74
101
  },
75
102
  };
76
103
  }
@@ -80,8 +107,8 @@ function addProject(tree, options) {
80
107
  project.targets.build = getBuildTarget(project);
81
108
  project.targets.deploy = getDeployTarget(options);
82
109
  project.targets.getconfig = getConfigTarget(project.root, options);
83
- project.targets.emulate = getEmulateTarget(options);
84
- project.targets.serve = getServeTarget(project);
110
+ project.targets.emulate = getEmulateTarget(options, project);
111
+ project.targets.serve = getServeTarget(options);
85
112
  (0, devkit_2.updateProjectConfiguration)(tree, options.projectName, project);
86
113
  }
87
114
  exports.addProject = addProject;
@@ -1 +1 @@
1
- {"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/add-project.ts"],"names":[],"mappings":";;;AAAA,yCAA4E;AAC5E,yCAGqB;AAGrB,SAAS,kBAAkB,CAAC,OAA0B;IACpD,IAAI,OAAO,CAAC,OAAO,EAAE;QACnB,OAAO,cAA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+ {"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/add-project.ts"],"names":[],"mappings":";;;AAAA,yCAA4E;AAC5E,yCAGqB;AACrB,0CAAmD;AAGnD;;GAEG;AACH,SAAS,sBAAsB;IAC7B,0DAA0D;IAC1D,MAAM,qBAAqB,GAAG,0BAAkB,CAAC,WAAW,IAAI,MAAM,CAAA;IACtE,OAAO,qBAAqB;QAC1B,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,8BAA8B,CAAA;AACpC,CAAC;AAED,SAAS,kBAAkB,CAAC,OAA0B;IACpD,IAAI,OAAO,CAAC,OAAO,EAAE;QACnB,OAAO,cAAc,OAAO,CAAC,OAAO,EAAE,CAAA;KACvC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,SAAS,iBAAiB,CAAC,OAA0B;IACnD,IAAI,OAAO,CAAC,kBAAkB,EAAE;QAC9B,OAAO,aAAa,OAAO,CAAC,kBAAkB,EAAE,CAAA;KACjD;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,SAAgB,cAAc,CAAC,OAA6B;IAC1D,OAAO;QACL,QAAQ,EAAE,8BAA8B;QACxC,OAAO,EAAE,CAAC,sBAAsB,CAAC;QACjC,OAAO,EAAE;YACP,UAAU,EAAE,IAAA,0BAAiB,EAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC;YACnD,IAAI,EAAE,IAAA,0BAAiB,EAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC;YACvD,QAAQ,EAAE,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC;YAC9D,WAAW,EAAE,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC;YAC5D,wCAAwC;YACxC,qGAAqG;YACrG,MAAM,EAAE;YACN,2CAA2C;YAC3C,0DAA0D;aAC3D;SACF;KACF,CAAA;AACH,CAAC;AAjBD,wCAiBC;AAED,SAAg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O,CAAC,WAAW,2CAA2C,OAAO,CAAC,WAAW,gBAAgB;YAC/J,UAAU,OAAO,CAAC,WAAW,UAAU;SACxC;QACH,CAAC,CAAC;YACE,UAAU,OAAO,CAAC,WAAW,gBAAgB;YAC7C,UAAU,OAAO,CAAC,WAAW,UAAU;SACxC,CAAA;IAEL,OAAO;QACL,QAAQ,EAAE,sBAAsB,EAAE;QAClC,OAAO,EAAE;YACP,QAAQ;SACT;KACF,CAAA;AACH,CAAC;AAzBD,wCAyBC;AAED,SAAgB,UAAU,CAAC,IAAU,EAAE,OAA0B;IAC/D,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAEnE,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAC/C,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IACjD,OAAO,CAAC,OAAO,CAAC,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAClE,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC5D,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAE/C,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AAChE,CAAC;AAVD,gCAUC"}
@@ -23,30 +23,34 @@ function addDependencies(tree) {
23
23
  devDependencies[packageName] = packageVersion;
24
24
  }
25
25
  }
26
- // dependencies
26
+ // firebase dependencies
27
27
  addDependencyIfNotPresent('firebase', versions_1.firebaseVersion);
28
28
  addDependencyIfNotPresent('firebase-admin', versions_1.firebaseAdminVersion);
29
29
  addDependencyIfNotPresent('firebase-functions', versions_1.firebaseFunctionsVersion);
30
30
  //SM: not convinced we should be adding tslib in this plugin
31
31
  //addDependencyIfNotPresent('tslib', tsLibVersion)
32
- // dev dependencies
32
+ // firebase dev dependencies
33
33
  addDevDependencyIfNotPresent('firebase-tools', versions_1.firebaseToolsVersion);
34
34
  addDevDependencyIfNotPresent('firebase-functions-test', versions_1.firebaseFunctionsTestVersion);
35
+ // kill-port is used by the emulate target to ensure clean emulator startup
36
+ // since Nx doesn't kill processes cleanly atm
35
37
  addDevDependencyIfNotPresent('kill-port', versions_1.killportVersion);
36
38
  // TODO: find out if Nx devkit adds these versions even if they already exist
37
39
  // for now, only add them if they aren't in the workspace already at the same version as the host workspace
38
40
  // from:
39
41
  // https://github.com/nrwl/nx/blob/5b7dba1cb78cabcf631129b4ce8163406b9c1328/packages/devkit/src/utils/package-json.ts#L84
40
42
  //
41
- // used by the plugin internals, most likely already in the host workspace
42
- addDevDependencyIfNotPresent('@nrwl/devkit', utils_1.workspaceNxVersion);
43
+ // These dependencies are required by the plugin internals, most likely already in the host workspace
44
+ // but add them if not. They are added with the same version that the host workspace is using.
45
+ // This is cleaner than using peerDeps.
46
+ addDevDependencyIfNotPresent('@nrwl/devkit', utils_1.workspaceNxVersion.version);
43
47
  // used by the plugin application generator
44
- addDevDependencyIfNotPresent('@nrwl/linter', utils_1.workspaceNxVersion);
45
- addDevDependencyIfNotPresent('@nrwl/jest', utils_1.workspaceNxVersion);
46
- // used as a proxy typescript app by the plugin application generator
47
- addDevDependencyIfNotPresent('@nrwl/node', utils_1.workspaceNxVersion);
48
+ addDevDependencyIfNotPresent('@nrwl/linter', utils_1.workspaceNxVersion.version);
49
+ addDevDependencyIfNotPresent('@nrwl/jest', utils_1.workspaceNxVersion.version);
50
+ // used by the plugin application generator as a proxy for creating a typescript app
51
+ addDevDependencyIfNotPresent('@nrwl/node', utils_1.workspaceNxVersion.version);
48
52
  // used by the plugin application builder
49
- addDevDependencyIfNotPresent('@nrwl/js', utils_1.workspaceNxVersion);
53
+ addDevDependencyIfNotPresent('@nrwl/js', utils_1.workspaceNxVersion.version);
50
54
  return (0, devkit_2.addDependenciesToPackageJson)(tree, dependencies, devDependencies);
51
55
  }
52
56
  exports.addDependencies = addDependencies;
@@ -1 +1 @@
1
- {"version":3,"file":"add-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-dependencies.ts"],"names":[],"mappings":";;;AAAA,yCAAgE;AAChE,yCAA2D;AAC3D,0CAAmD;AACnD,sDAQgC;AAEhC,SAAgB,eAAe,CAAC,IAAU;IACxC,MAAM,YAAY,GAA2B,EAAE,CAAA;IAC/C,MAAM,eAAe,GAA2B,EAAE,CAAA;IAElD,0EAA0E;IAC1E,8EAA8E;IAC9E,gGAAgG;IAChG,2EAA2E;IAC3E,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAA,CAAC,uBAAuB;IAE1E,SAAS,yBAAyB,CAChC,WAAmB,EACnB,cAAsB;QAEtB,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YAC1C,YAAY,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;SAC3C;IACH,CAAC;IACD,SAAS,4BAA4B,CACnC,WAAmB,EACnB,cAAsB;QAEtB,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE;YAC7C,eAAe,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;SAC9C;IACH,CAAC;IAED,eAAe;IACf,yBAAyB,CAAC,UAAU,EAAE,0BAAe,CAAC,CAAA;IACtD,yBAAyB,CAAC,gBAAgB,EAAE,+BAAoB,CAAC,CAAA;IACjE,yBAAyB,CAAC,oBAAoB,EAAE,mCAAwB,CAAC,CAAA;IACzE,4DAA4D;IAC5D,kDAAkD;IAElD,mBAAmB;IACnB,4BAA4B,CAAC,gBAAgB,EAAE,+BAAoB,CAAC,CAAA;IACpE,4BAA4B,CAC1B,yBAAyB,EACzB,uCAA4B,CAC7B,CAAA;IACD,4BAA4B,CAAC,WAAW,EAAE,0BAAe,CAAC,CAAA;IAE1D,6EAA6E;IAC7E,2GAA2G;IAC3G,QAAQ;IACR,yHAAyH;IACzH,EAAE;IAEF,0EAA0E;IAC1E,4BAA4B,CAAC,cAAc,EAAE,0BAAkB,CAAC,CAAA;IAEhE,2CAA2C;IAC3C,4BAA4B,CAAC,cAAc,EAAE,0BAAkB,CAAC,CAAA;IAChE,4BAA4B,CAAC,YAAY,EAAE,0BAAkB,CAAC,CAAA;IAE9D,qEAAqE;IACrE,4BAA4B,CAAC,YAAY,EAAE,0BAAkB,CAAC,CAAA;IAE9D,yCAAyC;IACzC,4BAA4B,CAAC,UAAU,EAAE,0BAAkB,CAAC,CAAA;IAE5D,OAAO,IAAA,qCAA4B,EAAC,IAAI,EAAE,YAAY,EAAE,eAAe,CAAC,CAAA;AAC1E,CAAC;AA9DD,0CA8DC"}
1
+ {"version":3,"file":"add-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-dependencies.ts"],"names":[],"mappings":";;;AAAA,yCAAgE;AAChE,yCAA2D;AAC3D,0CAAmD;AACnD,sDAQgC;AAEhC,SAAgB,eAAe,CAAC,IAAU;IACxC,MAAM,YAAY,GAA2B,EAAE,CAAA;IAC/C,MAAM,eAAe,GAA2B,EAAE,CAAA;IAElD,0EAA0E;IAC1E,8EAA8E;IAC9E,gGAAgG;IAChG,2EAA2E;IAC3E,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAA,CAAC,uBAAuB;IAE1E,SAAS,yBAAyB,CAChC,WAAmB,EACnB,cAAsB;QAEtB,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;YAC1C,YAAY,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;SAC3C;IACH,CAAC;IACD,SAAS,4BAA4B,CACnC,WAAmB,EACnB,cAAsB;QAEtB,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE;YAC7C,eAAe,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;SAC9C;IACH,CAAC;IAED,wBAAwB;IACxB,yBAAyB,CAAC,UAAU,EAAE,0BAAe,CAAC,CAAA;IACtD,yBAAyB,CAAC,gBAAgB,EAAE,+BAAoB,CAAC,CAAA;IACjE,yBAAyB,CAAC,oBAAoB,EAAE,mCAAwB,CAAC,CAAA;IAEzE,4DAA4D;IAC5D,kDAAkD;IAElD,4BAA4B;IAC5B,4BAA4B,CAAC,gBAAgB,EAAE,+BAAoB,CAAC,CAAA;IACpE,4BAA4B,CAC1B,yBAAyB,EACzB,uCAA4B,CAC7B,CAAA;IAED,2EAA2E;IAC3E,8CAA8C;IAC9C,4BAA4B,CAAC,WAAW,EAAE,0BAAe,CAAC,CAAA;IAE1D,6EAA6E;IAC7E,2GAA2G;IAC3G,QAAQ;IACR,yHAAyH;IACzH,EAAE;IAEF,qGAAqG;IACrG,8FAA8F;IAC9F,uCAAuC;IACvC,4BAA4B,CAAC,cAAc,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAExE,2CAA2C;IAC3C,4BAA4B,CAAC,cAAc,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IACxE,4BAA4B,CAAC,YAAY,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAEtE,oFAAoF;IACpF,4BAA4B,CAAC,YAAY,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAEtE,yCAAyC;IACzC,4BAA4B,CAAC,UAAU,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAA;IAEpE,OAAO,IAAA,qCAA4B,EAAC,IAAI,EAAE,YAAY,EAAE,eAAe,CAAC,CAAA;AAC1E,CAAC;AApED,0CAoEC"}
@@ -1,3 +1,3 @@
1
1
  import { Tree } from '@nrwl/devkit';
2
- export declare const gitIgnoreEntries = "\n\n# Nx-Firebase\n.runtimeconfig.json\ndatabase-debug.log\nfirestore-debug.log\npubsub-debug.log\nui-debug.log\n\n";
2
+ export declare const gitIgnoreEntries = "\n\n# Nx-Firebase\n.runtimeconfig.json\n**/.emulators/*\n**/.firebase/*\ndatabase-debug.log\nfirebase-debug.log\nfirestore-debug.log\npubsub-debug.log\nui-debug.log\n\n";
3
3
  export declare function addGitIgnoreEntry(host: Tree): void;
@@ -5,7 +5,10 @@ exports.gitIgnoreEntries = `
5
5
 
6
6
  # Nx-Firebase
7
7
  .runtimeconfig.json
8
+ **/.emulators/*
9
+ **/.firebase/*
8
10
  database-debug.log
11
+ firebase-debug.log
9
12
  firestore-debug.log
10
13
  pubsub-debug.log
11
14
  ui-debug.log
@@ -1 +1 @@
1
- {"version":3,"file":"add-git-ignore-entry.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-git-ignore-entry.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG;;;;;;;;;CAS/B,CAAA;AAED,SAAgB,iBAAiB,CAAC,IAAU;;IAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC9B,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,wBAAgB,CAAC,CAAA;QAC1C,OAAM;KACP;IAED,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,EAAE;QACvC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC,CAAA;KAC3D;AACH,CAAC;AAVD,8CAUC"}
1
+ {"version":3,"file":"add-git-ignore-entry.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/init/lib/add-git-ignore-entry.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAG;;;;;;;;;;;;CAY/B,CAAA;AAED,SAAgB,iBAAiB,CAAC,IAAU;;IAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC9B,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,wBAAgB,CAAC,CAAA;QAC1C,OAAM;KACP;IAED,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,0CAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1D,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAgB,CAAC,EAAE;QACvC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,wBAAgB,CAAC,CAAC,CAAA;KAC3D;AACH,CAAC;AAVD,8CAUC"}
@@ -1,5 +1,5 @@
1
1
  export declare const pluginNxVersion = "^13.10.6";
2
- export declare const pluginNxVersionMajor = "13";
2
+ export declare const pluginNxVersionMajor = 13;
3
3
  export declare const tsLibVersion = "^2.0.0";
4
4
  export declare const firebaseAdminVersion = "^11.3.0";
5
5
  export declare const firebaseFunctionsVersion = "^4.1.0";
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
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;
4
4
  // Declare target version of Nx that the plugin is currently compatible with
5
5
  exports.pluginNxVersion = '^13.10.6';
6
- exports.pluginNxVersionMajor = '13';
6
+ exports.pluginNxVersionMajor = 13;
7
7
  // Tslib version changes with each Nx version
8
8
  exports.tsLibVersion = '^2.0.0';
9
9
  // Firebase packages are not managed by the plugin
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/versions.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AAC/D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4BAA4B,GAAG,QAAQ,CAAA;AAEpD,+CAA+C;AAClC,QAAA,kBAAkB,GAAG,IAAI,CAAA;AACzB,QAAA,mBAAmB,GAAG,SAAS,0BAAkB,EAAE,CAAA;AAEhE,2FAA2F;AAE3F,MAAM,WAAW,GAA2B;IAC1C,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;CACf,CAAA;AAEY,QAAA,cAAc,GAAG,WAAW,CAAC,0BAAkB,CAAC,CAAA;AAE7D,IAAI,CAAC,sBAAc,EAAE;IACnB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;CAC5C;AAED,iDAAiD;AACpC,QAAA,eAAe,GAAG,QAAQ,CAAA"}
@@ -1,2 +1,13 @@
1
- export declare const workspaceNxVersion: string;
1
+ export declare type WorkspaceVersion = {
2
+ version: string;
3
+ versionCode: number;
4
+ major: number;
5
+ minor: number;
6
+ } | undefined;
7
+ export declare const workspaceNxVersion: {
8
+ version: string;
9
+ versionCode: number;
10
+ major: number;
11
+ minor: number;
12
+ };
2
13
  export declare function checkNxVersion(): void;
@@ -11,17 +11,26 @@ function readNxWorkspaceVersion() {
11
11
  if (workspaceNxPackageVersion) {
12
12
  const workspaceNxVersion = workspaceNxPackageVersion.match(semVerRegEx);
13
13
  if (workspaceNxVersion.length) {
14
- return workspaceNxVersion[0];
14
+ const semver = workspaceNxVersion[0].split('.');
15
+ const major = parseInt(semver[0]);
16
+ const minor = parseInt(semver[1]);
17
+ const patch = parseInt(semver[2]);
18
+ return {
19
+ version: workspaceNxVersion[0],
20
+ versionCode: major * 10000 + minor * 100 + patch,
21
+ major,
22
+ minor,
23
+ };
15
24
  }
16
25
  }
17
- return '';
26
+ return undefined;
18
27
  }
19
28
  // determine the Nx version being used by the host workspace
20
29
  exports.workspaceNxVersion = readNxWorkspaceVersion();
21
30
  function checkNxVersion() {
22
31
  if (exports.workspaceNxVersion) {
23
- if (!exports.workspaceNxVersion.includes(versions_1.pluginNxVersionMajor)) {
24
- devkit_1.logger.warn(`WARNING: @simondotm/nx-firebase plugin for Nx version (${versions_1.pluginNxVersion}) may not be compatible with your version of Nx (${exports.workspaceNxVersion})`);
32
+ if (exports.workspaceNxVersion.major > versions_1.pluginNxVersionMajor) {
33
+ devkit_1.logger.warn(`WARNING: @simondotm/nx-firebase plugin for Nx version (${versions_1.pluginNxVersion}) may not be compatible with your version of Nx (${exports.workspaceNxVersion.version})`);
25
34
  }
26
35
  }
27
36
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/workspace.ts"],"names":[],"mappings":";;;AAAA,yCAAkE;AAClE,yCAAkE;AAWlE,SAAS,sBAAsB;IAC7B,mEAAmE;IACnE,MAAM,WAAW,GAAG,iDAAiD,CAAA;IACrE,MAAM,gBAAgB,GAAG,IAAA,qBAAY,EACnC,GAAG,sBAAa,eAAe,CAChC,CAAA;IACD,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IACxE,IAAI,yBAAyB,EAAE;QAC7B,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACvE,IAAI,kBAAkB,CAAC,MAAM,EAAE;YAC7B,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAA;SAC7B;KACF;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,4DAA4D;AAC/C,QAAA,kBAAkB,GAAG,sBAAsB,EAAE,CAAA;AAE1D,SAAgB,cAAc;IAC5B,IAAI,0BAAkB,EAAE;QACtB,IAAI,CAAC,0BAAkB,CAAC,QAAQ,CAAC,+BAAoB,CAAC,EAAE;YACtD,eAAM,CAAC,IAAI,CACT,0DAA0D,0BAAe,oDAAoD,0BAAkB,GAAG,CACnJ,CAAA;SACF;KACF;SAAM;QACL,eAAM,CAAC,IAAI,CACT,iGAAiG,CAClG,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