@storm-software/k8s-tools 0.25.19 → 0.25.21

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +1 -1
  3. package/dist/chunk-27DDDFDE.mjs +29 -0
  4. package/dist/{chunk-RKHT4PWO.js → chunk-2SIDLIM5.js} +47 -31
  5. package/dist/{chunk-2GAU2GHG.js → chunk-4AADQIGW.js} +35 -102
  6. package/dist/{chunk-T5WNZJOD.js → chunk-7QVOU2PT.js} +3 -11
  7. package/dist/{chunk-3OATAJ3B.js → chunk-A7ARE63F.js} +83 -55
  8. package/dist/chunk-ARIMP3W4.mjs +155 -0
  9. package/dist/{chunk-TNVATOCF.mjs → chunk-BBY7MXHG.mjs} +93 -54
  10. package/dist/{chunk-OIKG7EMC.js → chunk-DD5DCADP.js} +32 -16
  11. package/dist/{chunk-IQYUMTUG.js → chunk-GQUK4O4E.js} +30 -23
  12. package/dist/{chunk-UC4ZBDTX.mjs → chunk-HGXQ6SSU.mjs} +5 -7
  13. package/dist/{chunk-LFNGKV6F.js → chunk-JSFRUBG5.js} +1 -8
  14. package/dist/{chunk-LLSJITI4.mjs → chunk-KVKKT3AU.mjs} +24 -13
  15. package/dist/{chunk-QKTRYJDT.mjs → chunk-MDGD27YL.mjs} +32 -16
  16. package/dist/{chunk-A2UL7VJH.mjs → chunk-MKWEGZBN.mjs} +31 -24
  17. package/dist/{chunk-YY3TH3F7.mjs → chunk-MQZUEUAT.mjs} +26 -21
  18. package/dist/{chunk-F37JQGEZ.mjs → chunk-MWMS7P7U.mjs} +333 -208
  19. package/dist/{chunk-X7ALQPYH.js → chunk-NMNRCEUZ.js} +21 -12
  20. package/dist/{chunk-T3C63ATM.mjs → chunk-NWIIGYA4.mjs} +68 -40
  21. package/dist/{chunk-NJPZBNWH.mjs → chunk-QHFQ2OBL.mjs} +2 -10
  22. package/dist/chunk-RECJ3G6F.js +21 -0
  23. package/dist/{chunk-IOT45LXV.js → chunk-RUPAIXLM.js} +59 -38
  24. package/dist/chunk-RUROM5AC.mjs +136 -0
  25. package/dist/{chunk-PDHZDUK3.js → chunk-SGNASGK5.js} +94 -55
  26. package/dist/{chunk-ARMCUBMY.js → chunk-UWVOFPSW.js} +334 -209
  27. package/dist/{chunk-RDQRJI4Y.mjs → chunk-VREITNWP.mjs} +36 -20
  28. package/dist/{chunk-EAQFLLRB.js → chunk-XKOZIQT3.js} +6 -8
  29. package/dist/{chunk-G7TAEXNU.js → chunk-Y2HMMGO2.js} +28 -23
  30. package/dist/{chunk-YHT26DWR.mjs → chunk-YXXZO2AJ.mjs} +0 -7
  31. package/dist/executors.js +10 -10
  32. package/dist/executors.mjs +9 -9
  33. package/dist/generators.js +7 -7
  34. package/dist/generators.mjs +6 -6
  35. package/dist/index.js +15 -15
  36. package/dist/index.mjs +14 -14
  37. package/dist/src/executors/container-publish/executor.js +6 -6
  38. package/dist/src/executors/container-publish/executor.mjs +5 -5
  39. package/dist/src/executors/helm-package/executor.js +8 -8
  40. package/dist/src/executors/helm-package/executor.mjs +7 -7
  41. package/dist/src/generators/helm-chart/generator.js +6 -6
  42. package/dist/src/generators/helm-chart/generator.mjs +5 -5
  43. package/dist/src/generators/helm-dependency/generator.js +6 -6
  44. package/dist/src/generators/helm-dependency/generator.mjs +5 -5
  45. package/dist/src/plugins/docker/index.js +5 -5
  46. package/dist/src/plugins/docker/index.mjs +4 -4
  47. package/dist/src/types.js +3 -3
  48. package/dist/src/types.mjs +2 -2
  49. package/dist/src/utils/client.js +5 -5
  50. package/dist/src/utils/client.mjs +4 -4
  51. package/dist/src/utils/ensure-init.js +3 -3
  52. package/dist/src/utils/ensure-init.mjs +2 -2
  53. package/dist/src/utils/index.js +6 -6
  54. package/dist/src/utils/index.mjs +5 -5
  55. package/dist/src/utils/prettier.js +3 -3
  56. package/dist/src/utils/prettier.mjs +2 -2
  57. package/dist/tsup.config.js +3 -8
  58. package/dist/tsup.config.mjs +3 -8
  59. package/package.json +1 -1
  60. package/dist/chunk-3GQAWCBQ.js +0 -13
  61. package/dist/chunk-5JZUTREX.mjs +0 -134
  62. package/dist/chunk-L2DHGVS5.mjs +0 -21
  63. package/dist/chunk-ZNGN7YLH.mjs +0 -203
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkOIKG7EMCjs = require('./chunk-OIKG7EMC.js');
4
+ var _chunkDD5DCADPjs = require('./chunk-DD5DCADP.js');
5
5
 
