@storm-software/k8s-tools 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +11 -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/dist/chunk-W7DPLC4K.mjs +184 -0
  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/dist/src/executors/helm-package/schema.d.ts +1 -1
  67. package/dist/src/generators/helm-chart/files/chart/templates/NOTES.txt +22 -0
  68. package/dist/src/generators/helm-chart/files/chart/templates/_helpers.yaml +62 -0
  69. package/dist/src/generators/helm-chart/files/chart/templates/deployment.yaml +68 -0
  70. package/dist/src/generators/helm-chart/files/chart/templates/hpa.yaml +32 -0
  71. package/dist/src/generators/helm-chart/files/chart/templates/ingress.yaml +61 -0
  72. package/dist/src/generators/helm-chart/files/chart/templates/service.yaml +13 -0
  73. package/dist/src/generators/helm-chart/files/chart/templates/serviceaccount.yaml +13 -0
  74. package/dist/src/generators/helm-chart/files/chart/templates/test/test-connection.yaml +15 -0
  75. package/dist/src/generators/helm-chart/generator.d.mts +5 -0
  76. package/dist/src/generators/helm-chart/generator.d.ts +5 -0
  77. package/dist/src/generators/helm-chart/generator.js +12 -0
  78. package/dist/src/generators/helm-chart/generator.mjs +12 -0
  79. package/dist/src/generators/helm-chart/schema.d.ts +1 -1
  80. package/dist/src/generators/helm-dependency/generator.d.mts +5 -0
  81. package/dist/src/generators/helm-dependency/generator.d.ts +5 -0
  82. package/dist/src/generators/helm-dependency/generator.js +12 -0
  83. package/dist/src/generators/helm-dependency/generator.mjs +12 -0
  84. package/dist/src/generators/helm-dependency/schema.d.ts +1 -1
  85. package/dist/src/plugins/docker/index.d.mts +12 -0
  86. package/dist/src/plugins/docker/index.d.ts +12 -0
  87. package/dist/src/plugins/docker/index.js +15 -0
  88. package/dist/src/plugins/docker/index.mjs +15 -0
  89. package/dist/src/utils/client.d.mts +35 -0
  90. package/dist/src/utils/client.d.ts +35 -0
  91. package/dist/src/utils/client.js +11 -0
  92. package/dist/src/utils/client.mjs +11 -0
  93. package/dist/src/utils/ensure-init.d.mts +11 -0
  94. package/dist/src/utils/ensure-init.d.ts +11 -0
  95. package/dist/src/utils/ensure-init.js +7 -0
  96. package/dist/src/utils/ensure-init.mjs +7 -0
  97. package/dist/src/utils/index.d.mts +6 -0
  98. package/dist/src/utils/index.d.ts +6 -0
  99. package/dist/src/utils/index.js +21 -0
  100. package/dist/src/utils/index.mjs +21 -0
  101. package/dist/src/utils/prettier.d.mts +13 -0
  102. package/dist/src/utils/prettier.d.ts +13 -0
  103. package/dist/src/utils/prettier.js +9 -0
  104. package/dist/src/utils/prettier.mjs +9 -0
  105. package/dist/tsup.config.d.mts +5 -0
  106. package/dist/tsup.config.d.ts +5 -0
  107. package/dist/tsup.config.js +36 -0
  108. package/dist/tsup.config.mjs +36 -0
  109. package/dist/types-BCBFBwnJ.d.mts +20 -0
  110. package/dist/types-BCBFBwnJ.d.ts +20 -0
  111. package/dist/types-CIJRaFHD.d.mts +1185 -0
  112. package/dist/types-CIJRaFHD.d.ts +1185 -0
  113. package/package.json +1 -1
