@storm-software/k8s-tools 0.17.1 → 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.
Files changed (145) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/chunk-2GAU2GHG.js +203 -0
  3. package/dist/chunk-2QNNUD5M.js +86 -0
  4. package/dist/chunk-3GQAWCBQ.js +13 -0
  5. package/dist/chunk-3J7KBHMJ.mjs +0 -0
  6. package/dist/chunk-6V45YKVB.mjs +203 -0
  7. package/dist/chunk-7AV2CVBT.mjs +169 -0
  8. package/dist/chunk-7BCSLKT3.js +98 -0
  9. package/dist/chunk-7IJP4RLN.mjs +63 -0
  10. package/dist/chunk-AFPEYAYK.js +61 -0
  11. package/dist/chunk-DHBG5ASJ.js +1 -0
  12. package/dist/chunk-DZ5UCMNL.mjs +1063 -0
  13. package/dist/chunk-EAQFLLRB.js +23 -0
  14. package/dist/chunk-EISL3C34.js +169 -0
  15. package/dist/chunk-GDXB64KG.js +1063 -0
  16. package/dist/chunk-GOVHOOTS.js +184 -0
  17. package/dist/chunk-IOT45LXV.js +134 -0
  18. package/dist/chunk-LFNGKV6F.js +18 -0
  19. package/dist/chunk-LSBSNYPQ.mjs +86 -0
  20. package/dist/chunk-O7U3AH6A.mjs +58 -0
  21. package/dist/chunk-OA63SGD6.mjs +23 -0
  22. package/dist/chunk-OBT35QXS.mjs +59 -0
  23. package/dist/chunk-OXY6AHKS.js +57 -0
  24. package/dist/chunk-Q6DDBFXE.mjs +147 -0
  25. package/dist/chunk-RVFKH45R.mjs +134 -0
  26. package/dist/chunk-T5WNZJOD.js +63 -0
  27. package/dist/chunk-TUDMFJIT.mjs +98 -0
  28. package/dist/chunk-U76ID4TS.js +1 -0
  29. package/dist/chunk-UDLI3L7V.mjs +18 -0
  30. package/dist/chunk-UWJTAL4W.js +59 -0
  31. package/{src/plugins/docker/index.js → dist/chunk-W7DPLC4K.mjs} +46 -68
  32. package/dist/chunk-WWU25UQ4.mjs +0 -0
  33. package/dist/chunk-XMPMWMWQ.js +147 -0
  34. package/dist/chunk-XO66D74Z.js +1 -0
  35. package/dist/chunk-XUV4U54K.mjs +21 -0
  36. package/dist/chunk-YSCEY447.mjs +0 -0
  37. package/dist/chunk-ZO7MGNKJ.mjs +61 -0
  38. package/dist/executor-DY-z8MOl.d.mts +53 -0
  39. package/dist/executor-Dr6UXfvX.d.ts +53 -0
  40. package/dist/executors.d.mts +6 -0
  41. package/dist/executors.d.ts +6 -0
  42. package/dist/executors.js +19 -0
  43. package/dist/executors.mjs +19 -0
  44. package/dist/generator-B5bCfIUV.d.ts +24 -0
  45. package/dist/generator-BIe65kKR.d.mts +28 -0
  46. package/dist/generator-Cad7bXVB.d.mts +24 -0
  47. package/dist/generator-D7M45zOU.d.ts +28 -0
  48. package/dist/generators.d.mts +6 -0
  49. package/dist/generators.d.ts +6 -0
  50. package/dist/generators.js +15 -0
  51. package/dist/generators.mjs +15 -0
  52. package/dist/index.d.mts +15 -0
  53. package/dist/index.d.ts +15 -0
  54. package/dist/index.js +57 -0
  55. package/dist/index.mjs +57 -0
  56. package/dist/schema.d-Cx_3iG9A.d.mts +150 -0
  57. package/dist/schema.d-Cx_3iG9A.d.ts +150 -0
  58. package/dist/src/executors/container-publish/executor.d.mts +11 -0
  59. package/dist/src/executors/container-publish/executor.d.ts +11 -0
  60. package/dist/src/executors/container-publish/executor.js +13 -0
  61. package/dist/src/executors/container-publish/executor.mjs +13 -0
  62. package/dist/src/executors/helm-package/executor.d.mts +4 -0
  63. package/dist/src/executors/helm-package/executor.d.ts +4 -0
  64. package/dist/src/executors/helm-package/executor.js +15 -0
  65. package/dist/src/executors/helm-package/executor.mjs +15 -0
  66. package/{src → dist/src}/executors/helm-package/schema.d.ts +1 -1
  67. package/dist/src/generators/helm-chart/generator.d.mts +5 -0
  68. package/dist/src/generators/helm-chart/generator.d.ts +5 -0
  69. package/dist/src/generators/helm-chart/generator.js +12 -0
  70. package/dist/src/generators/helm-chart/generator.mjs +12 -0
  71. package/{src → dist/src}/generators/helm-chart/schema.d.ts +4 -1
  72. package/dist/src/generators/helm-dependency/generator.d.mts +5 -0
  73. package/dist/src/generators/helm-dependency/generator.d.ts +5 -0
  74. package/dist/src/generators/helm-dependency/generator.js +12 -0
  75. package/dist/src/generators/helm-dependency/generator.mjs +12 -0
  76. package/{src → dist/src}/generators/helm-dependency/schema.d.ts +4 -1
  77. package/dist/src/plugins/docker/index.d.mts +12 -0
  78. package/dist/src/plugins/docker/index.d.ts +12 -0
  79. package/dist/src/plugins/docker/index.js +15 -0
  80. package/dist/src/plugins/docker/index.mjs +15 -0
  81. package/dist/src/types.d.mts +31 -0
  82. package/{src → dist/src}/types.d.ts +9 -6
  83. package/dist/src/types.js +7 -0
  84. package/dist/src/types.mjs +7 -0
  85. package/dist/src/utils/client.d.mts +35 -0
  86. package/{src → dist/src}/utils/client.d.ts +7 -3
  87. package/dist/src/utils/client.js +11 -0
  88. package/dist/src/utils/client.mjs +11 -0
  89. package/dist/src/utils/ensure-init.d.mts +11 -0
  90. package/{src → dist/src}/utils/ensure-init.d.ts +3 -1
  91. package/dist/src/utils/ensure-init.js +7 -0
  92. package/dist/src/utils/ensure-init.mjs +7 -0
  93. package/dist/src/utils/index.d.mts +6 -0
  94. package/dist/src/utils/index.d.ts +6 -0
  95. package/dist/src/utils/index.js +21 -0
  96. package/dist/src/utils/index.mjs +21 -0
  97. package/dist/src/utils/prettier.d.mts +13 -0
  98. package/dist/src/utils/prettier.d.ts +13 -0
  99. package/dist/src/utils/prettier.js +9 -0
  100. package/dist/src/utils/prettier.mjs +9 -0
  101. package/dist/tsup.config.d.mts +5 -0
  102. package/dist/tsup.config.d.ts +5 -0
  103. package/dist/tsup.config.js +36 -0
  104. package/dist/tsup.config.mjs +36 -0
  105. package/dist/types-BCBFBwnJ.d.mts +20 -0
  106. package/dist/types-BCBFBwnJ.d.ts +20 -0
  107. package/dist/types-CIJRaFHD.d.mts +1185 -0
  108. package/dist/types-CIJRaFHD.d.ts +1185 -0
  109. package/executors.json +4 -4
  110. package/generators.json +4 -4
  111. package/package.json +1 -1
  112. package/index.d.ts +0 -1
  113. package/index.js +0 -3269
  114. package/meta.json +0 -654
  115. package/src/executors/container-publish/executor.d.ts +0 -7
  116. package/src/executors/container-publish/executor.js +0 -199
  117. package/src/executors/helm-package/executor.d.ts +0 -8
  118. package/src/executors/helm-package/executor.js +0 -242
  119. package/src/executors/index.d.ts +0 -2
  120. package/src/generators/helm-chart/files/chart/.helmignore +0 -23
  121. package/src/generators/helm-chart/generator.d.ts +0 -8
  122. package/src/generators/helm-chart/generator.js +0 -79
  123. package/src/generators/helm-dependency/generator.d.ts +0 -8
  124. package/src/generators/helm-dependency/generator.js +0 -2747
  125. package/src/generators/index.d.ts +0 -2
  126. package/src/index.d.ts +0 -3
  127. package/src/plugins/docker/_dockerfile.d.ts +0 -9
  128. package/src/plugins/docker/index.d.ts +0 -1
  129. package/src/plugins/index.d.ts +0 -1
  130. package/src/utils/prettier.d.ts +0 -9
  131. /package/{src → dist/src}/executors/container-publish/schema.d.ts +0 -0
  132. /package/{src → dist/src}/executors/container-publish/schema.json +0 -0
  133. /package/{src → dist/src}/executors/helm-package/schema.json +0 -0
  134. /package/{src → dist/src}/generators/helm-chart/files/chart/Chart.yaml.template +0 -0
  135. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/NOTES.txt +0 -0
  136. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/_helpers.yaml +0 -0
  137. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/deployment.yaml +0 -0
  138. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/hpa.yaml +0 -0
  139. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/ingress.yaml +0 -0
  140. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/service.yaml +0 -0
  141. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/serviceaccount.yaml +0 -0
  142. /package/{src → dist/src}/generators/helm-chart/files/chart/templates/test/test-connection.yaml +0 -0
  143. /package/{src → dist/src}/generators/helm-chart/files/chart/values.yaml +0 -0
  144. /package/{src → dist/src}/generators/helm-chart/schema.json +0 -0
  145. /package/{src → dist/src}/generators/helm-dependency/schema.json +0 -0