6
6
 
7
7
 
@@ -14,61 +14,75 @@ var _chunkOIKG7EMCjs = require('./chunk-OIKG7EMC.js');
14
14
 
15
15
 
16
16
 
17
- var _chunkARMCUBMYjs = require('./chunk-ARMCUBMY.js');
17
+ var _chunkUWVOFPSWjs = require('./chunk-UWVOFPSW.js');
18
18
 
19
19
 
20
- var _chunk2GAU2GHGjs = require('./chunk-2GAU2GHG.js');
21
-
22
-
23
- var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
20
+ var _chunk4AADQIGWjs = require('./chunk-4AADQIGW.js');
24
21
 
25
22
  // ../workspace-tools/src/base/base-executor.ts
26
23
  var _defu = require('defu');
27
- var withRunExecutor = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (name, executorFn, executorOptions = {}) => async (_options, context) => {
28
- const stopwatch = _chunkARMCUBMYjs.getStopwatch.call(void 0, name);
24
+ var withRunExecutor = (name, executorFn, executorOptions = {}) => async (_options, context) => {
25
+ const stopwatch = _chunkUWVOFPSWjs.getStopwatch.call(void 0, name);
29
26
  let options = _options;
30
27
  let config = {};
31
28
  try {
32
29
  if (!_optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects]) || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
33
- throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
30
+ throw new Error(
31
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
32
+ );
34
33
  }
35
- const workspaceRoot = _chunkARMCUBMYjs.findWorkspaceRoot.call(void 0, );
34
+ const workspaceRoot = _chunkUWVOFPSWjs.findWorkspaceRoot.call(void 0, );
36
35
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot;
37
36
  const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot;
38
37
  const projectName = context.projectName;
39
38
  config.workspaceRoot = workspaceRoot;
40
- _chunkARMCUBMYjs.writeInfo.call(void 0, `\u26A1 Running the ${name} executor for ${projectName} `, config);
39
+ _chunkUWVOFPSWjs.writeInfo.call(void 0, `\u26A1 Running the ${name} executor for ${projectName} `, config);
41
40
  if (!executorOptions.skipReadingConfig) {
42
- _chunkARMCUBMYjs.writeTrace.call(void 0, `Loading the Storm Config from environment variables and storm.config.js file...
41
+ _chunkUWVOFPSWjs.writeTrace.call(void 0,
42
+ `Loading the Storm Config from environment variables and storm.config.js file...
43
43
  - workspaceRoot: ${workspaceRoot}
44
44
  - projectRoot: ${projectRoot}
45
45
  - sourceRoot: ${sourceRoot}
46
46
  - projectName: ${projectName}
47
- `, config);
48
- config = await _chunkARMCUBMYjs.getConfig.call(void 0, workspaceRoot);
47
+ `,
48
+ config
49
+ );
50
+ config = await _chunkUWVOFPSWjs.getConfig.call(void 0, workspaceRoot);
49
51
  }
50
52
  if (_optionalChain([executorOptions, 'optionalAccess', _3 => _3.hooks, 'optionalAccess', _4 => _4.applyDefaultOptions])) {
51
- _chunkARMCUBMYjs.writeDebug.call(void 0, "Running the applyDefaultOptions hook...", config);
52
- options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
53
- _chunkARMCUBMYjs.writeDebug.call(void 0, "Completed the applyDefaultOptions hook", config);
53
+ _chunkUWVOFPSWjs.writeDebug.call(void 0, "Running the applyDefaultOptions hook...", config);
54
+ options = await Promise.resolve(
55
+ executorOptions.hooks.applyDefaultOptions(options, config)
56
+ );
57
+ _chunkUWVOFPSWjs.writeDebug.call(void 0, "Completed the applyDefaultOptions hook", config);
54
58
  }
55
- _chunkARMCUBMYjs.writeTrace.call(void 0, `Executor schema options \u2699\uFE0F
56
- ${_chunkARMCUBMYjs.formatLogMessage.call(void 0, options)}
57
- `, config);
58
- const tokenized = await _chunkOIKG7EMCjs.applyWorkspaceTokens.call(void 0, options, _defu.defu.call(void 0, {
59
- workspaceRoot,
60
- projectRoot,
61
- sourceRoot,
62
- projectName,
59
+ _chunkUWVOFPSWjs.writeTrace.call(void 0,
60
+ `Executor schema options \u2699\uFE0F
61
+ ${_chunkUWVOFPSWjs.formatLogMessage.call(void 0, options)}
62
+ `,
63
63
  config
64
- }, config, context.projectsConfigurations.projects[context.projectName]), _chunkOIKG7EMCjs.applyWorkspaceProjectTokens);
65
- _chunkARMCUBMYjs.writeTrace.call(void 0, `Executor schema tokenized options \u2699\uFE0F
66
- ${_chunkARMCUBMYjs.formatLogMessage.call(void 0, tokenized)}
67
- `, config);
64
+ );
65
+ const tokenized = await _chunkDD5DCADPjs.applyWorkspaceTokens.call(void 0,
66
+ options,
67
+ _defu.defu.call(void 0,
68
+ { workspaceRoot, projectRoot, sourceRoot, projectName, config },
69
+ config,
70
+ context.projectsConfigurations.projects[context.projectName]
71
+ ),
72
+ _chunkDD5DCADPjs.applyWorkspaceProjectTokens
73
+ );
74
+ _chunkUWVOFPSWjs.writeTrace.call(void 0,
75
+ `Executor schema tokenized options \u2699\uFE0F
76
+ ${_chunkUWVOFPSWjs.formatLogMessage.call(void 0, tokenized)}
77
+ `,
78
+ config
79
+ );
68
80
  if (_optionalChain([executorOptions, 'optionalAccess', _5 => _5.hooks, 'optionalAccess', _6 => _6.preProcess])) {
69
- _chunkARMCUBMYjs.writeDebug.call(void 0, "Running the preProcess hook...", config);
70
- await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
71
- _chunkARMCUBMYjs.writeDebug.call(void 0, "Completed the preProcess hook", config);
81
+ _chunkUWVOFPSWjs.writeDebug.call(void 0, "Running the preProcess hook...", config);
82
+ await Promise.resolve(
83
+ executorOptions.hooks.preProcess(tokenized, config)
84
+ );
85
+ _chunkUWVOFPSWjs.writeDebug.call(void 0, "Completed the preProcess hook", config);
72
86
  }
73
87
  const ret = executorFn(tokenized, context, config);
74
88
  if (_isFunction(_optionalChain([ret, 'optionalAccess', _7 => _7.next]))) {
@@ -77,51 +91,62 @@ ${_chunkARMCUBMYjs.formatLogMessage.call(void 0, tokenized)}
77
91
  void iter;
78
92
  }
79
93
  }