@@ -0,0 +1,98 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunk2QNNUD5Mjs = require('./chunk-2QNNUD5M.js');
4
+
5
+
6
+ var _chunkGDXB64KGjs = require('./chunk-GDXB64KG.js');
7
+
8
+
9
+ var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
10
+
11
+ // src/generators/helm-dependency/generator.ts
12
+ var _devkit = require('@nx/devkit');
13
+ var _jsyaml = require('js-yaml'); var _jsyaml2 = _interopRequireDefault(_jsyaml);
14
+ async function helmDependencyGeneratorFn(tree, options, config) {
15
+ _chunkGDXB64KGjs.writeDebug.call(void 0, "\u{1F4DD} Preparing to add Helm Dependency", config);
16
+ const project = _devkit.readProjectConfiguration.call(void 0, tree, options.project);
17
+ if (!_optionalChain([project, 'access', _ => _.targets, 'optionalAccess', _2 => _2["helm-package"]])) {
18
+ throw new Error(`Project ${options.project} does not have a helm target. Please run the chart generator first.`);
19
+ }
20
+ _devkit.updateProjectConfiguration.call(void 0, tree, options.project, addDependencyToConfig(project, options.repositoryName, options.repository));
21
+ updateChartYaml(tree, project, options.chartName, options.chartVersion, options.repository);
22
+ if (options.format) {
23
+ await _devkit.formatFiles.call(void 0, tree);
24
+ }
25
+ return {
26
+ success: true
27
+ };
28
+ }
29
+ _chunk3GQAWCBQjs.__name.call(void 0, helmDependencyGeneratorFn, "helmDependencyGeneratorFn");
30
+ var generator_default = _chunk2QNNUD5Mjs.withRunGenerator.call(void 0, "Helm Dependency", helmDependencyGeneratorFn);
31
+ function addDependencyToConfig(project, name, url) {
32
+ return {
33
+ ...project,
34
+ targets: {
35
+ ...project.targets,
36
+ helm: {
37
+ ..._optionalChain([project, 'access', _3 => _3.targets, 'optionalAccess', _4 => _4["helm-package"]]),
38
+ options: {
39
+ ..._optionalChain([project, 'access', _5 => _5.targets, 'optionalAccess', _6 => _6["helm-package"], 'optionalAccess', _7 => _7.options]),
40
+ dependencies: {
41
+ ..._optionalChain([project, 'access', _8 => _8.targets, 'optionalAccess', _9 => _9["helm-package"], 'optionalAccess', _10 => _10.options, 'access', _11 => _11.dependencies]),
42
+ repositories: _optionalChain([project, 'access', _12 => _12.targets, 'optionalAccess', _13 => _13["helm-package"], 'optionalAccess', _14 => _14.options, 'access', _15 => _15.dependencies, 'access', _16 => _16.repositories]) ? [
43
+ ...project.targets["helm-package"].options.dependencies.repositories,
44
+ {
45
+ name,
46
+ url
47
+ }
48
+ ] : [
49
+ {
50
+ name,
51
+ url
52
+ }
53
+ ]
54
+ }
55
+ }
56
+ }
57
+ }
58
+ };
59
+ }
60
+ _chunk3GQAWCBQjs.__name.call(void 0, addDependencyToConfig, "addDependencyToConfig");
61
+ function updateChartYaml(tree, project, name, version, repository) {
62
+ const chartFolder = _optionalChain([project, 'access', _17 => _17.targets, 'optionalAccess', _18 => _18["helm-package"], 'optionalAccess', _19 => _19.options, 'access', _20 => _20.chartFolder]);
63
+ const chartPath = `${chartFolder}/Chart.yaml`;
64
+ if (!tree.exists(chartPath)) {
65
+ throw new Error("Chart.yaml not found");
66
+ }
67
+ try {
68
+ const result = _optionalChain([tree, 'access', _21 => _21.read, 'call', _22 => _22(chartPath, "utf8"), 'optionalAccess', _23 => _23.toString, 'call', _24 => _24()]);
69
+ if (!result) {
70
+ throw new Error("Failed to read Chart.yaml");
71
+ }
72
+ const chartContents = _jsyaml2.default.load(result);
73
+ if (!chartContents.dependencies) {
74
+ chartContents.dependencies = [];
75
+ }
76
+ const existingDependency = chartContents.dependencies.find((dep) => dep.name === name);
77
+ if (existingDependency) {
78
+ existingDependency.version = version;
79
+ existingDependency.repository = repository;
80
+ } else {
81
+ chartContents.dependencies.push({
82
+ name,
83
+ version,
84
+ repository
85
+ });
86
+ tree.write(chartPath, _jsyaml2.default.dump(chartContents));
87
+ }
88
+ } catch (error) {
89
+ console.error(error);
90
+ throw new Error("Failed to parse Chart.yaml");
91
+ }
92
+ }
93
+ _chunk3GQAWCBQjs.__name.call(void 0, updateChartYaml, "updateChartYaml");
94
+
95
+
96
+
97
+
98
+ exports.helmDependencyGeneratorFn = helmDependencyGeneratorFn; exports.generator_default = generator_default;
@@ -0,0 +1,63 @@
1
+ import {
2
+ __name,
3
+ __require
4
+ } from "./chunk-XUV4U54K.mjs";
5
+
6
+ // src/utils/prettier.ts
7
+ async function resolveUserExistingPrettierConfig() {
8
+ let prettier;
9
+ try {
10
+ prettier = __require("prettier");
11
+ } catch {
12
+ return void 0;
13
+ }
14
+ if (!prettier) {
15
+ return void 0;
16
+ }
17
+ try {
18
+ const filepath = await prettier.resolveConfigFile();
19
+ if (!filepath) {
20
+ return void 0;
21
+ }
22
+ const config = await prettier.resolveConfig(process.cwd(), {
23
+ useCache: false,
24
+ config: filepath
25
+ });
26
+ if (!config) {
27
+ return void 0;
28
+ }
29
+ return {
30
+ sourceFilepath: filepath,
31
+ config
32
+ };
33
+ } catch {
34
+ return void 0;
35
+ }
36
+ }
37
+ __name(resolveUserExistingPrettierConfig, "resolveUserExistingPrettierConfig");
38
+ function addToPrettierIgnore(tree, ignore) {
39
+ const ignorePath = `${tree.root}/.prettierignore`;
40
+ if (!tree.exists(ignorePath)) {
41
+ tree.write(ignorePath, ignore.join("\n"));
42
+ return;
43
+ }
44
+ try {
45
+ const content = tree.read(ignorePath, "utf8") || "";
46
+ const lines = content.split("\n");
47
+ const newContent = [
48
+ .../* @__PURE__ */ new Set([
49
+ ...lines,
50
+ ...ignore
51
+ ])
52
+ ].join("\n");
53
+ tree.write(ignorePath, newContent);
54
+ } catch (error) {
55
+ throw new Error(`Failed to update .prettierignore file: ${String(error)}`);
56
+ }
57
+ }
58
+ __name(addToPrettierIgnore, "addToPrettierIgnore");
59
+
60
+ export {
61
+ resolveUserExistingPrettierConfig,
62
+ addToPrettierIgnore
63
+ };
@@ -0,0 +1,61 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkGDXB64KGjs = require('./chunk-GDXB64KG.js');
4
+
5
+
6
+ var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
7
+
8
+ // ../config-tools/src/utilities/apply-workspace-tokens.ts
9
+ var applyWorkspaceBaseTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (option, tokenizerOptions) => {
10
+ let result = option;
11
+ if (!result) {
12
+ return result;
13
+ }
14
+ if (tokenizerOptions) {
15
+ const optionKeys = Object.keys(tokenizerOptions);
16
+ if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
17
+ for (const optionKey of optionKeys) {
18
+ if (result.includes(`{${optionKey}}`)) {
19
+ result = result.replaceAll(`{${optionKey}}`, _nullishCoalesce(_optionalChain([tokenizerOptions, 'access', _ => _.config, 'optionalAccess', _2 => _2[optionKey]]), () => ( "")));
20
+ }
21
+ }
22
+ }
23
+ }
24
+ if (tokenizerOptions.config) {
25
+ const configKeys = Object.keys(tokenizerOptions.config);
26
+ if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
27
+ for (const configKey of configKeys) {
28
+ if (result.includes(`{${configKey}}`)) {
29
+ result = result.replaceAll(`{${configKey}}`, tokenizerOptions.config[configKey]);
30
+ }
31
+ }
32
+ }
33
+ }
34
+ if (result.includes("{workspaceRoot}")) {
35
+ result = result.replaceAll("{workspaceRoot}", _nullishCoalesce(_nullishCoalesce(tokenizerOptions.workspaceRoot, () => ( _optionalChain([tokenizerOptions, 'access', _3 => _3.config, 'optionalAccess', _4 => _4.workspaceRoot]))), () => ( _chunkGDXB64KGjs.findWorkspaceRoot.call(void 0, ))));
36
+ }
37
+ return result;
38
+ }, "applyWorkspaceBaseTokens");
39
+ var applyWorkspaceTokens = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, async (options, config, tokenizerFn) => {
40
+ if (!options) {
41
+ return {};
42
+ }
43
+ const result = {};
44
+ for (const option of Object.keys(options)) {
45
+ if (typeof options[option] === "string") {
46
+ result[option] = await Promise.resolve(tokenizerFn(options[option], config));
47
+ } else if (Array.isArray(options[option])) {
48
+ result[option] = await Promise.all(options[option].map(async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, config)) : item));
49
+ } else if (typeof options[option] === "object") {
50
+ result[option] = await applyWorkspaceTokens(options[option], config, tokenizerFn);
51
+ } else {
52
+ result[option] = options[option];
53
+ }
54
+ }
55
+ return result;
56
+ }, "applyWorkspaceTokens");
57
+
58
+
59
+
60
+
61
+ exports.applyWorkspaceBaseTokens = applyWorkspaceBaseTokens; exports.applyWorkspaceTokens = applyWorkspaceTokens;
@@ -0,0 +1 @@
1
+ "use strict";