@trackunit/iris-app 1.10.28 → 1.11.6

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
@@ -1,3 +1,83 @@
1
+ ## 1.11.6 (2026-01-27)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated iris-app-build-utilities to 1.12.6
6
+ - Updated iris-app-webpack-plugin to 1.11.6
7
+ - Updated iris-app-api to 1.14.6
8
+ - Updated react-test-setup to 1.8.6
9
+ - Updated shared-utils to 1.13.6
10
+
11
+ ## 1.11.5 (2026-01-27)
12
+
13
+ ### 🧱 Updated Dependencies
14
+
15
+ - Updated iris-app-build-utilities to 1.12.5
16
+ - Updated iris-app-webpack-plugin to 1.11.5
17
+ - Updated iris-app-api to 1.14.5
18
+ - Updated react-test-setup to 1.8.5
19
+ - Updated shared-utils to 1.13.5
20
+
21
+ ## 1.11.4 (2026-01-26)
22
+
23
+ ### 🧱 Updated Dependencies
24
+
25
+ - Updated iris-app-build-utilities to 1.12.4
26
+ - Updated iris-app-webpack-plugin to 1.11.4
27
+ - Updated iris-app-api to 1.14.4
28
+ - Updated react-test-setup to 1.8.4
29
+ - Updated shared-utils to 1.13.4
30
+
31
+ ## 1.11.3 (2026-01-26)
32
+
33
+ ### 🧱 Updated Dependencies
34
+
35
+ - Updated iris-app-build-utilities to 1.12.3
36
+ - Updated iris-app-webpack-plugin to 1.11.3
37
+ - Updated iris-app-api to 1.14.3
38
+ - Updated react-test-setup to 1.8.3
39
+ - Updated shared-utils to 1.13.3
40
+
41
+ ## 1.11.2 (2026-01-26)
42
+
43
+ ### 🧱 Updated Dependencies
44
+
45
+ - Updated iris-app-build-utilities to 1.12.2
46
+ - Updated iris-app-webpack-plugin to 1.11.2
47
+ - Updated iris-app-api to 1.14.2
48
+ - Updated react-test-setup to 1.8.2
49
+ - Updated shared-utils to 1.13.2
50
+
51
+ ## 1.11.1 (2026-01-26)
52
+
53
+ ### 🧱 Updated Dependencies
54
+
55
+ - Updated iris-app-build-utilities to 1.12.1
56
+ - Updated iris-app-webpack-plugin to 1.11.1
57
+ - Updated iris-app-api to 1.14.1
58
+ - Updated react-test-setup to 1.8.1
59
+ - Updated shared-utils to 1.13.1
60
+
61
+ ## 1.11.0 (2026-01-26)
62
+
63
+ ### 🚀 Features
64
+
65
+ - add Vite build and serve executors to project.json ([4d89aa11b93](https://github.com/Trackunit/manager/commit/4d89aa11b93))
66
+ - integrate Vite support into Iris App SDK ([dce71027fbf](https://github.com/Trackunit/manager/commit/dce71027fbf))
67
+ - enhance iris-app-sdk-vite with new configurations and cleanup ([de5f148f316](https://github.com/Trackunit/manager/commit/de5f148f316))
68
+
69
+ ### 🧱 Updated Dependencies
70
+
71
+ - Updated iris-app-build-utilities to 1.12.0
72
+ - Updated iris-app-webpack-plugin to 1.11.0
73
+ - Updated iris-app-api to 1.14.0
74
+ - Updated react-test-setup to 1.8.0
75
+ - Updated shared-utils to 1.13.0
76
+
77
+ ### ❤️ Thank You
78
+
79
+ - Mikkel Thorbjørn Andersen
80
+
1
81
  ## 1.10.28 (2026-01-23)
2
82
 
3
83
  ### 🧱 Updated Dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app",
3
- "version": "1.10.28",
3
+ "version": "1.11.6",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "main": "src/index.js",
6
6
  "generators": "./generators.json",
@@ -31,9 +31,9 @@
31
31
  "@npmcli/arborist": "^9.1.9",
32
32
  "webpack-bundle-analyzer": "^4.8.0",
33
33
  "win-ca": "^3.5.1",
34
- "@trackunit/shared-utils": "1.12.26",
35
- "@trackunit/iris-app-api": "1.13.26",
36
- "@trackunit/iris-app-webpack-plugin": "1.10.28",
34
+ "@trackunit/shared-utils": "1.13.6",
35
+ "@trackunit/iris-app-api": "1.14.6",
36
+ "@trackunit/iris-app-webpack-plugin": "1.11.6",
37
37
  "tslib": "^2.6.2",
38
38
  "@clack/prompts": "^1.0.0-alpha.6"
39
39
  },
@@ -9,7 +9,6 @@ const path_1 = require("path");
9
9
  const op = tslib_1.__importStar(require("rxjs/operators"));
10
10
  require("webpack-dev-server");
11
11
  require("win-ca");
12
- const checkPackageVersion_1 = require("../utils/checkPackageVersion");
13
12
  const defaultWebpackConfig_1 = require("../utils/defaultWebpackConfig");
14
13
  const webpack_1 = require("./webpack");
15
14
  const deleteOutputDir = (root, outputPath) => {
@@ -67,7 +66,7 @@ Please update your "project.json" to make the following changes:
67
66
  ================================================================================
68
67
 
69
68
  `);
70
- await (0, checkPackageVersion_1.checkPackageVersion)(false);
69
+ await (0, iris_app_build_utilities_1.checkPackageVersion)(false);
71
70
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
72
71
  const projectRootDir = (0, path_1.join)(context.root, projectRoot);
73
72
  const tileManifestPath = (0, path_1.join)(context.root, projectRoot, "iris-app-manifest.ts");
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/build/executor.ts"],"names":[],"mappings":";;AAoCA,4BA6EC;;AA/GD,wEAAoE;AACpE,kFAAyE;AACzE,2BAA4B;AAC5B,+BAAqC;AAErC,2DAAqC;AAErC,8BAA4B;AAC5B,kBAAgB;AAChB,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,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,IAAA,WAAM,EAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;A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AA,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","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 \"win-ca\";\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 // eslint-disable-next-line no-console\n console.warn(\n `\n================================================================================\n ⚠️ Deprecation Notice ⚠️\n================================================================================\n\nThe NX executor \"@trackunit/iris-app:build\" is **deprecated** and will be\nremoved in the next major version of the Iris App SDK.\n\nPlease update your \"project.json\" to make the following changes:\n\n 1. Update the executor:\n Replace \"@trackunit/iris-app:build\" with:\n 👉 \"@trackunit/iris-app-sdk-rspack:build\"\n\n 2. Update the property name:\n Replace the \"webpackConfig\" property with:\n 👉 \"rspackConfig\"\n\n 3. Rename the configuration file:\n Rename your \"webpack.config.ts\" file to:\n 👉 \"rspack.config.ts\"\n\n Use the following content in the renamed file:\n\n import { Configuration } from \"@rspack/core\";\n\n export default async (configuration: Configuration) => {\n return configuration;\n };\n\n 4. Install the new dependency:\n Add the following package to your project:\n 👉 \"@trackunit/iris-app-sdk-rspack\"\n\n================================================================================\n 🚀 Update now to ensure compatibility! 🚀 ... its also faster!\n================================================================================\n\n`\n );\n await checkPackageVersion(false);\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\n const customConfigFile = await import(options.webpackConfig);\n\n let config = customConfigFile.default(await defaultConfig);\n const isPromise = config instanceof Promise;\n if (isPromise) {\n config = await config;\n }\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":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/build/executor.ts"],"names":[],"mappings":";;AAmCA,4BA6EC;;AA9GD,wEAAoE;AACpE,kFAA8F;AAC9F,2BAA4B;AAC5B,+BAAqC;AAErC,2DAAqC;AAErC,8BAA4B;AAC5B,kBAAgB;AAChB,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,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;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,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCH,CACE,CAAC;IACF,MAAM,IAAA,8CAAmB,EAAC,KAAK,CAAC,CAAC;IACjC,MAAM,WAAW,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAE,CAAC,IAAI,CAAC;IACxF,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC;IACjF,IAAA,6CAAkB,EAAC;QACjB,cAAc;KACf,CAAC,C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*/\nimport { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/src/utils/rxjs-for-await\";\nimport { checkPackageVersion, 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 \"win-ca\";\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 // eslint-disable-next-line no-console\n console.warn(\n `\n================================================================================\n ⚠️ Deprecation Notice ⚠️\n================================================================================\n\nThe NX executor \"@trackunit/iris-app:build\" is **deprecated** and will be\nremoved in the next major version of the Iris App SDK.\n\nPlease update your \"project.json\" to make the following changes:\n\n 1. Update the executor:\n Replace \"@trackunit/iris-app:build\" with:\n 👉 \"@trackunit/iris-app-sdk-rspack:build\"\n\n 2. Update the property name:\n Replace the \"webpackConfig\" property with:\n 👉 \"rspackConfig\"\n\n 3. Rename the configuration file:\n Rename your \"webpack.config.ts\" file to:\n 👉 \"rspack.config.ts\"\n\n Use the following content in the renamed file:\n\n import { Configuration } from \"@rspack/core\";\n\n export default async (configuration: Configuration) => {\n return configuration;\n };\n\n 4. Install the new dependency:\n Add the following package to your project:\n 👉 \"@trackunit/iris-app-sdk-rspack\"\n\n================================================================================\n 🚀 Update now to ensure compatibility! 🚀 ... its also faster!\n================================================================================\n\n`\n );\n await checkPackageVersion(false);\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\n const customConfigFile = await import(options.webpackConfig);\n\n let config = customConfigFile.default(await defaultConfig);\n const isPromise = config instanceof Promise;\n if (isPromise) {\n config = await config;\n }\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"]}
@@ -8,7 +8,6 @@ const path_1 = require("path");
8
8
  const op = tslib_1.__importStar(require("rxjs/operators"));
9
9
  require("webpack-dev-server");
10
10
  require("win-ca");
11
- const checkPackageVersion_1 = require("../utils/checkPackageVersion");
12
11
  const defaultWebpackConfig_1 = require("../utils/defaultWebpackConfig");
13
12
  const webpackDevServer_1 = require("./webpackDevServer");
14
13
  /**
@@ -60,7 +59,7 @@ Please update your "project.json" to make the following changes:
60
59
 
61
60
 
62
61
  `);
63
- await (0, checkPackageVersion_1.checkPackageVersion)(false);
62
+ await (0, iris_app_build_utilities_1.checkPackageVersion)(false);
64
63
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
65
64
  const projectRootDir = (0, path_1.join)(context.root, projectRoot);
66
65
  const tileManifestPath = (0, path_1.join)(context.root, projectRoot, "iris-app-manifest.ts");
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/serve/executor.ts"],"names":[],"mappings":";;AAyBA,4BA8EC;;AArGD,wEAAoE;AACpE,kFAAyE;AACzE,+BAA4B;AAE5B,2DAAqC;AAErC,8BAA4B;AAC5B,kBAAgB;AAChB,sEAAmE;AACnE,wEAAiE;AAEjE,yDAA2D;AAK3D;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,WAAE,OAA4B,EAAE,OAAwB;IACpF,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCH,CACE,CAAC;IACF,MAAM,IAAA,yCAAmB,EAAC,KAAK,CAAC,CAAC;IACjC,MAAM,WAAW,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAE,CAAC,IAAI,CAAC;IACxF,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC;IACjF,IAAA,6CAAkB,EAAC;QACjB,cAAc;KACf,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;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,IAAI,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,aAAa,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,MAAM,YAAY,OAAO,CAAC;IAC5C,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,GAAG,MAAM,aAAa,CAAC;IAC/B,CAAC;IAED,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","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 \"win-ca\";\nimport { checkPackageVersion } from \"../utils/checkPackageVersion\";\nimport { getDefaultConfig } from \"../utils/defaultWebpackConfig\";\nimport { ServeExecutorSchema } from \"./schema\";\nimport { doRunWebpackDevServer } from \"./webpackDevServer\";\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\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 // eslint-disable-next-line no-console\n console.warn(\n `\n================================================================================\n ⚠️ Deprecation Notice ⚠️\n================================================================================\n\nThe NX executor \"@trackunit/iris-app:serve\" is **deprecated** and will be\nremoved in the next major version of the Iris App SDK.\n\nPlease update your \"project.json\" to make the following changes:\n\n 1. Update the executor:\n Replace \"@trackunit/iris-app:serve\" with:\n 👉 \"@trackunit/iris-app-sdk-rspack:serve\"\n\n 2. Update the property name:\n Replace the \"webpackConfig\" property with:\n 👉 \"rspackConfig\"\n\n 3. Rename the configuration file:\n Rename your \"webpack.config.ts\" file to:\n 👉 \"rspack.config.ts\"\n\n Use the following content in the renamed file:\n\n import { Configuration } from \"@rspack/core\";\n\n export default async (configuration: Configuration) => {\n return configuration;\n };\n\n 4. Install the new dependency:\n Add the following package to your project:\n 👉 \"@trackunit/iris-app-sdk-rspack\"\n\n================================================================================\n 🚀 Update now to ensure compatibility! 🚀 ... its also faster!\n================================================================================\n\n\n`\n );\n await checkPackageVersion(false);\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(\"development\", context.root, projectRootDir, IrisAppManifest);\n const customConfigFile = await import(options.webpackConfig);\n\n let config = customConfigFile.default(await defaultConfig);\n const isPromise = config instanceof Promise;\n if (isPromise) {\n config = await defaultConfig;\n }\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":";;AAwBA,4BA8EC;;AApGD,wEAAoE;AACpE,kFAA8F;AAC9F,+BAA4B;AAE5B,2DAAqC;AAErC,8BAA4B;AAC5B,kBAAgB;AAChB,wEAAiE;AAEjE,yDAA2D;AAK3D;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,WAAE,OAA4B,EAAE,OAAwB;IACpF,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCH,CACE,CAAC;IACF,MAAM,IAAA,8CAAmB,EAAC,KAAK,CAAC,CAAC;IACjC,MAAM,WAAW,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAE,CAAC,IAAI,CAAC;IACxF,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC;IACjF,IAAA,6CAAkB,EAAC;QACjB,cAAc;KACf,CAAC,CAAC;IACH,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;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,IAAI,MAAM,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,aAAa,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,MAAM,YAAY,OAAO,CAAC;IAC5C,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,GAAG,MAAM,aAAa,CAAC;IAC/B,CAAC;IAED,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","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/src/utils/rxjs-for-await\";\nimport { checkPackageVersion, 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 \"win-ca\";\nimport { getDefaultConfig } from \"../utils/defaultWebpackConfig\";\nimport { ServeExecutorSchema } from \"./schema\";\nimport { doRunWebpackDevServer } from \"./webpackDevServer\";\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports\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 // eslint-disable-next-line no-console\n console.warn(\n `\n================================================================================\n ⚠️ Deprecation Notice ⚠️\n================================================================================\n\nThe NX executor \"@trackunit/iris-app:serve\" is **deprecated** and will be\nremoved in the next major version of the Iris App SDK.\n\nPlease update your \"project.json\" to make the following changes:\n\n 1. Update the executor:\n Replace \"@trackunit/iris-app:serve\" with:\n 👉 \"@trackunit/iris-app-sdk-rspack:serve\"\n\n 2. Update the property name:\n Replace the \"webpackConfig\" property with:\n 👉 \"rspackConfig\"\n\n 3. Rename the configuration file:\n Rename your \"webpack.config.ts\" file to:\n 👉 \"rspack.config.ts\"\n\n Use the following content in the renamed file:\n\n import { Configuration } from \"@rspack/core\";\n\n export default async (configuration: Configuration) => {\n return configuration;\n };\n\n 4. Install the new dependency:\n Add the following package to your project:\n 👉 \"@trackunit/iris-app-sdk-rspack\"\n\n================================================================================\n 🚀 Update now to ensure compatibility! 🚀 ... its also faster!\n================================================================================\n\n\n`\n );\n await checkPackageVersion(false);\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(\"development\", context.root, projectRootDir, IrisAppManifest);\n const customConfigFile = await import(options.webpackConfig);\n\n let config = customConfigFile.default(await defaultConfig);\n const isPromise = config instanceof Promise;\n if (isPromise) {\n config = await defaultConfig;\n }\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"]}
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = runExecutor;
4
4
  const tslib_1 = require("tslib");
5
5
  const arborist_1 = require("@npmcli/arborist");
6
+ const iris_app_build_utilities_1 = require("@trackunit/iris-app-build-utilities");
6
7
  const libpub = tslib_1.__importStar(require("libnpmpublish"));
7
8
  const pacote = tslib_1.__importStar(require("pacote"));
8
9
  const readline_1 = tslib_1.__importDefault(require("readline"));
9
10
  const win_ca_1 = require("win-ca");
10
11
  const authentication_1 = require("../utils/authentication");
11
- const checkPackageVersion_1 = require("../utils/checkPackageVersion");
12
12
  const irisAppServerSettings_1 = require("../utils/irisAppServerSettings");
13
13
  // Inject Windows trusted certificates to support Zscalar and other traffic inspection systems.
14
14
  (0, win_ca_1.inject)("+");
@@ -28,7 +28,7 @@ function sleep(time) {
28
28
  * @returns {Promise<{ success: boolean }>} The result of the submit.
29
29
  */
30
30
  async function runExecutor(options) {
31
- await (0, checkPackageVersion_1.checkPackageVersion)(true);
31
+ await (0, iris_app_build_utilities_1.checkPackageVersion)(true);
32
32
  const settings = (0, irisAppServerSettings_1.getSettings)();
33
33
  const linkToTerms = "https://trackunit.com/terms-conditions-marketplace/";
34
34
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/submit/executor.ts"],"names":[],"mappings":";;AA+BA,8BAqCC;;AAlED,+CAA4C;AAC5C,8DAAwC;AACxC,uDAAiC;AACjC,gEAAgC;AAChC,mCAAgC;AAChC,4DAAyD;AACzD,sEAAmE;AACnE,0EAAuE;AAGvE,+FAA+F;AAC/F,IAAA,eAAM,EAAC,GAAG,CAAC,CAAC;AAIZ,MAAM,gBAAiB,SAAQ,KAAK;CAAG;AACvC,MAAM,eAAgB,SAAQ,KAAK;CAAG;AACtC,MAAM,YAAa,S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,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,KAAa,EAAE,QAAqB,EAAE,QAAkB;IAClF,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE;YACvG,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE;aACjC;SACF,CAAC,CAAC;QAEH,IAAI,aAAa,CAAC,EAAE,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,sBAAsB,QAAQ,CAAC,OAAO,OAAO,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;YAC3E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,YAAY,CACpB,GAAG,aAAa,CAAC,UAAU,KAAK,MAAM,aAAa,CAAC,IAAI,EAAE,eAAe,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CACjH,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable no-console */\nimport { PackageJson } from \"@npm/types\";\nimport { Arborist } from \"@npmcli/arborist\";\nimport * as libpub from \"libnpmpublish\";\nimport * as pacote from \"pacote\";\nimport readline from \"readline\";\nimport { inject } from \"win-ca\";\nimport { getAccessToken } from \"../utils/authentication\";\nimport { checkPackageVersion } from \"../utils/checkPackageVersion\";\nimport { getSettings, Settings } from \"../utils/irisAppServerSettings\";\nimport { SubmitExecutorSchema } from \"./schema\";\n\n// Inject Windows trusted certificates to support Zscalar and other traffic inspection systems.\ninject(\"+\");\n\ntype SubmitError = Error & { statusCode?: number; code?: string; headers?: { [key: string]: string } };\n\nclass NpmConflictError extends Error {}\nclass NpmGeneralError extends Error {}\nclass ApproveError extends Error {}\n\nfunction sleep(time: number) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\n\n/**\n * Submit the package to the npm registry.\n *\n * @param {SubmitExecutorSchema} options The options provided to the executor.\n * @returns {Promise<{ success: boolean }>} The result of the submit.\n */\nexport default async function runExecutor(options: SubmitExecutorSchema) {\n await checkPackageVersion(true);\n const settings = getSettings();\n const linkToTerms = \"https://trackunit.com/terms-conditions-marketplace/\";\n\n try {\n if (options.devTermsAndConditions?.toLowerCase() !== \"accept\" && !settings.devTermsAccept) {\n // Ask user if they accept dev terms and conditions.\n const userInput = await promptUserForInput(\n `Do you accept the developer terms and conditions? \\n(${linkToTerms}) \\n\\n 📝 Type 'accept' to proceed: `\n );\n if (userInput.toLowerCase() !== \"accept\") {\n throw new Error(`You must accept the developer terms and conditions (${linkToTerms}) to continue.`);\n }\n }\n const tokenData = await getAccessToken(settings.env);\n\n if (\"access_token\" in tokenData) {\n console.log(\"🥳 Successfully authenticated.\");\n\n const manifest = (await pacote.manifest(options.inputPath)) as PackageJson;\n const tarData = await pacote.tarball(options.inputPath, { Arborist });\n\n return await doUploadAppWithRetry(tokenData.access_token, manifest, tarData, settings, 10);\n } else if (\"error\" in tokenData) {\n if (tokenData.error === \"expired_token\") {\n throw new Error(\"⌛️ Authentication attempt expired\");\n } else {\n throw new Error(`Error occurred: ${tokenData.error} ${tokenData.error_description}`);\n }\n } else {\n throw new Error(\"Unknown error occurred\");\n }\n } catch (e) {\n console.error(\"❌ \", e);\n return { success: false };\n }\n}\n\nasync function doUploadAppWithRetry(\n accessToken: string,\n manifest: PackageJson,\n tarData: Buffer & pacote.FetchResult,\n settings: Settings,\n retryCount: number\n): Promise<{ success: boolean }> {\n try {\n return await doUploadApp(accessToken, manifest, tarData, settings);\n } catch (e) {\n if (e instanceof NpmConflictError) {\n console.error(\"❌ Unable to ship app package. Cannot submit over existing version.\");\n return { success: false };\n } else {\n if (retryCount > 1) {\n console.error(\"⚠️ Unable to ship app package. Got error from Iris App SDK repository. Retrying submit...\", e);\n await sleep(30000);\n return await doUploadAppWithRetry(accessToken, manifest, tarData, settings, retryCount - 1);\n } else {\n console.error(\"❌ Unable to ship app package. Got error from Iris App SDK repository.\", e);\n return { success: false };\n }\n }\n }\n}\n\nasync function doUploadApp(\n accessToken: string,\n manifest: PackageJson,\n tarData: Buffer & pacote.FetchResult,\n settings: Settings\n): Promise<{ success: boolean }> {\n const npmFetchOptions: { registry?: string } & Record<string, string | boolean> = {};\n npmFetchOptions.registry = settings.repoUrl.toString();\n const repoHostAndPort = settings.repoUrl.hostname + (settings.repoUrl.port ? \":\" + settings.repoUrl.port : \"\");\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}:_authToken`] = accessToken;\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}/repo/:always-auth`] = true;\n\n console.log(\"🚢 Shipping the app package...\");\n const submitResult = await libpub.publish(manifest, tarData, npmFetchOptions).catch((err: SubmitError) => {\n if (err.statusCode === 409 || err.code === \"E409\" || err.code === \"EPUBLISHCONFLICT\") {\n return {\n ok: false,\n publishConflict: true,\n };\n } else {\n return {\n ok: false,\n headers: new Headers(err.headers),\n statusText: `Error`,\n text: () => Promise.resolve(`${err.name} ${err.message}`),\n };\n }\n });\n\n const warningsText = submitResult.headers?.get(\"TU-IRIS-APP-WARNINGS\");\n if (warningsText) {\n console.log(\"⚠️ \" + decodeURI(warningsText));\n }\n\n if (submitResult.ok) {\n console.log(`🚀 Uploaded the app package version ${manifest.version}`);\n\n return await doApproveAppWithRetry(accessToken, manifest, settings, 3);\n } else if (\"publishConflict\" in submitResult) {\n if (process.env.SKIP_EXISTING === \"true\") {\n console.log(`⏩ Skipped submitting ${manifest.version} because the version is already submitted`);\n return await doApproveAppWithRetry(accessToken, manifest, settings, 3);\n } else {\n throw new NpmConflictError();\n }\n } else {\n throw new NpmGeneralError(\n submitResult.statusText +\n \" \" +\n (await submitResult.text()) +\n \". Trace ID: \" +\n submitResult.headers.get(\"trace-id\")\n );\n }\n}\n\nasync function promptUserForInput(query: string): Promise<string> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise(resolve => {\n rl.question(query, (input: string) => {\n rl.close();\n resolve(input);\n });\n });\n}\n\nasync function doApproveAppWithRetry(\n token: string,\n manifest: PackageJson,\n settings: Settings,\n retryCount: number\n): Promise<{ success: boolean }> {\n try {\n return await doApproveApp(token, manifest, settings);\n } catch (e) {\n if (e instanceof ApproveError) {\n if (retryCount > 1) {\n console.error(\n \"⚠️ Unable to approve app package. Got approve error from Iris App SDK repository. Retrying approve...\",\n e\n );\n await sleep(30000);\n return await doApproveAppWithRetry(token, manifest, settings, retryCount - 1);\n } else {\n console.error(\"❌ Unable to approve app package. Got approve error from Iris App SDK repository.\", e);\n return { success: false };\n }\n } else {\n console.error(\"❌ Unable to approve app package. Got error from Iris App SDK repository.\", e);\n return { success: false };\n }\n }\n}\n\nasync function doApproveApp(token: string, manifest: PackageJson, settings: Settings) {\n if (process.env.TU_APPROVE === \"true\") {\n console.log(`🖋️ Approving the app...`);\n const approveResult = await fetch(new URL(`${manifest.name}@${manifest.version}`, settings.approvalUrl), {\n method: \"PUT\",\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (approveResult.ok) {\n console.log(`✅ Approved version ${manifest.version} of ${manifest.name}.`);\n return { success: true };\n } else {\n throw new ApproveError(\n `${approveResult.statusText}, ${await approveResult.text()}, Trace ID: ${approveResult.headers.get(\"trace-id\")}`\n );\n }\n } else {\n return { success: true };\n }\n}\n"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/submit/executor.ts"],"names":[],"mappings":";;AA+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C","sourcesContent":["/* eslint-disable no-console */\nimport { PackageJson } from \"@npm/types\";\nimport { Arborist } from \"@npmcli/arborist\";\nimport { checkPackageVersion } from \"@trackunit/iris-app-build-utilities\";\nimport * as libpub from \"libnpmpublish\";\nimport * as pacote from \"pacote\";\nimport readline from \"readline\";\nimport { inject } from \"win-ca\";\nimport { getAccessToken } from \"../utils/authentication\";\nimport { getSettings, Settings } from \"../utils/irisAppServerSettings\";\nimport { SubmitExecutorSchema } from \"./schema\";\n\n// Inject Windows trusted certificates to support Zscalar and other traffic inspection systems.\ninject(\"+\");\n\ntype SubmitError = Error & { statusCode?: number; code?: string; headers?: { [key: string]: string } };\n\nclass NpmConflictError extends Error {}\nclass NpmGeneralError extends Error {}\nclass ApproveError extends Error {}\n\nfunction sleep(time: number) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\n\n/**\n * Submit the package to the npm registry.\n *\n * @param {SubmitExecutorSchema} options The options provided to the executor.\n * @returns {Promise<{ success: boolean }>} The result of the submit.\n */\nexport default async function runExecutor(options: SubmitExecutorSchema) {\n await checkPackageVersion(true);\n const settings = getSettings();\n const linkToTerms = \"https://trackunit.com/terms-conditions-marketplace/\";\n\n try {\n if (options.devTermsAndConditions?.toLowerCase() !== \"accept\" && !settings.devTermsAccept) {\n // Ask user if they accept dev terms and conditions.\n const userInput = await promptUserForInput(\n `Do you accept the developer terms and conditions? \\n(${linkToTerms}) \\n\\n 📝 Type 'accept' to proceed: `\n );\n if (userInput.toLowerCase() !== \"accept\") {\n throw new Error(`You must accept the developer terms and conditions (${linkToTerms}) to continue.`);\n }\n }\n const tokenData = await getAccessToken(settings.env);\n\n if (\"access_token\" in tokenData) {\n console.log(\"🥳 Successfully authenticated.\");\n\n const manifest = (await pacote.manifest(options.inputPath)) as PackageJson;\n const tarData = await pacote.tarball(options.inputPath, { Arborist });\n\n return await doUploadAppWithRetry(tokenData.access_token, manifest, tarData, settings, 10);\n } else if (\"error\" in tokenData) {\n if (tokenData.error === \"expired_token\") {\n throw new Error(\"⌛️ Authentication attempt expired\");\n } else {\n throw new Error(`Error occurred: ${tokenData.error} ${tokenData.error_description}`);\n }\n } else {\n throw new Error(\"Unknown error occurred\");\n }\n } catch (e) {\n console.error(\"❌ \", e);\n return { success: false };\n }\n}\n\nasync function doUploadAppWithRetry(\n accessToken: string,\n manifest: PackageJson,\n tarData: Buffer & pacote.FetchResult,\n settings: Settings,\n retryCount: number\n): Promise<{ success: boolean }> {\n try {\n return await doUploadApp(accessToken, manifest, tarData, settings);\n } catch (e) {\n if (e instanceof NpmConflictError) {\n console.error(\"❌ Unable to ship app package. Cannot submit over existing version.\");\n return { success: false };\n } else {\n if (retryCount > 1) {\n console.error(\"⚠️ Unable to ship app package. Got error from Iris App SDK repository. Retrying submit...\", e);\n await sleep(30000);\n return await doUploadAppWithRetry(accessToken, manifest, tarData, settings, retryCount - 1);\n } else {\n console.error(\"❌ Unable to ship app package. Got error from Iris App SDK repository.\", e);\n return { success: false };\n }\n }\n }\n}\n\nasync function doUploadApp(\n accessToken: string,\n manifest: PackageJson,\n tarData: Buffer & pacote.FetchResult,\n settings: Settings\n): Promise<{ success: boolean }> {\n const npmFetchOptions: { registry?: string } & Record<string, string | boolean> = {};\n npmFetchOptions.registry = settings.repoUrl.toString();\n const repoHostAndPort = settings.repoUrl.hostname + (settings.repoUrl.port ? \":\" + settings.repoUrl.port : \"\");\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}:_authToken`] = accessToken;\n npmFetchOptions[`//${repoHostAndPort}${settings.repoUrl.pathname}/repo/:always-auth`] = true;\n\n console.log(\"🚢 Shipping the app package...\");\n const submitResult = await libpub.publish(manifest, tarData, npmFetchOptions).catch((err: SubmitError) => {\n if (err.statusCode === 409 || err.code === \"E409\" || err.code === \"EPUBLISHCONFLICT\") {\n return {\n ok: false,\n publishConflict: true,\n };\n } else {\n return {\n ok: false,\n headers: new Headers(err.headers),\n statusText: `Error`,\n text: () => Promise.resolve(`${err.name} ${err.message}`),\n };\n }\n });\n\n const warningsText = submitResult.headers?.get(\"TU-IRIS-APP-WARNINGS\");\n if (warningsText) {\n console.log(\"⚠️ \" + decodeURI(warningsText));\n }\n\n if (submitResult.ok) {\n console.log(`🚀 Uploaded the app package version ${manifest.version}`);\n\n return await doApproveAppWithRetry(accessToken, manifest, settings, 3);\n } else if (\"publishConflict\" in submitResult) {\n if (process.env.SKIP_EXISTING === \"true\") {\n console.log(`⏩ Skipped submitting ${manifest.version} because the version is already submitted`);\n return await doApproveAppWithRetry(accessToken, manifest, settings, 3);\n } else {\n throw new NpmConflictError();\n }\n } else {\n throw new NpmGeneralError(\n submitResult.statusText +\n \" \" +\n (await submitResult.text()) +\n \". Trace ID: \" +\n submitResult.headers.get(\"trace-id\")\n );\n }\n}\n\nasync function promptUserForInput(query: string): Promise<string> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise(resolve => {\n rl.question(query, (input: string) => {\n rl.close();\n resolve(input);\n });\n });\n}\n\nasync function doApproveAppWithRetry(\n token: string,\n manifest: PackageJson,\n settings: Settings,\n retryCount: number\n): Promise<{ success: boolean }> {\n try {\n return await doApproveApp(token, manifest, settings);\n } catch (e) {\n if (e instanceof ApproveError) {\n if (retryCount > 1) {\n console.error(\n \"⚠️ Unable to approve app package. Got approve error from Iris App SDK repository. Retrying approve...\",\n e\n );\n await sleep(30000);\n return await doApproveAppWithRetry(token, manifest, settings, retryCount - 1);\n } else {\n console.error(\"❌ Unable to approve app package. Got approve error from Iris App SDK repository.\", e);\n return { success: false };\n }\n } else {\n console.error(\"❌ Unable to approve app package. Got error from Iris App SDK repository.\", e);\n return { success: false };\n }\n }\n}\n\nasync function doApproveApp(token: string, manifest: PackageJson, settings: Settings) {\n if (process.env.TU_APPROVE === \"true\") {\n console.log(`🖋️ Approving the app...`);\n const approveResult = await fetch(new URL(`${manifest.name}@${manifest.version}`, settings.approvalUrl), {\n method: \"PUT\",\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (approveResult.ok) {\n console.log(`✅ Approved version ${manifest.version} of ${manifest.name}.`);\n return { success: true };\n } else {\n throw new ApproveError(\n `${approveResult.statusText}, ${await approveResult.text()}, Trace ID: ${approveResult.headers.get(\"trace-id\")}`\n );\n }\n } else {\n return { success: true };\n }\n}\n"]}
@@ -1,30 +0,0 @@
1
- /**
2
- *
3
- * @param pkg package to look for.
4
- * @param localRange local version of the package.
5
- * @param range range
6
- * @returns { boolean } true if its a valid version
7
- */
8
- export declare const versionCheck: (pkg: string, localRange: string, range: string, throwError?: boolean) => boolean;
9
- /**
10
- * Get the latest version of the package from the registry.
11
- *
12
- * @param pkg package to look for.
13
- * @returns { Promise<string> } returns version
14
- */
15
- export declare const getLatestRemoteVersion: (pkg: string) => Promise<string>;
16
- /**
17
- * Check if the current version of the package is the same as the one in the manager.
18
- *
19
- * @param {string} managerNxVersion version of nx in the manager
20
- * @returns { boolean} true if its a valid version
21
- */
22
- export declare function checkNxVersion(managerNxVersion: string, throwError?: boolean): Promise<boolean>;
23
- /**
24
- *
25
- */
26
- export declare function checkTrackunitPackages(dependencies: Record<string, string>, throwError?: boolean): Promise<boolean>;
27
- /**
28
- *
29
- */
30
- export declare function checkPackageVersion(throwError?: boolean): Promise<boolean>;
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLatestRemoteVersion = exports.versionCheck = void 0;
4
- exports.checkNxVersion = checkNxVersion;
5
- exports.checkTrackunitPackages = checkTrackunitPackages;
6
- exports.checkPackageVersion = checkPackageVersion;
7
- const tslib_1 = require("tslib");
8
- const devkit_1 = require("@nx/devkit");
9
- const shared_utils_1 = require("@trackunit/shared-utils");
10
- const child_process_1 = require("child_process");
11
- const pacote = tslib_1.__importStar(require("pacote"));
12
- const semver = tslib_1.__importStar(require("semver"));
13
- /**
14
- *
15
- * @param pkg package to look for.
16
- * @param localRange local version of the package.
17
- * @param range range
18
- * @returns { boolean } true if its a valid version
19
- */
20
- const versionCheck = (pkg, localRange, range, throwError = true) => {
21
- const localVersion = semver.minVersion(localRange) ?? localRange; // ('^1.0.0') => '1.0.0'
22
- const remoteVersion = semver.minVersion(range) ?? range; // Assume range is in a format that semver.minVersion can handle
23
- if (!semver.satisfies(localVersion, range)) {
24
- 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`;
25
- if (semver.major(localVersion) < semver.major(remoteVersion) && throwError) {
26
- throw new Error(msg);
27
- }
28
- else {
29
- // eslint-disable-next-line no-console
30
- console.warn("⚠️ " + msg + "\n");
31
- return true;
32
- }
33
- }
34
- return true;
35
- };
36
- exports.versionCheck = versionCheck;
37
- /**
38
- * Get the latest version of the package from the registry.
39
- *
40
- * @param pkg package to look for.
41
- * @returns { Promise<string> } returns version
42
- */
43
- const getLatestRemoteVersion = async (pkg) => {
44
- try {
45
- const manifest = await pacote.manifest(pkg);
46
- return manifest.version;
47
- }
48
- catch (error) {
49
- throw new Error(`Error fetching manifest for package ${pkg}. This package might need to be published, or it has been included as a dependency by mistake.`);
50
- }
51
- };
52
- exports.getLatestRemoteVersion = getLatestRemoteVersion;
53
- /**
54
- * Check if the current version of the package is the same as the one in the manager.
55
- *
56
- * @param {string} managerNxVersion version of nx in the manager
57
- * @returns { boolean} true if its a valid version
58
- */
59
- async function checkNxVersion(managerNxVersion, throwError = true) {
60
- const currentNxVersion = (0, child_process_1.execSync)("nx --version")
61
- .toString("utf-8")
62
- .replace(/\r?\n|\r/, ""); // regex removes any line breaks
63
- return (0, exports.versionCheck)("nx", currentNxVersion, managerNxVersion, throwError);
64
- }
65
- /**
66
- *
67
- */
68
- async function checkTrackunitPackages(dependencies, throwError = true) {
69
- for (const key in dependencies) {
70
- const remoteVersion = await (0, exports.getLatestRemoteVersion)(key);
71
- if (remoteVersion) {
72
- const localDependencyVersion = dependencies[key];
73
- // If @trackunit dependencies are linked/added locally using "file:", skip the version check, used for E2E tests.
74
- if (localDependencyVersion && !localDependencyVersion.includes("file:")) {
75
- (0, exports.versionCheck)(key, localDependencyVersion, remoteVersion, throwError);
76
- }
77
- }
78
- }
79
- return true;
80
- }
81
- function getLibraries() {
82
- const packageJsonLocal = (0, devkit_1.readJsonFile)("package.json");
83
- const trackunitDependencies = (0, shared_utils_1.objectFromEntries)(Object.entries(packageJsonLocal.dependencies || {}).filter(([key]) => key.startsWith("@trackunit/")));
84
- const trackunitDevDependencies = (0, shared_utils_1.objectFromEntries)(Object.entries(packageJsonLocal.devDependencies || {}).filter(([key]) => key.startsWith("@trackunit/")));
85
- return { trackunitDependencies, trackunitDevDependencies };
86
- }
87
- /**
88
- *
89
- */
90
- async function checkPackageVersion(throwError = true) {
91
- const { trackunitDependencies, trackunitDevDependencies } = getLibraries();
92
- // const managerNxVersion = version.managerNxVersion;
93
- // await checkNxVersion(managerNxVersion, throwError);
94
- await checkTrackunitPackages(trackunitDependencies, throwError);
95
- await checkTrackunitPackages(trackunitDevDependencies, throwError);
96
- return true;
97
- }
98
- //# sourceMappingURL=checkPackageVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkPackageVersion.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app/src/executors/utils/checkPackageVersion.ts"],"names":[],"mappings":";;;AAqDA,wCAKC;AAKD,wDAYC;AAgBD,kDAOC;;AAlGD,uCAA0C;AAC1C,0DAA4D;AAC5D,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,CAAC,IAAI,UAAU,CAAC,CAAC,wBAAwB;IAC1F,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,IAA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B,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","sourcesContent":["import { readJsonFile } from \"@nx/devkit\";\nimport { objectFromEntries } from \"@trackunit/shared-utils\";\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 = objectFromEntries(\n Object.entries(packageJsonLocal.dependencies || {}).filter(([key]) => key.startsWith(\"@trackunit/\"))\n );\n const trackunitDevDependencies = objectFromEntries(\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,4 +0,0 @@
1
- export declare const version: {
2
- managerNxVersion: string;
3
- managerNodeVersion: string;
4
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.version = void 0;
4
- // The major version of NX and Node specified here will be matched with corresponding versions in the iris app.
5
- exports.version = {
6
- managerNxVersion: "^19.8.3",
7
- managerNodeVersion: "^22.14.0",
8
- };
9
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
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: \"^19.8.3\",\n managerNodeVersion: \"^22.14.0\",\n};\n"]}