80
- const result = await Promise.resolve(ret);
94
+ const result = await Promise.resolve(
95
+ ret
96
+ );
81
97
  if (result && (!result.success || result.error && _optionalChain([result, 'optionalAccess', _8 => _8.error, 'optionalAccess', _9 => _9.message]) && typeof _optionalChain([result, 'optionalAccess', _10 => _10.error, 'optionalAccess', _11 => _11.message]) === "string" && _optionalChain([result, 'optionalAccess', _12 => _12.error, 'optionalAccess', _13 => _13.name]) && typeof _optionalChain([result, 'optionalAccess', _14 => _14.error, 'optionalAccess', _15 => _15.name]) === "string")) {
82
- _chunkARMCUBMYjs.writeTrace.call(void 0, `Failure determined by the ${name} executor
83
- ${_chunkARMCUBMYjs.formatLogMessage.call(void 0, result)}`, config);
98
+ _chunkUWVOFPSWjs.writeTrace.call(void 0,
99
+ `Failure determined by the ${name} executor
100
+ ${_chunkUWVOFPSWjs.formatLogMessage.call(void 0, result)}`,
101
+ config
102
+ );
84
103
  console.error(result);
85
104
  throw new Error(`The ${name} executor failed to run`, {
86
105
  cause: _optionalChain([result, 'optionalAccess', _16 => _16.error])
87
106
  });
88
107
  }