@@ -1,199 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // packages/k8s-tools/src/executors/container-publish/executor.ts
30
- var executor_exports = {};
31
- __export(executor_exports, {
32
- default: () => publishExecutor,
33
- getRegistryVersion: () => getRegistryVersion
34
- });
35
- module.exports = __toCommonJS(executor_exports);
36
- var import_devkit = require("@nx/devkit");
37
- var import_config_tools = require("@storm-software/config-tools");
38
- var import_apply_workspace_tokens = require("@storm-software/workspace-tools/utils/apply-workspace-tokens");
39
- var import_package_helpers = require("@storm-software/workspace-tools/utils/package-helpers");
40
- var import_node_https = __toESM(require("node:https"));
41
- async function* publishExecutor(options, context) {
42
- const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
43
- if (!context.projectName) {
44
- throw new Error("The executor requires a projectName.");
45
- }
46
- console.info(
47
- `\u{1F680} Running Storm Container Registry Publish executor on the ${context.projectName} crate`
48
- );
49
- const workspaceRoot = (0, import_config_tools.findWorkspaceRoot)();
50
- const config = await (0, import_config_tools.loadStormConfig)(workspaceRoot);
51
- const projectConfig = context.projectsConfigurations?.projects[context.projectName];
52
- if (!projectConfig) {
53
- throw new Error(
54
- `The executor requires a valid projectsConfiguration - No configuration found for project ${context.projectName}`
55
- );
56
- }
57
- const projectRoot = projectConfig?.root ?? workspaceRoot;
58
- const sourceRoot = projectConfig?.sourceRoot ?? workspaceRoot;
59
- const projectName = projectConfig?.name ?? context.projectName;
60
- config.workspaceRoot = workspaceRoot;
61
- const tokenized = await (0, import_config_tools.applyWorkspaceTokens)(
62
- options,
63
- {
64
- config,
65
- workspaceRoot,
66
- projectRoot,
67
- sourceRoot,
68
- projectName,
69
- ...projectConfig
70
- },
71
- import_apply_workspace_tokens.applyWorkspaceExecutorTokens
72
- );
73
- tokenized.engine ??= "docker";
74
- tokenized.registry ??= config.registry.container;
75
- try {
76
- if (isDryRun) {
77
- console.log(
78
- `Would publish to ${tokenized.registry}, but [dry-run] was set`
79
- );
80
- } else {
81
- console.log(`Published to ${tokenized.registry}`);
82
- const packageManager = (0, import_package_helpers.getPackageInfo)(projectConfig);
83
- if (packageManager) {
84
- tokenized["build-args"] ??= [
85
- "ENVIRONMENT=production",
86
- "DEBUG_IMAGE=false"
87
- ];
88
- tokenized["labels"] ??= [];
89
- let version = "";
90
- if (process.env.TAG) {
91
- version = process.env.TAG;
92
- } else {
93
- if (packageManager.type === "Cargo.toml") {
94
- version = packageManager.content.package.version;
95
- } else if (packageManager.type === "package.json") {
96
- version = packageManager.content.version;
97
- }
98
- }
99
- tokenized["build-args"].push(`RELEASE=${version}`);
100
- tokenized["labels"].push(`org.opencontainers.image.version=${version}`);
101
- const tags = await getRegistryVersion(projectName, config);
102
- if (tags.length === 0) {
103
- tokenized["labels"].push(
104
- `org.opencontainers.image.created=${(/* @__PURE__ */ new Date()).toISOString()}`
105
- );
106
- } else if (tags.includes(version)) {
107
- console.warn(
108
- `Skipped package "${projectName}" because v${version} already exists in ${tokenized.registry}`
109
- );
110
- return {
111
- success: true
112
- };
113
- }
114
- } else {
115
- console.warn(
116
- `No package manager found for project "${projectName}" - Skipping container publishing`
117
- );
118
- return {
119
- success: true
120
- };
121
- }
122
- const { project, target, configuration } = (0, import_devkit.parseTargetString)(
123
- "container",
124
- context
125
- );
126
- for await (const output of await (0, import_devkit.runExecutor)({ project, target, configuration }, tokenized, context)) {
127
- if (!output.success) {
128
- throw new Error("Could not compile application files");
129
- }
130
- yield;
131
- }
132
- }
133
- return {
134
- success: true
135
- };
136
- } catch (error) {
137
- console.error(`Failed to publish to ${tokenized.registry}`);
138
- console.error(error);
139
- console.log("");
140
- return {
141
- success: false
142
- };
143
- }
144
- }
145
- var getRegistryVersion = (name, config) => {
146
- if (!name) {
147
- throw new Error(
148
- "The `getRegistryVersion` function requires a container name."
149
- );
150
- }
151
- try {
152
- const tagsApiUrl = `${config.registry.container}/v2/namespaces/${encodeURIComponent(config.namespace ? config.namespace : "storm-software")}/repositories/${encodeURIComponent(
153
- name.replace(`${config.namespace}-`, "")
154
- )}/tags`;
155
- console.log(`Checking for existing version at ${tagsApiUrl}`);
156
- return new Promise(
157
- (resolve, reject) => import_node_https.default.get(tagsApiUrl, (res) => {
158
- if (res.statusCode === 404) {
159
- console.log(`No existing version found at ${tagsApiUrl}`);
160
- return resolve([]);
161
- }
162
- res.on("data", (data) => {
163
- if (data) {
164
- console.log(
165
- `Existing versions found at ${tagsApiUrl} - ${data}`
166
- );
167
- const json = JSON.parse(data.toString());
168
- return resolve(
169
- json.results.filter(
170
- (result) => result.status === "active" && result.name && result.name !== "latest"
171
- ).map((result) => result.name)
172
- );
173
- }
174
- return reject(
175
- new Error(
176
- "No data returned from container registry, expected a 404 if no tags exist"
177
- )
178
- );
179
- });
180
- }).on("error", (e) => {
181
- throw e;
182
- })
183
- );
184
- } catch (error) {
185
- console.error(`Failed to get version from ${config.registry.container}`);
186
- console.error(error);
187
- console.log("");
188
- throw new Error(
189
- `Could not get version from container registry - ${config.registry.container}`,
190
- {
191
- cause: error
192
- }
193
- );
194
- }
195
- };
196
- // Annotate the CommonJS export names for ESM import in node:
197
- 0 && (module.exports = {
198
- getRegistryVersion
199
- });
@@ -1,8 +0,0 @@
1
- import type { ExecutorContext, PromiseExecutor } from "@nx/devkit";
2
- import type { StormConfig } from "@storm-software/config";
3
- import { HelmPackageExecutorSchema } from "./schema";
4
- export declare function serveExecutor(options: HelmPackageExecutorSchema, context: ExecutorContext, config?: StormConfig): Promise<{
5
- success: boolean;
6
- }>;
7
- declare const _default: PromiseExecutor<HelmPackageExecutorSchema>;
8
- export default _default;
@@ -1,242 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var __decorateClass = (decorators, target, key, kind) => {
19
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
20
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
21
- if (decorator = decorators[i])
22
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
23
- if (kind && result) __defProp(target, key, result);
24
- return result;
25
- };
26
-
27
- // packages/k8s-tools/src/executors/helm-package/executor.ts
28
- var executor_exports = {};
29
- __export(executor_exports, {
30
- default: () => executor_default,
31
- serveExecutor: () => serveExecutor
32
- });
33
- module.exports = __toCommonJS(executor_exports);
34
- var import_console = require("@storm-software/config-tools/logger/console");
35
- var import_base_executor = require("@storm-software/workspace-tools/base/base-executor");
36
-
37
- // packages/k8s-tools/src/utils/client.ts
38
- var import_node_child_process = require("node:child_process");
39
-
40
- // packages/k8s-tools/src/types.ts
41
- var AbstractHelmClient = class {
42
- constructor() {
43
- this.initialized = false;
44
- }
45
- async initialize() {
46
- throw new Error("Method not implemented.");
47
- }
48
- };
49
-
50
- // packages/k8s-tools/src/utils/ensure-init.ts
51
- var ensureInitialized = (target, propertyKey, descriptor) => {
52
- const originalMethod = descriptor.value;
53
- descriptor.value = async function(...arguments_) {
54
- const self = this;
55
- if (self.initialized === void 0 || typeof self.initialize !== "function") {
56
- throw new TypeError(
57
- `The ensureInitialized decorator can only be applied in classes with an 'initialized' property and 'initialize' method.`
58
- );
59
- }
60
- if (!self.initialized) {
61
- await self.initialize();
62
- }
63
- return originalMethod.apply(this, arguments_);
64
- };
65
- return descriptor;
66
- };
67
-
68
- // packages/k8s-tools/src/utils/client.ts
69
- var HelmClient = class extends AbstractHelmClient {
70
- /**
71
- * Creates an instance of HelmClient
72
- */
73
- constructor() {
74
- super();
75
- }
76
- package(options) {
77
- let chartPath = void 0;
78
- let output = {};
79
- try {
80
- output = this.runCommand([
81
- "helm",
82
- "package",
83
- options.chartFolder,
84
- "-d",
85
- options.outputFolder
86
- ]);
87
- } catch (err) {
88
- if (err?.stderr.length > 0 && err?.exitCode !== 0) {
89
- throw new Error(`Failed to package chart: ${err.stderr}`);
90
- }
91
- }
92
- if (output?.stderr.length > 0 && output?.exitCode !== 0) {
93
- throw new Error(`Failed to package chart: ${output.stderr}`);
94
- }
95
- const match = output.stdout?.match(
96
- /Successfully packaged chart and saved it to: (.+)/
97
- );
98
- if (!match || match.length < 2) {
99
- throw new Error("Failed to parse chart path from helm output");
100
- }
101
- chartPath = match[1]?.trim();
102
- return new Promise((resolve) => resolve(chartPath));
103
- }
104
- push(options) {
105
- try {
106
- this.runCommand(["helm", "push", options.chartPath, options.remote]);
107
- } catch (err) {
108
- if (err?.stderr.length > 0 && err?.exitCode !== 0) {
109
- throw new Error(`Failed to push chart: ${err.stderr}`);
110
- }
111
- }
112
- }
113
- dependencyUpdate(chartFolder) {
114
- try {
115
- this.runCommand(["helm", "dependency", "update", chartFolder]);
116
- } catch (err) {
117
- if (err?.stderr.length > 0 && err?.exitCode !== 0) {
118
- throw new Error(`Failed to update chart dependencies: ${err.stderr}`);
119
- }
120
- }
121
- }
122
- dependencyBuild(chartFolder) {
123
- try {
124
- this.runCommand(["helm", "dependency", "build", chartFolder]);
125
- } catch (err) {
126
- if (err?.stderr.length > 0 && err?.exitCode !== 0) {
127
- throw new Error(`Failed to build chart dependencies: ${err.stderr}`);
128
- }
129
- }
130
- }
131
- addRepository(name, url) {
132
- try {
133
- this.runCommand(["helm", "repo", "add", name, url]);
134
- } catch (err) {
135
- if (err?.stderr.length > 0 && err?.exitCode !== 0) {
136
- throw new Error(`Failed to add repository: ${err.stderr}`);
137
- }
138
- }
139
- }
140
- /**
141
- * Initialize Helm
142
- *
143
- * @returns A promise
144
- */
145
- async initialize() {
146
- if (this.initialized) {
147
- return;
148
- }
149
- try {
150
- this.runCommand(["helm", "version"]);
151
- } catch (err) {
152
- if (err?.stderr.length > 0 && err?.exitCode !== 0) {
153
- throw new Error(`Helm is not installed: ${err.stderr}`);
154
- }
155
- }
156
- return new Promise((resolve) => {
157
- this.initialized = true;
158
- resolve();
159
- });
160
- }
161
- runCommand(commands) {
162
- return (0, import_node_child_process.execSync)(commands.filter(Boolean).join(" "), {
163
- encoding: "utf8",
164
- windowsHide: true,
165
- maxBuffer: 1024 * 1e6,
166
- stdio: "pipe"
167
- });
168
- }
169
- };
170
- __decorateClass([
171
- ensureInitialized
172
- ], HelmClient.prototype, "package", 1);
173
- __decorateClass([
174
- ensureInitialized
175
- ], HelmClient.prototype, "push", 1);
176
- __decorateClass([
177
- ensureInitialized
178
- ], HelmClient.prototype, "dependencyUpdate", 1);
179
- __decorateClass([
180
- ensureInitialized
181
- ], HelmClient.prototype, "dependencyBuild", 1);
182
- __decorateClass([
183
- ensureInitialized
184
- ], HelmClient.prototype, "addRepository", 1);
185
- var createHelmClient = () => {
186
- return new HelmClient();
187
- };
188
-
189
- // packages/k8s-tools/src/executors/helm-package/executor.ts
190
- async function serveExecutor(options, context, config) {
191
- if (!context?.projectName || !context?.projectsConfigurations?.projects?.[context.projectName]?.root) {
192
- throw new Error("Nx executor context was invalid");
193
- }
194
- const helm = createHelmClient();
195
- if (options.dependencies?.repositories) {
196
- for (const repository of options.dependencies.repositories) {
197
- if (repository.name && repository.url) {
198
- helm.addRepository(repository.name, repository.url);
199
- } else {
200
- throw new Error("Repository name and url are required");
201
- }
202
- }
203
- }
204
- if (options.dependencies?.update) {
205
- helm.dependencyUpdate(options.chartFolder);
206
- }
207
- if (options.dependencies?.build) {
208
- helm.dependencyBuild(options.chartFolder);
209
- }
210
- const chartPath = await helm.package({
211
- chartFolder: options.chartFolder,
212
- outputFolder: options.outputFolder
213
- });
214
- if (options.push && chartPath && options.remote) {
215
- helm.push({
216
- chartPath,
217
- remote: options.remote
218
- });
219
- } else {
220
- (0, import_console.writeWarning)(`Chart packaged at: ${chartPath}`, config);
221
- }
222
- return {
223
- success: true
224
- };
225
- }
226
- var executor_default = (0, import_base_executor.withRunExecutor)(
227
- "Helm Chart Package executor",
228
- serveExecutor,
229
- {
230
- skipReadingConfig: false,
231
- hooks: {
232
- applyDefaultOptions: (options) => {
233
- options.port ??= 4500;
234
- return options;
235
- }
236
- }
237
- }
238
- );
239
- // Annotate the CommonJS export names for ESM import in node:
240
- 0 && (module.exports = {
241
- serveExecutor
242
- });
@@ -1,2 +0,0 @@
1
- export * from "./container-publish/executor";
2
- export * from "./helm-package/executor";
@@ -1,23 +0,0 @@
1
- # Patterns to ignore when building packages.
2
- # This supports shell glob matching, relative path matching, and
3
- # negation (prefixed with !). Only one pattern per line.
4
- .DS_Store
5
- # Common VCS dirs
6
- .git/
7
- .gitignore
8
- .bzr/
9
- .bzrignore
10
- .hg/
11
- .hgignore
12
- .svn/
13
- # Common backup files
14
- *.swp
15
- *.bak
16
- *.tmp
17
- *.orig
18
- *~
19
- # Various IDEs
20
- .project
21
- .idea/
22
- *.tmproj
23
- .vscode/
@@ -1,8 +0,0 @@
1
- import { Tree } from "@nx/devkit";
2
- import { StormConfig } from "@storm-software/config";
3
- import type { HelmChartGeneratorSchema } from "./schema";
4
- export declare function helmChartGeneratorFn(tree: Tree, options: HelmChartGeneratorSchema, config?: StormConfig): Promise<{
5
- success: boolean;
6
- }>;
7
- declare const _default: (tree: Tree, _options: HelmChartGeneratorSchema) => Promise<import("@nx/devkit").GeneratorCallback | import("packages/workspace-tools/declarations").BaseGeneratorResult>;
8
- export default _default;
@@ -1,79 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/k8s-tools/src/generators/helm-chart/generator.ts
20
- var generator_exports = {};
21
- __export(generator_exports, {
22
- default: () => generator_default,
23
- helmChartGeneratorFn: () => helmChartGeneratorFn
24
- });
25
- module.exports = __toCommonJS(generator_exports);
26
- var import_devkit = require("@nx/devkit");
27
- var import_console = require("@storm-software/config-tools/logger/console");
28
- var import_base_generator = require("@storm-software/workspace-tools/base/base-generator");
29
- var import_path = require("path");
30
- async function helmChartGeneratorFn(tree, options, config) {
31
- (0, import_console.writeDebug)("\u{1F4DD} Preparing to write Helm Chart", config);
32
- const project = (0, import_devkit.readProjectConfiguration)(tree, options.project);
33
- if (project.targets?.["helm-package"]) {
34
- throw new Error(
35
- `Project ${options.project} already has a helm target. Please remove it before running this command.`
36
- );
37
- }
38
- (0, import_devkit.updateProjectConfiguration)(tree, options.project, {
39
- ...project,
40
- targets: {
41
- ...project.targets,
42
- "helm-package": {
43
- executor: "@storm-software/k8s-tools:helm-package",
44
- outputs: ["{options.outputFolder}"],
45
- options: {
46
- chartFolder: `${project.root}/${options.chartFolder}`,
47
- outputFolder: "{workspaceRoot}/dist/charts/{projectRoot}",
48
- push: false,
49
- remote: "oci://localhost:5000/helm-charts",
50
- dependencies: {
51
- update: true,
52
- build: true,
53
- repositories: []
54
- }
55
- }
56
- }
57
- }
58
- });
59
- (0, import_devkit.generateFiles)(
60
- tree,
61
- (0, import_path.join)(__dirname, "files", "chart"),
62
- (0, import_path.join)(project.root, options.chartFolder ?? ""),
63
- options
64
- );
65
- if (options.format) {
66
- await (0, import_devkit.formatFiles)(tree);
67
- }
68
- return {
69
- success: true
70
- };
71
- }
72
- var generator_default = (0, import_base_generator.withRunGenerator)(
73
- "Helm Chart",
74
- helmChartGeneratorFn
75
- );
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- helmChartGeneratorFn
79
- });
@@ -1,8 +0,0 @@
1
- import { Tree } from "@nx/devkit";
2
- import { StormConfig } from "@storm-software/config";
3
- import type { HelmDependencyGeneratorSchema } from "./schema";
4
- export declare function helmDependencyGeneratorFn(tree: Tree, options: HelmDependencyGeneratorSchema, config?: StormConfig): Promise<{
5
- success: boolean;
6
- }>;
7
- declare const _default: (tree: Tree, _options: HelmDependencyGeneratorSchema) => Promise<import("@nx/devkit").GeneratorCallback | import("packages/workspace-tools/declarations").BaseGeneratorResult>;
8
- export default _default;