@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
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rewriteFirebasePackage = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const copy_dependencies_1 = require("./copy-dependencies");
|
|
6
|
-
/**
|
|
7
|
-
* rewrite references to library packages in the functions package.json
|
|
8
|
-
* to be local package references to the copies we made
|
|
9
|
-
* @param outputPath
|
|
10
|
-
* @param localLibraries
|
|
11
|
-
*/
|
|
12
|
-
function rewriteFirebasePackage(outputPath, localLibraries) {
|
|
13
|
-
const functionsPackageFile = (0, devkit_1.joinPathFragments)(outputPath, 'package.json');
|
|
14
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
15
|
-
devkit_1.logger.info(`- functions PackageFile '${functionsPackageFile}'`);
|
|
16
|
-
}
|
|
17
|
-
const functionsPackageJson = (0, devkit_1.readJsonFile)(functionsPackageFile);
|
|
18
|
-
const functionsPackageDeps = functionsPackageJson.dependencies;
|
|
19
|
-
if (functionsPackageDeps) {
|
|
20
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
21
|
-
devkit_1.logger.info('- Updating local dependencies for Firebase functions package.json');
|
|
22
|
-
}
|
|
23
|
-
for (const d in functionsPackageDeps) {
|
|
24
|
-
const localDep = localLibraries[d];
|
|
25
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
26
|
-
devkit_1.logger.info(`- Checking dependency '${d}', isLocalDep=${localDep !== undefined}`);
|
|
27
|
-
}
|
|
28
|
-
if (localDep) {
|
|
29
|
-
const localRef = `file:${(0, devkit_1.joinPathFragments)('.', copy_dependencies_1.FIREBASE_DEPS_DIR, localDep.node.name)}`;
|
|
30
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
31
|
-
devkit_1.logger.info(` - Replacing '${d}' with '${localRef}'`);
|
|
32
|
-
}
|
|
33
|
-
functionsPackageDeps[d] = localRef;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
(0, devkit_1.writeJsonFile)(functionsPackageFile, functionsPackageJson);
|
|
38
|
-
devkit_1.logger.log('- Updated firebase functions package.json');
|
|
39
|
-
if (process.env.NX_VERBOSE_LOGGING) {
|
|
40
|
-
devkit_1.logger.info(`functions package deps = ${JSON.stringify(functionsPackageDeps, null, 3)}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.rewriteFirebasePackage = rewriteFirebasePackage;
|
|
44
|
-
//# sourceMappingURL=rewrite-package.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-package.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/executors/build/lib/rewrite-package.ts"],"names":[],"mappings":";;;AAAA,uCAKmB;AAEnB,2DAAuD;AAEvD;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,UAAkB,EAClB,cAA6D;IAE7D,MAAM,oBAAoB,GAAG,IAAA,0BAAiB,EAAC,UAAU,EAAE,cAAc,CAAC,CAAA;IAE1E,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;QAClC,eAAM,CAAC,IAAI,CAAC,4BAA4B,oBAAoB,GAAG,CAAC,CAAA;KACjE;IACD,MAAM,oBAAoB,GAAG,IAAA,qBAAY,EAAC,oBAAoB,CAAC,CAAA;IAC/D,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,YAAY,CAAA;IAC9D,IAAI,oBAAoB,EAAE;QACxB,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;YAClC,eAAM,CAAC,IAAI,CACT,mEAAmE,CACpE,CAAA;SACF;QACD,KAAK,MAAM,CAAC,IAAI,oBAAoB,EAAE;YACpC,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;YAClC,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;gBAClC,eAAM,CAAC,IAAI,CACT,0BAA0B,CAAC,iBAAiB,QAAQ,KAAK,SAAS,EAAE,CACrE,CAAA;aACF;YACD,IAAI,QAAQ,EAAE;gBACZ,MAAM,QAAQ,GAAG,QAAQ,IAAA,0BAAiB,EACxC,GAAG,EACH,qCAAiB,EACjB,QAAQ,CAAC,IAAI,CAAC,IAAI,CACnB,EAAE,CAAA;gBACH,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;oBAClC,eAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,QAAQ,GAAG,CAAC,CAAA;iBACtD;gBACD,oBAAoB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAA;aACnC;SACF;KACF;IACD,IAAA,sBAAa,EAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAA;IACzD,eAAM,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAA;IACvD,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE;QAClC,eAAM,CAAC,IAAI,CACT,4BAA4B,IAAI,CAAC,SAAS,CACxC,oBAAoB,EACpB,IAAI,EACJ,CAAC,CACF,EAAE,CACJ,CAAA;KACF;AACH,CAAC;AAhDD,wDAgDC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export interface BuildExecutorSchema {} // eslint-disable-line
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"version": 2,
|
|
4
|
-
"outputCapture": "direct-nodejs",
|
|
5
|
-
"title": "Typescript Build Target",
|
|
6
|
-
"description": "Builds using TypeScript.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"main": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"description": "The name of the main entry-point file.",
|
|
12
|
-
"x-completion-type": "file",
|
|
13
|
-
"x-completion-glob": "main@(.js|.ts|.jsx|.tsx)"
|
|
14
|
-
},
|
|
15
|
-
"rootDir": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"description": "Sets the rootDir for TypeScript compilation. When not defined, it uses the root of project."
|
|
18
|
-
},
|
|
19
|
-
"outputPath": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "The output path of the generated files.",
|
|
22
|
-
"x-completion-type": "directory"
|
|
23
|
-
},
|
|
24
|
-
"tsConfig": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "The path to the Typescript configuration file.",
|
|
27
|
-
"x-completion-type": "file",
|
|
28
|
-
"x-completion-glob": "tsconfig.*.json"
|
|
29
|
-
},
|
|
30
|
-
"assets": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"description": "List of static assets.",
|
|
33
|
-
"default": [],
|
|
34
|
-
"items": {
|
|
35
|
-
"$ref": "#/definitions/assetPattern"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"watch": {
|
|
39
|
-
"type": "boolean",
|
|
40
|
-
"description": "Enable re-building when files change.",
|
|
41
|
-
"default": false
|
|
42
|
-
},
|
|
43
|
-
"clean": {
|
|
44
|
-
"type": "boolean",
|
|
45
|
-
"description": "Remove previous output before build.",
|
|
46
|
-
"default": true
|
|
47
|
-
},
|
|
48
|
-
"transformers": {
|
|
49
|
-
"type": "array",
|
|
50
|
-
"description": "List of TypeScript Transformer Plugins.",
|
|
51
|
-
"default": [],
|
|
52
|
-
"items": {
|
|
53
|
-
"$ref": "#/definitions/transformerPattern"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"updateBuildableProjectDepsInPackageJson": {
|
|
57
|
-
"type": "boolean",
|
|
58
|
-
"description": "Whether to update the buildable project dependencies in `package.json`.",
|
|
59
|
-
"default": true
|
|
60
|
-
},
|
|
61
|
-
"buildableProjectDepsInPackageJsonType": {
|
|
62
|
-
"type": "string",
|
|
63
|
-
"description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
|
|
64
|
-
"enum": [
|
|
65
|
-
"dependencies",
|
|
66
|
-
"peerDependencies"
|
|
67
|
-
],
|
|
68
|
-
"default": "dependencies"
|
|
69
|
-
},
|
|
70
|
-
"external": {
|
|
71
|
-
"description": "A list projects to be treated as external. This feature is experimental",
|
|
72
|
-
"oneOf": [
|
|
73
|
-
{
|
|
74
|
-
"type": "string",
|
|
75
|
-
"enum": [
|
|
76
|
-
"all",
|
|
77
|
-
"none"
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"type": "array",
|
|
82
|
-
"items": {
|
|
83
|
-
"type": "string"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
"externalBuildTargets": {
|
|
89
|
-
"type": "array",
|
|
90
|
-
"items": {
|
|
91
|
-
"type": "string"
|
|
92
|
-
},
|
|
93
|
-
"description": "List of target names that annotate a build target for a project",
|
|
94
|
-
"default": [
|
|
95
|
-
"build"
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"required": [
|
|
100
|
-
"main",
|
|
101
|
-
"outputPath",
|
|
102
|
-
"tsConfig"
|
|
103
|
-
],
|
|
104
|
-
"definitions": {
|
|
105
|
-
"assetPattern": {
|
|
106
|
-
"oneOf": [
|
|
107
|
-
{
|
|
108
|
-
"type": "object",
|
|
109
|
-
"properties": {
|
|
110
|
-
"glob": {
|
|
111
|
-
"type": "string",
|
|
112
|
-
"description": "The pattern to match."
|
|
113
|
-
},
|
|
114
|
-
"input": {
|
|
115
|
-
"type": "string",
|
|
116
|
-
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
|
|
117
|
-
},
|
|
118
|
-
"ignore": {
|
|
119
|
-
"description": "An array of globs to ignore.",
|
|
120
|
-
"type": "array",
|
|
121
|
-
"items": {
|
|
122
|
-
"type": "string"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"output": {
|
|
126
|
-
"type": "string",
|
|
127
|
-
"description": "Absolute path within the output."
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
"additionalProperties": false,
|
|
131
|
-
"required": [
|
|
132
|
-
"glob",
|
|
133
|
-
"input",
|
|
134
|
-
"output"
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"type": "string"
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
|
-
"transformerPattern": {
|
|
143
|
-
"oneOf": [
|
|
144
|
-
{
|
|
145
|
-
"type": "string"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"type": "object",
|
|
149
|
-
"properties": {
|
|
150
|
-
"name": {
|
|
151
|
-
"type": "string"
|
|
152
|
-
},
|
|
153
|
-
"options": {
|
|
154
|
-
"type": "object",
|
|
155
|
-
"additionalProperties": true
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
"additionalProperties": false,
|
|
159
|
-
"required": [
|
|
160
|
-
"name"
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"examplesFile": "../../../docs/tsc-examples.md"
|
|
167
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "<%= name %>",
|
|
3
|
-
"description": "Firebase Functions package, auto generated by @simondotm/nx-firebase",
|
|
4
|
-
"scripts": {
|
|
5
|
-
"lint": "nx lint <%= name %>",
|
|
6
|
-
"build": "nx build <%= name %>",
|
|
7
|
-
"serve": "npm run build && firebase emulators:start --only functions --config <%= firebaseAppConfig %>",
|
|
8
|
-
"shell": "npm run build && firebase functions:shell",
|
|
9
|
-
"start": "npm run shell",
|
|
10
|
-
"deploy": "firebase deploy --only functions --config <%= firebaseAppConfig %>",
|
|
11
|
-
"logs": "firebase functions:log"
|
|
12
|
-
},
|
|
13
|
-
"engines": {
|
|
14
|
-
"node": " <%= firebaseNodeEngine %>"
|
|
15
|
-
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
},
|
|
20
|
-
"private": true
|
|
21
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ProjectConfiguration, Tree } from '@nx/devkit';
|
|
2
|
-
import type { NormalizedOptions } from '../schema';
|
|
3
|
-
export declare function getBuildTarget(project: ProjectConfiguration): {
|
|
4
|
-
executor: string;
|
|
5
|
-
outputs: string[];
|
|
6
|
-
options: {
|
|
7
|
-
outputPath: string;
|
|
8
|
-
main: string;
|
|
9
|
-
tsConfig: string;
|
|
10
|
-
packageJson: string;
|
|
11
|
-
assets: any[];
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export declare function getDeployTarget(options: NormalizedOptions): {
|
|
15
|
-
executor: string;
|
|
16
|
-
options: {
|
|
17
|
-
command: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare function getConfigTarget(projectRoot: string, options: NormalizedOptions): {
|
|
21
|
-
executor: string;
|
|
22
|
-
options: {
|
|
23
|
-
command: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export declare function getEmulateTarget(options: NormalizedOptions, project: ProjectConfiguration): {
|
|
27
|
-
executor: string;
|
|
28
|
-
options: {
|
|
29
|
-
commands: string[];
|
|
30
|
-
parallel: boolean;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare function getServeTarget(options: NormalizedOptions): {
|
|
34
|
-
executor: string;
|
|
35
|
-
options: {
|
|
36
|
-
commands: string[];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export declare function addProject(tree: Tree, options: NormalizedOptions): void;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addProject = exports.getServeTarget = exports.getEmulateTarget = exports.getConfigTarget = exports.getDeployTarget = exports.getBuildTarget = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
/**
|
|
8
|
-
* Return run-commands executor that is most compatible with host workspace version
|
|
9
|
-
*/
|
|
10
|
-
function getRunCommandsExecutor() {
|
|
11
|
-
// `nx:run-commands` executor is supported from Nx 14.8.0+
|
|
12
|
-
const supportsNxRunCommands = utils_1.workspaceNxVersion.versionCode >= 140800;
|
|
13
|
-
return supportsNxRunCommands
|
|
14
|
-
? 'nx:run-commands'
|
|
15
|
-
: '@nx/workspace:run-commands';
|
|
16
|
-
}
|
|
17
|
-
function getFirebaseProject(options) {
|
|
18
|
-
if (options.project) {
|
|
19
|
-
return ` --project ${options.project}`;
|
|
20
|
-
}
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
function getFirebaseConfig(options) {
|
|
24
|
-
if (options.firebaseConfigName) {
|
|
25
|
-
return ` --config ${options.firebaseConfigName}`;
|
|
26
|
-
}
|
|
27
|
-
return '';
|
|
28
|
-
}
|
|
29
|
-
function getBuildTarget(project) {
|
|
30
|
-
return {
|
|
31
|
-
executor: '@simondotm/nx-firebase:build',
|
|
32
|
-
outputs: ['{options.outputPath}'],
|
|
33
|
-
options: {
|
|
34
|
-
outputPath: (0, devkit_1.joinPathFragments)('dist', project.root),
|
|
35
|
-
main: (0, devkit_1.joinPathFragments)(project.sourceRoot, 'index.ts'),
|
|
36
|
-
tsConfig: (0, devkit_1.joinPathFragments)(project.root, 'tsconfig.app.json'),
|
|
37
|
-
packageJson: (0, devkit_1.joinPathFragments)(project.root, 'package.json'),
|
|
38
|
-
// no need to copy these assets anymore.
|
|
39
|
-
// .runtimeconfig.json cant be copied at build time because it is .gitignored and Nx also ignores it.
|
|
40
|
-
assets: [
|
|
41
|
-
// joinPathFragments(project.root, '*.md'),
|
|
42
|
-
// joinPathFragments(project.root, '.runtimeconfig.json'),
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
exports.getBuildTarget = getBuildTarget;
|
|
48
|
-
function getDeployTarget(options) {
|
|
49
|
-
return {
|
|
50
|
-
executor: getRunCommandsExecutor(),
|
|
51
|
-
options: {
|
|
52
|
-
command: `firebase deploy${getFirebaseConfig(options)}${getFirebaseProject(options)}`,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
exports.getDeployTarget = getDeployTarget;
|
|
57
|
-
function getConfigTarget(projectRoot, options) {
|
|
58
|
-
return {
|
|
59
|
-
executor: getRunCommandsExecutor(),
|
|
60
|
-
options: {
|
|
61
|
-
command: `firebase functions:config:get${getFirebaseConfig(options)}${getFirebaseProject(options)} > ${projectRoot}/.runtimeconfig.json`,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
exports.getConfigTarget = getConfigTarget;
|
|
66
|
-
function getEmulateTarget(options, project) {
|
|
67
|
-
return {
|
|
68
|
-
executor: getRunCommandsExecutor(),
|
|
69
|
-
options: {
|
|
70
|
-
commands: [
|
|
71
|
-
`node -e "setTimeout(()=>{},5000)"`,
|
|
72
|
-
`kill-port --port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500`,
|
|
73
|
-
`firebase functions:config:get ${getFirebaseConfig(options)}${getFirebaseProject(options)} > ${(0, devkit_1.joinPathFragments)('dist', project.root)}/.runtimeconfig.json`,
|
|
74
|
-
`firebase emulators:start ${getFirebaseConfig(options)}${getFirebaseProject(options)}`,
|
|
75
|
-
],
|
|
76
|
-
parallel: false,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
exports.getEmulateTarget = getEmulateTarget;
|
|
81
|
-
function getServeTarget(options) {
|
|
82
|
-
const workspaceSupportsNxWatch = utils_1.workspaceNxVersion.major >= 15 && utils_1.workspaceNxVersion.minor >= 4;
|
|
83
|
-
// From Nx 15.4.x+ we can use the new watch command which gives us the ability to rebuild the main project
|
|
84
|
-
// if any dependent libraries change.
|
|
85
|
-
// We have to do an initial build first to create the dist output, and then we watch for further changes, but with --clean, so that we dont delete the
|
|
86
|
-
// dist folder every build, because thats also being watched by the emulator.
|
|
87
|
-
// Otherwise, the only option is to just use `tsc --watch` which only detects changes to the main project.
|
|
88
|
-
const commands = workspaceSupportsNxWatch
|
|
89
|
-
? [
|
|
90
|
-
`nx run ${options.projectName}:build && nx watch --projects=${options.projectName} --includeDependentProjects -- nx build ${options.projectName} --clean=false`,
|
|
91
|
-
`nx run ${options.projectName}:emulate`,
|
|
92
|
-
]
|
|
93
|
-
: [
|
|
94
|
-
`nx run ${options.projectName}:build --watch`,
|
|
95
|
-
`nx run ${options.projectName}:emulate`,
|
|
96
|
-
];
|
|
97
|
-
return {
|
|
98
|
-
executor: getRunCommandsExecutor(),
|
|
99
|
-
options: {
|
|
100
|
-
commands,
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
exports.getServeTarget = getServeTarget;
|
|
105
|
-
function addProject(tree, options) {
|
|
106
|
-
const project = (0, devkit_2.readProjectConfiguration)(tree, options.projectName);
|
|
107
|
-
project.targets.build = getBuildTarget(project);
|
|
108
|
-
project.targets.deploy = getDeployTarget(options);
|
|
109
|
-
project.targets.getconfig = getConfigTarget(project.root, options);
|
|
110
|
-
project.targets.emulate = getEmulateTarget(options, project);
|
|
111
|
-
project.targets.serve = getServeTarget(options);
|
|
112
|
-
(0, devkit_2.updateProjectConfiguration)(tree, options.projectName, project);
|
|
113
|
-
}
|
|
114
|
-
exports.addProject = addProject;
|
|
115
|
-
//# sourceMappingURL=add-project.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete-files.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/delete-files.ts"],"names":[],"mappings":";;;AACA,uCAA8C;AAG9C;;;;GAIG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAA0B;IAChE,MAAM,iBAAiB,GAAG;QACxB,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC;QACxD,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;QAChE,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC;QACnE,IAAA,0BAAiB,EACf,OAAO,CAAC,WAAW,EACnB,KAAK,EACL,cAAc,EACd,qBAAqB,CACtB;QACD,IAAA,0BAAiB,EACf,OAAO,CAAC,WAAW,EACnB,KAAK,EACL,cAAc,EACd,gBAAgB,CACjB;KACF,CAAA;IAED,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE;QACpC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAClB;AACH,CAAC;AAtBD,kCAsBC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import type { Schema as NodeApplicationGeneratorOptions } from '@nx/node/src/generators/application/schema';
|
|
3
|
-
import type { ApplicationGeneratorOptions, NormalizedOptions } from '../schema';
|
|
4
|
-
export declare function normalizeOptions(tree: Tree, options: ApplicationGeneratorOptions): NormalizedOptions;
|
|
5
|
-
export declare function toNodeApplicationGeneratorOptions(options: NormalizedOptions): NodeApplicationGeneratorOptions;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toNodeApplicationGeneratorOptions = exports.normalizeOptions = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const linter_1 = require("@nx/linter");
|
|
6
|
-
function normalizeOptions(tree, options) {
|
|
7
|
-
var _a, _b;
|
|
8
|
-
// see https://github.com/nrwl/nx/blob/84cbcb7e105cd2b3bf5b3d84a519e5c52951e0f3/packages/js/src/generators/library/library.ts#L332
|
|
9
|
-
// for how the project name is derived from options.name and --directory
|
|
10
|
-
const name = (0, devkit_1.names)(options.name).fileName;
|
|
11
|
-
const projectDirectory = options.directory
|
|
12
|
-
? `${(0, devkit_1.names)(options.directory).fileName}/${name}`
|
|
13
|
-
: name;
|
|
14
|
-
const projectRoot = (0, devkit_1.joinPathFragments)((0, devkit_1.getWorkspaceLayout)(tree).appsDir, projectDirectory);
|
|
15
|
-
const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');
|
|
16
|
-
const firebaseConfigName = tree.exists('firebase.json')
|
|
17
|
-
? `firebase.${projectName}.json`
|
|
18
|
-
: 'firebase.json';
|
|
19
|
-
// make sure this firebase config name is unique.
|
|
20
|
-
// shouldn't happen as nx already enforces unique project names
|
|
21
|
-
if (tree.exists(firebaseConfigName)) {
|
|
22
|
-
throw Error(`There is already a firebase configuration called '${firebaseConfigName}' in this workspace. Please try a different project name.`);
|
|
23
|
-
}
|
|
24
|
-
return Object.assign(Object.assign({}, options), { projectRoot,
|
|
25
|
-
projectName,
|
|
26
|
-
firebaseConfigName, linter: (_a = options.linter) !== null && _a !== void 0 ? _a : linter_1.Linter.EsLint, unitTestRunner: (_b = options.unitTestRunner) !== null && _b !== void 0 ? _b : 'jest' });
|
|
27
|
-
}
|
|
28
|
-
exports.normalizeOptions = normalizeOptions;
|
|
29
|
-
function toNodeApplicationGeneratorOptions(options) {
|
|
30
|
-
return {
|
|
31
|
-
name: options.name,
|
|
32
|
-
directory: options.directory,
|
|
33
|
-
frontendProject: options.frontendProject,
|
|
34
|
-
linter: options.linter,
|
|
35
|
-
skipFormat: true,
|
|
36
|
-
skipPackageJson: options.skipPackageJson,
|
|
37
|
-
standaloneConfig: options.standaloneConfig,
|
|
38
|
-
tags: options.tags,
|
|
39
|
-
unitTestRunner: options.unitTestRunner,
|
|
40
|
-
setParserOptionsProject: options.setParserOptionsProject,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
exports.toNodeApplicationGeneratorOptions = toNodeApplicationGeneratorOptions;
|
|
44
|
-
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,uCAAyE;AACzE,uCAAmC;AAInC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAoC;;IAEpC,kIAAkI;IAClI,wEAAwE;IACxE,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAA;IACzC,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS;QACxC,CAAC,CAAC,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,IAAI,IAAI,EAAE;QAChD,CAAC,CAAC,IAAI,CAAA;IAER,MAAM,WAAW,GAAG,IAAA,0BAAiB,EACnC,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC,OAAO,EAChC,gBAAgB,CACjB,CAAA;IAED,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;IAEvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;QACrD,CAAC,CAAC,YAAY,WAAW,OAAO;QAChC,CAAC,CAAC,eAAe,CAAA;IAEnB,iDAAiD;IACjD,+DAA+D;IAC/D,IAAI,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE;QACnC,MAAM,KAAK,CACT,qDAAqD,kBAAkB,2DAA2D,CACnI,CAAA;KACF;IAED,uCACK,OAAO,KACV,WAAW;QACX,WAAW;QACX,kBAAkB,EAClB,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,eAAM,CAAC,MAAM,EACvC,cAAc,EAAE,MAAA,OAAO,CAAC,cAAc,mCAAI,MAAM,IACjD;AACH,CAAC;AAtCD,4CAsCC;AAED,SAAgB,iCAAiC,CAC/C,OAA0B;IAE1B,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;KACzD,CAAA;AACH,CAAC;AAfD,8EAeC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import type { NormalizedOptions } from '../schema';
|
|
3
|
-
/**
|
|
4
|
-
* With firebase cli > 10.0.1 now compatible with node versions >=14 we can use es modules rather than commonjs
|
|
5
|
-
*
|
|
6
|
-
* @param tree
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
|
-
export declare function updateTsConfig(tree: Tree, options: NormalizedOptions): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-tsconfig.js","sourceRoot":"","sources":["../../../../../../../packages/nx-firebase/src/generators/application/lib/update-tsconfig.ts"],"names":[],"mappings":";;;AACA,uCAA0D;AAC1D,0CAA+C;AAG/C;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,IAAU,EAAE,OAA0B;IACnE,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAC3D,CAAC,IAAI,EAAE,EAAE;QACP,IAAI,CAAC,eAAe,CAAC,qBAAqB,GAAG,IAAI,CAAA;QACjD,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,sBAAc,CAAA;QAC5C,OAAO,IAAI,CAAA;IACb,CAAC,CACF,CAAA;AACH,CAAC;AAVD,wCAUC"}
|
package/src/utils/e2ePatch.d.ts
DELETED
package/src/utils/e2ePatch.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
// e2e patch from old nx-firebase plugin
|
|
4
|
-
// monkeypatch to ensure nx plugin e2e tests have the correct workspace for createProjectGraph()
|
|
5
|
-
// https://github.com/nrwl/nx/issues/5065
|
|
6
|
-
import * as path from 'path'
|
|
7
|
-
import * as fs from 'fs'
|
|
8
|
-
function patchAppRoot(): string {
|
|
9
|
-
const cwd = process.cwd()
|
|
10
|
-
const e2e = cwd.includes('nx-e2e')
|
|
11
|
-
function pathInner(dir: string): string {
|
|
12
|
-
if (process.env.NX_WORKSPACE_ROOT_PATH)
|
|
13
|
-
return process.env.NX_WORKSPACE_ROOT_PATH
|
|
14
|
-
if (path.dirname(dir) === dir) return cwd
|
|
15
|
-
if (
|
|
16
|
-
fs.existsSync(path.join(dir, 'workspace.json')) ||
|
|
17
|
-
fs.existsSync(path.join(dir, 'angular.json'))
|
|
18
|
-
) {
|
|
19
|
-
return dir
|
|
20
|
-
} else {
|
|
21
|
-
return pathInner(path.dirname(dir))
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const appRoot = pathInner(cwd)
|
|
25
|
-
|
|
26
|
-
//console.log("cwd=" + cwd)
|
|
27
|
-
//console.log("is e2e=" + e2e)
|
|
28
|
-
//console.log("appRoot=" + appRoot)
|
|
29
|
-
|
|
30
|
-
//only patch the workspace rootpath if we are running in an nx-e2e workspace path
|
|
31
|
-
if (e2e) {
|
|
32
|
-
process.env.NX_WORKSPACE_ROOT_PATH = appRoot
|
|
33
|
-
console.log(
|
|
34
|
-
"e2e appRoot PATCHED from __dirname '" +
|
|
35
|
-
__dirname +
|
|
36
|
-
"' to '" +
|
|
37
|
-
appRoot +
|
|
38
|
-
"'",
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
return appRoot
|
|
42
|
-
}
|
|
43
|
-
export const e2eAppRoot = patchAppRoot()
|
|
44
|
-
*/
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.e2eAppRoot = exports.fileExists = void 0;
|
|
47
|
-
// NEEDED FOR NX13 ONLY - FIXED AT SOMEPOINT FROM 14.x to 15.x
|
|
48
|
-
// monkeypatch to ensure nx plugin e2e tests have the correct workspace for createProjectGraph()
|
|
49
|
-
// https://github.com/nrwl/nx/issues/5065
|
|
50
|
-
const path = require("path");
|
|
51
|
-
const fs_1 = require("fs");
|
|
52
|
-
// import { logger, readJsonFile } from '@nx/devkit'
|
|
53
|
-
// from https://github.com/nrwl/nx/blob/803d5ff126d20d1116d3a505233ddf7d971688d6/packages/nx/src/utils/app-root.ts#L9
|
|
54
|
-
function fileExists(filePath) {
|
|
55
|
-
try {
|
|
56
|
-
return (0, fs_1.statSync)(filePath).isFile();
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.fileExists = fileExists;
|
|
63
|
-
// this function determines the current workspace root
|
|
64
|
-
// it unwraps 'dir' until it reaches an nx workspace root.
|
|
65
|
-
// OR, if NX_WORKSPACE_ROOT_PATH environment var is defined, it will use that instead.
|
|
66
|
-
function pathInner(dir) {
|
|
67
|
-
if (process.env.NX_WORKSPACE_ROOT_PATH)
|
|
68
|
-
return process.env.NX_WORKSPACE_ROOT_PATH;
|
|
69
|
-
// console.log(`pathInner(${dir})`)
|
|
70
|
-
if (path.dirname(dir) === dir)
|
|
71
|
-
return process.cwd();
|
|
72
|
-
// console.log(`not returning cwd, checking next level`)
|
|
73
|
-
if (fileExists(path.join(dir, 'workspace.json')) ||
|
|
74
|
-
fileExists(path.join(dir, 'nx.json')) ||
|
|
75
|
-
fileExists(path.join(dir, 'angular.json'))) {
|
|
76
|
-
// console.log(`found root, returning dir=${dir}`)
|
|
77
|
-
return dir;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
// console.log(`not found root, recursing on dir=${dir}`)
|
|
81
|
-
return pathInner(path.dirname(dir));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// function patchAppRoot(): string {
|
|
85
|
-
// const cwd = process.cwd()
|
|
86
|
-
// console.log('NX_WORKSPACE_ROOT_PATH=' + process.env.NX_WORKSPACE_ROOT_PATH)
|
|
87
|
-
// console.log(`cwd=${cwd}`)
|
|
88
|
-
// const appRootPath = pathInner(__dirname)
|
|
89
|
-
// console.log('--------')
|
|
90
|
-
// // determine if plugin is being run from somewhere other than cwd
|
|
91
|
-
// const needsPatching = pathInner(cwd) !== pathInner(__dirname)
|
|
92
|
-
// const e2e = cwd.includes('nx-e2e')
|
|
93
|
-
// // for our patch, we are using cwd instead of __dirname
|
|
94
|
-
// const appRoot = pathInner(cwd)
|
|
95
|
-
// //needsPatching patch the workspace rootpath if we are running in an nx-e2e workspace path
|
|
96
|
-
// if (e2e) {
|
|
97
|
-
// //needsPatching) {
|
|
98
|
-
// console.log('cwd=' + cwd)
|
|
99
|
-
// console.log('is e2e=' + e2e)
|
|
100
|
-
// console.log('appRoot=' + appRoot)
|
|
101
|
-
// process.env.NX_WORKSPACE_ROOT_PATH = appRoot
|
|
102
|
-
// console.log(
|
|
103
|
-
// "appRoot PATCHED from __dirname '" + __dirname + "' to '" + appRoot + "'",
|
|
104
|
-
// )
|
|
105
|
-
// }
|
|
106
|
-
// return appRoot
|
|
107
|
-
// }
|
|
108
|
-
function patchAppRoot() {
|
|
109
|
-
let appRoot = process.env.NX_WORKSPACE_ROOT_PATH;
|
|
110
|
-
if (!appRoot) {
|
|
111
|
-
const cwd = process.cwd();
|
|
112
|
-
// console.log('NX_WORKSPACE_ROOT_PATH=' + process.env.NX_WORKSPACE_ROOT_PATH)
|
|
113
|
-
// console.log(`cwd=${cwd}`)
|
|
114
|
-
const pluginAppRootPath = pathInner(__dirname);
|
|
115
|
-
const cwdAppRootPath = pathInner(cwd);
|
|
116
|
-
// console.log('--------')
|
|
117
|
-
if (pluginAppRootPath !== cwdAppRootPath) {
|
|
118
|
-
// plugin is located in a different workspace, so patch the NX_WORKSPACE_ROOT_PATH
|
|
119
|
-
appRoot = cwdAppRootPath;
|
|
120
|
-
process.env.NX_WORKSPACE_ROOT_PATH = appRoot;
|
|
121
|
-
// logger.warn(
|
|
122
|
-
// `WARNING: @simondotm/nx-firebase plugin is located outside this workspace, NX_WORKSPACE_ROOT_PATH has been set to ${appRoot}`,
|
|
123
|
-
// )
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
appRoot = pluginAppRootPath;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
// logger.warn(`NX_WORKSPACE_ROOT_PATH is set to ${appRoot}`)
|
|
131
|
-
}
|
|
132
|
-
return appRoot;
|
|
133
|
-
}
|
|
134
|
-
exports.e2eAppRoot = patchAppRoot();
|
|
135
|
-
//# sourceMappingURL=e2ePatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"e2ePatch.js","sourceRoot":"","sources":["../../../../../packages/nx-firebase/src/utils/e2ePatch.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CE;;;AAEF,8DAA8D;AAC9D,gGAAgG;AAChG,yCAAyC;AACzC,6BAA4B;AAE5B,2BAA6B;AAE7B,oDAAoD;AAEpD,qHAAqH;AACrH,SAAgB,UAAU,CAAC,QAAgB;IACzC,IAAI;QACF,OAAO,IAAA,aAAQ,EAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAA;KACnC;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;AACH,CAAC;AAND,gCAMC;AAED,sDAAsD;AACtD,0DAA0D;AAC1D,sFAAsF;AACtF,SAAS,SAAS,CAAC,GAAW;IAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB;QACpC,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAA;IAC3C,qCAAqC;IACrC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,GAAG,EAAE,CAAA;IACnD,0DAA0D;IAC1D,IACE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;QAC5C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACrC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAC1C;QACA,kDAAkD;QAClD,OAAO,GAAG,CAAA;KACX;SAAM;QACL,yDAAyD;QACzD,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;KACpC;AACH,CAAC;AAED,oCAAoC;AACpC,8BAA8B;AAC9B,gFAAgF;AAChF,8BAA8B;AAC9B,6CAA6C;AAE7C,4BAA4B;AAE5B,sEAAsE;AACtE,kEAAkE;AAClE,uCAAuC;AAEvC,4DAA4D;AAC5D,mCAAmC;AAEnC,+FAA+F;AAC/F,eAAe;AACf,yBAAyB;AACzB,gCAAgC;AAChC,mCAAmC;AACnC,wCAAwC;AAExC,mDAAmD;AACnD,mBAAmB;AACnB,mFAAmF;AACnF,QAAQ;AACR,MAAM;AACN,mBAAmB;AACnB,IAAI;AAEJ,SAAS,YAAY;IACnB,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAA;IAEhD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;QACzB,8EAA8E;QAC9E,4BAA4B;QAC5B,MAAM,iBAAiB,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;QAC9C,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QACrC,0BAA0B;QAE1B,IAAI,iBAAiB,KAAK,cAAc,EAAE;YACxC,kFAAkF;YAClF,OAAO,GAAG,cAAc,CAAA;YACxB,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,OAAO,CAAA;YAC5C,iBAAiB;YACjB,qIAAqI;YACrI,MAAM;SACP;aAAM;YACL,OAAO,GAAG,iBAAiB,CAAA;SAC5B;KACF;SAAM;QACL,6DAA6D;KAC9D;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAEY,QAAA,UAAU,GAAG,YAAY,EAAE,CAAA"}
|
|
File without changes
|