@storm-software/k8s-tools 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.1.1 (2024-08-27)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **k8s-tools:** Resolved issue invoking generator functions
6
+ ([405367cb](https://github.com/storm-software/storm-ops/commit/405367cb))
7
+
1
8
  ## 0.1.0 (2024-08-23)
2
9
 
3
10
  ### Features
package/generators.json CHANGED
@@ -3,11 +3,13 @@
3
3
  "helm-chart": {
4
4
  "factory": "./src/generators/helm-chart/generator",
5
5
  "schema": "./src/generators/helm-chart/schema.json",
6
+ "aliases": ["add-chart", "chart"],
6
7
  "description": "Generate a new Helm chart"
7
8
  },
8
9
  "helm-dependency": {
9
10
  "factory": "./src/generators/helm-dependency/generator",
10
11
  "schema": "./src/generators/helm-dependency/schema.json",
12
+ "aliases": ["add-dependency", "dependency"],
11
13
  "description": "Generate a new dependency for an existing Helm chart"
12
14
  }
13
15
  }
package/index.js CHANGED
@@ -1052,10 +1052,8 @@ var require_exec = __commonJS({
1052
1052
  // packages/k8s-tools/index.ts
1053
1053
  var k8s_tools_exports = {};
1054
1054
  __export(k8s_tools_exports, {
1055
- helmChartGenerator: () => helmChartGenerator,
1056
- helmChartSchematic: () => helmChartSchematic,
1057
- helmDependencyGenerator: () => helmDependencyGenerator,
1058
- helmDependencySchematic: () => helmDependencySchematic,
1055
+ helmChartGeneratorFn: () => helmChartGeneratorFn,
1056
+ helmDependencyGeneratorFn: () => helmDependencyGeneratorFn,
1059
1057
  serveExecutor: () => serveExecutor
1060
1058
  });
1061
1059
  module.exports = __toCommonJS(k8s_tools_exports);
@@ -1246,97 +1244,59 @@ var executor_default = (0, import_workspace_tools.withRunExecutor)(
1246
1244
 
1247
1245
  // packages/k8s-tools/src/generators/helm-chart/generator.ts
1248
1246
  var import_devkit = require("@nx/devkit");
1247
+ var import_workspace_tools2 = require("@storm-software/workspace-tools");
1249
1248
  var import_path = require("path");
1250
- async function helmChartGenerator(tree, options) {
1251
- const {
1252
- getStopwatch,
1253
- writeDebug,
1254
- writeError,
1255
- writeFatal,
1256
- writeInfo,
1257
- writeTrace,
1258
- findWorkspaceRoot,
1259
- loadStormConfig
1260
- } = await import("@storm-software/config-tools");
1261
- const stopwatch = getStopwatch("Storm Helm Chart generator");
1262
- let config;
1263
- try {
1264
- writeInfo(`\u26A1 Running the Storm Helm Chart generator...
1265
-
1266
- `, config);
1267
- const workspaceRoot = findWorkspaceRoot();
1268
- writeDebug(
1269
- `Loading the Storm Config from environment variables and storm.json file...
1270
- - workspaceRoot: ${workspaceRoot}`,
1271
- config
1272
- );
1273
- config = await loadStormConfig(workspaceRoot);
1274
- writeTrace(
1275
- `Loaded Storm config into env:
1276
- ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`,
1277
- config
1249
+ async function helmChartGeneratorFn(tree, options, config) {
1250
+ const { writeTrace } = await import("@storm-software/config-tools");
1251
+ writeTrace("\u{1F4DD} Preparing to write Helm Chart", config);
1252
+ const project = (0, import_devkit.readProjectConfiguration)(tree, options.project);
1253
+ if (project.targets?.["helm-package"]) {
1254
+ throw new Error(
1255
+ `Project ${options.project} already has a helm target. Please remove it before running this command.`
1278
1256
  );
1279
- const tasks = [];
1280
- tasks.push(async () => {
1281
- const project = (0, import_devkit.readProjectConfiguration)(tree, options.project);
1282
- if (project.targets?.["helm-package"]) {
1283
- throw new Error(
1284
- `Project ${options.project} already has a helm target. Please remove it before running this command.`
1285
- );
1286
- }
1287
- (0, import_devkit.updateProjectConfiguration)(tree, options.project, {
1288
- ...project,
1289
- targets: {
1290
- ...project.targets,
1291
- "helm-package": {
1292
- executor: "@storm-software/k8s-tools:helm-package",
1293
- outputs: ["{options.outputFolder}"],
1294
- options: {
1295
- chartFolder: `${project.root}/${options.chartFolder}`,
1296
- outputFolder: "{workspaceRoot}/dist/charts/{projectRoot}",
1297
- push: false,
1298
- remote: "oci://localhost:5000/helm-charts",
1299
- dependencies: {
1300
- update: true,
1301
- build: true,
1302
- repositories: []
1303
- }
1304
- }
1257
+ }
1258
+ (0, import_devkit.updateProjectConfiguration)(tree, options.project, {
1259
+ ...project,
1260
+ targets: {
1261
+ ...project.targets,
1262
+ "helm-package": {
1263
+ executor: "@storm-software/k8s-tools:helm-package",
1264
+ outputs: ["{options.outputFolder}"],
1265
+ options: {
1266
+ chartFolder: `${project.root}/${options.chartFolder}`,
1267
+ outputFolder: "{workspaceRoot}/dist/charts/{projectRoot}",
1268
+ push: false,
1269
+ remote: "oci://localhost:5000/helm-charts",
1270
+ dependencies: {
1271
+ update: true,
1272
+ build: true,
1273
+ repositories: []
1305
1274
  }
1306
1275
  }
1307
- });
1308
- (0, import_devkit.generateFiles)(
1309
- tree,
1310
- (0, import_path.join)(__dirname, "files", "chart"),
1311
- (0, import_path.join)(project.root, options.chartFolder ?? ""),
1312
- options
1313
- );
1314
- if (options.format) {
1315
- await (0, import_devkit.formatFiles)(tree);
1316
1276
  }
1317
- });
1318
- return (0, import_devkit.runTasksInSerial)(...tasks);
1319
- } catch (error) {
1320
- return () => {
1321
- writeFatal(
1322
- "A fatal error occurred while running the generator - the process was forced to terminate",
1323
- config
1324
- );
1325
- writeError(
1326
- `An exception was thrown in the generator's process
1327
- - Details: ${error.message}
1328
- - Stacktrace: ${error.stack}`,
1329
- config
1330
- );
1331
- };
1332
- } finally {
1333
- stopwatch();
1277
+ }
1278
+ });
1279
+ (0, import_devkit.generateFiles)(
1280
+ tree,
1281
+ (0, import_path.join)(__dirname, "files", "chart"),
1282
+ (0, import_path.join)(project.root, options.chartFolder ?? ""),
1283
+ options
1284
+ );
1285
+ if (options.format) {
1286
+ await (0, import_devkit.formatFiles)(tree);
1334
1287
  }
1288
+ return {
1289
+ success: true
1290
+ };
1335
1291
  }
1336
- var helmChartSchematic = (0, import_devkit.convertNxGenerator)(helmChartGenerator);
1292
+ var generator_default = (0, import_workspace_tools2.withRunGenerator)(
1293
+ "Helm Chart",
1294
+ helmChartGeneratorFn
1295
+ );
1337
1296
 
1338
1297
  // packages/k8s-tools/src/generators/helm-dependency/generator.ts
1339
1298
  var import_devkit2 = require("@nx/devkit");
1299
+ var import_workspace_tools3 = require("@storm-software/workspace-tools");
1340
1300
 
1341
1301
  // node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs
1342
1302
  function isNothing(subject) {
@@ -3961,83 +3921,37 @@ var jsYaml = {
3961
3921
  var js_yaml_default = jsYaml;
3962
3922
 
3963
3923
  // packages/k8s-tools/src/generators/helm-dependency/generator.ts
3964
- async function helmDependencyGenerator(tree, options) {
3965
- const {
3966
- getStopwatch,
3967
- writeDebug,
3968
- writeError,
3969
- writeFatal,
3970
- writeInfo,
3971
- writeTrace,
3972
- findWorkspaceRoot,
3973
- loadStormConfig
3974
- } = await import("@storm-software/config-tools");
3975
- const stopwatch = getStopwatch("Storm Worker generator");
3976
- let config;
3977
- try {
3978
- writeInfo(`\u26A1 Running the Storm Worker generator...
3979
-
3980
- `, config);
3981
- const workspaceRoot = findWorkspaceRoot();
3982
- writeDebug(
3983
- `Loading the Storm Config from environment variables and storm.json file...
3984
- - workspaceRoot: ${workspaceRoot}`,
3985
- config
3924
+ async function helmDependencyGeneratorFn(tree, options, config) {
3925
+ const { writeTrace } = await import("@storm-software/config-tools");
3926
+ writeTrace("\u{1F4DD} Preparing to add Helm Dependency", config);
3927
+ const project = (0, import_devkit2.readProjectConfiguration)(tree, options.project);
3928
+ if (!project.targets?.["helm-package"]) {
3929
+ throw new Error(
3930
+ `Project ${options.project} does not have a helm target. Please run the chart generator first.`
3986
3931
  );
3987
- config = await loadStormConfig(workspaceRoot);
3988
- writeTrace(
3989
- `Loaded Storm config into env:
3990
- ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`,
3991
- config
3992
- );
3993
- const tasks = [];
3994
- tasks.push(async () => {
3995
- const project = (0, import_devkit2.readProjectConfiguration)(tree, options.project);
3996
- if (!project.targets?.["helm-package"]) {
3997
- throw new Error(
3998
- `Project ${options.project} does not have a helm target. Please run the chart generator first.`
3999
- );
4000
- }
4001
- (0, import_devkit2.updateProjectConfiguration)(
4002
- tree,
4003
- options.project,
4004
- addDependencyToConfig(
4005
- project,
4006
- options.repositoryName,
4007
- options.repository
4008
- )
4009
- );
4010
- updateChartYaml(
4011
- tree,
4012
- project,
4013
- options.chartName,
4014
- options.chartVersion,
4015
- options.repository
4016
- );
4017
- if (options.format) {
4018
- await (0, import_devkit2.formatFiles)(tree);
4019
- }
4020
- });
4021
- return (0, import_devkit2.runTasksInSerial)(...tasks);
4022
- } catch (error) {
4023
- return () => {
4024
- writeFatal(
4025
- "A fatal error occurred while running the generator - the process was forced to terminate",
4026
- config
4027
- );
4028
- writeError(
4029
- `An exception was thrown in the generator's process
4030
- - Details: ${error.message}
4031
- - Stacktrace: ${error.stack}`,
4032
- config
4033
- );
4034
- };
4035
- } finally {
4036
- stopwatch();
4037
3932
  }
3933
+ (0, import_devkit2.updateProjectConfiguration)(
3934
+ tree,
3935
+ options.project,
3936
+ addDependencyToConfig(project, options.repositoryName, options.repository)
3937
+ );
3938
+ updateChartYaml(
3939
+ tree,
3940
+ project,
3941
+ options.chartName,
3942
+ options.chartVersion,
3943
+ options.repository
3944
+ );
3945
+ if (options.format) {
3946
+ await (0, import_devkit2.formatFiles)(tree);
3947
+ }
3948
+ return {
3949
+ success: true
3950
+ };
4038
3951
  }
4039
- var helmDependencySchematic = (0, import_devkit2.convertNxGenerator)(
4040
- helmDependencyGenerator
3952
+ var generator_default2 = (0, import_workspace_tools3.withRunGenerator)(
3953
+ "Helm Dependency",
3954
+ helmDependencyGeneratorFn
4041
3955
  );
4042
3956
  function addDependencyToConfig(project, name, url) {
4043
3957
  return {
@@ -4096,10 +4010,8 @@ function updateChartYaml(tree, project, name, version, repository) {
4096
4010
  }
4097
4011
  // Annotate the CommonJS export names for ESM import in node:
4098
4012
  0 && (module.exports = {
4099
- helmChartGenerator,
4100
- helmChartSchematic,
4101
- helmDependencyGenerator,
4102
- helmDependencySchematic,
4013
+ helmChartGeneratorFn,
4014
+ helmDependencyGeneratorFn,
4103
4015
  serveExecutor
4104
4016
  });
4105
4017
  /*! Bundled license information:
package/meta.json CHANGED
@@ -1 +1 @@
1
- {"inputs":{"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js":{"bytes":7922,"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true}],"format":"cjs"},"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js":{"bytes":11782,"imports":[{"path":"assert","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js","kind":"require-call","original":"./io-util"}],"format":"cjs"},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js":{"bytes":25282,"imports":[{"path":"os","kind":"require-call","external":true},{"path":"events","kind":"require-call","external":true},{"path":"child_process","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js","kind":"require-call","original":"@actions/io"},{"path":"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js","kind":"require-call","original":"@actions/io/lib/io-util"},{"path":"timers","kind":"require-call","external":true}],"format":"cjs"},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js":{"bytes":5011,"imports":[{"path":"string_decoder","kind":"require-call","external":true},{"path":"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js","kind":"require-call","original":"./toolrunner"}],"format":"cjs"},"packages/k8s-tools/src/types.ts":{"bytes":859,"imports":[{"path":"prettier","kind":"import-statement","external":true}],"format":"esm"},"packages/k8s-tools/src/utils/ensure-init.ts":{"bytes":956,"imports":[{"path":"../types","kind":"import-statement","external":true}],"format":"esm"},"packages/k8s-tools/src/utils/client.ts":{"bytes":3120,"imports":[{"path":"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js","kind":"import-statement","original":"@actions/exec"},{"path":"packages/k8s-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/k8s-tools/src/utils/ensure-init.ts","kind":"import-statement","original":"./ensure-init"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/k8s-tools/src/executors/helm-package/executor.ts":{"bytes":1993,"imports":[{"path":"@storm-software/workspace-tools","kind":"import-statement","external":true},{"path":"packages/k8s-tools/src/utils/client.ts","kind":"import-statement","original":"../../utils/client"},{"path":"./schema","kind":"import-statement","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"format":"esm"},"packages/k8s-tools/src/executors/index.ts":{"bytes":41,"imports":[{"path":"packages/k8s-tools/src/executors/helm-package/executor.ts","kind":"import-statement","original":"./helm-package/executor"}],"format":"esm"},"packages/k8s-tools/src/generators/helm-chart/generator.ts":{"bytes":3098,"imports":[{"path":"@nx/devkit","kind":"import-statement","external":true},{"path":"@storm-software/config","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"format":"esm"},"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs":{"bytes":107533,"imports":[],"format":"esm"},"packages/k8s-tools/src/generators/helm-dependency/generator.ts":{"bytes":4670,"imports":[{"path":"@nx/devkit","kind":"import-statement","external":true},{"path":"@storm-software/config","kind":"import-statement","external":true},{"path":"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs","kind":"import-statement","original":"js-yaml"},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"format":"esm"},"packages/k8s-tools/src/generators/index.ts":{"bytes":85,"imports":[{"path":"packages/k8s-tools/src/generators/helm-chart/generator.ts","kind":"import-statement","original":"./helm-chart/generator"},{"path":"packages/k8s-tools/src/generators/helm-dependency/generator.ts","kind":"import-statement","original":"./helm-dependency/generator"}],"format":"esm"},"packages/k8s-tools/src/index.ts":{"bytes":59,"imports":[{"path":"packages/k8s-tools/src/executors/index.ts","kind":"import-statement","original":"./executors"},{"path":"packages/k8s-tools/src/generators/index.ts","kind":"import-statement","original":"./generators"}],"format":"esm"},"packages/k8s-tools/index.ts":{"bytes":23,"imports":[{"path":"packages/k8s-tools/src/index.ts","kind":"import-statement","original":"./src"}],"format":"esm"}},"outputs":{"dist/packages/k8s-tools/index.js":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"assert","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"events","kind":"require-call","external":true},{"path":"child_process","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"timers","kind":"require-call","external":true},{"path":"string_decoder","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true},{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true},{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/index.ts","inputs":{"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js":{"bytesInOutput":6851},"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js":{"bytesInOutput":9387},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js":{"bytesInOutput":16633},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js":{"bytesInOutput":4288},"packages/k8s-tools/index.ts":{"bytesInOutput":361},"packages/k8s-tools/src/executors/helm-package/executor.ts":{"bytesInOutput":1564},"packages/k8s-tools/src/utils/client.ts":{"bytesInOutput":2941},"packages/k8s-tools/src/types.ts":{"bytesInOutput":134},"packages/k8s-tools/src/utils/ensure-init.ts":{"bytesInOutput":579},"packages/k8s-tools/src/executors/index.ts":{"bytesInOutput":0},"packages/k8s-tools/src/index.ts":{"bytesInOutput":0},"packages/k8s-tools/src/generators/helm-chart/generator.ts":{"bytesInOutput":2826},"packages/k8s-tools/src/generators/index.ts":{"bytesInOutput":0},"packages/k8s-tools/src/generators/helm-dependency/generator.ts":{"bytesInOutput":3963},"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs":{"bytesInOutput":87999}},"bytes":140726},"dist/packages/k8s-tools/src/executors/helm-package/executor.js":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"assert","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"events","kind":"require-call","external":true},{"path":"child_process","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"timers","kind":"require-call","external":true},{"path":"string_decoder","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/src/executors/helm-package/executor.ts","inputs":{"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js":{"bytesInOutput":6851},"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js":{"bytesInOutput":9387},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js":{"bytesInOutput":16631},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js":{"bytesInOutput":4288},"packages/k8s-tools/src/executors/helm-package/executor.ts":{"bytesInOutput":1745},"packages/k8s-tools/src/utils/client.ts":{"bytesInOutput":2941},"packages/k8s-tools/src/types.ts":{"bytesInOutput":134},"packages/k8s-tools/src/utils/ensure-init.ts":{"bytesInOutput":579}},"bytes":45222},"dist/packages/k8s-tools/src/generators/helm-chart/generator.js":{"imports":[{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/src/generators/helm-chart/generator.ts","inputs":{"packages/k8s-tools/src/generators/helm-chart/generator.ts":{"bytesInOutput":3113}},"bytes":4691},"dist/packages/k8s-tools/src/generators/helm-dependency/generator.js":{"imports":[{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/src/generators/helm-dependency/generator.ts","inputs":{"packages/k8s-tools/src/generators/helm-dependency/generator.ts":{"bytesInOutput":4269},"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs":{"bytesInOutput":87999}},"bytes":94136}}}
1
+ {"inputs":{"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js":{"bytes":7922,"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true}],"format":"cjs"},"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js":{"bytes":11782,"imports":[{"path":"assert","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js","kind":"require-call","original":"./io-util"}],"format":"cjs"},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js":{"bytes":25282,"imports":[{"path":"os","kind":"require-call","external":true},{"path":"events","kind":"require-call","external":true},{"path":"child_process","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js","kind":"require-call","original":"@actions/io"},{"path":"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js","kind":"require-call","original":"@actions/io/lib/io-util"},{"path":"timers","kind":"require-call","external":true}],"format":"cjs"},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js":{"bytes":5011,"imports":[{"path":"string_decoder","kind":"require-call","external":true},{"path":"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js","kind":"require-call","original":"./toolrunner"}],"format":"cjs"},"packages/k8s-tools/src/types.ts":{"bytes":859,"imports":[{"path":"prettier","kind":"import-statement","external":true}],"format":"esm"},"packages/k8s-tools/src/utils/ensure-init.ts":{"bytes":956,"imports":[{"path":"../types","kind":"import-statement","external":true}],"format":"esm"},"packages/k8s-tools/src/utils/client.ts":{"bytes":3120,"imports":[{"path":"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js","kind":"import-statement","original":"@actions/exec"},{"path":"packages/k8s-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/k8s-tools/src/utils/ensure-init.ts","kind":"import-statement","original":"./ensure-init"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/k8s-tools/src/executors/helm-package/executor.ts":{"bytes":1993,"imports":[{"path":"@storm-software/workspace-tools","kind":"import-statement","external":true},{"path":"packages/k8s-tools/src/utils/client.ts","kind":"import-statement","original":"../../utils/client"},{"path":"./schema","kind":"import-statement","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"format":"esm"},"packages/k8s-tools/src/executors/index.ts":{"bytes":41,"imports":[{"path":"packages/k8s-tools/src/executors/helm-package/executor.ts","kind":"import-statement","original":"./helm-package/executor"}],"format":"esm"},"packages/k8s-tools/src/generators/helm-chart/generator.ts":{"bytes":1794,"imports":[{"path":"@nx/devkit","kind":"import-statement","external":true},{"path":"@storm-software/config","kind":"import-statement","external":true},{"path":"@storm-software/workspace-tools","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"format":"esm"},"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs":{"bytes":107533,"imports":[],"format":"esm"},"packages/k8s-tools/src/generators/helm-dependency/generator.ts":{"bytes":3394,"imports":[{"path":"@nx/devkit","kind":"import-statement","external":true},{"path":"@storm-software/config","kind":"import-statement","external":true},{"path":"@storm-software/workspace-tools","kind":"import-statement","external":true},{"path":"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs","kind":"import-statement","original":"js-yaml"},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"format":"esm"},"packages/k8s-tools/src/generators/index.ts":{"bytes":85,"imports":[{"path":"packages/k8s-tools/src/generators/helm-chart/generator.ts","kind":"import-statement","original":"./helm-chart/generator"},{"path":"packages/k8s-tools/src/generators/helm-dependency/generator.ts","kind":"import-statement","original":"./helm-dependency/generator"}],"format":"esm"},"packages/k8s-tools/src/index.ts":{"bytes":59,"imports":[{"path":"packages/k8s-tools/src/executors/index.ts","kind":"import-statement","original":"./executors"},{"path":"packages/k8s-tools/src/generators/index.ts","kind":"import-statement","original":"./generators"}],"format":"esm"},"packages/k8s-tools/index.ts":{"bytes":23,"imports":[{"path":"packages/k8s-tools/src/index.ts","kind":"import-statement","original":"./src"}],"format":"esm"}},"outputs":{"dist/packages/k8s-tools/index.js":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"assert","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"events","kind":"require-call","external":true},{"path":"child_process","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"timers","kind":"require-call","external":true},{"path":"string_decoder","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true},{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true},{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/index.ts","inputs":{"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js":{"bytesInOutput":6851},"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js":{"bytesInOutput":9387},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js":{"bytesInOutput":16633},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js":{"bytesInOutput":4288},"packages/k8s-tools/index.ts":{"bytesInOutput":263},"packages/k8s-tools/src/executors/helm-package/executor.ts":{"bytesInOutput":1564},"packages/k8s-tools/src/utils/client.ts":{"bytesInOutput":2941},"packages/k8s-tools/src/types.ts":{"bytesInOutput":134},"packages/k8s-tools/src/utils/ensure-init.ts":{"bytesInOutput":579},"packages/k8s-tools/src/executors/index.ts":{"bytesInOutput":0},"packages/k8s-tools/src/index.ts":{"bytesInOutput":0},"packages/k8s-tools/src/generators/helm-chart/generator.ts":{"bytesInOutput":1668},"packages/k8s-tools/src/generators/index.ts":{"bytesInOutput":0},"packages/k8s-tools/src/generators/helm-dependency/generator.ts":{"bytesInOutput":2831},"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs":{"bytesInOutput":87999}},"bytes":138293},"dist/packages/k8s-tools/src/executors/helm-package/executor.js":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"assert","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"os","kind":"require-call","external":true},{"path":"events","kind":"require-call","external":true},{"path":"child_process","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"timers","kind":"require-call","external":true},{"path":"string_decoder","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/src/executors/helm-package/executor.ts","inputs":{"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js":{"bytesInOutput":6851},"node_modules/.pnpm/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js":{"bytesInOutput":9387},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/toolrunner.js":{"bytesInOutput":16631},"node_modules/.pnpm/@actions+exec@1.1.1/node_modules/@actions/exec/lib/exec.js":{"bytesInOutput":4288},"packages/k8s-tools/src/executors/helm-package/executor.ts":{"bytesInOutput":1745},"packages/k8s-tools/src/utils/client.ts":{"bytesInOutput":2941},"packages/k8s-tools/src/types.ts":{"bytesInOutput":134},"packages/k8s-tools/src/utils/ensure-init.ts":{"bytesInOutput":579}},"bytes":45222},"dist/packages/k8s-tools/src/generators/helm-chart/generator.js":{"imports":[{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/src/generators/helm-chart/generator.ts","inputs":{"packages/k8s-tools/src/generators/helm-chart/generator.ts":{"bytesInOutput":1865}},"bytes":3423},"dist/packages/k8s-tools/src/generators/helm-dependency/generator.js":{"imports":[{"path":"@nx/devkit","kind":"require-call","external":true},{"path":"@storm-software/workspace-tools","kind":"require-call","external":true},{"path":"@storm-software/config-tools","kind":"dynamic-import","external":true}],"exports":[],"entryPoint":"packages/k8s-tools/src/generators/helm-dependency/generator.ts","inputs":{"packages/k8s-tools/src/generators/helm-dependency/generator.ts":{"bytesInOutput":3033},"node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs":{"bytesInOutput":87999}},"bytes":92875}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/k8s-tools",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "commonjs",
5
5
  "description": "⚡ A Nx plugin package that contains various executors, generators, and utilities that assist in managing k8s IoC.",
6
6
  "repository": {
@@ -1,5 +1,8 @@
1
- import { GeneratorCallback, Tree } from "@nx/devkit";
1
+ import { Tree } from "@nx/devkit";
2
+ import { StormConfig } from "@storm-software/config";
2
3
  import type { HelmChartGeneratorSchema } from "./schema";
3
- export declare function helmChartGenerator(tree: Tree, options: HelmChartGeneratorSchema): Promise<GeneratorCallback>;
4
- export default helmChartGenerator;
5
- export declare const helmChartSchematic: (generatorOptions: HelmChartGeneratorSchema) => (tree: any, context: any) => Promise<any>;
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;
@@ -30,102 +30,60 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var generator_exports = {};
31
31
  __export(generator_exports, {
32
32
  default: () => generator_default,
33
- helmChartGenerator: () => helmChartGenerator,
34
- helmChartSchematic: () => helmChartSchematic
33
+ helmChartGeneratorFn: () => helmChartGeneratorFn
35
34
  });
36
35
  module.exports = __toCommonJS(generator_exports);
37
36
  var import_devkit = require("@nx/devkit");
37
+ var import_workspace_tools = require("@storm-software/workspace-tools");
38
38
  var import_path = require("path");
39
- async function helmChartGenerator(tree, options) {
40
- const {
41
- getStopwatch,
42
- writeDebug,
43
- writeError,
44
- writeFatal,
45
- writeInfo,
46
- writeTrace,
47
- findWorkspaceRoot,
48
- loadStormConfig
49
- } = await import("@storm-software/config-tools");
50
- const stopwatch = getStopwatch("Storm Helm Chart generator");
51
- let config;
52
- try {
53
- writeInfo(`\u26A1 Running the Storm Helm Chart generator...
54
-
55
- `, config);
56
- const workspaceRoot = findWorkspaceRoot();
57
- writeDebug(
58
- `Loading the Storm Config from environment variables and storm.json file...
59
- - workspaceRoot: ${workspaceRoot}`,
60
- config
61
- );
62
- config = await loadStormConfig(workspaceRoot);
63
- writeTrace(
64
- `Loaded Storm config into env:
65
- ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`,
66
- config
39
+ async function helmChartGeneratorFn(tree, options, config) {
40
+ const { writeTrace } = await import("@storm-software/config-tools");
41
+ writeTrace("\u{1F4DD} Preparing to write Helm Chart", config);
42
+ const project = (0, import_devkit.readProjectConfiguration)(tree, options.project);
43
+ if (project.targets?.["helm-package"]) {
44
+ throw new Error(
45
+ `Project ${options.project} already has a helm target. Please remove it before running this command.`
67
46
  );
68
- const tasks = [];
69
- tasks.push(async () => {
70
- const project = (0, import_devkit.readProjectConfiguration)(tree, options.project);
71
- if (project.targets?.["helm-package"]) {
72
- throw new Error(
73
- `Project ${options.project} already has a helm target. Please remove it before running this command.`
74
- );
75
- }
76
- (0, import_devkit.updateProjectConfiguration)(tree, options.project, {
77
- ...project,
78
- targets: {
79
- ...project.targets,
80
- "helm-package": {
81
- executor: "@storm-software/k8s-tools:helm-package",
82
- outputs: ["{options.outputFolder}"],
83
- options: {
84
- chartFolder: `${project.root}/${options.chartFolder}`,
85
- outputFolder: "{workspaceRoot}/dist/charts/{projectRoot}",
86
- push: false,
87
- remote: "oci://localhost:5000/helm-charts",
88
- dependencies: {
89
- update: true,
90
- build: true,
91
- repositories: []
92
- }
93
- }
47
+ }
48
+ (0, import_devkit.updateProjectConfiguration)(tree, options.project, {
49
+ ...project,
50
+ targets: {
51
+ ...project.targets,
52
+ "helm-package": {
53
+ executor: "@storm-software/k8s-tools:helm-package",
54
+ outputs: ["{options.outputFolder}"],
55
+ options: {
56
+ chartFolder: `${project.root}/${options.chartFolder}`,
57
+ outputFolder: "{workspaceRoot}/dist/charts/{projectRoot}",
58
+ push: false,
59
+ remote: "oci://localhost:5000/helm-charts",
60
+ dependencies: {
61
+ update: true,
62
+ build: true,
63
+ repositories: []
94
64
  }
95
65
  }
96
- });
97
- (0, import_devkit.generateFiles)(
98
- tree,
99
- (0, import_path.join)(__dirname, "files", "chart"),
100
- (0, import_path.join)(project.root, options.chartFolder ?? ""),
101
- options
102
- );
103
- if (options.format) {
104
- await (0, import_devkit.formatFiles)(tree);
105
66
  }
106
- });
107
- return (0, import_devkit.runTasksInSerial)(...tasks);
108
- } catch (error) {
109
- return () => {
110
- writeFatal(
111
- "A fatal error occurred while running the generator - the process was forced to terminate",
112
- config
113
- );
114
- writeError(
115
- `An exception was thrown in the generator's process
116
- - Details: ${error.message}
117
- - Stacktrace: ${error.stack}`,
118
- config
119
- );
120
- };
121
- } finally {
122
- stopwatch();
67
+ }
68
+ });
69
+ (0, import_devkit.generateFiles)(
70
+ tree,
71
+ (0, import_path.join)(__dirname, "files", "chart"),
72
+ (0, import_path.join)(project.root, options.chartFolder ?? ""),
73
+ options
74
+ );
75
+ if (options.format) {
76
+ await (0, import_devkit.formatFiles)(tree);
123
77
  }
78
+ return {
79
+ success: true
80
+ };
124
81
  }
125
- var generator_default = helmChartGenerator;
126
- var helmChartSchematic = (0, import_devkit.convertNxGenerator)(helmChartGenerator);
82
+ var generator_default = (0, import_workspace_tools.withRunGenerator)(
83
+ "Helm Chart",
84
+ helmChartGeneratorFn
85
+ );
127
86
  // Annotate the CommonJS export names for ESM import in node:
128
87
  0 && (module.exports = {
129
- helmChartGenerator,
130
- helmChartSchematic
88
+ helmChartGeneratorFn
131
89
  });
@@ -1,5 +1,8 @@
1
- import { GeneratorCallback, Tree } from "@nx/devkit";
1
+ import { Tree } from "@nx/devkit";
2
+ import { StormConfig } from "@storm-software/config";
2
3
  import type { HelmDependencyGeneratorSchema } from "./schema";
3
- export declare function helmDependencyGenerator(tree: Tree, options: HelmDependencyGeneratorSchema): Promise<GeneratorCallback>;
4
- export default helmDependencyGenerator;
5
- export declare const helmDependencySchematic: (generatorOptions: HelmDependencyGeneratorSchema) => (tree: any, context: any) => Promise<any>;
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;
@@ -30,11 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var generator_exports = {};
31
31
  __export(generator_exports, {
32
32
  default: () => generator_default,
33
- helmDependencyGenerator: () => helmDependencyGenerator,
34
- helmDependencySchematic: () => helmDependencySchematic
33
+ helmDependencyGeneratorFn: () => helmDependencyGeneratorFn
35
34
  });
36
35
  module.exports = __toCommonJS(generator_exports);
37
36
  var import_devkit = require("@nx/devkit");
37
+ var import_workspace_tools = require("@storm-software/workspace-tools");
38
38
 
39
39
  // node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs
40
40
  function isNothing(subject) {
@@ -2659,84 +2659,37 @@ var jsYaml = {
2659
2659
  var js_yaml_default = jsYaml;
2660
2660
 
2661
2661
  // packages/k8s-tools/src/generators/helm-dependency/generator.ts
2662
- async function helmDependencyGenerator(tree, options) {
2663
- const {
2664
- getStopwatch,
2665
- writeDebug,
2666
- writeError,
2667
- writeFatal,
2668
- writeInfo,
2669
- writeTrace,
2670
- findWorkspaceRoot,
2671
- loadStormConfig
2672
- } = await import("@storm-software/config-tools");
2673
- const stopwatch = getStopwatch("Storm Worker generator");
2674
- let config;
2675
- try {
2676
- writeInfo(`\u26A1 Running the Storm Worker generator...
2677
-
2678
- `, config);
2679
- const workspaceRoot = findWorkspaceRoot();
2680
- writeDebug(
2681
- `Loading the Storm Config from environment variables and storm.json file...
2682
- - workspaceRoot: ${workspaceRoot}`,
2683
- config
2662
+ async function helmDependencyGeneratorFn(tree, options, config) {
2663
+ const { writeTrace } = await import("@storm-software/config-tools");
2664
+ writeTrace("\u{1F4DD} Preparing to add Helm Dependency", config);
2665
+ const project = (0, import_devkit.readProjectConfiguration)(tree, options.project);
2666
+ if (!project.targets?.["helm-package"]) {
2667
+ throw new Error(
2668
+ `Project ${options.project} does not have a helm target. Please run the chart generator first.`
2684
2669
  );
2685
- config = await loadStormConfig(workspaceRoot);
2686
- writeTrace(
2687
- `Loaded Storm config into env:
2688
- ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`,
2689
- config
2690
- );
2691
- const tasks = [];
2692
- tasks.push(async () => {
2693
- const project = (0, import_devkit.readProjectConfiguration)(tree, options.project);
2694
- if (!project.targets?.["helm-package"]) {
2695
- throw new Error(
2696
- `Project ${options.project} does not have a helm target. Please run the chart generator first.`
2697
- );
2698
- }
2699
- (0, import_devkit.updateProjectConfiguration)(
2700
- tree,
2701
- options.project,
2702
- addDependencyToConfig(
2703
- project,
2704
- options.repositoryName,
2705
- options.repository
2706
- )
2707
- );
2708
- updateChartYaml(
2709
- tree,
2710
- project,
2711
- options.chartName,
2712
- options.chartVersion,
2713
- options.repository
2714
- );
2715
- if (options.format) {
2716
- await (0, import_devkit.formatFiles)(tree);
2717
- }
2718
- });
2719
- return (0, import_devkit.runTasksInSerial)(...tasks);
2720
- } catch (error) {
2721
- return () => {
2722
- writeFatal(
2723
- "A fatal error occurred while running the generator - the process was forced to terminate",
2724
- config
2725
- );
2726
- writeError(
2727
- `An exception was thrown in the generator's process
2728
- - Details: ${error.message}
2729
- - Stacktrace: ${error.stack}`,
2730
- config
2731
- );
2732
- };
2733
- } finally {
2734
- stopwatch();
2735
- }
2736
- }
2737
- var generator_default = helmDependencyGenerator;
2738
- var helmDependencySchematic = (0, import_devkit.convertNxGenerator)(
2739
- helmDependencyGenerator
2670
+ }
2671
+ (0, import_devkit.updateProjectConfiguration)(
2672
+ tree,
2673
+ options.project,
2674
+ addDependencyToConfig(project, options.repositoryName, options.repository)
2675
+ );
2676
+ updateChartYaml(
2677
+ tree,
2678
+ project,
2679
+ options.chartName,
2680
+ options.chartVersion,
2681
+ options.repository
2682
+ );
2683
+ if (options.format) {
2684
+ await (0, import_devkit.formatFiles)(tree);
2685
+ }
2686
+ return {
2687
+ success: true
2688
+ };
2689
+ }
2690
+ var generator_default = (0, import_workspace_tools.withRunGenerator)(
2691
+ "Helm Dependency",
2692
+ helmDependencyGeneratorFn
2740
2693
  );
2741
2694
  function addDependencyToConfig(project, name, url) {
2742
2695
  return {
@@ -2795,8 +2748,7 @@ function updateChartYaml(tree, project, name, version, repository) {
2795
2748
  }
2796
2749
  // Annotate the CommonJS export names for ESM import in node:
2797
2750
  0 && (module.exports = {
2798
- helmDependencyGenerator,
2799
- helmDependencySchematic
2751
+ helmDependencyGeneratorFn
2800
2752
  });
2801
2753
  /*! Bundled license information:
2802
2754