89
108
  if (_optionalChain([executorOptions, 'optionalAccess', _17 => _17.hooks, 'optionalAccess', _18 => _18.postProcess])) {
90
- _chunkARMCUBMYjs.writeDebug.call(void 0, "Running the postProcess hook...", config);
109
+ _chunkUWVOFPSWjs.writeDebug.call(void 0, "Running the postProcess hook...", config);
91
110
  await Promise.resolve(executorOptions.hooks.postProcess(config));
92
- _chunkARMCUBMYjs.writeDebug.call(void 0, "Completed the postProcess hook", config);
111
+ _chunkUWVOFPSWjs.writeDebug.call(void 0, "Completed the postProcess hook", config);
93
112
  }
94
- _chunkARMCUBMYjs.writeSuccess.call(void 0, `Completed running the ${name} task executor!
113
+ _chunkUWVOFPSWjs.writeSuccess.call(void 0, `Completed running the ${name} task executor!
95
114
  `, config);
96
115
  return {
97
116
  success: true
98
117
  };
99
118
  } catch (error) {
100
- _chunkARMCUBMYjs.writeFatal.call(void 0, "A fatal error occurred while running the executor - the process was forced to terminate", config);
101
- _chunkARMCUBMYjs.writeError.call(void 0, `An exception was thrown in the executor's process
119
+ _chunkUWVOFPSWjs.writeFatal.call(void 0,
120
+ "A fatal error occurred while running the executor - the process was forced to terminate",
121
+ config
122
+ );
123
+ _chunkUWVOFPSWjs.writeError.call(void 0,
124
+ `An exception was thrown in the executor's process
102
125
  - Details: ${error.message}
103
- - Stacktrace: ${error.stack}`, config);
126
+ - Stacktrace: ${error.stack}`,
127
+ config
128
+ );
104
129
  return {
105
130
  success: false
106
131
  };
107
132
  } finally {
108
133
  stopwatch();
109
134
  }
110
- }, "withRunExecutor");
111
- var _isFunction = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (value) => {
135
+ };
136
+ var _isFunction = (value) => {
112
137
  try {
113
138
  return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _19 => _19.constructor]) && _optionalChain([value, 'optionalAccess', _20 => _20.call]) && _optionalChain([value, 'optionalAccess', _21 => _21.apply]));
114
139
  } catch (e) {
115
140
  return false;
116
141
  }
117
- }, "_isFunction");
142
+ };
118
143
 
119
144
  // src/executors/helm-package/executor.ts
120
145
  async function serveExecutor(options, context, config) {
121
146
  if (!_optionalChain([context, 'optionalAccess', _22 => _22.projectName]) || !_optionalChain([context, 'optionalAccess', _23 => _23.projectsConfigurations, 'optionalAccess', _24 => _24.projects, 'optionalAccess', _25 => _25[context.projectName], 'optionalAccess', _26 => _26.root])) {
122
147
  throw new Error("Nx executor context was invalid");
123
148
  }
124
- const helm = _chunk2GAU2GHGjs.createHelmClient.call(void 0, );
149
+ const helm = _chunk4AADQIGWjs.createHelmClient.call(void 0, );
125
150
  if (_optionalChain([options, 'access', _27 => _27.dependencies, 'optionalAccess', _28 => _28.repositories])) {
126
151
  for (const repository of options.dependencies.repositories) {
127
152
  if (repository.name && repository.url) {
@@ -147,22 +172,25 @@ async function serveExecutor(options, context, config) {
147
172
  remote: options.remote
148
173
  });
149
174
  } else {
150
- _chunkARMCUBMYjs.writeWarning.call(void 0, `Chart packaged at: ${chartPath}`, config);
175
+ _chunkUWVOFPSWjs.writeWarning.call(void 0, `Chart packaged at: ${chartPath}`, config);
151
176
  }
152
177
  return {
153
178
  success: true
154
179
  };
155
180
  }
156
- _chunk3GQAWCBQjs.__name.call(void 0, serveExecutor, "serveExecutor");
157
- var executor_default = withRunExecutor("Helm Chart Package executor", serveExecutor, {
158
- skipReadingConfig: false,
159
- hooks: {
160
- applyDefaultOptions: /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (options) => {
161
- options.port ??= 4500;
162
- return options;
163
- }, "applyDefaultOptions")
181
+ var executor_default = withRunExecutor(
182
+ "Helm Chart Package executor",
183
+ serveExecutor,
184
+ {
185
+ skipReadingConfig: false,
186
+ hooks: {
187
+ applyDefaultOptions: (options) => {
188
+ options.port ??= 4500;
189
+ return options;
190
+ }
191
+ }
164
192
  }
165
- });
193
+ );
166
194
 
167
195
 
168
196
 
@@ -0,0 +1,155 @@
1
+ // ../workspace-tools/src/utils/package-helpers.ts
2
+ import {
3
+ joinPathFragments,
4
+ readJsonFile
5
+ } from "@nx/devkit";
6
+ import { existsSync } from "node:fs";
7
+
8
+ // ../workspace-tools/src/utils/project-tags.ts
9
+ var ProjectTagConstants = {
10
+ Language: {
11
+ TAG_ID: "language",
12
+ TYPESCRIPT: "typescript",
13
+ RUST: "rust"
14
+ },
15
+ ProjectType: {
16
+ TAG_ID: "type",
17
+ LIBRARY: "library",
18
+ APPLICATION: "application"
19
+ },
20
+ DistStyle: {
21
+ TAG_ID: "dist-style",
22
+ NORMAL: "normal",
23
+ CLEAN: "clean"
24
+ },
25
+ Provider: {
26
+ TAG_ID: "provider"
27
+ },
28
+ Platform: {
29
+ TAG_ID: "platform",
30
+ NODE: "node",
31
+ BROWSER: "browser",
32
+ NEUTRAL: "neutral",
33
+ WORKER: "worker"
34
+ },
35
+ Registry: {
36
+ TAG_ID: "registry",
37
+ CARGO: "cargo",
38
+ NPM: "npm",
39
+ CONTAINER: "container",
40
+ CYCLONE: "cyclone"
41
+ },
42
+ Plugin: {
43
+ TAG_ID: "plugin"
44
+ }
45
+ };
46
+ var formatProjectTag = (variant, value) => {
47
+ return `${variant}:${value}`;
48
+ };
49
+ var hasProjectTag = (project, variant) => {
50
+ project.tags = project.tags ?? [];
51
+ const prefix = formatProjectTag(variant, "");
52
+ return project.tags.some(
53
+ (tag) => tag.startsWith(prefix) && tag.length > prefix.length
54
+ );
55
+ };
56
+ var getProjectTag = (project, variant) => {
57
+ if (!hasProjectTag(project, variant)) {
58
+ return void 0;
59
+ }
60
+ project.tags = project.tags ?? [];
61
+ const prefix = formatProjectTag(variant, "");
62
+ const tag = project.tags.find((tag2) => tag2.startsWith(prefix));
63
+ return tag?.replace(prefix, "");
64
+ };
65
+ var isEqualProjectTag = (project, variant, value) => {
66
+ const tag = getProjectTag(project, variant);
67
+ return !!(tag && tag?.toUpperCase() === value.toUpperCase());
68
+ };
69
+ var addProjectTag = (project, variant, value, options = {
70
+ overwrite: false
71
+ }) => {
72
+ project.tags = project.tags ?? [];
73
+ if (options.overwrite || !hasProjectTag(project, variant)) {
74
+ project.tags = project.tags.filter(
75
+ (tag) => !tag.startsWith(formatProjectTag(variant, ""))
76
+ );
77
+ project.tags.push(formatProjectTag(variant, value));
78
+ }
79
+ };
80
+ var addPluginProjectTag = (project, plugin) => {
81
+ project.tags = project.tags ?? [];
82
+ project.tags.push(
83
+ formatProjectTag(ProjectTagConstants.Plugin.TAG_ID, plugin)
84
+ );
85
+ };
86
+ var setDefaultProjectTags = (project, plugin) => {
87
+ project.tags = project.tags ?? [];
88
+ addProjectTag(
89
+ project,
90
+ ProjectTagConstants.ProjectType.TAG_ID,
91
+ project.projectType === "application" ? ProjectTagConstants.ProjectType.APPLICATION : ProjectTagConstants.ProjectType.LIBRARY,
92
+ { overwrite: true }
93
+ );
94
+ addProjectTag(
95
+ project,
96
+ ProjectTagConstants.DistStyle.TAG_ID,
97
+ project.targets && Object.keys(project.targets).includes("clean-package") ? ProjectTagConstants.DistStyle.CLEAN : ProjectTagConstants.DistStyle.NORMAL,
98
+ { overwrite: true }
99
+ );
100
+ addProjectTag(
101
+ project,
102
+ ProjectTagConstants.Platform.TAG_ID,
103
+ project.targets?.build?.options.platform === "node" ? ProjectTagConstants.Platform.NODE : project.targets?.build?.options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : project.targets?.build?.options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
104
+ { overwrite: false }
105
+ );
106
+ if (plugin) {
107
+ addPluginProjectTag(project, plugin);
108
+ }
109
+ };
110
+
111
+ // ../workspace-tools/src/utils/toml.ts
112
+ import TOML from "@ltd/j-toml";
113
+ import { logger } from "@nx/devkit";
114
+ function parseCargoToml(cargoString) {
115
+ if (!cargoString) {
116
+ throw new Error("Cargo.toml is empty");
117
+ }
118
+ return TOML.parse(cargoString, {
119
+ x: { comment: true }
120
+ });
121
+ }
122
+
123
+ // ../workspace-tools/src/utils/package-helpers.ts
124
+ var getPackageInfo = (project) => {
125
+ if (isEqualProjectTag(
126
+ project,
127
+ ProjectTagConstants.Language.TAG_ID,
128
+ ProjectTagConstants.Language.RUST
129
+ ) && existsSync(joinPathFragments(project.root, "Cargo.toml"))) {
130
+ return {
131
+ type: "Cargo.toml",
132
+ content: parseCargoToml(joinPathFragments(project.root, "Cargo.toml"))
133
+ };
134
+ } else if (isEqualProjectTag(
135
+ project,
136
+ ProjectTagConstants.Language.TAG_ID,
137
+ ProjectTagConstants.Language.TYPESCRIPT
138
+ ) && existsSync(joinPathFragments(project.root, "package.json"))) {
139
+ return {
140
+ type: "package.json",
141
+ content: readJsonFile(
142
+ joinPathFragments(project.root, "package.json")
143
+ )
144
+ };
145
+ }
146
+ return null;
147
+ };
148
+
149
+ export {
150
+ ProjectTagConstants,
151
+ hasProjectTag,
152
+ isEqualProjectTag,
153
+ setDefaultProjectTags,
154
+ getPackageInfo
155
+ };
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  getPackageInfo
3
- } from "./chunk-5JZUTREX.mjs";
3
+ } from "./chunk-ARIMP3W4.mjs";
4
4
  import {
5
5
  applyWorkspaceTokens
6
- } from "./chunk-QKTRYJDT.mjs";
6
+ } from "./chunk-MDGD27YL.mjs";
7
7
  import {
8
8
  findWorkspaceRoot,
9
9
  getConfig
10
- } from "./chunk-F37JQGEZ.mjs";
11
- import {
12
- __name
13
- } from "./chunk-L2DHGVS5.mjs";
10
+ } from "./chunk-MWMS7P7U.mjs";
14
11
 
15
12
  // src/executors/container-publish/executor.ts
16
- import { parseTargetString, runExecutor } from "@nx/devkit";
13
+ import {
14
+ parseTargetString,
15
+ runExecutor
16
+ } from "@nx/devkit";
17
17
 
18
18
  // ../workspace-tools/src/utils/apply-workspace-tokens.ts
19
- var applyWorkspaceExecutorTokens = /* @__PURE__ */ __name(async (option, tokenizerOptions) => {
19
+ var applyWorkspaceExecutorTokens = async (option, tokenizerOptions) => {
20
20
  let result = option;
21
21
  if (!result) {
22
22
  return result;
@@ -44,7 +44,10 @@ var applyWorkspaceExecutorTokens = /* @__PURE__ */ __name(async (option, tokeniz
44
44
  if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
45
45
  for (const configKey of configKeys) {
46
46
  if (result.includes(`{${configKey}}`)) {
47
- result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
47
+ result = result.replaceAll(
48
+ `{${configKey}}`,
49
+ tokenizerOptions.config[configKey]
50
+ );
48
51
  }
49
52
  }
50
53
  }
@@ -59,10 +62,13 @@ var applyWorkspaceExecutorTokens = /* @__PURE__ */ __name(async (option, tokeniz
59
62
  result = result.replaceAll("{sourceRoot}", sourceRoot);
60
63
  }
61
64
  if (result.includes("{workspaceRoot}")) {
62
- result = result.replaceAll("{workspaceRoot}", tokenizerOptions.workspaceRoot ?? findWorkspaceRoot());
65
+ result = result.replaceAll(
66
+ "{workspaceRoot}",
67
+ tokenizerOptions.workspaceRoot ?? findWorkspaceRoot()
68
+ );
63
69
  }
64
70
  return result;
65
- }, "applyWorkspaceExecutorTokens");
71
+ };
66
72
 
67
73
  // src/executors/container-publish/executor.ts
68
74
  import https from "node:https";
@@ -71,30 +77,40 @@ async function* publishExecutor(options, context) {
71
77
  if (!context.projectName) {
72
78
  throw new Error("The executor requires a projectName.");
73
79
  }
74
- console.info(`\u{1F680} Running Storm Container Registry Publish executor on the ${context.projectName} crate`);
80
+ console.info(
81
+ `\u{1F680} Running Storm Container Registry Publish executor on the ${context.projectName} crate`
82
+ );
75
83
  const workspaceRoot = findWorkspaceRoot();
76
84
  const config = await getConfig(workspaceRoot);
77
85
  const projectConfig = context.projectsConfigurations?.projects[context.projectName];
78
86
  if (!projectConfig) {
79
- throw new Error(`The executor requires a valid projectsConfiguration - No configuration found for project ${context.projectName}`);
87
+ throw new Error(
88
+ `The executor requires a valid projectsConfiguration - No configuration found for project ${context.projectName}`
89
+ );
80
90
  }
81
91
  const projectRoot = projectConfig?.root ?? workspaceRoot;
82
92
  const sourceRoot = projectConfig?.sourceRoot ?? workspaceRoot;
83
93
  const projectName = projectConfig?.name ?? context.projectName;
84
94
  config.workspaceRoot = workspaceRoot;
85
- const tokenized = await applyWorkspaceTokens(options, {
86
- config,
87
- workspaceRoot,
88
- projectRoot,
89
- sourceRoot,
90
- projectName,
91
- ...projectConfig
92
- }, applyWorkspaceExecutorTokens);
95
+ const tokenized = await applyWorkspaceTokens(
96
+ options,
97
+ {
98
+ config,
99
+ workspaceRoot,
100
+ projectRoot,
101
+ sourceRoot,
102
+ projectName,
103
+ ...projectConfig
104
+ },
105
+ applyWorkspaceExecutorTokens
106
+ );
93
107
  tokenized.engine ??= "docker";
94
108
  tokenized.registry ??= config.registry.container;
95
109
  try {
96
110
  if (isDryRun) {
97
- console.log(`Would publish to ${tokenized.registry}, but [dry-run] was set`);
111
+ console.log(
112
+ `Would publish to ${tokenized.registry}, but [dry-run] was set`
113
+ );
98
114
  } else {
99
115
  console.log(`Published to ${tokenized.registry}`);
100
116
  const packageManager = getPackageInfo(projectConfig);
@@ -118,25 +134,30 @@ async function* publishExecutor(options, context) {
118
134
  tokenized["labels"].push(`org.opencontainers.image.version=${version}`);
119
135
  const tags = await getRegistryVersion(projectName, config);
120
136
  if (tags.length === 0) {
121
- tokenized["labels"].push(`org.opencontainers.image.created=${(/* @__PURE__ */ new Date()).toISOString()}`);
137
+ tokenized["labels"].push(
138
+ `org.opencontainers.image.created=${(/* @__PURE__ */ new Date()).toISOString()}`
139
+ );
122
140
  } else if (tags.includes(version)) {
123
- console.warn(`Skipped package "${projectName}" because v${version} already exists in ${tokenized.registry}`);
141
+ console.warn(
142
+ `Skipped package "${projectName}" because v${version} already exists in ${tokenized.registry}`
143
+ );
124
144
  return {
125
145
  success: true
126
146
  };
127
147
  }
128
148
  } else {
129
- console.warn(`No package manager found for project "${projectName}" - Skipping container publishing`);
149
+ console.warn(
150
+ `No package manager found for project "${projectName}" - Skipping container publishing`
151
+ );
130
152
  return {
131
153
  success: true
132
154
  };
133
155
  }
134
- const { project, target, configuration } = parseTargetString("container", context);
135
- for await (const output of await runExecutor({
136
- project,
137
- target,
138
- configuration
139
- }, tokenized, context)) {
156
+ const { project, target, configuration } = parseTargetString(
157
+ "container",
158
+ context
159
+ );
160
+ for await (const output of await runExecutor({ project, target, configuration }, tokenized, context)) {
140
161
  if (!output.success) {
141
162
  throw new Error("Could not compile application files");
142
163
  }
@@ -155,39 +176,57 @@ async function* publishExecutor(options, context) {
155
176
  };
156
177
  }
157
178
  }
158
- __name(publishExecutor, "publishExecutor");
159
- var getRegistryVersion = /* @__PURE__ */ __name((name, config) => {
179
+ var getRegistryVersion = (name, config) => {
160
180
  if (!name) {
161
- throw new Error("The `getRegistryVersion` function requires a container name.");
181
+ throw new Error(
182
+ "The `getRegistryVersion` function requires a container name."
183
+ );
162
184
  }
163
185
  try {
164
- const tagsApiUrl = `${config.registry.container}/v2/namespaces/${encodeURIComponent(config.namespace ? config.namespace : "storm-software")}/repositories/${encodeURIComponent(name.replace(`${config.namespace}-`, ""))}/tags`;
186
+ const tagsApiUrl = `${config.registry.container}/v2/namespaces/${encodeURIComponent(config.namespace ? config.namespace : "storm-software")}/repositories/${encodeURIComponent(
187
+ name.replace(`${config.namespace}-`, "")
188
+ )}/tags`;
165
189
  console.log(`Checking for existing version at ${tagsApiUrl}`);
166
- return new Promise((resolve, reject) => https.get(tagsApiUrl, (res) => {
167
- if (res.statusCode === 404) {
168
- console.log(`No existing version found at ${tagsApiUrl}`);
169
- return resolve([]);
170
- }
171
- res.on("data", (data) => {
172
- if (data) {
173
- console.log(`Existing versions found at ${tagsApiUrl} - ${data}`);
174
- const json = JSON.parse(data.toString());
175
- return resolve(json.results.filter((result) => result.status === "active" && result.name && result.name !== "latest").map((result) => result.name));
190
+ return new Promise(
191
+ (resolve, reject) => https.get(tagsApiUrl, (res) => {
192
+ if (res.statusCode === 404) {
193
+ console.log(`No existing version found at ${tagsApiUrl}`);
194
+ return resolve([]);
176
195
  }
177
- return reject(new Error("No data returned from container registry, expected a 404 if no tags exist"));
178
- });
179
- }).on("error", (e) => {
180
- throw e;
181
- }));
196
+ res.on("data", (data) => {
197
+ if (data) {
198
+ console.log(
199
+ `Existing versions found at ${tagsApiUrl} - ${data}`
200
+ );
201
+ const json = JSON.parse(data.toString());
202
+ return resolve(
203
+ json.results.filter(
204
+ (result) => result.status === "active" && result.name && result.name !== "latest"
205
+ ).map((result) => result.name)
206
+ );
207
+ }
208
+ return reject(
209
+ new Error(
210
+ "No data returned from container registry, expected a 404 if no tags exist"
211
+ )
212
+ );
213
+ });
214
+ }).on("error", (e) => {
215
+ throw e;
216
+ })
217
+ );
182
218
  } catch (error) {
183
219
  console.error(`Failed to get version from ${config.registry.container}`);
184
220
  console.error(error);
185
221
  console.log("");
186
- throw new Error(`Could not get version from container registry - ${config.registry.container}`, {
187
- cause: error
188
- });
222
+ throw new Error(
223
+ `Could not get version from container registry - ${config.registry.container}`,
224
+ {
225
+ cause: error
226
+ }
227
+ );
189
228
  }
190
- }, "getRegistryVersion");
229
+ };
191
230
 
192
231
  export {
193
232
  publishExecutor,