@trackunit/iris-app 0.0.530 → 0.0.532

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 CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.532](https://github.com/Trackunit/manager/compare/iris-app/0.0.531...iris-app/0.0.532) (2024-02-29)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `iris-app-build-utilities` updated to version `0.0.531`
10
+ ## [0.0.531](https://github.com/Trackunit/manager/compare/iris-app/0.0.530...iris-app/0.0.531) (2024-02-28)
11
+
12
+ ### Dependency Updates
13
+
14
+ * `iris-app-build-utilities` updated to version `0.0.530`
15
+ * `test-setup` updated to version `0.0.530`
5
16
  ## [0.0.530](https://github.com/Trackunit/manager/compare/iris-app/0.0.529...iris-app/0.0.530) (2024-02-28)
6
17
 
7
18
  ### Dependency Updates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app",
3
- "version": "0.0.530",
3
+ "version": "0.0.532",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "main": "./src/index.js",
6
6
  "generators": "./generators.json",
@@ -29,8 +29,9 @@ async function* default_1(options, context) {
29
29
  if (!context.projectsConfigurations) {
30
30
  throw new Error("context projectsConfigurations is required");
31
31
  }
32
- const projectRootDir = (0, path_1.join)(context.root, context.projectsConfigurations.projects[context.projectName].root);
33
- const tileManifestPath = (0, path_1.join)(context.root, context.projectsConfigurations.projects[context.projectName].root, "iris-app-manifest.ts");
32
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
33
+ const projectRootDir = (0, path_1.join)(context.root, projectRoot);
34
+ const tileManifestPath = (0, path_1.join)(context.root, projectRoot, "iris-app-manifest.ts");
34
35
  (0, iris_app_build_utilities_1.enableTsConfigPath)({
35
36
  projectRootDir,
36
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,wEAAoE;AACpE,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,yBAAa,gBAAgB,+CAAC,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,yBAAa,OAAO,CAAC,aAAa,+CAAC,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 \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/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"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","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AAe,GAAG,CAAC,yBAAa,gBAAgB,+CAAC,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,yBAAa,OAAO,CAAC,aAAa,+CAAC,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;AAjCD,4BAiCC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/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 projectRoot = context.projectsConfigurations.projects![context.projectName!]!.root;\n const projectRootDir = join(context.root, projectRoot);\n const tileManifestPath = join(context.root, projectRoot, \"iris-app-manifest.ts\");\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"]}
@@ -21,8 +21,9 @@ async function* default_1(options, context) {
21
21
  if (!context.workspace) {
22
22
  throw new Error("context workspace is required");
23
23
  }
24
- const projectRootDir = (0, path_1.join)(context.root, context.workspace.projects[context.projectName].root);
25
- const tileManifestPath = (0, path_1.join)(context.root, context.workspace.projects[context.projectName].root, "iris-app-manifest.ts");
24
+ const projectRoot = context.workspace.projects[context.projectName].root;
25
+ const projectRootDir = (0, path_1.join)(context.root, projectRoot);
26
+ const tileManifestPath = (0, path_1.join)(context.root, projectRoot, "iris-app-manifest.ts");
26
27
  (0, iris_app_build_utilities_1.enableTsConfigPath)({
27
28
  projectRootDir,
28
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/serve/executor.ts"],"names":[],"mappings":";;;AAEA,wEAAoE;AACpE,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,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,CAAC,CAAC;IACjG,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAC3B,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,EACrD,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,yBAAa,gBAAgB,+CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,aAAa,GAAG,IAAA,uCAAgB,EAAC,aAAa,EAAE,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IACrG,MAAM,gBAAgB,GAAG,yBAAa,OAAO,CAAC,aAAa,+CAAC,CAAC;IAE7D,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAE7D,MAAM,UAAU,GAAG,IAAA,wCAAqB,EAAC,MAAM,CAAC,CAAC,IAAI,CACnD,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACnB,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAE,MAAgC,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC,EACF,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;QAC5B,OAAO;YACL,OAAO;YACP,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE;SAC5B,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAwC,CAAC,CAAC;AACxE,CAAC;AArCD,4BAqCC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/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"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/serve/executor.ts"],"names":[],"mappings":";;;AAEA,wEAAoE;AACpE,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,CAA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C;IAEF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAwC,CAAC,CAAC;AACxE,CAAC;AAlCD,4BAkCC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/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 projectRoot = context.workspace.projects![context.projectName!]!.root;\n const projectRootDir = join(context.root, projectRoot);\n const tileManifestPath = join(context.root, projectRoot, \"iris-app-manifest.ts\");\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"]}
@@ -68,7 +68,7 @@ async function checkTrackunitPackages(dependencies, throwError = true) {
68
68
  if (remoteVersion) {
69
69
  const localDependencyVersion = dependencies[key];
70
70
  // If @trackunit dependencies are linked/added locally using "file:", skip the version check, used for E2E tests.
71
- if (!localDependencyVersion.includes("file:")) {
71
+ if (localDependencyVersion && !localDependencyVersion.includes("file:")) {
72
72
  (0, exports.versionCheck)(key, localDependencyVersion, remoteVersion, throwError);
73
73
  }
74
74
  }
@@ -78,8 +78,8 @@ async function checkTrackunitPackages(dependencies, throwError = true) {
78
78
  exports.checkTrackunitPackages = checkTrackunitPackages;
79
79
  function getLibraries() {
80
80
  const packageJsonLocal = (0, devkit_1.readJsonFile)("package.json");
81
- const trackunitDependencies = Object.fromEntries(Object.entries(packageJsonLocal.dependencies).filter(([key]) => key.startsWith("@trackunit/")));
82
- const trackunitDevDependencies = Object.fromEntries(Object.entries(packageJsonLocal.devDependencies).filter(([key]) => key.startsWith("@trackunit/")));
81
+ const trackunitDependencies = Object.fromEntries(Object.entries(packageJsonLocal.dependencies || {}).filter(([key]) => key.startsWith("@trackunit/")));
82
+ const trackunitDevDependencies = Object.fromEntries(Object.entries(packageJsonLocal.devDependencies || {}).filter(([key]) => key.startsWith("@trackunit/")));
83
83
  return { trackunitDependencies, trackunitDevDependencies };
84
84
  }
85
85
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"checkPackageVersion.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/checkPackageVersion.ts"],"names":[],"mappings":";;;;AAAA,uCAA0C;AAC1C,iDAAyC;AACzC,uDAAiC;AACjC,uDAAiC;AAEjC;;;;;;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,CA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CAAC,UAAU,GAAG,IAAI;IACzD,MAAM,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC3E,qDAAqD;IACrD,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;AAPD,kDAOC","sourcesContent":["import { readJsonFile } from \"@nx/devkit\";\nimport { execSync } from \"child_process\";\nimport * as pacote from \"pacote\";\nimport * as semver from \"semver\";\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 const remoteVersion = semver.minVersion(range) ?? range; // Assume range is in a format that semver.minVersion can handle\n\n if (!semver.satisfies(localVersion, range)) {\n const msg = `Package \"${pkg}\" outdated. Remote Version: ${range} Local version: ${localRange}. 👈\\n Update package using command: \\n npm i ${pkg}@${range}\\n ...or to update all trackunit dependencies: \\n npx npm-check-updates \"/@trackunit/\" -u`;\n if (semver.major(localVersion) < semver.major(remoteVersion) && throwError) {\n throw new Error(msg);\n } else {\n // eslint-disable-next-line no-console\n console.warn(\"⚠️ \" + msg + \"\\n\");\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(\n `Error fetching manifest for package ${pkg}. This package might need to be published, or it has been included as a dependency by mistake.`\n );\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} 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, used for E2E tests.\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 managerNxVersion = version.managerNxVersion;\n // await checkNxVersion(managerNxVersion, throwError);\n await checkTrackunitPackages(trackunitDependencies, throwError);\n await checkTrackunitPackages(trackunitDevDependencies, throwError);\n return true;\n}\n"]}
1
+ {"version":3,"file":"checkPackageVersion.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/checkPackageVersion.ts"],"names":[],"mappings":";;;;AAAA,uCAA0C;AAC1C,iDAAyC;AACzC,uDAAiC;AACjC,uDAAiC;AAEjC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,UAAkB,EAAE,KAAa,EAAE,UAAU,GAAG,IAAI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AAC;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,qDAAqD;IACrD,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;AAPD,kDAOC","sourcesContent":["import { readJsonFile } from \"@nx/devkit\";\nimport { execSync } from \"child_process\";\nimport * as pacote from \"pacote\";\nimport * as semver from \"semver\";\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 const remoteVersion = semver.minVersion(range) ?? range; // Assume range is in a format that semver.minVersion can handle\n\n if (!semver.satisfies(localVersion, range)) {\n const msg = `Package \"${pkg}\" outdated. Remote Version: ${range} Local version: ${localRange}. 👈\\n Update package using command: \\n npm i ${pkg}@${range}\\n ...or to update all trackunit dependencies: \\n npx npm-check-updates \"/@trackunit/\" -u`;\n if (semver.major(localVersion) < semver.major(remoteVersion) && throwError) {\n throw new Error(msg);\n } else {\n // eslint-disable-next-line no-console\n console.warn(\"⚠️ \" + msg + \"\\n\");\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(\n `Error fetching manifest for package ${pkg}. This package might need to be published, or it has been included as a dependency by mistake.`\n );\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} 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 | undefined = dependencies[key];\n // If @trackunit dependencies are linked/added locally using \"file:\", skip the version check, used for E2E tests.\n if (localDependencyVersion && !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 managerNxVersion = version.managerNxVersion;\n // await checkNxVersion(managerNxVersion, throwError);\n await checkTrackunitPackages(trackunitDependencies, throwError);\n await checkTrackunitPackages(trackunitDevDependencies, throwError);\n return true;\n}\n"]}
@@ -19,7 +19,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
19
19
  * @returns { Promise<webpack.Configuration> } the default webpack config
20
20
  */
21
21
  const getDefaultConfig = async (mode, nxRootDir, appDir, irisAppManifest) => {
22
- const relativeAppDir = appDir.split(nxRootDir)[1];
22
+ const relativeAppDir = appDir.split(nxRootDir)[1] || "<unknown appdir>";
23
23
  return {
24
24
  mode: mode,
25
25
  output: {
@@ -118,7 +118,7 @@ const getDefaultConfig = async (mode, nxRootDir, appDir, irisAppManifest) => {
118
118
  {
119
119
  //globs must use / in path to be valid
120
120
  from: path
121
- .join(path.resolve(relativeAppDir.substring(1), "assets"), "**", "(*.png|*.svg|*.jpg|*.jpeg|*.webp|*.md)")
121
+ .join(path.resolve(relativeAppDir?.substring(1), "assets"), "**", "(*.png|*.svg|*.jpg|*.jpeg|*.webp|*.md)")
122
122
  .replace(/\\/g, "/"),
123
123
  to: path.resolve(nxRootDir, "dist"),
124
124
  },
@@ -1 +1 @@
1
- {"version":3,"file":"defaultWebpackConfig.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/defaultWebpackConfig.ts"],"names":[],"mappings":";;;;AACA,kFAK6C;AAC7C,gFAAmF;AACnF,mDAA6B;AAC7B,yDAAmC;AACnC,8BAA4B;AAC5B,8DAA8D;AAC9D,MAAM,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACI,MAAM,gBAAgB,GAAG,KAAK,EACnC,IAAkC,EAClC,SAAiB,EACjB,MAAc,EACd,eAAgC,EACA,EAAE;IAClC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE;YACN,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC;SACnD;QAED,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,WAAW;QACnD,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,MAAM,IAAA,kDAAuB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iBACF;aACF;SACF;QAED,OAAO,EAAE;YACP,IAAI,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC;gBAC3C,IAAI,EAAE,eAAe,CAAC,oBAAoB;gBAC1C,QAAQ,EAAE,gBAAgB;gBAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,CAAC,oBAAoB,EAAE;gBACvE,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,MAAM,IAAA,+CAAoB,EAAC;oBAClC,SAAS;oBACT,QAAQ,EAAE,eAAe;iBAC1B,CAAC;gBACF,MAAM,EAAE,MAAM,IAAA,gDAAqB,EAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;aACnE,CAAC;YAEF,IAAI,uDAA6B,CAAC;gBAChC,SAAS,EAAE,SAAS;gBACpB,MAAM;gBACN,QAAQ,EAAE,eAAe;aAC1B,CAAC;YACF,IAAI,iBAAiB,CAAC;gBACpB,QAAQ,EAAE;oBACR;wBACE,sCAAsC;wBACtC,IAAI,EAAE,IAAI;6BACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,wCAAwC,CAAC;6BACzG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;wBACtB,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;qBACpC;iBACF;aACF,CAAC;SACH,CAAC,MAAM,CAAC,OAAO,CAAC;KAClB,CAAC;AACJ,CAAC,CAAC;AApHW,QAAA,gBAAgB,oBAoH3B","sourcesContent":["import { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport {\n getAliasesFromTsConfig,\n getExposedExtensions,\n getSharedDependencies,\n getTileWebpackDevServer,\n} from \"@trackunit/iris-app-build-utilities\";\nimport { TrackunitIrisAppWebpackPlugin } from \"@trackunit/iris-app-webpack-plugin\";\nimport * as path from \"path\";\nimport * as webpack from \"webpack\";\nimport \"webpack-dev-server\";\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst CopyWebpackPlugin = require(\"copy-webpack-plugin\");\n\n/**\n * Gets the default webpack config.\n *\n * @param mode mode either \"production\" or \"development\"\n * @param nxRootDir the root of the nx workspace\n * @param appDir the app directory\n * @param irisAppManifest the iris app manifest\n * @returns { Promise<webpack.Configuration> } the default webpack config\n */\nexport const getDefaultConfig = async (\n mode: \"production\" | \"development\",\n nxRootDir: string,\n appDir: string,\n irisAppManifest: IrisAppManifest\n): Promise<webpack.Configuration> => {\n const relativeAppDir = appDir.split(nxRootDir)[1];\n return {\n mode: mode,\n output: {\n publicPath: \"auto\",\n path: path.join(nxRootDir, \"dist\", relativeAppDir),\n },\n\n entry: path.resolve(__dirname, \"src\") + \"/index.js\",\n devtool: false,\n devServer: await getTileWebpackDevServer(),\n resolve: {\n extensions: [\".tsx\", \".ts\", \".jsx\", \".js\", \".json\"],\n alias: await getAliasesFromTsConfig({ nxRootDir }),\n },\n module: {\n rules: [\n {\n test: /\\.m?js/,\n type: \"javascript/auto\",\n resolve: {\n fullySpecified: false,\n },\n },\n {\n test: /\\.svg$/,\n type: \"asset/resource\",\n },\n {\n test: /\\.(png|jpg|gif|woff|ico)$/,\n exclude: /(node_modules)/,\n type: \"asset/resource\",\n },\n {\n test: /\\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,\n include: /(node_modules\\/@okta)/,\n type: \"asset/resource\",\n },\n {\n test: /\\.(css|s[ac]ss)$/i,\n use: [\n \"style-loader\",\n \"css-loader\",\n {\n loader: \"postcss-loader\",\n options: {\n postcssOptions: {\n plugins: {\n \"postcss-import\": {},\n \"tailwindcss/nesting\": {},\n tailwindcss: {\n config: path.resolve(appDir, \"tailwind.config.js\"),\n },\n autoprefixer: {},\n },\n },\n },\n },\n ],\n },\n {\n test: /\\.json$/,\n loader: \"json-loader\",\n },\n {\n test: /\\.(j|t)sx?$/,\n exclude: /(vendor|node_modules|dist)/,\n use: {\n loader: \"esbuild-loader\",\n options: {\n loader: \"tsx\",\n jsx: \"automatic\",\n target: \"es6\",\n },\n },\n },\n ],\n },\n\n plugins: [\n new webpack.container.ModuleFederationPlugin({\n name: irisAppManifest.moduleFederationName,\n filename: \"remoteEntry.js\",\n library: { type: \"global\", name: irisAppManifest.moduleFederationName },\n remotes: {},\n exposes: await getExposedExtensions({\n nxRootDir,\n manifest: irisAppManifest,\n }),\n shared: await getSharedDependencies({ manifest: irisAppManifest }),\n }),\n\n new TrackunitIrisAppWebpackPlugin({\n nxRootDir: nxRootDir,\n appDir,\n manifest: irisAppManifest,\n }),\n new CopyWebpackPlugin({\n patterns: [\n {\n //globs must use / in path to be valid\n from: path\n .join(path.resolve(relativeAppDir.substring(1), \"assets\"), \"**\", \"(*.png|*.svg|*.jpg|*.jpeg|*.webp|*.md)\")\n .replace(/\\\\/g, \"/\"),\n to: path.resolve(nxRootDir, \"dist\"),\n },\n ],\n }),\n ].filter(Boolean),\n };\n};\n"]}
1
+ {"version":3,"file":"defaultWebpackConfig.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/defaultWebpackConfig.ts"],"names":[],"mappings":";;;;AACA,kFAK6C;AAC7C,gFAAmF;AACnF,mDAA6B;AAC7B,yDAAmC;AACnC,8BAA4B;AAC5B,8DAA8D;AAC9D,MAAM,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEzD;;;;;;;;GAQG;AACI,MAAM,gBAAgB,GAAG,KAAK,EACnC,IAAkC,EAClC,SAAiB,EACjB,MAAc,EACd,eAAgC,EACA,EAAE;IAClC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC;IACxE,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE;YACN,UAAU,EAAE,MAAM;YAClB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS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nimport {\n getAliasesFromTsConfig,\n getExposedExtensions,\n getSharedDependencies,\n getTileWebpackDevServer,\n} from \"@trackunit/iris-app-build-utilities\";\nimport { TrackunitIrisAppWebpackPlugin } from \"@trackunit/iris-app-webpack-plugin\";\nimport * as path from \"path\";\nimport * as webpack from \"webpack\";\nimport \"webpack-dev-server\";\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst CopyWebpackPlugin = require(\"copy-webpack-plugin\");\n\n/**\n * Gets the default webpack config.\n *\n * @param mode mode either \"production\" or \"development\"\n * @param nxRootDir the root of the nx workspace\n * @param appDir the app directory\n * @param irisAppManifest the iris app manifest\n * @returns { Promise<webpack.Configuration> } the default webpack config\n */\nexport const getDefaultConfig = async (\n mode: \"production\" | \"development\",\n nxRootDir: string,\n appDir: string,\n irisAppManifest: IrisAppManifest\n): Promise<webpack.Configuration> => {\n const relativeAppDir = appDir.split(nxRootDir)[1] || \"<unknown appdir>\";\n return {\n mode: mode,\n output: {\n publicPath: \"auto\",\n path: path.join(nxRootDir, \"dist\", relativeAppDir),\n },\n\n entry: path.resolve(__dirname, \"src\") + \"/index.js\",\n devtool: false,\n devServer: await getTileWebpackDevServer(),\n resolve: {\n extensions: [\".tsx\", \".ts\", \".jsx\", \".js\", \".json\"],\n alias: await getAliasesFromTsConfig({ nxRootDir }),\n },\n module: {\n rules: [\n {\n test: /\\.m?js/,\n type: \"javascript/auto\",\n resolve: {\n fullySpecified: false,\n },\n },\n {\n test: /\\.svg$/,\n type: \"asset/resource\",\n },\n {\n test: /\\.(png|jpg|gif|woff|ico)$/,\n exclude: /(node_modules)/,\n type: \"asset/resource\",\n },\n {\n test: /\\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,\n include: /(node_modules\\/@okta)/,\n type: \"asset/resource\",\n },\n {\n test: /\\.(css|s[ac]ss)$/i,\n use: [\n \"style-loader\",\n \"css-loader\",\n {\n loader: \"postcss-loader\",\n options: {\n postcssOptions: {\n plugins: {\n \"postcss-import\": {},\n \"tailwindcss/nesting\": {},\n tailwindcss: {\n config: path.resolve(appDir, \"tailwind.config.js\"),\n },\n autoprefixer: {},\n },\n },\n },\n },\n ],\n },\n {\n test: /\\.json$/,\n loader: \"json-loader\",\n },\n {\n test: /\\.(j|t)sx?$/,\n exclude: /(vendor|node_modules|dist)/,\n use: {\n loader: \"esbuild-loader\",\n options: {\n loader: \"tsx\",\n jsx: \"automatic\",\n target: \"es6\",\n },\n },\n },\n ],\n },\n\n plugins: [\n new webpack.container.ModuleFederationPlugin({\n name: irisAppManifest.moduleFederationName,\n filename: \"remoteEntry.js\",\n library: { type: \"global\", name: irisAppManifest.moduleFederationName },\n remotes: {},\n exposes: await getExposedExtensions({\n nxRootDir,\n manifest: irisAppManifest,\n }),\n shared: await getSharedDependencies({ manifest: irisAppManifest }),\n }),\n\n new TrackunitIrisAppWebpackPlugin({\n nxRootDir: nxRootDir,\n appDir,\n manifest: irisAppManifest,\n }),\n new CopyWebpackPlugin({\n patterns: [\n {\n //globs must use / in path to be valid\n from: path\n .join(\n path.resolve(relativeAppDir?.substring(1), \"assets\"),\n \"**\",\n \"(*.png|*.svg|*.jpg|*.jpeg|*.webp|*.md)\"\n )\n .replace(/\\\\/g, \"/\"),\n to: path.resolve(nxRootDir, \"dist\"),\n },\n ],\n }),\n ].filter(Boolean),\n };\n};\n"]}
@@ -163,7 +163,7 @@ const updateAppName = async (tree, options) => {
163
163
  }
164
164
  });
165
165
  if (tileApps.length === 1) {
166
- options.app = tileApps[0];
166
+ options.app = tileApps[0] || "<Missing iris app name>";
167
167
  }
168
168
  else if (tileApps.length === 0) {
169
169
  throw new Error("Please add an iris-app using: nx g @trackunit/iris-app:create ");
@@ -1 +1 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/generators/extend/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAWoB;AACpB,uCAAoC;AACpC,+BAAmD;AACnD,+EAA0E;AAC1E,qCAA6C;AAE7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O,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 \"@nx/devkit\";\nimport { Linter } from \"@nx/eslint\";\nimport { getRootTsConfigPathInTree } from \"@nx/js\";\nimport { getNpmScope } from \"@nx/js/src/utils/package-json/get-npm-scope\";\nimport { libraryGenerator } from \"@nx/react\";\nimport { Schema } from \"@nx/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 { addPropertyWithName } from \"../../utils/ast/astUtils\";\nimport { updateFileInTree } from \"../../utils/fileUpdater\";\nimport { spaDependencies, testDependencies } from \"./dependencies\";\nimport { IrisAppExtensionGeneratorSchema } from \"./schema\";\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\n const npmScope = getNpmScope(tree);\n if (!npmScope) {\n throw new Error(\"Could not find npm scope in package.json\");\n }\n const importPath = `@${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 (!tree.exists(`${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 (!tree.exists(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 ...testDependencies,\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 };\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 //TODO: Change the following to update the manifest in the virtual Tree - not on the file system.\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 updateFileInTree(tree, joinPathFragments(normalizedOptions.projectRoot, \"jest.config.ts\"), fileContent =>\n addPropertyWithName(fileContent, \"moduleNameMapper\", {\n \"@trackunit/css-core\": \"jest-transform-stub\",\n \"@trackunit/ui-icons/icons-sprite-mini.svg\": \"jest-transform-stub\",\n \"@trackunit/ui-icons/icons-sprite-outline.svg\": \"jest-transform-stub\",\n \"@trackunit/ui-icons/icons-sprite-solid.svg\": \"jest-transform-stub\",\n })\n );\n\n await formatFiles(tree);\n installPackagesTask(tree, true);\n return () => {\n // eslint-disable-next-line no-console\n console.log(\"🥳 Successfully created an app extensions and it is already added to the Iris App!\");\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 the iris app that this extension should belong to:\",\n type: \"autocomplete\",\n choices: tileApps.map(item => item),\n };\n await prompt(promptObject).then((values: object) => {\n // @ts-ignore - suppressImplicitAnyIndexErrors\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,uCAWoB;AACpB,uCAAoC;AACpC,+BAAmD;AACnD,+EAA0E;AAC1E,qCAA6C;AAE7C,kEAAkC;AAClC,uCAAkC;AAClC,+CAAyB;AACzB,mDAA6B;AAC7B,uCAAqD;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,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 \"@nx/devkit\";\nimport { Linter } from \"@nx/eslint\";\nimport { getRootTsConfigPathInTree } from \"@nx/js\";\nimport { getNpmScope } from \"@nx/js/src/utils/package-json/get-npm-scope\";\nimport { libraryGenerator } from \"@nx/react\";\nimport { Schema } from \"@nx/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 { addPropertyWithName } from \"../../utils/ast/astUtils\";\nimport { updateFileInTree } from \"../../utils/fileUpdater\";\nimport { spaDependencies, testDependencies } from \"./dependencies\";\nimport { IrisAppExtensionGeneratorSchema } from \"./schema\";\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\n const npmScope = getNpmScope(tree);\n if (!npmScope) {\n throw new Error(\"Could not find npm scope in package.json\");\n }\n const importPath = `@${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 (!tree.exists(`${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 (!tree.exists(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 ...testDependencies,\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 };\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 //TODO: Change the following to update the manifest in the virtual Tree - not on the file system.\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 updateFileInTree(tree, joinPathFragments(normalizedOptions.projectRoot, \"jest.config.ts\"), fileContent =>\n addPropertyWithName(fileContent, \"moduleNameMapper\", {\n \"@trackunit/css-core\": \"jest-transform-stub\",\n \"@trackunit/ui-icons/icons-sprite-mini.svg\": \"jest-transform-stub\",\n \"@trackunit/ui-icons/icons-sprite-outline.svg\": \"jest-transform-stub\",\n \"@trackunit/ui-icons/icons-sprite-solid.svg\": \"jest-transform-stub\",\n })\n );\n\n await formatFiles(tree);\n installPackagesTask(tree, true);\n return () => {\n // eslint-disable-next-line no-console\n console.log(\"🥳 Successfully created an app extensions and it is already added to the Iris App!\");\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] || \"<Missing iris app name>\";\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 the iris app that this extension should belong to:\",\n type: \"autocomplete\",\n choices: tileApps.map(item => item),\n };\n await prompt(promptObject).then((values: object) => {\n // @ts-ignore - suppressImplicitAnyIndexErrors\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"]}