@storm-software/k8s-tools 0.33.30 → 0.33.31

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,19 @@
2
2
 
3
3
  # Changelog for Storm Ops - K8s Tools
4
4
 
5
+ ## [0.33.30](https://github.com/storm-software/storm-ops/releases/tag/k8s-tools%400.33.30) (2025-06-27)
6
+
7
+ ### Miscellaneous
8
+
9
+ - **monorepo:** Regenerated README markdown files
10
+ ([e86c0228b](https://github.com/storm-software/storm-ops/commit/e86c0228b))
11
+
12
+ ### Updated Dependencies
13
+
14
+ - Updated workspace-tools to 1.277.6
15
+ - Updated config-tools to 1.175.5
16
+ - Updated config to 1.124.7
17
+
5
18
  ## [0.33.29](https://github.com/storm-software/storm-ops/releases/tag/k8s-tools%400.33.29) (2025-06-27)
6
19
 
7
20
  ### Miscellaneous
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.33.28-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.33.29-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
@@ -0,0 +1,198 @@
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
+
3
+
4
+ var _chunkHRLQCM5Gjs = require('./chunk-HRLQCM5G.js');
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ var _chunkZJUABHMEjs = require('./chunk-ZJUABHME.js');
18
+
19
+
20
+ var _chunkM5IOCZK5js = require('./chunk-M5IOCZK5.js');
21
+
22
+ // ../workspace-tools/src/base/base-executor.ts
23
+ var _defu = require('defu');
24
+ var withRunExecutor = (name, executorFn, executorOptions = {}) => async (_options, context) => {
25
+ const stopwatch = _chunkZJUABHMEjs.getStopwatch.call(void 0, name);
26
+ let options = _options;
27
+ let config = {};
28
+ try {
29
+ if (!_optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects]) || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
30
+ throw new Error(
31
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
32
+ );
33
+ }
34
+ const workspaceRoot = _chunkZJUABHMEjs.findWorkspaceRoot.call(void 0, );
35
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot;
36
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot;
37
+ const projectName = context.projectName;
38
+ config.workspaceRoot = workspaceRoot;
39
+ _chunkZJUABHMEjs.writeInfo.call(void 0, `\u26A1 Running the ${name} executor for ${projectName} `, config);
40
+ if (!executorOptions.skipReadingConfig) {
41
+ _chunkZJUABHMEjs.writeTrace.call(void 0,
42
+ `Loading the Storm Config from environment variables and storm.config.js file...
43
+ - workspaceRoot: ${workspaceRoot}
44
+ - projectRoot: ${projectRoot}
45
+ - sourceRoot: ${sourceRoot}
46
+ - projectName: ${projectName}
47
+ `,
48
+ config
49
+ );
50
+ config = await _chunkZJUABHMEjs.getConfig.call(void 0, workspaceRoot);
51
+ }
52
+ if (_optionalChain([executorOptions, 'optionalAccess', _3 => _3.hooks, 'optionalAccess', _4 => _4.applyDefaultOptions])) {
53
+ _chunkZJUABHMEjs.writeDebug.call(void 0, "Running the applyDefaultOptions hook...", config);
54
+ options = await Promise.resolve(
55
+ executorOptions.hooks.applyDefaultOptions(options, config)
56
+ );
57
+ _chunkZJUABHMEjs.writeDebug.call(void 0, "Completed the applyDefaultOptions hook", config);
58
+ }
59
+ _chunkZJUABHMEjs.writeTrace.call(void 0,
60
+ `Executor schema options \u2699\uFE0F
61
+ ${_chunkZJUABHMEjs.formatLogMessage.call(void 0, options)}
62
+ `,
63
+ config
64
+ );
65
+ const tokenized = await _chunkHRLQCM5Gjs.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
+ _chunkHRLQCM5Gjs.applyWorkspaceProjectTokens
73
+ );
74
+ _chunkZJUABHMEjs.writeTrace.call(void 0,
75
+ `Executor schema tokenized options \u2699\uFE0F
76
+ ${_chunkZJUABHMEjs.formatLogMessage.call(void 0, tokenized)}
77
+ `,
78
+ config
79
+ );
80
+ if (_optionalChain([executorOptions, 'optionalAccess', _5 => _5.hooks, 'optionalAccess', _6 => _6.preProcess])) {
81
+ _chunkZJUABHMEjs.writeDebug.call(void 0, "Running the preProcess hook...", config);
82
+ await Promise.resolve(
83
+ executorOptions.hooks.preProcess(tokenized, config)
84
+ );
85
+ _chunkZJUABHMEjs.writeDebug.call(void 0, "Completed the preProcess hook", config);
86
+ }
87
+ const ret = executorFn(tokenized, context, config);
88
+ if (_isFunction(_optionalChain([ret, 'optionalAccess', _7 => _7.next]))) {
89
+ const asyncGen = ret;
90
+ for await (const iter of asyncGen) {
91
+ void iter;
92
+ }
93
+ }
94
+ const result = await Promise.resolve(
95
+ ret
96
+ );
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")) {
98
+ _chunkZJUABHMEjs.writeTrace.call(void 0,
99
+ `Failure determined by the ${name} executor
100
+ ${_chunkZJUABHMEjs.formatLogMessage.call(void 0, result)}`,
101
+ config
102
+ );
103
+ console.error(result);
104
+ throw new Error(`The ${name} executor failed to run`, {
105
+ cause: _optionalChain([result, 'optionalAccess', _16 => _16.error])
106
+ });
107
+ }
108
+ if (_optionalChain([executorOptions, 'optionalAccess', _17 => _17.hooks, 'optionalAccess', _18 => _18.postProcess])) {
109
+ _chunkZJUABHMEjs.writeDebug.call(void 0, "Running the postProcess hook...", config);
110
+ await Promise.resolve(executorOptions.hooks.postProcess(config));
111
+ _chunkZJUABHMEjs.writeDebug.call(void 0, "Completed the postProcess hook", config);
112
+ }
113
+ _chunkZJUABHMEjs.writeSuccess.call(void 0, `Completed running the ${name} task executor!
114
+ `, config);
115
+ return {
116
+ success: true
117
+ };
118
+ } catch (error) {
119
+ _chunkZJUABHMEjs.writeFatal.call(void 0,
120
+ "A fatal error occurred while running the executor - the process was forced to terminate",
121
+ config
122
+ );
123
+ _chunkZJUABHMEjs.writeError.call(void 0,
124
+ `An exception was thrown in the executor's process
125
+ - Details: ${error.message}
126
+ - Stacktrace: ${error.stack}`,
127
+ config
128
+ );
129
+ return {
130
+ success: false
131
+ };
132
+ } finally {
133
+ stopwatch();
134
+ }
135
+ };
136
+ var _isFunction = (value) => {
137
+ try {
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]));
139
+ } catch (e) {
140
+ return false;
141
+ }
142
+ };
143
+
144
+ // src/executors/helm-package/executor.ts
145
+ async function serveExecutor(options, context, config) {
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])) {
147
+ throw new Error("Nx executor context was invalid");
148
+ }
149
+ const helm = _chunkM5IOCZK5js.createHelmClient.call(void 0, );
150
+ if (_optionalChain([options, 'access', _27 => _27.dependencies, 'optionalAccess', _28 => _28.repositories])) {
151
+ for (const repository of options.dependencies.repositories) {
152
+ if (repository.name && repository.url) {
153
+ helm.addRepository(repository.name, repository.url);
154
+ } else {
155
+ throw new Error("Repository name and url are required");
156
+ }
157
+ }
158
+ }
159
+ if (_optionalChain([options, 'access', _29 => _29.dependencies, 'optionalAccess', _30 => _30.update])) {
160
+ helm.dependencyUpdate(options.chartFolder);
161
+ }
162
+ if (_optionalChain([options, 'access', _31 => _31.dependencies, 'optionalAccess', _32 => _32.build])) {
163
+ helm.dependencyBuild(options.chartFolder);
164
+ }
165
+ const chartPath = await helm.package({
166
+ chartFolder: options.chartFolder,
167
+ outputFolder: options.outputFolder
168
+ });
169
+ if (options.push && chartPath && options.remote) {
170
+ helm.push({
171
+ chartPath,
172
+ remote: options.remote
173
+ });
174
+ } else {
175
+ _chunkZJUABHMEjs.writeWarning.call(void 0, `Chart packaged at: ${chartPath}`, config);
176
+ }
177
+ return {
178
+ success: true
179
+ };
180
+ }
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
+ }
192
+ }
193
+ );
194
+
195
+
196
+
197
+
198
+ exports.serveExecutor = serveExecutor; exports.executor_default = executor_default;
@@ -0,0 +1,136 @@
1
+ import {
2
+ ensureInitialized
3
+ } from "./chunk-HGXQ6SSU.mjs";
4
+ import {
5
+ AbstractHelmClient
6
+ } from "./chunk-YXXZO2AJ.mjs";
7
+ import {
8
+ __decorateClass
9
+ } from "./chunk-GMTGF6X4.mjs";
10
+
11
+ // src/utils/client.ts
12
+ import { execSync } from "node:child_process";
13
+ var HelmClient = class extends AbstractHelmClient {
14
+ /**
15
+ * Creates an instance of HelmClient
16
+ */
17
+ constructor() {
18
+ super();
19
+ }
20
+ package(options) {
21
+ let chartPath = void 0;
22
+ let output = {};
23
+ try {
24
+ output = this.runCommand([
25
+ "helm",
26
+ "package",
27
+ options.chartFolder,
28
+ "-d",
29
+ options.outputFolder
30
+ ]);
31
+ } catch (err) {
32
+ if (err?.stderr.length > 0 && err?.exitCode !== 0) {
33
+ throw new Error(`Failed to package chart: ${err.stderr}`);
34
+ }
35
+ }
36
+ if (output?.stderr.length > 0 && output?.exitCode !== 0) {
37
+ throw new Error(`Failed to package chart: ${output.stderr}`);
38
+ }
39
+ const match = output.stdout?.match(
40
+ /Successfully packaged chart and saved it to: (.+)/
41
+ );
42
+ if (!match || match.length < 2) {
43
+ throw new Error("Failed to parse chart path from helm output");
44
+ }
45
+ chartPath = match[1]?.trim();
46
+ return new Promise((resolve) => resolve(chartPath));
47
+ }
48
+ push(options) {
49
+ try {
50
+ this.runCommand(["helm", "push", options.chartPath, options.remote]);
51
+ } catch (err) {
52
+ if (err?.stderr.length > 0 && err?.exitCode !== 0) {
53
+ throw new Error(`Failed to push chart: ${err.stderr}`);
54
+ }
55
+ }
56
+ }
57
+ dependencyUpdate(chartFolder) {
58
+ try {
59
+ this.runCommand(["helm", "dependency", "update", chartFolder]);
60
+ } catch (err) {
61
+ if (err?.stderr.length > 0 && err?.exitCode !== 0) {
62
+ throw new Error(`Failed to update chart dependencies: ${err.stderr}`);
63
+ }
64
+ }
65
+ }
66
+ dependencyBuild(chartFolder) {
67
+ try {
68
+ this.runCommand(["helm", "dependency", "build", chartFolder]);
69
+ } catch (err) {
70
+ if (err?.stderr.length > 0 && err?.exitCode !== 0) {
71
+ throw new Error(`Failed to build chart dependencies: ${err.stderr}`);
72
+ }
73
+ }
74
+ }
75
+ addRepository(name, url) {
76
+ try {
77
+ this.runCommand(["helm", "repo", "add", name, url]);
78
+ } catch (err) {
79
+ if (err?.stderr.length > 0 && err?.exitCode !== 0) {
80
+ throw new Error(`Failed to add repository: ${err.stderr}`);
81
+ }
82
+ }
83
+ }
84
+ /**
85
+ * Initialize Helm
86
+ *
87
+ * @returns A promise
88
+ */
89
+ async initialize() {
90
+ if (this.initialized) {
91
+ return;
92
+ }
93
+ try {
94
+ this.runCommand(["helm", "version"]);
95
+ } catch (err) {
96
+ if (err?.stderr.length > 0 && err?.exitCode !== 0) {
97
+ throw new Error(`Helm is not installed: ${err.stderr}`);
98
+ }
99
+ }
100
+ return new Promise((resolve) => {
101
+ this.initialized = true;
102
+ resolve();
103
+ });
104
+ }
105
+ runCommand(commands) {
106
+ return execSync(commands.filter(Boolean).join(" "), {
107
+ encoding: "utf8",
108
+ windowsHide: true,
109
+ maxBuffer: 1024 * 1e6,
110
+ stdio: "pipe"
111
+ });
112
+ }
113
+ };
114
+ __decorateClass([
115
+ ensureInitialized
116
+ ], HelmClient.prototype, "package", 1);
117
+ __decorateClass([
118
+ ensureInitialized
119
+ ], HelmClient.prototype, "push", 1);
120
+ __decorateClass([
121
+ ensureInitialized
122
+ ], HelmClient.prototype, "dependencyUpdate", 1);
123
+ __decorateClass([
124
+ ensureInitialized
125
+ ], HelmClient.prototype, "dependencyBuild", 1);
126
+ __decorateClass([
127
+ ensureInitialized
128
+ ], HelmClient.prototype, "addRepository", 1);
129
+ var createHelmClient = () => {
130
+ return new HelmClient();
131
+ };
132
+
133
+ export {
134
+ HelmClient,
135
+ createHelmClient
136
+ };
@@ -0,0 +1,136 @@
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
+
3
+ var _chunkXKOZIQT3js = require('./chunk-XKOZIQT3.js');
4
+
5
+
6
+ var _chunkJSFRUBG5js = require('./chunk-JSFRUBG5.js');
7
+
8
+
9
+ var _chunkRECJ3G6Fjs = require('./chunk-RECJ3G6F.js');
10
+
11
+ // src/utils/client.ts
12
+ var _child_process = require('child_process');
13
+ var HelmClient = class extends _chunkJSFRUBG5js.AbstractHelmClient {
14
+ /**
15
+ * Creates an instance of HelmClient
16
+ */
17
+ constructor() {
18
+ super();
19
+ }
20
+ package(options) {
21
+ let chartPath = void 0;
22
+ let output = {};
23
+ try {
24
+ output = this.runCommand([
25
+ "helm",
26
+ "package",
27
+ options.chartFolder,
28
+ "-d",
29
+ options.outputFolder
30
+ ]);
31
+ } catch (err) {
32
+ if (_optionalChain([err, 'optionalAccess', _ => _.stderr, 'access', _2 => _2.length]) > 0 && _optionalChain([err, 'optionalAccess', _3 => _3.exitCode]) !== 0) {
33
+ throw new Error(`Failed to package chart: ${err.stderr}`);
34
+ }
35
+ }
36
+ if (_optionalChain([output, 'optionalAccess', _4 => _4.stderr, 'access', _5 => _5.length]) > 0 && _optionalChain([output, 'optionalAccess', _6 => _6.exitCode]) !== 0) {
37
+ throw new Error(`Failed to package chart: ${output.stderr}`);
38
+ }
39
+ const match = _optionalChain([output, 'access', _7 => _7.stdout, 'optionalAccess', _8 => _8.match, 'call', _9 => _9(
40
+ /Successfully packaged chart and saved it to: (.+)/
41
+ )]);
42
+ if (!match || match.length < 2) {
43
+ throw new Error("Failed to parse chart path from helm output");
44
+ }
45
+ chartPath = _optionalChain([match, 'access', _10 => _10[1], 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]);
46
+ return new Promise((resolve) => resolve(chartPath));
47
+ }
48
+ push(options) {
49
+ try {
50
+ this.runCommand(["helm", "push", options.chartPath, options.remote]);
51
+ } catch (err) {
52
+ if (_optionalChain([err, 'optionalAccess', _13 => _13.stderr, 'access', _14 => _14.length]) > 0 && _optionalChain([err, 'optionalAccess', _15 => _15.exitCode]) !== 0) {
53
+ throw new Error(`Failed to push chart: ${err.stderr}`);
54
+ }
55
+ }
56
+ }
57
+ dependencyUpdate(chartFolder) {
58
+ try {
59
+ this.runCommand(["helm", "dependency", "update", chartFolder]);
60
+ } catch (err) {
61
+ if (_optionalChain([err, 'optionalAccess', _16 => _16.stderr, 'access', _17 => _17.length]) > 0 && _optionalChain([err, 'optionalAccess', _18 => _18.exitCode]) !== 0) {
62
+ throw new Error(`Failed to update chart dependencies: ${err.stderr}`);
63
+ }
64
+ }
65
+ }
66
+ dependencyBuild(chartFolder) {
67
+ try {
68
+ this.runCommand(["helm", "dependency", "build", chartFolder]);
69
+ } catch (err) {
70
+ if (_optionalChain([err, 'optionalAccess', _19 => _19.stderr, 'access', _20 => _20.length]) > 0 && _optionalChain([err, 'optionalAccess', _21 => _21.exitCode]) !== 0) {
71
+ throw new Error(`Failed to build chart dependencies: ${err.stderr}`);
72
+ }
73
+ }
74
+ }
75
+ addRepository(name, url) {
76
+ try {
77
+ this.runCommand(["helm", "repo", "add", name, url]);
78
+ } catch (err) {
79
+ if (_optionalChain([err, 'optionalAccess', _22 => _22.stderr, 'access', _23 => _23.length]) > 0 && _optionalChain([err, 'optionalAccess', _24 => _24.exitCode]) !== 0) {
80
+ throw new Error(`Failed to add repository: ${err.stderr}`);
81
+ }
82
+ }
83
+ }
84
+ /**
85
+ * Initialize Helm
86
+ *
87
+ * @returns A promise
88
+ */
89
+ async initialize() {
90
+ if (this.initialized) {
91
+ return;
92
+ }
93
+ try {
94
+ this.runCommand(["helm", "version"]);
95
+ } catch (err) {
96
+ if (_optionalChain([err, 'optionalAccess', _25 => _25.stderr, 'access', _26 => _26.length]) > 0 && _optionalChain([err, 'optionalAccess', _27 => _27.exitCode]) !== 0) {
97
+ throw new Error(`Helm is not installed: ${err.stderr}`);
98
+ }
99
+ }
100
+ return new Promise((resolve) => {
101
+ this.initialized = true;
102
+ resolve();
103
+ });
104
+ }
105
+ runCommand(commands) {
106
+ return _child_process.execSync.call(void 0, commands.filter(Boolean).join(" "), {
107
+ encoding: "utf8",
108
+ windowsHide: true,
109
+ maxBuffer: 1024 * 1e6,
110
+ stdio: "pipe"
111
+ });
112
+ }
113
+ };
114
+ _chunkRECJ3G6Fjs.__decorateClass.call(void 0, [
115
+ _chunkXKOZIQT3js.ensureInitialized
116
+ ], HelmClient.prototype, "package", 1);
117
+ _chunkRECJ3G6Fjs.__decorateClass.call(void 0, [
118
+ _chunkXKOZIQT3js.ensureInitialized
119
+ ], HelmClient.prototype, "push", 1);
120
+ _chunkRECJ3G6Fjs.__decorateClass.call(void 0, [
121
+ _chunkXKOZIQT3js.ensureInitialized
122
+ ], HelmClient.prototype, "dependencyUpdate", 1);
123
+ _chunkRECJ3G6Fjs.__decorateClass.call(void 0, [
124
+ _chunkXKOZIQT3js.ensureInitialized
125
+ ], HelmClient.prototype, "dependencyBuild", 1);
126
+ _chunkRECJ3G6Fjs.__decorateClass.call(void 0, [
127
+ _chunkXKOZIQT3js.ensureInitialized
128
+ ], HelmClient.prototype, "addRepository", 1);
129
+ var createHelmClient = () => {
130
+ return new HelmClient();
131
+ };
132
+
133
+
134
+
135
+
136
+ exports.HelmClient = HelmClient; exports.createHelmClient = createHelmClient;
@@ -0,0 +1,198 @@
1
+ import {
2
+ applyWorkspaceProjectTokens,
3
+ applyWorkspaceTokens
4
+ } from "./chunk-TUXKNGC2.mjs";
5
+ import {
6
+ findWorkspaceRoot,
7
+ formatLogMessage,
8
+ getConfig,
9
+ getStopwatch,
10
+ writeDebug,
11
+ writeError,
12
+ writeFatal,
13
+ writeInfo,
14
+ writeSuccess,
15
+ writeTrace,
16
+ writeWarning
17
+ } from "./chunk-GCWINIPX.mjs";
18
+ import {
19
+ createHelmClient
20
+ } from "./chunk-M3IML23P.mjs";
21
+
22
+ // ../workspace-tools/src/base/base-executor.ts
23
+ import { defu } from "defu";
24
+ var withRunExecutor = (name, executorFn, executorOptions = {}) => async (_options, context) => {
25
+ const stopwatch = getStopwatch(name);
26
+ let options = _options;
27
+ let config = {};
28
+ try {
29
+ if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
30
+ throw new Error(
31
+ "The Build process failed because the context is not valid. Please run this command from a workspace."
32
+ );
33
+ }
34
+ const workspaceRoot = findWorkspaceRoot();
35
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot;
36
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot || projectRoot || workspaceRoot;
37
+ const projectName = context.projectName;
38
+ config.workspaceRoot = workspaceRoot;
39
+ writeInfo(`\u26A1 Running the ${name} executor for ${projectName} `, config);
40
+ if (!executorOptions.skipReadingConfig) {
41
+ writeTrace(
42
+ `Loading the Storm Config from environment variables and storm.config.js file...
43
+ - workspaceRoot: ${workspaceRoot}
44
+ - projectRoot: ${projectRoot}
45
+ - sourceRoot: ${sourceRoot}
46
+ - projectName: ${projectName}
47
+ `,
48
+ config
49
+ );
50
+ config = await getConfig(workspaceRoot);
51
+ }
52
+ if (executorOptions?.hooks?.applyDefaultOptions) {
53
+ writeDebug("Running the applyDefaultOptions hook...", config);
54
+ options = await Promise.resolve(
55
+ executorOptions.hooks.applyDefaultOptions(options, config)
56
+ );
57
+ writeDebug("Completed the applyDefaultOptions hook", config);
58
+ }
59
+ writeTrace(
60
+ `Executor schema options \u2699\uFE0F
61
+ ${formatLogMessage(options)}
62
+ `,
63
+ config
64
+ );
65
+ const tokenized = await applyWorkspaceTokens(
66
+ options,
67
+ defu(
68
+ { workspaceRoot, projectRoot, sourceRoot, projectName, config },
69
+ config,
70
+ context.projectsConfigurations.projects[context.projectName]
71
+ ),
72
+ applyWorkspaceProjectTokens
73
+ );
74
+ writeTrace(
75
+ `Executor schema tokenized options \u2699\uFE0F
76
+ ${formatLogMessage(tokenized)}
77
+ `,
78
+ config
79
+ );
80
+ if (executorOptions?.hooks?.preProcess) {
81
+ writeDebug("Running the preProcess hook...", config);
82
+ await Promise.resolve(
83
+ executorOptions.hooks.preProcess(tokenized, config)
84
+ );
85
+ writeDebug("Completed the preProcess hook", config);
86
+ }
87
+ const ret = executorFn(tokenized, context, config);
88
+ if (_isFunction(ret?.next)) {
89
+ const asyncGen = ret;
90
+ for await (const iter of asyncGen) {
91
+ void iter;
92
+ }
93
+ }
94
+ const result = await Promise.resolve(
95
+ ret
96
+ );
97
+ if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
98
+ writeTrace(
99
+ `Failure determined by the ${name} executor
100
+ ${formatLogMessage(result)}`,
101
+ config
102
+ );
103
+ console.error(result);
104
+ throw new Error(`The ${name} executor failed to run`, {
105
+ cause: result?.error
106
+ });
107
+ }
108
+ if (executorOptions?.hooks?.postProcess) {
109
+ writeDebug("Running the postProcess hook...", config);
110
+ await Promise.resolve(executorOptions.hooks.postProcess(config));
111
+ writeDebug("Completed the postProcess hook", config);
112
+ }
113
+ writeSuccess(`Completed running the ${name} task executor!
114
+ `, config);
115
+ return {
116
+ success: true
117
+ };
118
+ } catch (error) {
119
+ writeFatal(
120
+ "A fatal error occurred while running the executor - the process was forced to terminate",
121
+ config
122
+ );
123
+ writeError(
124
+ `An exception was thrown in the executor's process
125
+ - Details: ${error.message}
126
+ - Stacktrace: ${error.stack}`,
127
+ config
128
+ );
129
+ return {
130
+ success: false
131
+ };
132
+ } finally {
133
+ stopwatch();
134
+ }
135
+ };
136
+ var _isFunction = (value) => {
137
+ try {
138
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
139
+ } catch (e) {
140
+ return false;
141
+ }
142
+ };
143
+
144
+ // src/executors/helm-package/executor.ts
145
+ async function serveExecutor(options, context, config) {
146
+ if (!context?.projectName || !context?.projectsConfigurations?.projects?.[context.projectName]?.root) {
147
+ throw new Error("Nx executor context was invalid");
148
+ }
149
+ const helm = createHelmClient();
150
+ if (options.dependencies?.repositories) {
151
+ for (const repository of options.dependencies.repositories) {
152
+ if (repository.name && repository.url) {
153
+ helm.addRepository(repository.name, repository.url);
154
+ } else {
155
+ throw new Error("Repository name and url are required");
156
+ }
157
+ }
158
+ }
159
+ if (options.dependencies?.update) {
160
+ helm.dependencyUpdate(options.chartFolder);
161
+ }
162
+ if (options.dependencies?.build) {
163
+ helm.dependencyBuild(options.chartFolder);
164
+ }
165
+ const chartPath = await helm.package({
166
+ chartFolder: options.chartFolder,
167
+ outputFolder: options.outputFolder
168
+ });
169
+ if (options.push && chartPath && options.remote) {
170
+ helm.push({
171
+ chartPath,
172
+ remote: options.remote
173
+ });
174
+ } else {
175
+ writeWarning(`Chart packaged at: ${chartPath}`, config);
176
+ }
177
+ return {
178
+ success: true
179
+ };
180
+ }
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
+ }
192
+ }
193
+ );
194
+
195
+ export {
196
+ serveExecutor,
197
+ executor_default
198
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/k8s-tools",
3
- "version": "0.33.30",
3
+ "version": "0.33.31",
4
4
  "description": "Tools for managing Kubernetes (k8s) infrastructure within a Nx workspace.",
5
5
  "repository": {
6
6
  "type": "github",
@@ -137,8 +137,8 @@
137
137
  },
138
138
  "dependencies": {
139
139
  "@storm-software/config": "^1.124.7",
140
- "@storm-software/config-tools": "^1.175.5",
141
- "@storm-software/workspace-tools": "^1.277.6",
140
+ "@storm-software/config-tools": "^1.175.6",
141
+ "@storm-software/workspace-tools": "^1.277.7",
142
142
  "js-yaml": "^4.1.0"
143
143
  },
144
144
  "devDependencies": {
@@ -156,5 +156,5 @@
156
156
  "publishConfig": { "access": "public" },
157
157
  "executors": "./executors.json",
158
158
  "generators": "./generators.json",
159
- "gitHead": "446803d73ec4fd31944e933c4965955bc744c0db"
159
+ "gitHead": "121302d2d6b8fdec625ea4ce00d0026800a6bdf8"
160
160
  }