@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.
- package/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/dist/chunk-27DDDFDE.mjs +29 -0
- package/dist/{chunk-RKHT4PWO.js → chunk-2SIDLIM5.js} +47 -31
- package/dist/{chunk-2GAU2GHG.js → chunk-4AADQIGW.js} +35 -102
- package/dist/{chunk-T5WNZJOD.js → chunk-7QVOU2PT.js} +3 -11
- package/dist/{chunk-3OATAJ3B.js → chunk-A7ARE63F.js} +83 -55
- package/dist/chunk-ARIMP3W4.mjs +155 -0
- package/dist/{chunk-TNVATOCF.mjs → chunk-BBY7MXHG.mjs} +93 -54
- package/dist/{chunk-OIKG7EMC.js → chunk-DD5DCADP.js} +32 -16
- package/dist/{chunk-IQYUMTUG.js → chunk-GQUK4O4E.js} +30 -23
- package/dist/{chunk-UC4ZBDTX.mjs → chunk-HGXQ6SSU.mjs} +5 -7
- package/dist/{chunk-LFNGKV6F.js → chunk-JSFRUBG5.js} +1 -8
- package/dist/{chunk-LLSJITI4.mjs → chunk-KVKKT3AU.mjs} +24 -13
- package/dist/{chunk-QKTRYJDT.mjs → chunk-MDGD27YL.mjs} +32 -16
- package/dist/{chunk-A2UL7VJH.mjs → chunk-MKWEGZBN.mjs} +31 -24
- package/dist/{chunk-YY3TH3F7.mjs → chunk-MQZUEUAT.mjs} +26 -21
- package/dist/{chunk-F37JQGEZ.mjs → chunk-MWMS7P7U.mjs} +333 -208
- package/dist/{chunk-X7ALQPYH.js → chunk-NMNRCEUZ.js} +21 -12
- package/dist/{chunk-T3C63ATM.mjs → chunk-NWIIGYA4.mjs} +68 -40
- package/dist/{chunk-NJPZBNWH.mjs → chunk-QHFQ2OBL.mjs} +2 -10
- package/dist/chunk-RECJ3G6F.js +21 -0
- package/dist/{chunk-IOT45LXV.js → chunk-RUPAIXLM.js} +59 -38
- package/dist/chunk-RUROM5AC.mjs +136 -0
- package/dist/{chunk-PDHZDUK3.js → chunk-SGNASGK5.js} +94 -55
- package/dist/{chunk-ARMCUBMY.js → chunk-UWVOFPSW.js} +334 -209
- package/dist/{chunk-RDQRJI4Y.mjs → chunk-VREITNWP.mjs} +36 -20
- package/dist/{chunk-EAQFLLRB.js → chunk-XKOZIQT3.js} +6 -8
- package/dist/{chunk-G7TAEXNU.js → chunk-Y2HMMGO2.js} +28 -23
- package/dist/{chunk-YHT26DWR.mjs → chunk-YXXZO2AJ.mjs} +0 -7
- package/dist/executors.js +10 -10
- package/dist/executors.mjs +9 -9
- package/dist/generators.js +7 -7
- package/dist/generators.mjs +6 -6
- package/dist/index.js +15 -15
- package/dist/index.mjs +14 -14
- package/dist/src/executors/container-publish/executor.js +6 -6
- package/dist/src/executors/container-publish/executor.mjs +5 -5
- package/dist/src/executors/helm-package/executor.js +8 -8
- package/dist/src/executors/helm-package/executor.mjs +7 -7
- package/dist/src/generators/helm-chart/generator.js +6 -6
- package/dist/src/generators/helm-chart/generator.mjs +5 -5
- package/dist/src/generators/helm-dependency/generator.js +6 -6
- package/dist/src/generators/helm-dependency/generator.mjs +5 -5
- package/dist/src/plugins/docker/index.js +5 -5
- package/dist/src/plugins/docker/index.mjs +4 -4
- package/dist/src/types.js +3 -3
- package/dist/src/types.mjs +2 -2
- package/dist/src/utils/client.js +5 -5
- package/dist/src/utils/client.mjs +4 -4
- package/dist/src/utils/ensure-init.js +3 -3
- package/dist/src/utils/ensure-init.mjs +2 -2
- package/dist/src/utils/index.js +6 -6
- package/dist/src/utils/index.mjs +5 -5
- package/dist/src/utils/prettier.js +3 -3
- package/dist/src/utils/prettier.mjs +2 -2
- package/dist/tsup.config.js +3 -8
- package/dist/tsup.config.mjs +3 -8
- package/package.json +1 -1
- package/dist/chunk-3GQAWCBQ.js +0 -13
- package/dist/chunk-5JZUTREX.mjs +0 -134
- package/dist/chunk-L2DHGVS5.mjs +0 -21
- package/dist/chunk-ZNGN7YLH.mjs +0 -203
|
@@ -1,21 +1,25 @@
|
|
|
1
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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2SIDLIM5js = require('./chunk-2SIDLIM5.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkUWVOFPSWjs = require('./chunk-UWVOFPSW.js');
|
|
7
|
+
|
|
8
|
+
// src/generators/helm-chart/generator.ts
|
|
4
9
|
|
|
5
10
|
|
|
6
|
-
var _chunkARMCUBMYjs = require('./chunk-ARMCUBMY.js');
|
|
7
11
|
|
|
8
12
|
|
|
9
|
-
var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
|
|
10
13
|
|
|
11
|
-
// src/generators/helm-chart/generator.ts
|
|
12
14
|
var _devkit = require('@nx/devkit');
|
|
13
15
|
var _path = require('path');
|
|
14
16
|
async function helmChartGeneratorFn(tree, options, config) {
|
|
15
|
-
|
|
17
|
+
_chunkUWVOFPSWjs.writeDebug.call(void 0, "\u{1F4DD} Preparing to write Helm Chart", config);
|
|
16
18
|
const project = _devkit.readProjectConfiguration.call(void 0, tree, options.project);
|
|
17
19
|
if (_optionalChain([project, 'access', _ => _.targets, 'optionalAccess', _2 => _2["helm-package"]])) {
|
|
18
|
-
throw new Error(
|
|
20
|
+
throw new Error(
|
|
21
|
+
`Project ${options.project} already has a helm target. Please remove it before running this command.`
|
|
22
|
+
);
|
|
19
23
|
}
|
|
20
24
|
_devkit.updateProjectConfiguration.call(void 0, tree, options.project, {
|
|
21
25
|
...project,
|
|
@@ -23,9 +27,7 @@ async function helmChartGeneratorFn(tree, options, config) {
|
|
|
23
27
|
...project.targets,
|
|
24
28
|
"helm-package": {
|
|
25
29
|
executor: "@storm-software/k8s-tools:helm-package",
|
|
26
|
-
outputs: [
|
|
27
|
-
"{options.outputFolder}"
|
|
28
|
-
],
|
|
30
|
+
outputs: ["{options.outputFolder}"],
|
|
29
31
|
options: {
|
|
30
32
|
chartFolder: `${project.root}/${options.chartFolder}`,
|
|
31
33
|
outputFolder: "{workspaceRoot}/dist/charts/{projectRoot}",
|
|
@@ -40,7 +42,12 @@ async function helmChartGeneratorFn(tree, options, config) {
|
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
});
|
|
43
|
-
_devkit.generateFiles.call(void 0,
|
|
45
|
+
_devkit.generateFiles.call(void 0,
|
|
46
|
+
tree,
|
|
47
|
+
_path.join.call(void 0, __dirname, "files", "chart"),
|
|
48
|
+
_path.join.call(void 0, project.root, _nullishCoalesce(options.chartFolder, () => ( ""))),
|
|
49
|
+
options
|
|
50
|
+
);
|
|
44
51
|
if (options.format) {
|
|
45
52
|
await _devkit.formatFiles.call(void 0, tree);
|
|
46
53
|
}
|
|
@@ -48,8 +55,10 @@ async function helmChartGeneratorFn(tree, options, config) {
|
|
|
48
55
|
success: true
|
|
49
56
|
};
|
|
50
57
|
}
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
var generator_default = _chunk2SIDLIM5js.withRunGenerator.call(void 0,
|
|
59
|
+
"Helm Chart",
|
|
60
|
+
helmChartGeneratorFn
|
|
61
|
+
);
|
|
53
62
|
|
|
54
63
|
|
|
55
64
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyWorkspaceProjectTokens,
|
|
3
3
|
applyWorkspaceTokens
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MDGD27YL.mjs";
|
|
5
5
|
import {
|
|
6
6
|
findWorkspaceRoot,
|
|
7
7
|
formatLogMessage,
|
|
@@ -14,23 +14,22 @@ import {
|
|
|
14
14
|
writeSuccess,
|
|
15
15
|
writeTrace,
|
|
16
16
|
writeWarning
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MWMS7P7U.mjs";
|
|
18
18
|
import {
|
|
19
19
|
createHelmClient
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
__name
|
|
23
|
-
} from "./chunk-L2DHGVS5.mjs";
|
|
20
|
+
} from "./chunk-RUROM5AC.mjs";
|
|
24
21
|
|
|
25
22
|
// ../workspace-tools/src/base/base-executor.ts
|
|
26
23
|
import { defu } from "defu";
|
|
27
|
-
var withRunExecutor =
|
|
24
|
+
var withRunExecutor = (name, executorFn, executorOptions = {}) => async (_options, context) => {
|
|
28
25
|
const stopwatch = getStopwatch(name);
|
|
29
26
|
let options = _options;
|
|
30
27
|
let config = {};
|
|
31
28
|
try {
|
|
32
29
|
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
33
|
-
throw new Error(
|
|
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
34
|
const workspaceRoot = findWorkspaceRoot();
|
|
36
35
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot;
|
|
@@ -39,35 +38,50 @@ var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions
|
|
|
39
38
|
config.workspaceRoot = workspaceRoot;
|
|
40
39
|
writeInfo(`\u26A1 Running the ${name} executor for ${projectName} `, config);
|
|
41
40
|
if (!executorOptions.skipReadingConfig) {
|
|
42
|
-
writeTrace(
|
|
41
|
+
writeTrace(
|
|
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
|
-
`,
|
|
47
|
+
`,
|
|
48
|
+
config
|
|
49
|
+
);
|
|
48
50
|
config = await getConfig(workspaceRoot);
|
|
49
51
|
}
|
|
50
52
|
if (executorOptions?.hooks?.applyDefaultOptions) {
|
|
51
53
|
writeDebug("Running the applyDefaultOptions hook...", config);
|
|
52
|
-
options = await Promise.resolve(
|
|
54
|
+
options = await Promise.resolve(
|
|
55
|
+
executorOptions.hooks.applyDefaultOptions(options, config)
|
|
56
|
+
);
|
|
53
57
|
writeDebug("Completed the applyDefaultOptions hook", config);
|
|
54
58
|
}
|
|
55
|
-
writeTrace(
|
|
59
|
+
writeTrace(
|
|
60
|
+
`Executor schema options \u2699\uFE0F
|
|
56
61
|
${formatLogMessage(options)}
|
|
57
|
-
`,
|
|
58
|
-
const tokenized = await applyWorkspaceTokens(options, defu({
|
|
59
|
-
workspaceRoot,
|
|
60
|
-
projectRoot,
|
|
61
|
-
sourceRoot,
|
|
62
|
-
projectName,
|
|
62
|
+
`,
|
|
63
63
|
config
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
66
76
|
${formatLogMessage(tokenized)}
|
|
67
|
-
`,
|
|
77
|
+
`,
|
|
78
|
+
config
|
|
79
|
+
);
|
|
68
80
|
if (executorOptions?.hooks?.preProcess) {
|
|
69
81
|
writeDebug("Running the preProcess hook...", config);
|
|
70
|
-
await Promise.resolve(
|
|
82
|
+
await Promise.resolve(
|
|
83
|
+
executorOptions.hooks.preProcess(tokenized, config)
|
|
84
|
+
);
|
|
71
85
|
writeDebug("Completed the preProcess hook", config);
|
|
72
86
|
}
|
|
73
87
|
const ret = executorFn(tokenized, context, config);
|
|
@@ -77,10 +91,15 @@ ${formatLogMessage(tokenized)}
|
|
|
77
91
|
void iter;
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
|
-
const result = await Promise.resolve(
|
|
94
|
+
const result = await Promise.resolve(
|
|
95
|
+
ret
|
|
96
|
+
);
|
|
81
97
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
82
|
-
writeTrace(
|
|
83
|
-
${
|
|
98
|
+
writeTrace(
|
|
99
|
+
`Failure determined by the ${name} executor
|
|
100
|
+
${formatLogMessage(result)}`,
|
|
101
|
+
config
|
|
102
|
+
);
|
|
84
103
|
console.error(result);
|
|
85
104
|
throw new Error(`The ${name} executor failed to run`, {
|
|
86
105
|
cause: result?.error
|
|
@@ -97,24 +116,30 @@ ${formatLogMessage(result)}`, config);
|
|
|
97
116
|
success: true
|
|
98
117
|
};
|
|
99
118
|
} catch (error) {
|
|
100
|
-
writeFatal(
|
|
101
|
-
|
|
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
|
|
102
125
|
- Details: ${error.message}
|
|
103
|
-
- Stacktrace: ${error.stack}`,
|
|
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
|
-
}
|
|
111
|
-
var _isFunction =
|
|
135
|
+
};
|
|
136
|
+
var _isFunction = (value) => {
|
|
112
137
|
try {
|
|
113
138
|
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
114
139
|
} catch (e) {
|
|
115
140
|
return false;
|
|
116
141
|
}
|
|
117
|
-
}
|
|
142
|
+
};
|
|
118
143
|
|
|
119
144
|
// src/executors/helm-package/executor.ts
|
|
120
145
|
async function serveExecutor(options, context, config) {
|
|
@@ -153,16 +178,19 @@ async function serveExecutor(options, context, config) {
|
|
|
153
178
|
success: true
|
|
154
179
|
};
|
|
155
180
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
export {
|
|
168
196
|
serveExecutor,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__name,
|
|
3
2
|
__require
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-27DDDFDE.mjs";
|
|
5
4
|
|
|
6
5
|
// src/utils/prettier.ts
|
|
7
6
|
async function resolveUserExistingPrettierConfig() {
|
|
@@ -34,7 +33,6 @@ async function resolveUserExistingPrettierConfig() {
|
|
|
34
33
|
return void 0;
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
__name(resolveUserExistingPrettierConfig, "resolveUserExistingPrettierConfig");
|
|
38
36
|
function addToPrettierIgnore(tree, ignore) {
|
|
39
37
|
const ignorePath = `${tree.root}/.prettierignore`;
|
|
40
38
|
if (!tree.exists(ignorePath)) {
|
|
@@ -44,18 +42,12 @@ function addToPrettierIgnore(tree, ignore) {
|
|
|
44
42
|
try {
|
|
45
43
|
const content = tree.read(ignorePath, "utf8") || "";
|
|
46
44
|
const lines = content.split("\n");
|
|
47
|
-
const newContent = [
|
|
48
|
-
.../* @__PURE__ */ new Set([
|
|
49
|
-
...lines,
|
|
50
|
-
...ignore
|
|
51
|
-
])
|
|
52
|
-
].join("\n");
|
|
45
|
+
const newContent = [.../* @__PURE__ */ new Set([...lines, ...ignore])].join("\n");
|
|
53
46
|
tree.write(ignorePath, newContent);
|
|
54
47
|
} catch (error) {
|
|
55
48
|
throw new Error(`Failed to update .prettierignore file: ${String(error)}`);
|
|
56
49
|
}
|
|
57
50
|
}
|
|
58
|
-
__name(addToPrettierIgnore, "addToPrettierIgnore");
|
|
59
51
|
|
|
60
52
|
export {
|
|
61
53
|
resolveUserExistingPrettierConfig,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
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
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result) __defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.__require = __require; exports.__decorateClass = __decorateClass;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }// ../workspace-tools/src/utils/package-helpers.ts
|
|
2
|
+
|
|
2
3
|
|
|
3
|
-
var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
|
|
4
4
|
|
|
5
|
-
// ../workspace-tools/src/utils/package-helpers.ts
|
|
6
5
|
var _devkit = require('@nx/devkit');
|
|
7
6
|
var _fs = require('fs');
|
|
8
7
|
|
|
@@ -44,15 +43,17 @@ var ProjectTagConstants = {
|
|
|
44
43
|
TAG_ID: "plugin"
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
|
-
var formatProjectTag =
|
|
46
|
+
var formatProjectTag = (variant, value) => {
|
|
48
47
|
return `${variant}:${value}`;
|
|
49
|
-
}
|
|
50
|
-
var hasProjectTag =
|
|
48
|
+
};
|
|
49
|
+
var hasProjectTag = (project, variant) => {
|
|
51
50
|
project.tags = _nullishCoalesce(project.tags, () => ( []));
|
|
52
51
|
const prefix = formatProjectTag(variant, "");
|
|
53
|
-
return project.tags.some(
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
return project.tags.some(
|
|
53
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
var getProjectTag = (project, variant) => {
|
|
56
57
|
if (!hasProjectTag(project, variant)) {
|
|
57
58
|
return void 0;
|
|
58
59
|
}
|
|
@@ -60,39 +61,52 @@ var getProjectTag = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (projec
|
|
|
60
61
|
const prefix = formatProjectTag(variant, "");
|
|
61
62
|
const tag = project.tags.find((tag2) => tag2.startsWith(prefix));
|
|
62
63
|
return _optionalChain([tag, 'optionalAccess', _ => _.replace, 'call', _2 => _2(prefix, "")]);
|
|
63
|
-
}
|
|
64
|
-
var isEqualProjectTag =
|
|
64
|
+
};
|
|
65
|
+
var isEqualProjectTag = (project, variant, value) => {
|
|
65
66
|
const tag = getProjectTag(project, variant);
|
|
66
67
|
return !!(tag && _optionalChain([tag, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]) === value.toUpperCase());
|
|
67
|
-
}
|
|
68
|
-
var addProjectTag =
|
|
68
|
+
};
|
|
69
|
+
var addProjectTag = (project, variant, value, options = {
|
|
69
70
|
overwrite: false
|
|
70
71
|
}) => {
|
|
71
72
|
project.tags = _nullishCoalesce(project.tags, () => ( []));
|
|
72
73
|
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
73
|
-
project.tags = project.tags.filter(
|
|
74
|
+
project.tags = project.tags.filter(
|
|
75
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
76
|
+
);
|
|
74
77
|
project.tags.push(formatProjectTag(variant, value));
|
|
75
78
|
}
|
|
76
|
-
}
|
|
77
|
-
var addPluginProjectTag =
|
|
79
|
+
};
|
|
80
|
+
var addPluginProjectTag = (project, plugin) => {
|
|
78
81
|
project.tags = _nullishCoalesce(project.tags, () => ( []));
|
|
79
|
-
project.tags.push(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
project.tags.push(
|
|
83
|
+
formatProjectTag(ProjectTagConstants.Plugin.TAG_ID, plugin)
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
var setDefaultProjectTags = (project, plugin) => {
|
|
82
87
|
project.tags = _nullishCoalesce(project.tags, () => ( []));
|
|
83
|
-
addProjectTag(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
overwrite: true
|
|
88
|
-
|
|
89
|
-
addProjectTag(
|
|
90
|
-
|
|
91
|
-
|
|
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
|
+
_optionalChain([project, 'access', _5 => _5.targets, 'optionalAccess', _6 => _6.build, 'optionalAccess', _7 => _7.options, 'access', _8 => _8.platform]) === "node" ? ProjectTagConstants.Platform.NODE : _optionalChain([project, 'access', _9 => _9.targets, 'optionalAccess', _10 => _10.build, 'optionalAccess', _11 => _11.options, 'access', _12 => _12.platform]) === "worker" ? ProjectTagConstants.Platform.WORKER : _optionalChain([project, 'access', _13 => _13.targets, 'optionalAccess', _14 => _14.build, 'optionalAccess', _15 => _15.options, 'access', _16 => _16.platform]) === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
104
|
+
{ overwrite: false }
|
|
105
|
+
);
|
|
92
106
|
if (plugin) {
|
|
93
107
|
addPluginProjectTag(project, plugin);
|
|
94
108
|
}
|
|
95
|
-
}
|
|
109
|
+
};
|
|
96
110
|
|
|
97
111
|
// ../workspace-tools/src/utils/toml.ts
|
|
98
112
|
var _jtoml = require('@ltd/j-toml'); var _jtoml2 = _interopRequireDefault(_jtoml);
|
|
@@ -102,28 +116,35 @@ function parseCargoToml(cargoString) {
|
|
|
102
116
|
throw new Error("Cargo.toml is empty");
|
|
103
117
|
}
|
|
104
118
|
return _jtoml2.default.parse(cargoString, {
|
|
105
|
-
x: {
|
|
106
|
-
comment: true
|
|
107
|
-
}
|
|
119
|
+
x: { comment: true }
|
|
108
120
|
});
|
|
109
121
|
}
|
|
110
|
-
_chunk3GQAWCBQjs.__name.call(void 0, parseCargoToml, "parseCargoToml");
|
|
111
122
|
|
|
112
123
|
// ../workspace-tools/src/utils/package-helpers.ts
|
|
113
|
-
var getPackageInfo =
|
|
114
|
-
if (isEqualProjectTag(
|
|
124
|
+
var getPackageInfo = (project) => {
|
|
125
|
+
if (isEqualProjectTag(
|
|
126
|
+
project,
|
|
127
|
+
ProjectTagConstants.Language.TAG_ID,
|
|
128
|
+
ProjectTagConstants.Language.RUST
|
|
129
|
+
) && _fs.existsSync.call(void 0, _devkit.joinPathFragments.call(void 0, project.root, "Cargo.toml"))) {
|
|
115
130
|
return {
|
|
116
131
|
type: "Cargo.toml",
|
|
117
132
|
content: parseCargoToml(_devkit.joinPathFragments.call(void 0, project.root, "Cargo.toml"))
|
|
118
133
|
};
|
|
119
|
-
} else if (isEqualProjectTag(
|
|
134
|
+
} else if (isEqualProjectTag(
|
|
135
|
+
project,
|
|
136
|
+
ProjectTagConstants.Language.TAG_ID,
|
|
137
|
+
ProjectTagConstants.Language.TYPESCRIPT
|
|
138
|
+
) && _fs.existsSync.call(void 0, _devkit.joinPathFragments.call(void 0, project.root, "package.json"))) {
|
|
120
139
|
return {
|
|
121
140
|
type: "package.json",
|
|
122
|
-
content: _devkit.readJsonFile.call(void 0,
|
|
141
|
+
content: _devkit.readJsonFile.call(void 0,
|
|
142
|
+
_devkit.joinPathFragments.call(void 0, project.root, "package.json")
|
|
143
|
+
)
|
|
123
144
|
};
|
|
124
145
|
}
|
|
125
146
|
return null;
|
|
126
|
-
}
|
|
147
|
+
};
|
|
127
148
|
|
|
128
149
|
|
|
129
150
|
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractHelmClient
|
|
3
|
+
} from "./chunk-YXXZO2AJ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ensureInitialized
|
|
6
|
+
} from "./chunk-HGXQ6SSU.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__decorateClass
|
|
9
|
+
} from "./chunk-27DDDFDE.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
|
+
};
|