@storm-software/k8s-tools 0.18.0 → 0.19.0
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 +11 -0
- package/dist/chunk-2GAU2GHG.js +203 -0
- package/dist/chunk-2QNNUD5M.js +86 -0
- package/dist/chunk-3GQAWCBQ.js +13 -0
- package/dist/chunk-3J7KBHMJ.mjs +0 -0
- package/dist/chunk-6V45YKVB.mjs +203 -0
- package/dist/chunk-7AV2CVBT.mjs +169 -0
- package/dist/chunk-7BCSLKT3.js +98 -0
- package/dist/chunk-7IJP4RLN.mjs +63 -0
- package/dist/chunk-AFPEYAYK.js +61 -0
- package/dist/chunk-DHBG5ASJ.js +1 -0
- package/dist/chunk-DZ5UCMNL.mjs +1063 -0
- package/dist/chunk-EAQFLLRB.js +23 -0
- package/dist/chunk-EISL3C34.js +169 -0
- package/dist/chunk-GDXB64KG.js +1063 -0
- package/dist/chunk-GOVHOOTS.js +184 -0
- package/dist/chunk-IOT45LXV.js +134 -0
- package/dist/chunk-LFNGKV6F.js +18 -0
- package/dist/chunk-LSBSNYPQ.mjs +86 -0
- package/dist/chunk-O7U3AH6A.mjs +58 -0
- package/dist/chunk-OA63SGD6.mjs +23 -0
- package/dist/chunk-OBT35QXS.mjs +59 -0
- package/dist/chunk-OXY6AHKS.js +57 -0
- package/dist/chunk-Q6DDBFXE.mjs +147 -0
- package/dist/chunk-RVFKH45R.mjs +134 -0
- package/dist/chunk-T5WNZJOD.js +63 -0
- package/dist/chunk-TUDMFJIT.mjs +98 -0
- package/dist/chunk-U76ID4TS.js +1 -0
- package/dist/chunk-UDLI3L7V.mjs +18 -0
- package/dist/chunk-UWJTAL4W.js +59 -0
- package/dist/chunk-W7DPLC4K.mjs +184 -0
- package/dist/chunk-WWU25UQ4.mjs +0 -0
- package/dist/chunk-XMPMWMWQ.js +147 -0
- package/dist/chunk-XO66D74Z.js +1 -0
- package/dist/chunk-XUV4U54K.mjs +21 -0
- package/dist/chunk-YSCEY447.mjs +0 -0
- package/dist/chunk-ZO7MGNKJ.mjs +61 -0
- package/dist/executor-DY-z8MOl.d.mts +53 -0
- package/dist/executor-Dr6UXfvX.d.ts +53 -0
- package/dist/executors.d.mts +6 -0
- package/dist/executors.d.ts +6 -0
- package/dist/executors.js +19 -0
- package/dist/executors.mjs +19 -0
- package/dist/generator-B5bCfIUV.d.ts +24 -0
- package/dist/generator-BIe65kKR.d.mts +28 -0
- package/dist/generator-Cad7bXVB.d.mts +24 -0
- package/dist/generator-D7M45zOU.d.ts +28 -0
- package/dist/generators.d.mts +6 -0
- package/dist/generators.d.ts +6 -0
- package/dist/generators.js +15 -0
- package/dist/generators.mjs +15 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +57 -0
- package/dist/index.mjs +57 -0
- package/dist/schema.d-Cx_3iG9A.d.mts +150 -0
- package/dist/schema.d-Cx_3iG9A.d.ts +150 -0
- package/dist/src/executors/container-publish/executor.d.mts +11 -0
- package/dist/src/executors/container-publish/executor.d.ts +11 -0
- package/dist/src/executors/container-publish/executor.js +13 -0
- package/dist/src/executors/container-publish/executor.mjs +13 -0
- package/dist/src/executors/helm-package/executor.d.mts +4 -0
- package/dist/src/executors/helm-package/executor.d.ts +4 -0
- package/dist/src/executors/helm-package/executor.js +15 -0
- package/dist/src/executors/helm-package/executor.mjs +15 -0
- package/dist/src/executors/helm-package/schema.d.ts +1 -1
- package/dist/src/generators/helm-chart/files/chart/templates/NOTES.txt +22 -0
- package/dist/src/generators/helm-chart/files/chart/templates/_helpers.yaml +62 -0
- package/dist/src/generators/helm-chart/files/chart/templates/deployment.yaml +68 -0
- package/dist/src/generators/helm-chart/files/chart/templates/hpa.yaml +32 -0
- package/dist/src/generators/helm-chart/files/chart/templates/ingress.yaml +61 -0
- package/dist/src/generators/helm-chart/files/chart/templates/service.yaml +13 -0
- package/dist/src/generators/helm-chart/files/chart/templates/serviceaccount.yaml +13 -0
- package/dist/src/generators/helm-chart/files/chart/templates/test/test-connection.yaml +15 -0
- package/dist/src/generators/helm-chart/generator.d.mts +5 -0
- package/dist/src/generators/helm-chart/generator.d.ts +5 -0
- package/dist/src/generators/helm-chart/generator.js +12 -0
- package/dist/src/generators/helm-chart/generator.mjs +12 -0
- package/dist/src/generators/helm-chart/schema.d.ts +1 -1
- package/dist/src/generators/helm-dependency/generator.d.mts +5 -0
- package/dist/src/generators/helm-dependency/generator.d.ts +5 -0
- package/dist/src/generators/helm-dependency/generator.js +12 -0
- package/dist/src/generators/helm-dependency/generator.mjs +12 -0
- package/dist/src/generators/helm-dependency/schema.d.ts +1 -1
- package/dist/src/plugins/docker/index.d.mts +12 -0
- package/dist/src/plugins/docker/index.d.ts +12 -0
- package/dist/src/plugins/docker/index.js +15 -0
- package/dist/src/plugins/docker/index.mjs +15 -0
- package/dist/src/utils/client.d.mts +35 -0
- package/dist/src/utils/client.d.ts +35 -0
- package/dist/src/utils/client.js +11 -0
- package/dist/src/utils/client.mjs +11 -0
- package/dist/src/utils/ensure-init.d.mts +11 -0
- package/dist/src/utils/ensure-init.d.ts +11 -0
- package/dist/src/utils/ensure-init.js +7 -0
- package/dist/src/utils/ensure-init.mjs +7 -0
- package/dist/src/utils/index.d.mts +6 -0
- package/dist/src/utils/index.d.ts +6 -0
- package/dist/src/utils/index.js +21 -0
- package/dist/src/utils/index.mjs +21 -0
- package/dist/src/utils/prettier.d.mts +13 -0
- package/dist/src/utils/prettier.d.ts +13 -0
- package/dist/src/utils/prettier.js +9 -0
- package/dist/src/utils/prettier.mjs +9 -0
- package/dist/tsup.config.d.mts +5 -0
- package/dist/tsup.config.d.ts +5 -0
- package/dist/tsup.config.js +36 -0
- package/dist/tsup.config.mjs +36 -0
- package/dist/types-BCBFBwnJ.d.mts +20 -0
- package/dist/types-BCBFBwnJ.d.ts +20 -0
- package/dist/types-CIJRaFHD.d.mts +1185 -0
- package/dist/types-CIJRaFHD.d.ts +1185 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 0.19.0 (2025-01-20)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- **untyped:** Standard file name changes to avoid collisions ([71acf100](https://github.com/storm-software/storm-ops/commit/71acf100))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **pulumi-tools:** Resolved issue with invalid import paths ([af7e7c5e](https://github.com/storm-software/storm-ops/commit/af7e7c5e))
|
|
10
|
+
- **workspace-tools:** Resolved issues with import paths ([9eeb1f73](https://github.com/storm-software/storm-ops/commit/9eeb1f73))
|
|
11
|
+
|
|
1
12
|
## 0.18.0 (2025-01-20)
|
|
2
13
|
|
|
3
14
|
### Features
|
|
@@ -0,0 +1,203 @@
|
|
|
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 _chunkLFNGKV6Fjs = require('./chunk-LFNGKV6F.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkEAQFLLRBjs = require('./chunk-EAQFLLRB.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
|
|
10
|
+
|
|
11
|
+
// src/utils/client.ts
|
|
12
|
+
var _child_process = require('child_process');
|
|
13
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
}
|
|
19
|
+
_chunk3GQAWCBQjs.__name.call(void 0, _ts_decorate, "_ts_decorate");
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
}
|
|
23
|
+
_chunk3GQAWCBQjs.__name.call(void 0, _ts_metadata, "_ts_metadata");
|
|
24
|
+
var HelmClient = class extends _chunkLFNGKV6Fjs.AbstractHelmClient {
|
|
25
|
+
static {
|
|
26
|
+
_chunk3GQAWCBQjs.__name.call(void 0, this, "HelmClient");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates an instance of HelmClient
|
|
30
|
+
*/
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Package a chart directory into a chart archive
|
|
36
|
+
*
|
|
37
|
+
* @param {PackageOptions} [options]
|
|
38
|
+
*/
|
|
39
|
+
package(options) {
|
|
40
|
+
let chartPath = void 0;
|
|
41
|
+
let output = {};
|
|
42
|
+
try {
|
|
43
|
+
output = this.runCommand([
|
|
44
|
+
"helm",
|
|
45
|
+
"package",
|
|
46
|
+
options.chartFolder,
|
|
47
|
+
"-d",
|
|
48
|
+
options.outputFolder
|
|
49
|
+
]);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
if (_optionalChain([err, 'optionalAccess', _ => _.stderr, 'access', _2 => _2.length]) > 0 && _optionalChain([err, 'optionalAccess', _3 => _3.exitCode]) !== 0) {
|
|
52
|
+
throw new Error(`Failed to package chart: ${err.stderr}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (_optionalChain([output, 'optionalAccess', _4 => _4.stderr, 'access', _5 => _5.length]) > 0 && _optionalChain([output, 'optionalAccess', _6 => _6.exitCode]) !== 0) {
|
|
56
|
+
throw new Error(`Failed to package chart: ${output.stderr}`);
|
|
57
|
+
}
|
|
58
|
+
const match = _optionalChain([output, 'access', _7 => _7.stdout, 'optionalAccess', _8 => _8.match, 'call', _9 => _9(/Successfully packaged chart and saved it to: (.+)/)]);
|
|
59
|
+
if (!match || match.length < 2) {
|
|
60
|
+
throw new Error("Failed to parse chart path from helm output");
|
|
61
|
+
}
|
|
62
|
+
chartPath = _optionalChain([match, 'access', _10 => _10[1], 'optionalAccess', _11 => _11.trim, 'call', _12 => _12()]);
|
|
63
|
+
return new Promise((resolve) => resolve(chartPath));
|
|
64
|
+
}
|
|
65
|
+
push(options) {
|
|
66
|
+
try {
|
|
67
|
+
this.runCommand([
|
|
68
|
+
"helm",
|
|
69
|
+
"push",
|
|
70
|
+
options.chartPath,
|
|
71
|
+
options.remote
|
|
72
|
+
]);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
if (_optionalChain([err, 'optionalAccess', _13 => _13.stderr, 'access', _14 => _14.length]) > 0 && _optionalChain([err, 'optionalAccess', _15 => _15.exitCode]) !== 0) {
|
|
75
|
+
throw new Error(`Failed to push chart: ${err.stderr}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
dependencyUpdate(chartFolder) {
|
|
80
|
+
try {
|
|
81
|
+
this.runCommand([
|
|
82
|
+
"helm",
|
|
83
|
+
"dependency",
|
|
84
|
+
"update",
|
|
85
|
+
chartFolder
|
|
86
|
+
]);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
if (_optionalChain([err, 'optionalAccess', _16 => _16.stderr, 'access', _17 => _17.length]) > 0 && _optionalChain([err, 'optionalAccess', _18 => _18.exitCode]) !== 0) {
|
|
89
|
+
throw new Error(`Failed to update chart dependencies: ${err.stderr}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
dependencyBuild(chartFolder) {
|
|
94
|
+
try {
|
|
95
|
+
this.runCommand([
|
|
96
|
+
"helm",
|
|
97
|
+
"dependency",
|
|
98
|
+
"build",
|
|
99
|
+
chartFolder
|
|
100
|
+
]);
|
|
101
|
+
} catch (err) {
|
|
102
|
+
if (_optionalChain([err, 'optionalAccess', _19 => _19.stderr, 'access', _20 => _20.length]) > 0 && _optionalChain([err, 'optionalAccess', _21 => _21.exitCode]) !== 0) {
|
|
103
|
+
throw new Error(`Failed to build chart dependencies: ${err.stderr}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
addRepository(name, url) {
|
|
108
|
+
try {
|
|
109
|
+
this.runCommand([
|
|
110
|
+
"helm",
|
|
111
|
+
"repo",
|
|
112
|
+
"add",
|
|
113
|
+
name,
|
|
114
|
+
url
|
|
115
|
+
]);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
if (_optionalChain([err, 'optionalAccess', _22 => _22.stderr, 'access', _23 => _23.length]) > 0 && _optionalChain([err, 'optionalAccess', _24 => _24.exitCode]) !== 0) {
|
|
118
|
+
throw new Error(`Failed to add repository: ${err.stderr}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Initialize Helm
|
|
124
|
+
*
|
|
125
|
+
* @returns A promise
|
|
126
|
+
*/
|
|
127
|
+
async initialize() {
|
|
128
|
+
if (this.initialized) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
this.runCommand([
|
|
133
|
+
"helm",
|
|
134
|
+
"version"
|
|
135
|
+
]);
|
|
136
|
+
} catch (err) {
|
|
137
|
+
if (_optionalChain([err, 'optionalAccess', _25 => _25.stderr, 'access', _26 => _26.length]) > 0 && _optionalChain([err, 'optionalAccess', _27 => _27.exitCode]) !== 0) {
|
|
138
|
+
throw new Error(`Helm is not installed: ${err.stderr}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return new Promise((resolve) => {
|
|
142
|
+
this.initialized = true;
|
|
143
|
+
resolve();
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
runCommand(commands) {
|
|
147
|
+
return _child_process.execSync.call(void 0, commands.filter(Boolean).join(" "), {
|
|
148
|
+
encoding: "utf8",
|
|
149
|
+
windowsHide: true,
|
|
150
|
+
maxBuffer: 1024 * 1e6,
|
|
151
|
+
stdio: "pipe"
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
_ts_decorate([
|
|
156
|
+
_chunkEAQFLLRBjs.ensureInitialized,
|
|
157
|
+
_ts_metadata("design:type", Function),
|
|
158
|
+
_ts_metadata("design:paramtypes", [
|
|
159
|
+
typeof PackageOptions === "undefined" ? Object : PackageOptions
|
|
160
|
+
]),
|
|
161
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
162
|
+
], HelmClient.prototype, "package", null);
|
|
163
|
+
_ts_decorate([
|
|
164
|
+
_chunkEAQFLLRBjs.ensureInitialized,
|
|
165
|
+
_ts_metadata("design:type", Function),
|
|
166
|
+
_ts_metadata("design:paramtypes", [
|
|
167
|
+
typeof PushOptions === "undefined" ? Object : PushOptions
|
|
168
|
+
]),
|
|
169
|
+
_ts_metadata("design:returntype", void 0)
|
|
170
|
+
], HelmClient.prototype, "push", null);
|
|
171
|
+
_ts_decorate([
|
|
172
|
+
_chunkEAQFLLRBjs.ensureInitialized,
|
|
173
|
+
_ts_metadata("design:type", Function),
|
|
174
|
+
_ts_metadata("design:paramtypes", [
|
|
175
|
+
String
|
|
176
|
+
]),
|
|
177
|
+
_ts_metadata("design:returntype", void 0)
|
|
178
|
+
], HelmClient.prototype, "dependencyUpdate", null);
|
|
179
|
+
_ts_decorate([
|
|
180
|
+
_chunkEAQFLLRBjs.ensureInitialized,
|
|
181
|
+
_ts_metadata("design:type", Function),
|
|
182
|
+
_ts_metadata("design:paramtypes", [
|
|
183
|
+
String
|
|
184
|
+
]),
|
|
185
|
+
_ts_metadata("design:returntype", void 0)
|
|
186
|
+
], HelmClient.prototype, "dependencyBuild", null);
|
|
187
|
+
_ts_decorate([
|
|
188
|
+
_chunkEAQFLLRBjs.ensureInitialized,
|
|
189
|
+
_ts_metadata("design:type", Function),
|
|
190
|
+
_ts_metadata("design:paramtypes", [
|
|
191
|
+
String,
|
|
192
|
+
String
|
|
193
|
+
]),
|
|
194
|
+
_ts_metadata("design:returntype", void 0)
|
|
195
|
+
], HelmClient.prototype, "addRepository", null);
|
|
196
|
+
var createHelmClient = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, () => {
|
|
197
|
+
return new HelmClient();
|
|
198
|
+
}, "createHelmClient");
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
exports.HelmClient = HelmClient; exports.createHelmClient = createHelmClient;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunkAFPEYAYKjs = require('./chunk-AFPEYAYK.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkGDXB64KGjs = require('./chunk-GDXB64KG.js');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
|
|
19
|
+
|
|
20
|
+
// ../workspace-tools/src/base/base-generator.ts
|
|
21
|
+
var withRunGenerator = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (name, generatorFn, generatorOptions = {
|
|
22
|
+
skipReadingConfig: false
|
|
23
|
+
}) => async (tree, _options) => {
|
|
24
|
+
const stopwatch = _chunkGDXB64KGjs.getStopwatch.call(void 0, name);
|
|
25
|
+
let options = _options;
|
|
26
|
+
let config;
|
|
27
|
+
try {
|
|
28
|
+
_chunkGDXB64KGjs.writeInfo.call(void 0, `\u26A1 Running the ${name} generator...
|
|
29
|
+
|
|
30
|
+
`, config);
|
|
31
|
+
const workspaceRoot = _chunkGDXB64KGjs.findWorkspaceRoot.call(void 0, );
|
|
32
|
+
if (!generatorOptions.skipReadingConfig) {
|
|
33
|
+
_chunkGDXB64KGjs.writeDebug.call(void 0, `Loading the Storm Config from environment variables and storm.config.js file...
|
|
34
|
+
- workspaceRoot: ${workspaceRoot}`, config);
|
|
35
|
+
config = await _chunkGDXB64KGjs.loadStormConfig.call(void 0, workspaceRoot);
|
|
36
|
+
}
|
|
37
|
+
if (_optionalChain([generatorOptions, 'optionalAccess', _ => _.hooks, 'optionalAccess', _2 => _2.applyDefaultOptions])) {
|
|
38
|
+
_chunkGDXB64KGjs.writeDebug.call(void 0, "Running the applyDefaultOptions hook...", config);
|
|
39
|
+
options = await Promise.resolve(generatorOptions.hooks.applyDefaultOptions(options, config));
|
|
40
|
+
_chunkGDXB64KGjs.writeDebug.call(void 0, "Completed the applyDefaultOptions hook", config);
|
|
41
|
+
}
|
|
42
|
+
_chunkGDXB64KGjs.writeTrace.call(void 0, `Generator schema options \u2699\uFE0F
|
|
43
|
+
${Object.keys(_nullishCoalesce(options, () => ( {}))).map((key) => ` - ${key}=${JSON.stringify(options[key])}`).join("\n")}`, config);
|
|
44
|
+
const tokenized = await _chunkAFPEYAYKjs.applyWorkspaceTokens.call(void 0, options, {
|
|
45
|
+
workspaceRoot: tree.root,
|
|
46
|
+
config
|
|
47
|
+
}, _chunkAFPEYAYKjs.applyWorkspaceBaseTokens);
|
|
48
|
+
if (_optionalChain([generatorOptions, 'optionalAccess', _3 => _3.hooks, 'optionalAccess', _4 => _4.preProcess])) {
|
|
49
|
+
_chunkGDXB64KGjs.writeDebug.call(void 0, "Running the preProcess hook...", config);
|
|
50
|
+
await Promise.resolve(generatorOptions.hooks.preProcess(tokenized, config));
|
|
51
|
+
_chunkGDXB64KGjs.writeDebug.call(void 0, "Completed the preProcess hook", config);
|
|
52
|
+
}
|
|
53
|
+
const result = await Promise.resolve(generatorFn(tree, tokenized, config));
|
|
54
|
+
if (result) {
|
|
55
|
+
if (result.success === false || result.error && _optionalChain([result, 'optionalAccess', _5 => _5.error, 'optionalAccess', _6 => _6.message]) && typeof _optionalChain([result, 'optionalAccess', _7 => _7.error, 'optionalAccess', _8 => _8.message]) === "string" && _optionalChain([result, 'optionalAccess', _9 => _9.error, 'optionalAccess', _10 => _10.name]) && typeof _optionalChain([result, 'optionalAccess', _11 => _11.error, 'optionalAccess', _12 => _12.name]) === "string") {
|
|
56
|
+
throw new Error(`The ${name} generator failed to run`, {
|
|
57
|
+
cause: _optionalChain([result, 'optionalAccess', _13 => _13.error])
|
|
58
|
+
});
|
|
59
|
+
} else if (result.success && result.data) {
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (_optionalChain([generatorOptions, 'optionalAccess', _14 => _14.hooks, 'optionalAccess', _15 => _15.postProcess])) {
|
|
64
|
+
_chunkGDXB64KGjs.writeDebug.call(void 0, "Running the postProcess hook...", config);
|
|
65
|
+
await Promise.resolve(generatorOptions.hooks.postProcess(config));
|
|
66
|
+
_chunkGDXB64KGjs.writeDebug.call(void 0, "Completed the postProcess hook", config);
|
|
67
|
+
}
|
|
68
|
+
return () => {
|
|
69
|
+
_chunkGDXB64KGjs.writeSuccess.call(void 0, `Completed running the ${name} generator!
|
|
70
|
+
`, config);
|
|
71
|
+
};
|
|
72
|
+
} catch (error) {
|
|
73
|
+
return () => {
|
|
74
|
+
_chunkGDXB64KGjs.writeFatal.call(void 0, "A fatal error occurred while running the generator - the process was forced to terminate", config);
|
|
75
|
+
_chunkGDXB64KGjs.writeError.call(void 0, `An exception was thrown in the generator's process
|
|
76
|
+
- Details: ${error.message}
|
|
77
|
+
- Stacktrace: ${error.stack}`, config);
|
|
78
|
+
};
|
|
79
|
+
} finally {
|
|
80
|
+
stopwatch();
|
|
81
|
+
}
|
|
82
|
+
}, "withRunGenerator");
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
exports.withRunGenerator = withRunGenerator;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.__name = __name; exports.__require = __require;
|
|
File without changes
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractHelmClient
|
|
3
|
+
} from "./chunk-UDLI3L7V.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ensureInitialized
|
|
6
|
+
} from "./chunk-OA63SGD6.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__name
|
|
9
|
+
} from "./chunk-XUV4U54K.mjs";
|
|
10
|
+
|
|
11
|
+
// src/utils/client.ts
|
|
12
|
+
import { execSync } from "node:child_process";
|
|
13
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
}
|
|
19
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
}
|
|
23
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
24
|
+
var HelmClient = class extends AbstractHelmClient {
|
|
25
|
+
static {
|
|
26
|
+
__name(this, "HelmClient");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates an instance of HelmClient
|
|
30
|
+
*/
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Package a chart directory into a chart archive
|
|
36
|
+
*
|
|
37
|
+
* @param {PackageOptions} [options]
|
|
38
|
+
*/
|
|
39
|
+
package(options) {
|
|
40
|
+
let chartPath = void 0;
|
|
41
|
+
let output = {};
|
|
42
|
+
try {
|
|
43
|
+
output = this.runCommand([
|
|
44
|
+
"helm",
|
|
45
|
+
"package",
|
|
46
|
+
options.chartFolder,
|
|
47
|
+
"-d",
|
|
48
|
+
options.outputFolder
|
|
49
|
+
]);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
if (err?.stderr.length > 0 && err?.exitCode !== 0) {
|
|
52
|
+
throw new Error(`Failed to package chart: ${err.stderr}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (output?.stderr.length > 0 && output?.exitCode !== 0) {
|
|
56
|
+
throw new Error(`Failed to package chart: ${output.stderr}`);
|
|
57
|
+
}
|
|
58
|
+
const match = output.stdout?.match(/Successfully packaged chart and saved it to: (.+)/);
|
|
59
|
+
if (!match || match.length < 2) {
|
|
60
|
+
throw new Error("Failed to parse chart path from helm output");
|
|
61
|
+
}
|
|
62
|
+
chartPath = match[1]?.trim();
|
|
63
|
+
return new Promise((resolve) => resolve(chartPath));
|
|
64
|
+
}
|
|
65
|
+
push(options) {
|
|
66
|
+
try {
|
|
67
|
+
this.runCommand([
|
|
68
|
+
"helm",
|
|
69
|
+
"push",
|
|
70
|
+
options.chartPath,
|
|
71
|
+
options.remote
|
|
72
|
+
]);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
if (err?.stderr.length > 0 && err?.exitCode !== 0) {
|
|
75
|
+
throw new Error(`Failed to push chart: ${err.stderr}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
dependencyUpdate(chartFolder) {
|
|
80
|
+
try {
|
|
81
|
+
this.runCommand([
|
|
82
|
+
"helm",
|
|
83
|
+
"dependency",
|
|
84
|
+
"update",
|
|
85
|
+
chartFolder
|
|
86
|
+
]);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
if (err?.stderr.length > 0 && err?.exitCode !== 0) {
|
|
89
|
+
throw new Error(`Failed to update chart dependencies: ${err.stderr}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
dependencyBuild(chartFolder) {
|
|
94
|
+
try {
|
|
95
|
+
this.runCommand([
|
|
96
|
+
"helm",
|
|
97
|
+
"dependency",
|
|
98
|
+
"build",
|
|
99
|
+
chartFolder
|
|
100
|
+
]);
|
|
101
|
+
} catch (err) {
|
|
102
|
+
if (err?.stderr.length > 0 && err?.exitCode !== 0) {
|
|
103
|
+
throw new Error(`Failed to build chart dependencies: ${err.stderr}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
addRepository(name, url) {
|
|
108
|
+
try {
|
|
109
|
+
this.runCommand([
|
|
110
|
+
"helm",
|
|
111
|
+
"repo",
|
|
112
|
+
"add",
|
|
113
|
+
name,
|
|
114
|
+
url
|
|
115
|
+
]);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
if (err?.stderr.length > 0 && err?.exitCode !== 0) {
|
|
118
|
+
throw new Error(`Failed to add repository: ${err.stderr}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Initialize Helm
|
|
124
|
+
*
|
|
125
|
+
* @returns A promise
|
|
126
|
+
*/
|
|
127
|
+
async initialize() {
|
|
128
|
+
if (this.initialized) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
this.runCommand([
|
|
133
|
+
"helm",
|
|
134
|
+
"version"
|
|
135
|
+
]);
|
|
136
|
+
} catch (err) {
|
|
137
|
+
if (err?.stderr.length > 0 && err?.exitCode !== 0) {
|
|
138
|
+
throw new Error(`Helm is not installed: ${err.stderr}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return new Promise((resolve) => {
|
|
142
|
+
this.initialized = true;
|
|
143
|
+
resolve();
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
runCommand(commands) {
|
|
147
|
+
return execSync(commands.filter(Boolean).join(" "), {
|
|
148
|
+
encoding: "utf8",
|
|
149
|
+
windowsHide: true,
|
|
150
|
+
maxBuffer: 1024 * 1e6,
|
|
151
|
+
stdio: "pipe"
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
_ts_decorate([
|
|
156
|
+
ensureInitialized,
|
|
157
|
+
_ts_metadata("design:type", Function),
|
|
158
|
+
_ts_metadata("design:paramtypes", [
|
|
159
|
+
typeof PackageOptions === "undefined" ? Object : PackageOptions
|
|
160
|
+
]),
|
|
161
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
162
|
+
], HelmClient.prototype, "package", null);
|
|
163
|
+
_ts_decorate([
|
|
164
|
+
ensureInitialized,
|
|
165
|
+
_ts_metadata("design:type", Function),
|
|
166
|
+
_ts_metadata("design:paramtypes", [
|
|
167
|
+
typeof PushOptions === "undefined" ? Object : PushOptions
|
|
168
|
+
]),
|
|
169
|
+
_ts_metadata("design:returntype", void 0)
|
|
170
|
+
], HelmClient.prototype, "push", null);
|
|
171
|
+
_ts_decorate([
|
|
172
|
+
ensureInitialized,
|
|
173
|
+
_ts_metadata("design:type", Function),
|
|
174
|
+
_ts_metadata("design:paramtypes", [
|
|
175
|
+
String
|
|
176
|
+
]),
|
|
177
|
+
_ts_metadata("design:returntype", void 0)
|
|
178
|
+
], HelmClient.prototype, "dependencyUpdate", null);
|
|
179
|
+
_ts_decorate([
|
|
180
|
+
ensureInitialized,
|
|
181
|
+
_ts_metadata("design:type", Function),
|
|
182
|
+
_ts_metadata("design:paramtypes", [
|
|
183
|
+
String
|
|
184
|
+
]),
|
|
185
|
+
_ts_metadata("design:returntype", void 0)
|
|
186
|
+
], HelmClient.prototype, "dependencyBuild", null);
|
|
187
|
+
_ts_decorate([
|
|
188
|
+
ensureInitialized,
|
|
189
|
+
_ts_metadata("design:type", Function),
|
|
190
|
+
_ts_metadata("design:paramtypes", [
|
|
191
|
+
String,
|
|
192
|
+
String
|
|
193
|
+
]),
|
|
194
|
+
_ts_metadata("design:returntype", void 0)
|
|
195
|
+
], HelmClient.prototype, "addRepository", null);
|
|
196
|
+
var createHelmClient = /* @__PURE__ */ __name(() => {
|
|
197
|
+
return new HelmClient();
|
|
198
|
+
}, "createHelmClient");
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
HelmClient,
|
|
202
|
+
createHelmClient
|
|
203
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyWorkspaceExecutorTokens
|
|
3
|
+
} from "./chunk-OBT35QXS.mjs";
|
|
4
|
+
import {
|
|
5
|
+
applyWorkspaceTokens
|
|
6
|
+
} from "./chunk-ZO7MGNKJ.mjs";
|
|
7
|
+
import {
|
|
8
|
+
findWorkspaceRoot,
|
|
9
|
+
formatLogMessage,
|
|
10
|
+
getStopwatch,
|
|
11
|
+
loadStormConfig,
|
|
12
|
+
writeDebug,
|
|
13
|
+
writeError,
|
|
14
|
+
writeFatal,
|
|
15
|
+
writeInfo,
|
|
16
|
+
writeSuccess,
|
|
17
|
+
writeTrace,
|
|
18
|
+
writeWarning
|
|
19
|
+
} from "./chunk-DZ5UCMNL.mjs";
|
|
20
|
+
import {
|
|
21
|
+
createHelmClient
|
|
22
|
+
} from "./chunk-6V45YKVB.mjs";
|
|
23
|
+
import {
|
|
24
|
+
__name
|
|
25
|
+
} from "./chunk-XUV4U54K.mjs";
|
|
26
|
+
|
|
27
|
+
// ../workspace-tools/src/base/base-executor.ts
|
|
28
|
+
var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context) => {
|
|
29
|
+
const stopwatch = getStopwatch(name);
|
|
30
|
+
let options = _options;
|
|
31
|
+
let config = {};
|
|
32
|
+
try {
|
|
33
|
+
writeInfo(`\u26A1 Running the ${name} executor...
|
|
34
|
+
`, config);
|
|
35
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
36
|
+
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
|
|
37
|
+
}
|
|
38
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
39
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName]?.root ?? workspaceRoot;
|
|
40
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? workspaceRoot;
|
|
41
|
+
const projectName = context.projectsConfigurations.projects[context.projectName]?.name ?? context.projectName;
|
|
42
|
+
config.workspaceRoot = workspaceRoot;
|
|
43
|
+
if (!executorOptions.skipReadingConfig) {
|
|
44
|
+
writeTrace(`Loading the Storm Config from environment variables and storm.config.js file...
|
|
45
|
+
- workspaceRoot: ${workspaceRoot}
|
|
46
|
+
- projectRoot: ${projectRoot}
|
|
47
|
+
- sourceRoot: ${sourceRoot}
|
|
48
|
+
- projectName: ${projectName}
|
|
49
|
+
`, config);
|
|
50
|
+
config = await loadStormConfig(workspaceRoot);
|
|
51
|
+
}
|
|
52
|
+
if (executorOptions?.hooks?.applyDefaultOptions) {
|
|
53
|
+
writeDebug("Running the applyDefaultOptions hook...", config);
|
|
54
|
+
options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
|
|
55
|
+
writeDebug("Completed the applyDefaultOptions hook", config);
|
|
56
|
+
}
|
|
57
|
+
writeTrace(`Executor schema options \u2699\uFE0F
|
|
58
|
+
${Object.keys(options).map((key) => ` - ${key}=${_isFunction(options[key]) ? "<function>" : JSON.stringify(options[key])}`).join("\n")}`, config);
|
|
59
|
+
const tokenized = await applyWorkspaceTokens(options, {
|
|
60
|
+
config,
|
|
61
|
+
workspaceRoot,
|
|
62
|
+
projectRoot,
|
|
63
|
+
sourceRoot,
|
|
64
|
+
projectName,
|
|
65
|
+
...context.projectsConfigurations.projects[context.projectName],
|
|
66
|
+
...executorOptions
|
|
67
|
+
}, applyWorkspaceExecutorTokens);
|
|
68
|
+
if (executorOptions?.hooks?.preProcess) {
|
|
69
|
+
writeDebug("Running the preProcess hook...", config);
|
|
70
|
+
await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
|
|
71
|
+
writeDebug("Completed the preProcess hook", config);
|
|
72
|
+
}
|
|
73
|
+
const ret = executorFn(tokenized, context, config);
|
|
74
|
+
if (_isFunction(ret?.next)) {
|
|
75
|
+
const asyncGen = ret;
|
|
76
|
+
for await (const iter of asyncGen) {
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const result = await Promise.resolve(ret);
|
|
80
|
+
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
81
|
+
writeTrace(`Failure determined by the ${name} executor
|
|
82
|
+
${formatLogMessage(result)}`, config);
|
|
83
|
+
console.error(result);
|
|
84
|
+
throw new Error(`The ${name} executor failed to run`, {
|
|
85
|
+
cause: result?.error
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (executorOptions?.hooks?.postProcess) {
|
|
89
|
+
writeDebug("Running the postProcess hook...", config);
|
|
90
|
+
await Promise.resolve(executorOptions.hooks.postProcess(config));
|
|
91
|
+
writeDebug("Completed the postProcess hook", config);
|
|
92
|
+
}
|
|
93
|
+
writeSuccess(`Completed running the ${name} task executor!
|
|
94
|
+
`, config);
|
|
95
|
+
return {
|
|
96
|
+
success: true
|
|
97
|
+
};
|
|
98
|
+
} catch (error) {
|
|
99
|
+
writeFatal("A fatal error occurred while running the executor - the process was forced to terminate", config);
|
|
100
|
+
writeError(`An exception was thrown in the executor's process
|
|
101
|
+
- Details: ${error.message}
|
|
102
|
+
- Stacktrace: ${error.stack}`, config);
|
|
103
|
+
return {
|
|
104
|
+
success: false
|
|
105
|
+
};
|
|
106
|
+
} finally {
|
|
107
|
+
stopwatch();
|
|
108
|
+
}
|
|
109
|
+
}, "withRunExecutor");
|
|
110
|
+
var _isFunction = /* @__PURE__ */ __name((value) => {
|
|
111
|
+
try {
|
|
112
|
+
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}, "_isFunction");
|
|
117
|
+
|
|
118
|
+
// src/executors/helm-package/executor.ts
|
|
119
|
+
async function serveExecutor(options, context, config) {
|
|
120
|
+
if (!context?.projectName || !context?.projectsConfigurations?.projects?.[context.projectName]?.root) {
|
|
121
|
+
throw new Error("Nx executor context was invalid");
|
|
122
|
+
}
|
|
123
|
+
const helm = createHelmClient();
|
|
124
|
+
if (options.dependencies?.repositories) {
|
|
125
|
+
for (const repository of options.dependencies.repositories) {
|
|
126
|
+
if (repository.name && repository.url) {
|
|
127
|
+
helm.addRepository(repository.name, repository.url);
|
|
128
|
+
} else {
|
|
129
|
+
throw new Error("Repository name and url are required");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (options.dependencies?.update) {
|
|
134
|
+
helm.dependencyUpdate(options.chartFolder);
|
|
135
|
+
}
|
|
136
|
+
if (options.dependencies?.build) {
|
|
137
|
+
helm.dependencyBuild(options.chartFolder);
|
|
138
|
+
}
|
|
139
|
+
const chartPath = await helm.package({
|
|
140
|
+
chartFolder: options.chartFolder,
|
|
141
|
+
outputFolder: options.outputFolder
|
|
142
|
+
});
|
|
143
|
+
if (options.push && chartPath && options.remote) {
|
|
144
|
+
helm.push({
|
|
145
|
+
chartPath,
|
|
146
|
+
remote: options.remote
|
|
147
|
+
});
|
|
148
|
+
} else {
|
|
149
|
+
writeWarning(`Chart packaged at: ${chartPath}`, config);
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
success: true
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
__name(serveExecutor, "serveExecutor");
|
|
156
|
+
var executor_default = withRunExecutor("Helm Chart Package executor", serveExecutor, {
|
|
157
|
+
skipReadingConfig: false,
|
|
158
|
+
hooks: {
|
|
159
|
+
applyDefaultOptions: /* @__PURE__ */ __name((options) => {
|
|
160
|
+
options.port ??= 4500;
|
|
161
|
+
return options;
|
|
162
|
+
}, "applyDefaultOptions")
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
export {
|
|
167
|
+
serveExecutor,
|
|
168
|
+
executor_default
|
|
169
|
+
};
|