@trackunit/iris-app 0.0.204 → 0.0.206
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/CHANGELOG.md +10 -0
- package/package.json +50 -50
- package/src/executors/build/executor.js +4 -4
- package/src/executors/build/executor.js.map +1 -1
- package/src/executors/serve/executor.js +0 -2
- package/src/executors/serve/executor.js.map +1 -1
- package/src/executors/utils/checkPackageVersion.d.ts +2 -2
- package/src/executors/utils/checkPackageVersion.js +8 -9
- package/src/executors/utils/checkPackageVersion.js.map +1 -1
- package/src/executors/utils/version.js +1 -1
- package/src/executors/utils/version.js.map +1 -1
- package/src/generators/extend/generator.js +2 -2
- package/src/generators/extend/generator.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.0.206](https://github.com/Trackunit/manager/compare/iris-app/0.0.205...iris-app/0.0.206) (2023-04-17)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `iris-app-build-utilities` updated to version `0.0.114`
|
|
10
|
+
## [0.0.205](https://github.com/Trackunit/manager/compare/iris-app/0.0.204...iris-app/0.0.205) (2023-04-14)
|
|
11
|
+
|
|
12
|
+
### Dependency Updates
|
|
13
|
+
|
|
14
|
+
* `iris-app-build-utilities` updated to version `0.0.113`
|
|
5
15
|
## [0.0.204](https://github.com/Trackunit/manager/compare/iris-app/0.0.203...iris-app/0.0.204) (2023-04-13)
|
|
6
16
|
|
|
7
17
|
### Dependency Updates
|
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.206",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"generators": "./generators.json",
|
|
7
7
|
"executors": "./executors.json",
|
|
8
8
|
"repository": "https://github.com/Trackunit/manager",
|
|
9
9
|
"dependencies": {
|
|
10
|
+
"@react-google-maps/api": "2.17.1",
|
|
11
|
+
"@react-spring/web": "9.6.0",
|
|
12
|
+
"camelcase": "5.3.1",
|
|
13
|
+
"csp-header": "5.1.0",
|
|
14
|
+
"csstype": "3.1.1",
|
|
15
|
+
"echarts": "5.4.0",
|
|
16
|
+
"enquirer": "2.3.6",
|
|
17
|
+
"get-port": "5.1.1",
|
|
18
|
+
"i18next": "21.10.0",
|
|
19
|
+
"jest-canvas-mock": "2.4.0",
|
|
20
|
+
"libnpmpublish": "7.1.2",
|
|
21
|
+
"moment-timezone": "0.5.39",
|
|
22
|
+
"node-fetch": "2.6.8",
|
|
23
|
+
"open": "8.4.0",
|
|
24
|
+
"pacote": "13.6.2",
|
|
25
|
+
"penpal": "6.2.2",
|
|
10
26
|
"postcss": "8.4.19",
|
|
11
|
-
"react": "
|
|
27
|
+
"react": "18.2.0",
|
|
12
28
|
"react-dom": "18.2.0",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
29
|
+
"react-i18next": "12.1.1",
|
|
30
|
+
"react-virtualized-auto-sizer": "1.0.7",
|
|
31
|
+
"rxjs": "7.6.0",
|
|
32
|
+
"semver": "7.3.8",
|
|
16
33
|
"tsconfig-paths": "3.14.1",
|
|
17
|
-
"@
|
|
18
|
-
"@trackunit/css-components": "0.0.313",
|
|
19
|
-
"@trackunit/css-core": "0.0.79",
|
|
20
|
-
"@trackunit/ui-design-tokens": "0.0.65",
|
|
21
|
-
"@trackunit/tailwind-styled-components": "0.0.55",
|
|
22
|
-
"react-use": "17.4.0",
|
|
23
|
-
"react-day-picker": "8.3.7",
|
|
24
|
-
"date-fns": "2.29.3",
|
|
25
|
-
"@floating-ui/react": "0.22.2",
|
|
26
|
-
"@heroicons/react": "2.0.16",
|
|
34
|
+
"@apollo/client": "3.7.10",
|
|
27
35
|
"@babel/core": "7.18.9",
|
|
28
36
|
"@babel/template": "7.18.10",
|
|
29
|
-
"
|
|
37
|
+
"@floating-ui/react": "0.22.2",
|
|
38
|
+
"@heroicons/react": "2.0.16",
|
|
39
|
+
"@sentry/browser": "7.24.2",
|
|
40
|
+
"@trackunit/css-component-tokens": "0.0.24",
|
|
41
|
+
"@trackunit/css-components": "0.0.315",
|
|
42
|
+
"@trackunit/css-core": "0.0.80",
|
|
43
|
+
"@trackunit/css-tailwind": "0.0.50",
|
|
44
|
+
"@trackunit/css-tailwind-custom-properties-plugin": "0.0.16",
|
|
45
|
+
"@trackunit/i18n-library-translation": "0.0.38",
|
|
46
|
+
"@trackunit/iris-app-api": "0.0.85",
|
|
47
|
+
"@trackunit/iris-app-build-utilities": "0.0.114",
|
|
48
|
+
"@trackunit/iris-app-runtime-core": "0.3.27",
|
|
49
|
+
"@trackunit/iris-app-runtime-core-api": "0.3.25",
|
|
50
|
+
"@trackunit/iris-app-webpack-plugin": "0.0.95",
|
|
51
|
+
"@trackunit/react-core-contexts-api": "0.2.24",
|
|
52
|
+
"@trackunit/react-core-contexts-test": "0.1.44",
|
|
53
|
+
"@trackunit/react-core-hooks": "0.2.40",
|
|
54
|
+
"@trackunit/tailwind-styled-components": "0.0.55",
|
|
55
|
+
"@trackunit/ui-design-tokens": "0.0.66",
|
|
56
|
+
"@trackunit/ui-icons": "0.0.63",
|
|
30
57
|
"capitalize": "2.0.4",
|
|
58
|
+
"date-fns": "2.29.3",
|
|
31
59
|
"glob": "7.2.3",
|
|
32
|
-
"react-useportal": "1.0.17",
|
|
33
|
-
"react-router-dom": "6.4.5",
|
|
34
|
-
"react-helmet-async": "1.3.0",
|
|
35
|
-
"jest-canvas-mock": "2.4.0",
|
|
36
|
-
"@react-google-maps/api": "2.17.1",
|
|
37
|
-
"react-virtualized-auto-sizer": "1.0.7",
|
|
38
|
-
"@react-spring/web": "9.6.0",
|
|
39
|
-
"moment-timezone": "0.5.39",
|
|
40
|
-
"react-i18next": "12.1.1",
|
|
41
|
-
"@trackunit/react-core-contexts-test": "0.1.43",
|
|
42
|
-
"@apollo/client": "3.7.10",
|
|
43
|
-
"@trackunit/react-core-contexts-api": "0.2.23",
|
|
44
|
-
"@trackunit/react-core-hooks": "0.2.39",
|
|
45
|
-
"@trackunit/iris-app-runtime-core": "0.3.26",
|
|
46
|
-
"@trackunit/iris-app-runtime-core-api": "0.3.24",
|
|
47
60
|
"graphql": "15.8.0",
|
|
48
|
-
"@trackunit/i18n-library-translation": "0.0.38",
|
|
49
|
-
"i18next": "21.10.0",
|
|
50
61
|
"i18next-browser-languagedetector": "6.1.8",
|
|
51
62
|
"i18next-resources-to-backend": "1.1.0",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"get-port": "5.1.1",
|
|
58
|
-
"node-fetch": "2.6.8",
|
|
59
|
-
"rxjs": "7.6.0",
|
|
60
|
-
"libnpmpublish": "7.1.2",
|
|
61
|
-
"open": "8.4.0",
|
|
62
|
-
"pacote": "13.6.2",
|
|
63
|
-
"semver": "7.3.8",
|
|
64
|
-
"@trackunit/iris-app-webpack-plugin": "0.0.95",
|
|
65
|
-
"csp-header": "5.1.0",
|
|
66
|
-
"enquirer": "2.3.6",
|
|
63
|
+
"react-day-picker": "8.7.1",
|
|
64
|
+
"react-helmet-async": "1.3.0",
|
|
65
|
+
"react-router-dom": "6.4.5",
|
|
66
|
+
"react-use": "17.4.0",
|
|
67
|
+
"react-useportal": "1.0.17",
|
|
67
68
|
"tslib": "2.4.1"
|
|
68
69
|
},
|
|
69
|
-
"types": "./src/index.d.ts"
|
|
70
|
-
"peerDependencies": {}
|
|
70
|
+
"types": "./src/index.d.ts"
|
|
71
71
|
}
|
|
@@ -27,11 +27,11 @@ const deleteOutputDir = (root, outputPath) => {
|
|
|
27
27
|
*/
|
|
28
28
|
async function* default_1(options, context) {
|
|
29
29
|
await (0, checkPackageVersion_1.checkPackageVersion)(false);
|
|
30
|
-
if (!context.
|
|
31
|
-
throw new Error("context
|
|
30
|
+
if (!context.projectsConfigurations) {
|
|
31
|
+
throw new Error("context projectsConfigurations is required");
|
|
32
32
|
}
|
|
33
|
-
const projectRootDir = (0, path_1.join)(context.root, context.
|
|
34
|
-
const tileManifestPath = (0, path_1.join)(context.root, context.
|
|
33
|
+
const projectRootDir = (0, path_1.join)(context.root, context.projectsConfigurations.projects[context.projectName].root);
|
|
34
|
+
const tileManifestPath = (0, path_1.join)(context.root, context.projectsConfigurations.projects[context.projectName].root, "iris-app-manifest.ts");
|
|
35
35
|
(0, iris_app_build_utilities_1.enableTsConfigPath)({
|
|
36
36
|
projectRootDir,
|
|
37
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/build/executor.ts"],"names":[],"mappings":";;;;AAEA,0EAAsE;AACtE,kFAAyE;AACzE,2BAA4B;AAC5B,+BAAqC;AAErC,2DAAqC;AAErC,8BAA4B;AAC5B,sEAAmE;AACnE,wEAAiE;AAEjE,uCAAyC;AAOzC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAE,EAAE;IAC3D,MAAM,kBAAkB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,kBAAkB,KAAK,IAAI,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;KACpE;IACD,IAAA,WAAM,EAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,WAAE,OAA4B,EAAE,OAAwB;IACpF,MAAM,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/build/executor.ts"],"names":[],"mappings":";;;;AAEA,0EAAsE;AACtE,kFAAyE;AACzE,2BAA4B;AAC5B,+BAAqC;AAErC,2DAAqC;AAErC,8BAA4B;AAC5B,sEAAmE;AACnE,wEAAiE;AAEjE,uCAAyC;AAOzC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAE,EAAE;IAC3D,MAAM,kBAAkB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,kBAAkB,KAAK,IAAI,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;KACpE;IACD,IAAA,WAAM,EAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,WAAE,OAA4B,EAAE,OAAwB;IACpF,MAAM,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KAC/D;IACD,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,sBAAsB,CAAC,QAAS,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/G,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAC3B,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,EAClE,sBAAsB,CACvB,CAAC;IACF,IAAA,6CAAkB,EAAC;QACjB,cAAc;KACf,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KACrD;IACD,MAAM,eAAe,GAAG,CAAC,YAAa,gBAAgB,kEAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,aAAa,GAAG,IAAA,uCAAgB,EAAC,YAAY,EAAE,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IACpG,MAAM,gBAAgB,GAAG,YAAa,OAAO,CAAC,aAAa,kEAAC,CAAC;IAE7D,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7D,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,IAAA,sBAAY,EAAC,MAAM,CAAC,CAAC,IAAI,CAC1C,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACb,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,EACF,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACb,OAAO;YACL,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE;YAC3B,OAAO,EAAE,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;SACjC,CAAC;IACtB,CAAC,CAAC,CACH,CAAC;IACF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAwC,CAAC,CAAC;AACxE,CAAC;AApCD,4BAoCC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nrwl/devkit\";\nimport { eachValueFrom } from \"@nrwl/devkit/src/utils/rxjs-for-await\";\nimport { enableTsConfigPath } from \"@trackunit/iris-app-build-utilities\";\nimport { rmSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport { Observable } from \"rxjs\";\nimport * as op from \"rxjs/operators\";\n\nimport \"webpack-dev-server\";\nimport { checkPackageVersion } from \"../utils/checkPackageVersion\";\nimport { getDefaultConfig } from \"../utils/defaultWebpackConfig\";\nimport { BuildExecutorSchema } from \"./schema\";\nimport { doRunWebpack } from \"./webpack\";\n\nexport type NodeBuildEvent = {\n outfile: string;\n success: boolean;\n};\n\nconst deleteOutputDir = (root: string, outputPath: string) => {\n const resolvedOutputPath = resolve(root, outputPath);\n if (resolvedOutputPath === root) {\n throw new Error(\"Output path MUST not be project root directory!\");\n }\n rmSync(resolvedOutputPath, { recursive: true, force: true });\n};\n\n/**\n * Build executor for building iris apps.\n *\n * @param {BuildExecutorSchema} options build executor options for this nx executor\n * @param {ExecutorContext} context build executor context for this nx executor\n * @yields {NodeBuildEvent} the build event\n */\nexport default async function* (options: BuildExecutorSchema, context: ExecutorContext) {\n await checkPackageVersion(false);\n if (!context.projectsConfigurations) {\n throw new Error(\"context projectsConfigurations is required\");\n }\n const projectRootDir = join(context.root, context.projectsConfigurations.projects![context.projectName!].root);\n const tileManifestPath = join(\n context.root,\n context.projectsConfigurations.projects[context.projectName!].root,\n \"iris-app-manifest.ts\"\n );\n enableTsConfigPath({\n projectRootDir,\n });\n if (!options.webpackConfig) {\n throw new Error(\"option.webpackConfig is required\");\n }\n const IrisAppManifest = (await import(tileManifestPath)).default;\n const defaultConfig = getDefaultConfig(\"production\", context.root, projectRootDir, IrisAppManifest);\n const customConfigFile = await import(options.webpackConfig);\n\n const config = await customConfigFile.default(defaultConfig);\n deleteOutputDir(context.root, options.outputPath);\n const observable = doRunWebpack(config).pipe(\n op.tap(stats => {\n // eslint-disable-next-line no-console\n console.info(stats.toString(config.stats));\n }),\n op.map(stats => {\n return {\n success: !stats.hasErrors(),\n outfile: resolve(context.root, options.outputPath),\n } as NodeBuildEvent;\n })\n );\n return yield* eachValueFrom(observable as unknown as Observable<any>);\n}\n"]}
|
|
@@ -3,7 +3,6 @@ var _a, _b;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const rxjs_for_await_1 = require("@nrwl/devkit/src/utils/rxjs-for-await");
|
|
6
|
-
const get_emitted_files_1 = require("@nrwl/webpack/src/executors/webpack/lib/get-emitted-files");
|
|
7
6
|
const iris_app_build_utilities_1 = require("@trackunit/iris-app-build-utilities");
|
|
8
7
|
const path_1 = require("path");
|
|
9
8
|
const op = tslib_1.__importStar(require("rxjs/operators"));
|
|
@@ -41,7 +40,6 @@ async function* default_1(options, context) {
|
|
|
41
40
|
}), op.map(({ baseUrl, stats }) => {
|
|
42
41
|
return {
|
|
43
42
|
baseUrl,
|
|
44
|
-
emittedFiles: (0, get_emitted_files_1.getEmittedFiles)(stats),
|
|
45
43
|
success: !stats.hasErrors(),
|
|
46
44
|
};
|
|
47
45
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/serve/executor.ts"],"names":[],"mappings":";;;;AAEA,0EAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/serve/executor.ts"],"names":[],"mappings":";;;;AAEA,0EAAsE;AACtE,kFAAyE;AACzE,+BAA4B;AAE5B,2DAAqC;AAErC,8BAA4B;AAC5B,sEAAmE;AACnE,wEAAiE;AAEjE,yDAA2D;AAI3D;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,WAAE,OAA4B,EAAE,OAAwB;IACpF,MAAM,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,OA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AAwC,CAAC,CAAC;AACxE,CAAC;AArCD,4BAqCC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nrwl/devkit\";\nimport { eachValueFrom } from \"@nrwl/devkit/src/utils/rxjs-for-await\";\nimport { enableTsConfigPath } from \"@trackunit/iris-app-build-utilities\";\nimport { join } from \"path\";\nimport { Observable } from \"rxjs\";\nimport * as op from \"rxjs/operators\";\n\nimport \"webpack-dev-server\";\nimport { checkPackageVersion } from \"../utils/checkPackageVersion\";\nimport { getDefaultConfig } from \"../utils/defaultWebpackConfig\";\nimport { ServeExecutorSchema } from \"./schema\";\nimport { doRunWebpackDevServer } from \"./webpackDevServer\";\n\nimport type webpack = require(\"webpack\");\n\n/**\n * Serve executor for serving iris apps.\n *\n * @param {ServeExecutorSchema} options serve executor options for this nx executor\n * @param {ExecutorContext} context serve executor context for this nx executor\n * @yields {AsyncGenerator<any, void, unknown>} the serve observable\n */\nexport default async function* (options: ServeExecutorSchema, context: ExecutorContext) {\n await checkPackageVersion(false);\n if (!context.workspace) {\n throw new Error(\"context workspace is required\");\n }\n const projectRootDir = join(context.root, context.workspace.projects[context.projectName!].root);\n const tileManifestPath = join(\n context.root,\n context.workspace.projects[context.projectName!].root,\n \"iris-app-manifest.ts\"\n );\n enableTsConfigPath({\n projectRootDir,\n });\n if (!options.webpackConfig) {\n throw new Error(\"option.webpackConfig is required\");\n }\n const IrisAppManifest = (await import(tileManifestPath)).default;\n const defaultConfig = getDefaultConfig(\"development\", context.root, projectRootDir, IrisAppManifest);\n const customConfigFile = await import(options.webpackConfig);\n\n const config = await customConfigFile.default(defaultConfig);\n\n const observable = doRunWebpackDevServer(config).pipe(\n op.tap(({ stats }) => {\n // eslint-disable-next-line no-console\n console.info(stats.toString((config as webpack.Configuration).stats));\n }),\n op.map(({ baseUrl, stats }) => {\n return {\n baseUrl,\n success: !stats.hasErrors(),\n };\n })\n );\n\n return yield* eachValueFrom(observable as unknown as Observable<any>);\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export declare const versionCheck: (pkg: string, localRange: string, range: stri
|
|
|
10
10
|
* Get the latest version of the package from the registry.
|
|
11
11
|
*
|
|
12
12
|
* @param pkg package to look for.
|
|
13
|
-
* @returns { Promise<string> } returns
|
|
13
|
+
* @returns { Promise<string> } returns version
|
|
14
14
|
*/
|
|
15
15
|
export declare const getLatestRemoteVersion: (pkg: string) => Promise<string>;
|
|
16
16
|
/**
|
|
@@ -30,7 +30,7 @@ export declare function checkNxVersion(managerNxVersion: string, throwError?: bo
|
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
32
|
*/
|
|
33
|
-
export declare function checkTrackunitPackages(
|
|
33
|
+
export declare function checkTrackunitPackages(dependencies: Record<string, string>, throwError?: boolean): Promise<boolean>;
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
@@ -34,7 +34,7 @@ exports.versionCheck = versionCheck;
|
|
|
34
34
|
* Get the latest version of the package from the registry.
|
|
35
35
|
*
|
|
36
36
|
* @param pkg package to look for.
|
|
37
|
-
* @returns { Promise<string> } returns
|
|
37
|
+
* @returns { Promise<string> } returns version
|
|
38
38
|
*/
|
|
39
39
|
const getLatestRemoteVersion = async (pkg) => {
|
|
40
40
|
try {
|
|
@@ -53,7 +53,7 @@ exports.getLatestRemoteVersion = getLatestRemoteVersion;
|
|
|
53
53
|
* @returns { boolean } true if its a valid version
|
|
54
54
|
*/
|
|
55
55
|
async function checkNodeVersion(managerNodeVersion, throwError = true) {
|
|
56
|
-
const currentNodeVersion = await process.version.replace(/\r?\n|\r/, ""); // regex removes any
|
|
56
|
+
const currentNodeVersion = await process.version.replace(/\r?\n|\r/, ""); // regex removes any line breaks
|
|
57
57
|
return (0, exports.versionCheck)("node", currentNodeVersion, managerNodeVersion, throwError);
|
|
58
58
|
}
|
|
59
59
|
exports.checkNodeVersion = checkNodeVersion;
|
|
@@ -66,19 +66,18 @@ exports.checkNodeVersion = checkNodeVersion;
|
|
|
66
66
|
async function checkNxVersion(managerNxVersion, throwError = true) {
|
|
67
67
|
const currentNxVersion = (0, child_process_1.execSync)("nx --version")
|
|
68
68
|
.toString("utf-8")
|
|
69
|
-
.replace(/\r?\n|\r/, ""); // regex removes any
|
|
69
|
+
.replace(/\r?\n|\r/, ""); // regex removes any line breaks
|
|
70
70
|
return (0, exports.versionCheck)("nx", currentNxVersion, managerNxVersion, throwError);
|
|
71
71
|
}
|
|
72
72
|
exports.checkNxVersion = checkNxVersion;
|
|
73
73
|
/**
|
|
74
74
|
*
|
|
75
75
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
for (const key in packageJson) {
|
|
76
|
+
async function checkTrackunitPackages(dependencies, throwError = true) {
|
|
77
|
+
for (const key in dependencies) {
|
|
79
78
|
const remoteVersion = await (0, exports.getLatestRemoteVersion)(key);
|
|
80
79
|
if (remoteVersion) {
|
|
81
|
-
const localDependencyVersion =
|
|
80
|
+
const localDependencyVersion = dependencies[key];
|
|
82
81
|
// If @trackunit dependencies are linked/added locally using "file://", skip the version check.
|
|
83
82
|
if (!localDependencyVersion.includes("file://")) {
|
|
84
83
|
(0, exports.versionCheck)(key, localDependencyVersion, remoteVersion, throwError);
|
|
@@ -100,9 +99,9 @@ function getLibraries() {
|
|
|
100
99
|
async function checkPackageVersion(throwError = true) {
|
|
101
100
|
const { trackunitDependencies, trackunitDevDependencies } = getLibraries();
|
|
102
101
|
const managerNodeVersion = version_1.version.managerNodeVersion;
|
|
103
|
-
const managerNxVersion =
|
|
102
|
+
// const managerNxVersion = version.managerNxVersion;
|
|
104
103
|
await checkNodeVersion(managerNodeVersion, throwError);
|
|
105
|
-
await checkNxVersion(managerNxVersion, throwError);
|
|
104
|
+
// await checkNxVersion(managerNxVersion, throwError);
|
|
106
105
|
await checkTrackunitPackages(trackunitDependencies, throwError);
|
|
107
106
|
await checkTrackunitPackages(trackunitDevDependencies, throwError);
|
|
108
107
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPackageVersion.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/checkPackageVersion.ts"],"names":[],"mappings":";;;;AAAA,yCAA4C;AAC5C,iDAAyC;AACzC,uDAAiC;AACjC,uDAAiC;AACjC,uCAAoC;AAEpC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,UAAkB,EAAE,KAAa,EAAE,UAAU,GAAG,IAAI,EAAE,EAAE;IAChG,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,CAAC,wBAAwB;IAC1F,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;QAC1C,MAAM,GAAG,GAAG,YAAY,GAAG,+BAA+B,KAAK,mBAAmB,UAAU,6CAA6C,GAAG,IAAI,KAAK,GAAG,CAAC;QACzJ,IAAI,UAAU,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;SACtB;aAAM;YACL,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;YAC3B,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEF;;;;;GAKG;AACI,MAAM,sBAAsB,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IAC1D,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,QAAQ,CAAC,OAAO,CAAC;KACzB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,EAAE,CAAC,CAAC;KAC/D;AACH,CAAC,CAAC;AAPW,QAAA,sBAAsB,0BAOjC;AAEF;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CAAC,kBAA0B,EAAE,UAAU,GAAG,IAAI;IAClF,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"checkPackageVersion.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/checkPackageVersion.ts"],"names":[],"mappings":";;;;AAAA,yCAA4C;AAC5C,iDAAyC;AACzC,uDAAiC;AACjC,uDAAiC;AACjC,uCAAoC;AAEpC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,UAAkB,EAAE,KAAa,EAAE,UAAU,GAAG,IAAI,EAAE,EAAE;IAChG,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,CAAC,wBAAwB;IAC1F,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;QAC1C,MAAM,GAAG,GAAG,YAAY,GAAG,+BAA+B,KAAK,mBAAmB,UAAU,6CAA6C,GAAG,IAAI,KAAK,GAAG,CAAC;QACzJ,IAAI,UAAU,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;SACtB;aAAM;YACL,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;YAC3B,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEF;;;;;GAKG;AACI,MAAM,sBAAsB,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;IAC1D,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,QAAQ,CAAC,OAAO,CAAC;KACzB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG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SAAS,YAAY;IACnB,MAAM,gBAAgB,GAAoD,IAAA,qBAAY,EAAC,cAAc,CAAC,CAAC;IACvG,MAAM,qBAAqB,GAAG,MAAM,CAAC,WAAW,CAC9C,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAC/F,CAAC;IACF,MAAM,wBAAwB,GAAG,MAAM,CAAC,WAAW,CACjD,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAClG,CAAC;IACF,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,CAAC;AAC7D,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,mBAAmB,CAAC,UAAU,GAAG,IAAI;IACzD,MAAM,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC3E,MAAM,kBAAkB,GAAG,iBAAO,CAAC,kBAAkB,CAAC;IACtD,qDAAqD;IACrD,MAAM,gBAAgB,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;IACvD,sDAAsD;IACtD,MAAM,sBAAsB,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;IAChE,MAAM,sBAAsB,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC;AACd,CAAC;AATD,kDASC","sourcesContent":["import { readJsonFile } from \"@nrwl/devkit\";\nimport { execSync } from \"child_process\";\nimport * as pacote from \"pacote\";\nimport * as semver from \"semver\";\nimport { version } from \"./version\";\n\n/**\n *\n * @param pkg package to look for.\n * @param localRange local version of the package.\n * @param range range\n * @returns { boolean } true if its a valid version\n */\nexport const versionCheck = (pkg: string, localRange: string, range: string, throwError = true) => {\n const localVersion = semver.minVersion(localRange) ?? localRange; // ('^1.0.0') => '1.0.0'\n if (!semver.satisfies(localVersion, range)) {\n const msg = `Package \"${pkg}\" outdated. Remote Version: ${range} Local version: ${localRange}. \\n Update package using command: 'npm i ${pkg}@${range}'`;\n if (throwError) {\n throw new Error(msg);\n } else {\n // eslint-disable-next-line no-console\n console.warn(\"!!! \" + msg);\n return true;\n }\n }\n return true;\n};\n\n/**\n * Get the latest version of the package from the registry.\n *\n * @param pkg package to look for.\n * @returns { Promise<string> } returns version\n */\nexport const getLatestRemoteVersion = async (pkg: string) => {\n try {\n const manifest = await pacote.manifest(pkg);\n return manifest.version;\n } catch (error) {\n throw new Error(`Error fetching manifest for package ${pkg}`);\n }\n};\n\n/**\n * Check if the current version of the package is the same as the one in the manager.\n *\n * @param {string} managerNodeVersion version of node in the manager\n * @returns { boolean } true if its a valid version\n */\nexport async function checkNodeVersion(managerNodeVersion: string, throwError = true) {\n const currentNodeVersion = await process.version.replace(/\\r?\\n|\\r/, \"\"); // regex removes any line breaks\n return versionCheck(\"node\", currentNodeVersion, managerNodeVersion, throwError);\n}\n\n/**\n * Check if the current version of the package is the same as the one in the manager.\n *\n * @param {string} managerNxVersion version of nx in the manager\n * @returns { boolean} true if its a valid version\n */\nexport async function checkNxVersion(managerNxVersion: string, throwError = true) {\n const currentNxVersion = execSync(\"nx --version\")\n .toString(\"utf-8\")\n .replace(/\\r?\\n|\\r/, \"\"); // regex removes any line breaks\n return versionCheck(\"nx\", currentNxVersion, managerNxVersion, throwError);\n}\n\n/**\n *\n */\nexport async function checkTrackunitPackages(dependencies: Record<string, string>, throwError = true) {\n for (const key in dependencies) {\n const remoteVersion: string | undefined = await getLatestRemoteVersion(key);\n if (remoteVersion) {\n const localDependencyVersion: string = dependencies[key];\n // If @trackunit dependencies are linked/added locally using \"file://\", skip the version check.\n if (!localDependencyVersion.includes(\"file://\")) {\n versionCheck(key, localDependencyVersion, remoteVersion, throwError);\n }\n }\n }\n return true;\n}\n\nfunction getLibraries() {\n const packageJsonLocal: Record<string, string | Record<string, string>> = readJsonFile(\"package.json\");\n const trackunitDependencies = Object.fromEntries(\n Object.entries(packageJsonLocal.dependencies).filter(([key]) => key.startsWith(\"@trackunit/\"))\n );\n const trackunitDevDependencies = Object.fromEntries(\n Object.entries(packageJsonLocal.devDependencies).filter(([key]) => key.startsWith(\"@trackunit/\"))\n );\n return { trackunitDependencies, trackunitDevDependencies };\n}\n\n/**\n *\n */\nexport async function checkPackageVersion(throwError = true) {\n const { trackunitDependencies, trackunitDevDependencies } = getLibraries();\n const managerNodeVersion = version.managerNodeVersion;\n // const managerNxVersion = version.managerNxVersion;\n await checkNodeVersion(managerNodeVersion, throwError);\n // await checkNxVersion(managerNxVersion, throwError);\n await checkTrackunitPackages(trackunitDependencies, throwError);\n await checkTrackunitPackages(trackunitDevDependencies, throwError);\n return true;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.version = void 0;
|
|
4
4
|
// The major version of NX and Node specified here will be matched with corresponding versions in the iris app.
|
|
5
5
|
exports.version = {
|
|
6
|
-
managerNxVersion: "^15.
|
|
6
|
+
managerNxVersion: "^15.9.2",
|
|
7
7
|
managerNodeVersion: "^16.13.2",
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/version.ts"],"names":[],"mappings":";;;AAAA,+GAA+G;AAClG,QAAA,OAAO,GAAG;IACrB,gBAAgB,EAAE,SAAS;IAC3B,kBAAkB,EAAE,UAAU;CAC/B,CAAC","sourcesContent":["// The major version of NX and Node specified here will be matched with corresponding versions in the iris app.\nexport const version = {\n managerNxVersion: \"^15.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/version.ts"],"names":[],"mappings":";;;AAAA,+GAA+G;AAClG,QAAA,OAAO,GAAG;IACrB,gBAAgB,EAAE,SAAS;IAC3B,kBAAkB,EAAE,UAAU;CAC/B,CAAC","sourcesContent":["// The major version of NX and Node specified here will be matched with corresponding versions in the iris app.\nexport const version = {\n managerNxVersion: \"^15.9.2\",\n managerNodeVersion: \"^16.13.2\",\n};\n"]}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IrisAppExtensionGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const js_1 = require("@nrwl/js");
|
|
6
7
|
const linter_1 = require("@nrwl/linter");
|
|
7
8
|
const react_1 = require("@nrwl/react");
|
|
8
|
-
const typescript_1 = require("@nrwl/workspace/src/utilities/typescript");
|
|
9
9
|
const camelcase_1 = tslib_1.__importDefault(require("camelcase"));
|
|
10
10
|
const enquirer_1 = require("enquirer");
|
|
11
11
|
const fs = tslib_1.__importStar(require("fs"));
|
|
@@ -79,7 +79,7 @@ const IrisAppExtensionGenerator = async function (tree, options) {
|
|
|
79
79
|
if (irisAppExtensionType !== "REPORT_EXTENSION") {
|
|
80
80
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "react-app"), normalizedOptions.projectRoot, templateOptions);
|
|
81
81
|
}
|
|
82
|
-
const rootTsConfigPath = (0,
|
|
82
|
+
const rootTsConfigPath = (0, js_1.getRootTsConfigPathInTree)(tree);
|
|
83
83
|
if (!rootTsConfigPath) {
|
|
84
84
|
throw new Error("Could not find root tsconfig.json");
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/extend/generator.ts"],"names":[],"mappings":";;;;AAAA,yCAWsB;AACtB,yCAAsC;AACtC,uCAA+C;AAE/C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C,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;SAC3B;aAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;aAAM;YACL,MAAM,YAAY,GAAG;gBACnB,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,qCAAqC;gBAC9C,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;aACpC,CAAC;YACF,MAAM,IAAA,iBAAM,EAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,MAAc,EAAE,EAAE;gBACjD,2DAA2D;gBAC3D,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;SACJ;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,kBAAe,iCAAyB,CAAC","sourcesContent":["import {\n addDependenciesToPackageJson,\n formatFiles,\n generateFiles,\n getWorkspaceLayout,\n installPackagesTask,\n joinPathFragments,\n names,\n offsetFromRoot,\n Tree,\n updateJson,\n} from \"@nrwl/devkit\";\nimport { Linter } from \"@nrwl/linter\";\nimport { libraryGenerator } from \"@nrwl/react\";\nimport { Schema } from \"@nrwl/react/src/generators/library/schema\";\nimport { getRootTsConfigPathInTree } from \"@nrwl/workspace/src/utilities/typescript\";\nimport camelCase from \"camelcase\";\nimport { prompt } from \"enquirer\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { Node, Project, SyntaxKind } from \"ts-morph\";\nimport { IrisAppExtensionGeneratorSchema } from \"./schema\";\nimport { spaDependencies } from \"./singleSpaDependencies\";\n\ninterface NormalizedSchema extends IrisAppExtensionGeneratorSchema {\n projectName: string;\n projectRoot: string;\n projectDirectory: string;\n projectCamelcase: string;\n importPath: string;\n sourceRoot: string;\n}\n\nfunction normalizeOptions(tree: Tree, options: IrisAppExtensionGeneratorSchema): NormalizedSchema {\n const name = names(options.name).fileName;\n const projectDirectory = options.directory ? `${names(options.directory).fileName}/${name}` : name;\n const projectName = projectDirectory.replace(new RegExp(\"/\", \"g\"), \"-\");\n const projectCamelcase = camelCase(name);\n const wsLayout = getWorkspaceLayout(tree);\n const projectRoot = `${wsLayout.libsDir}/${projectDirectory}`;\n const sourceRoot = `${wsLayout.libsDir}/${projectDirectory}/src`;\n const importPath = `@${wsLayout.npmScope}/${projectDirectory}`;\n\n return {\n ...options,\n projectName,\n projectRoot,\n projectDirectory,\n projectCamelcase,\n importPath,\n sourceRoot,\n };\n}\n\n/**\n * Iris App Extension Generator.\n *\n * @param tree the nx tree\n * @param options the generator options\n * @returns { Promise<void> } void\n */\nexport const IrisAppExtensionGenerator = async function (tree: Tree, options: IrisAppExtensionGeneratorSchema) {\n const adjustedOptions = await updateAppName(tree, options);\n\n const normalizedOptions = normalizeOptions(tree, adjustedOptions);\n\n const templateOptions = {\n ...normalizedOptions,\n ...names(normalizedOptions.name),\n offsetFromRoot: offsetFromRoot(normalizedOptions.projectRoot),\n template: \"\",\n };\n const irisAppExtensionType = normalizedOptions.type;\n\n if (!fs.existsSync(`${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}`)) {\n throw new Error(\n `The app does not exist: ${getWorkspaceLayout(tree).appsDir}/${\n normalizedOptions.app\n } make sure you enter the right app name`\n );\n }\n\n const manifestPath = `${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}/iris-app-manifest.ts`;\n if (!fs.existsSync(manifestPath)) {\n throw new Error(\n `The app does not have an iris-app-manifest.ts: ${manifestPath} make sure you enter the right app name, which has an iris-app-manifest.ts`\n );\n }\n generateFiles(\n tree,\n path.join(__dirname, \"files\", irisAppExtensionType),\n normalizedOptions.projectRoot,\n templateOptions\n );\n\n if (normalizedOptions.updatePackageJson) {\n addDependenciesToPackageJson(\n tree,\n {},\n {\n ...spaDependencies,\n }\n );\n }\n\n const schema: Schema = {\n name: normalizedOptions.name,\n style: \"none\",\n skipFormat: false,\n strict: true,\n unitTestRunner: \"jest\",\n linter: Linter.EsLint,\n routing: false,\n pascalCaseFiles: true,\n directory: normalizedOptions.directory,\n skipTsConfig: false,\n skipPackageJson: true,\n standaloneConfig: true,\n };\n await libraryGenerator(tree, schema);\n\n if (irisAppExtensionType !== \"REPORT_EXTENSION\") {\n generateFiles(tree, path.join(__dirname, \"files\", \"react-app\"), normalizedOptions.projectRoot, templateOptions);\n }\n\n const rootTsConfigPath = getRootTsConfigPathInTree(tree);\n if (!rootTsConfigPath) {\n throw new Error(\"Could not find root tsconfig.json\");\n }\n updateJson(tree, rootTsConfigPath, tsConfigBase => {\n tsConfigBase.compilerOptions.paths[normalizedOptions.importPath] = [\n path.join(normalizedOptions.projectRoot, \"extension-manifest.ts\"),\n ];\n return tsConfigBase;\n });\n\n const project = new Project({\n tsConfigFilePath: `${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}/tsconfig.app.json`,\n });\n\n const manifest = project.getSourceFileOrThrow(manifestPath);\n\n manifest.addImportDeclaration({\n moduleSpecifier: normalizedOptions.importPath,\n defaultImport: normalizedOptions.projectCamelcase,\n });\n\n manifest.forEachDescendant(node => {\n if (Node.isPropertyAssignment(node)) {\n if (node.getText().indexOf(\"extensions\") !== -1) {\n const array = node.getFirstChildByKindOrThrow(SyntaxKind.ArrayLiteralExpression);\n array.addElement(`${normalizedOptions.projectCamelcase}`);\n }\n }\n });\n await manifest.save();\n\n tree.delete(joinPathFragments(normalizedOptions.projectRoot, \"src\", \"index.ts\"));\n\n updateJson(tree, joinPathFragments(normalizedOptions.projectRoot, \"tsconfig.lib.json\"), tsConfigLib => {\n tsConfigLib.include = [...tsConfigLib.include, \"extension-manifest.ts\"];\n return tsConfigLib;\n });\n\n await formatFiles(tree);\n return () => {\n installPackagesTask(tree, true);\n };\n};\nconst updateAppName = async (tree: Tree, options: IrisAppExtensionGeneratorSchema) => {\n if (!options.app) {\n const folders = fs\n .readdirSync(getWorkspaceLayout(tree).appsDir, { withFileTypes: true })\n .filter(item => item.isDirectory());\n\n const tileApps: string[] = [];\n\n folders.forEach(folder => {\n const irisAppManifest = fs\n .readdirSync(`${getWorkspaceLayout(tree).appsDir}/${folder.name}`, { withFileTypes: true })\n .find(item => item.name === \"iris-app-manifest.ts\");\n\n if (irisAppManifest) {\n tileApps.push(folder.name);\n } else {\n const subFolders = fs\n .readdirSync(path.join(getWorkspaceLayout(tree).appsDir, folder.name), { withFileTypes: true })\n .filter(item => item.isDirectory());\n subFolders.forEach(subFolder => {\n const subDirIrisAppManifest = fs\n .readdirSync(`${getWorkspaceLayout(tree).appsDir}/${folder.name}/${subFolder.name}`, {\n withFileTypes: true,\n })\n .find(item => item.name === \"iris-app-manifest.ts\");\n\n if (subDirIrisAppManifest) {\n tileApps.push(path.join(folder.name, subFolder.name));\n }\n });\n }\n });\n\n if (tileApps.length === 1) {\n options.app = tileApps[0];\n } else if (tileApps.length === 0) {\n throw new Error(\"Please add an iris-app using: nx g @trackunit/iris-app:create \");\n } else {\n const promptObject = {\n name: \"app\",\n message: \"Select iris-app for this extension:\",\n type: \"select\",\n choices: tileApps.map(item => item),\n };\n await prompt(promptObject).then((values: object) => {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n options.app = values[\"app\"];\n });\n }\n }\n return options;\n};\n\nexport default IrisAppExtensionGenerator;\n"]}
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/extend/generator.ts"],"names":[],"mappings":";;;;AAAA,yCAWsB;AACtB,iCAAqD;AACrD,yCAAsC;AACtC,uCAA+C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,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;SAC3B;aAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;aAAM;YACL,MAAM,YAAY,GAAG;gBACnB,IAAI,EAAE,KAAK;gBACX,OAAO,EAAE,qCAAqC;gBAC9C,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;aACpC,CAAC;YACF,MAAM,IAAA,iBAAM,EAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,MAAc,EAAE,EAAE;gBACjD,2DAA2D;gBAC3D,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;SACJ;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,kBAAe,iCAAyB,CAAC","sourcesContent":["import {\n addDependenciesToPackageJson,\n formatFiles,\n generateFiles,\n getWorkspaceLayout,\n installPackagesTask,\n joinPathFragments,\n names,\n offsetFromRoot,\n Tree,\n updateJson\n} from \"@nrwl/devkit\";\nimport { getRootTsConfigPathInTree } from \"@nrwl/js\";\nimport { Linter } from \"@nrwl/linter\";\nimport { libraryGenerator } from \"@nrwl/react\";\nimport { Schema } from \"@nrwl/react/src/generators/library/schema\";\nimport camelCase from \"camelcase\";\nimport { prompt } from \"enquirer\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { Node, Project, SyntaxKind } from \"ts-morph\";\nimport { IrisAppExtensionGeneratorSchema } from \"./schema\";\nimport { spaDependencies } from \"./singleSpaDependencies\";\n\ninterface NormalizedSchema extends IrisAppExtensionGeneratorSchema {\n projectName: string;\n projectRoot: string;\n projectDirectory: string;\n projectCamelcase: string;\n importPath: string;\n sourceRoot: string;\n}\n\nfunction normalizeOptions(tree: Tree, options: IrisAppExtensionGeneratorSchema): NormalizedSchema {\n const name = names(options.name).fileName;\n const projectDirectory = options.directory ? `${names(options.directory).fileName}/${name}` : name;\n const projectName = projectDirectory.replace(new RegExp(\"/\", \"g\"), \"-\");\n const projectCamelcase = camelCase(name);\n const wsLayout = getWorkspaceLayout(tree);\n const projectRoot = `${wsLayout.libsDir}/${projectDirectory}`;\n const sourceRoot = `${wsLayout.libsDir}/${projectDirectory}/src`;\n const importPath = `@${wsLayout.npmScope}/${projectDirectory}`;\n\n return {\n ...options,\n projectName,\n projectRoot,\n projectDirectory,\n projectCamelcase,\n importPath,\n sourceRoot,\n };\n}\n\n/**\n * Iris App Extension Generator.\n *\n * @param tree the nx tree\n * @param options the generator options\n * @returns { Promise<void> } void\n */\nexport const IrisAppExtensionGenerator = async function (tree: Tree, options: IrisAppExtensionGeneratorSchema) {\n const adjustedOptions = await updateAppName(tree, options);\n\n const normalizedOptions = normalizeOptions(tree, adjustedOptions);\n\n const templateOptions = {\n ...normalizedOptions,\n ...names(normalizedOptions.name),\n offsetFromRoot: offsetFromRoot(normalizedOptions.projectRoot),\n template: \"\",\n };\n const irisAppExtensionType = normalizedOptions.type;\n\n if (!fs.existsSync(`${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}`)) {\n throw new Error(\n `The app does not exist: ${getWorkspaceLayout(tree).appsDir}/${\n normalizedOptions.app\n } make sure you enter the right app name`\n );\n }\n\n const manifestPath = `${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}/iris-app-manifest.ts`;\n if (!fs.existsSync(manifestPath)) {\n throw new Error(\n `The app does not have an iris-app-manifest.ts: ${manifestPath} make sure you enter the right app name, which has an iris-app-manifest.ts`\n );\n }\n generateFiles(\n tree,\n path.join(__dirname, \"files\", irisAppExtensionType),\n normalizedOptions.projectRoot,\n templateOptions\n );\n\n if (normalizedOptions.updatePackageJson) {\n addDependenciesToPackageJson(\n tree,\n {},\n {\n ...spaDependencies,\n }\n );\n }\n\n const schema: Schema = {\n name: normalizedOptions.name,\n style: \"none\",\n skipFormat: false,\n strict: true,\n unitTestRunner: \"jest\",\n linter: Linter.EsLint,\n routing: false,\n pascalCaseFiles: true,\n directory: normalizedOptions.directory,\n skipTsConfig: false,\n skipPackageJson: true,\n standaloneConfig: true,\n };\n await libraryGenerator(tree, schema);\n\n if (irisAppExtensionType !== \"REPORT_EXTENSION\") {\n generateFiles(tree, path.join(__dirname, \"files\", \"react-app\"), normalizedOptions.projectRoot, templateOptions);\n }\n\n const rootTsConfigPath = getRootTsConfigPathInTree(tree);\n if (!rootTsConfigPath) {\n throw new Error(\"Could not find root tsconfig.json\");\n }\n updateJson(tree, rootTsConfigPath, tsConfigBase => {\n tsConfigBase.compilerOptions.paths[normalizedOptions.importPath] = [\n path.join(normalizedOptions.projectRoot, \"extension-manifest.ts\"),\n ];\n return tsConfigBase;\n });\n\n const project = new Project({\n tsConfigFilePath: `${getWorkspaceLayout(tree).appsDir}/${normalizedOptions.app}/tsconfig.app.json`,\n });\n\n const manifest = project.getSourceFileOrThrow(manifestPath);\n\n manifest.addImportDeclaration({\n moduleSpecifier: normalizedOptions.importPath,\n defaultImport: normalizedOptions.projectCamelcase,\n });\n\n manifest.forEachDescendant(node => {\n if (Node.isPropertyAssignment(node)) {\n if (node.getText().indexOf(\"extensions\") !== -1) {\n const array = node.getFirstChildByKindOrThrow(SyntaxKind.ArrayLiteralExpression);\n array.addElement(`${normalizedOptions.projectCamelcase}`);\n }\n }\n });\n await manifest.save();\n\n tree.delete(joinPathFragments(normalizedOptions.projectRoot, \"src\", \"index.ts\"));\n\n updateJson(tree, joinPathFragments(normalizedOptions.projectRoot, \"tsconfig.lib.json\"), tsConfigLib => {\n tsConfigLib.include = [...tsConfigLib.include, \"extension-manifest.ts\"];\n return tsConfigLib;\n });\n\n await formatFiles(tree);\n return () => {\n installPackagesTask(tree, true);\n };\n};\nconst updateAppName = async (tree: Tree, options: IrisAppExtensionGeneratorSchema) => {\n if (!options.app) {\n const folders = fs\n .readdirSync(getWorkspaceLayout(tree).appsDir, { withFileTypes: true })\n .filter(item => item.isDirectory());\n\n const tileApps: string[] = [];\n\n folders.forEach(folder => {\n const irisAppManifest = fs\n .readdirSync(`${getWorkspaceLayout(tree).appsDir}/${folder.name}`, { withFileTypes: true })\n .find(item => item.name === \"iris-app-manifest.ts\");\n\n if (irisAppManifest) {\n tileApps.push(folder.name);\n } else {\n const subFolders = fs\n .readdirSync(path.join(getWorkspaceLayout(tree).appsDir, folder.name), { withFileTypes: true })\n .filter(item => item.isDirectory());\n subFolders.forEach(subFolder => {\n const subDirIrisAppManifest = fs\n .readdirSync(`${getWorkspaceLayout(tree).appsDir}/${folder.name}/${subFolder.name}`, {\n withFileTypes: true,\n })\n .find(item => item.name === \"iris-app-manifest.ts\");\n\n if (subDirIrisAppManifest) {\n tileApps.push(path.join(folder.name, subFolder.name));\n }\n });\n }\n });\n\n if (tileApps.length === 1) {\n options.app = tileApps[0];\n } else if (tileApps.length === 0) {\n throw new Error(\"Please add an iris-app using: nx g @trackunit/iris-app:create \");\n } else {\n const promptObject = {\n name: \"app\",\n message: \"Select iris-app for this extension:\",\n type: \"select\",\n choices: tileApps.map(item => item),\n };\n await prompt(promptObject).then((values: object) => {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n options.app = values[\"app\"];\n });\n }\n }\n return options;\n};\n\nexport default IrisAppExtensionGenerator;\n"]}
|