@storm-software/k8s-tools 0.12.0 → 0.18.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 (48) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/{src → dist/src}/generators/helm-chart/schema.d.ts +4 -1
  3. package/{src → dist/src}/generators/helm-dependency/schema.d.ts +4 -1
  4. package/dist/src/types.d.mts +31 -0
  5. package/{src → dist/src}/types.d.ts +9 -6
  6. package/dist/src/types.js +7 -0
  7. package/dist/src/types.mjs +7 -0
  8. package/executors.json +4 -4
  9. package/generators.json +4 -4
  10. package/package.json +1 -84
  11. package/index.d.ts +0 -1
  12. package/index.js +0 -3267
  13. package/meta.json +0 -634
  14. package/src/executors/container-publish/executor.d.ts +0 -7
  15. package/src/executors/container-publish/executor.js +0 -199
  16. package/src/executors/helm-package/executor.d.ts +0 -8
  17. package/src/executors/helm-package/executor.js +0 -252
  18. package/src/executors/index.d.ts +0 -2
  19. package/src/generators/helm-chart/files/chart/.helmignore +0 -23
  20. package/src/generators/helm-chart/files/chart/templates/NOTES.txt +0 -22
  21. package/src/generators/helm-chart/files/chart/templates/_helpers.yaml +0 -62
  22. package/src/generators/helm-chart/files/chart/templates/deployment.yaml +0 -68
  23. package/src/generators/helm-chart/files/chart/templates/hpa.yaml +0 -32
  24. package/src/generators/helm-chart/files/chart/templates/ingress.yaml +0 -61
  25. package/src/generators/helm-chart/files/chart/templates/service.yaml +0 -13
  26. package/src/generators/helm-chart/files/chart/templates/serviceaccount.yaml +0 -13
  27. package/src/generators/helm-chart/files/chart/templates/test/test-connection.yaml +0 -15
  28. package/src/generators/helm-chart/generator.d.ts +0 -8
  29. package/src/generators/helm-chart/generator.js +0 -89
  30. package/src/generators/helm-dependency/generator.d.ts +0 -8
  31. package/src/generators/helm-dependency/generator.js +0 -2757
  32. package/src/generators/index.d.ts +0 -2
  33. package/src/index.d.ts +0 -3
  34. package/src/plugins/docker/_dockerfile.d.ts +0 -9
  35. package/src/plugins/docker/index.d.ts +0 -1
  36. package/src/plugins/docker/index.js +0 -215
  37. package/src/plugins/index.d.ts +0 -1
  38. package/src/utils/client.d.ts +0 -31
  39. package/src/utils/ensure-init.d.ts +0 -9
  40. package/src/utils/prettier.d.ts +0 -9
  41. /package/{src → dist/src}/executors/container-publish/schema.d.ts +0 -0
  42. /package/{src → dist/src}/executors/container-publish/schema.json +0 -0
  43. /package/{src → dist/src}/executors/helm-package/schema.d.ts +0 -0
  44. /package/{src → dist/src}/executors/helm-package/schema.json +0 -0
  45. /package/{src → dist/src}/generators/helm-chart/files/chart/Chart.yaml.template +0 -0
  46. /package/{src → dist/src}/generators/helm-chart/files/chart/values.yaml +0 -0
  47. /package/{src → dist/src}/generators/helm-chart/schema.json +0 -0
  48. /package/{src → dist/src}/generators/helm-dependency/schema.json +0 -0
@@ -1,2 +0,0 @@
1
- export * from "./helm-chart/generator";
2
- export * from "./helm-dependency/generator";
package/src/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from "./executors";
2
- export * from "./generators";
3
- export * from "./plugins";
@@ -1,9 +0,0 @@
1
- import { type CreateDependencies, type CreateNodes } from "@nx/devkit";
2
- import type { ExternalContainerExecutorSchema } from "../../executors/container-publish/schema";
3
- export declare const name = "storm-software/docker/dockerfile";
4
- export declare const description = "Plugin for parsing Dockerfile files";
5
- export interface DockerFilePluginOptions {
6
- defaultEngine?: ExternalContainerExecutorSchema["engine"];
7
- }
8
- export declare const createNodes: CreateNodes<DockerFilePluginOptions>;
9
- export declare const createDependencies: CreateDependencies;
@@ -1 +0,0 @@
1
- export * from "./_dockerfile";
@@ -1,215 +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 name2 in all)
9
- __defProp(target, name2, { get: all[name2], 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/plugins/docker/index.ts
30
- var docker_exports = {};
31
- __export(docker_exports, {
32
- createDependencies: () => createDependencies,
33
- createNodes: () => createNodes,
34
- description: () => description,
35
- name: () => name
36
- });
37
- module.exports = __toCommonJS(docker_exports);
38
-
39
- // packages/k8s-tools/src/plugins/docker/_dockerfile.ts
40
- var import_devkit = require("@nx/devkit");
41
- var import_package_helpers = require("@storm-software/workspace-tools/utils/package-helpers");
42
- var import_project_tags = require("@storm-software/workspace-tools/utils/project-tags");
43
- var import_node_fs = require("node:fs");
44
- var name = "storm-software/docker/dockerfile";
45
- var description = "Plugin for parsing Dockerfile files";
46
- var createNodes = [
47
- "*/**/{Dockerfile,Dockerfile.*}",
48
- async (dockerFilePath, opts = {
49
- defaultEngine: "docker"
50
- }, _) => {
51
- if (!dockerFilePath) {
52
- return {};
53
- }
54
- const { loadStormConfig, findWorkspaceRoot } = await import("@storm-software/config-tools");
55
- const root = dockerFilePath.substring(dockerFilePath.lastIndexOf("/") + 1);
56
- const projectJsonPath = (0, import_devkit.joinPathFragments)(root, "project.json");
57
- if (!(0, import_node_fs.existsSync)(projectJsonPath)) {
58
- return {};
59
- }
60
- const projectJson = (0, import_devkit.readJsonFile)(projectJsonPath);
61
- if (projectJson?.name) {
62
- return {};
63
- }
64
- const workspaceRoot = findWorkspaceRoot();
65
- const config = await loadStormConfig(workspaceRoot);
66
- Object.keys(projectJson).forEach((key) => {
67
- if (!project[key]) {
68
- project[key] = projectJson[key];
69
- }
70
- });
71
- const project = {
72
- root,
73
- name: projectJson?.name
74
- };
75
- const engine = opts.defaultEngine ?? "docker";
76
- const labels = [
77
- `org.opencontainers.image.ref.name=${project.name}`,
78
- `org.opencontainers.image.title=${titleCase(project.name)}`,
79
- `org.opencontainers.image.authors=${config.organization ? titleCase(config.organization) : "Storm Software"}`,
80
- `org.opencontainers.image.vendor=${config.organization ? titleCase(config.organization) : "Storm Software"}`,
81
- `org.opencontainers.image.documentation=${config.docs}`,
82
- `org.opencontainers.image.url=${config.homepage}`,
83
- `org.opencontainers.image.source=${config.repository}`
84
- ];
85
- let tag = "latest";
86
- const packageManager = (0, import_package_helpers.getPackageInfo)(project);
87
- if (packageManager) {
88
- if (packageManager.type === "Cargo.toml") {
89
- tag = packageManager.content.package.version;
90
- labels.push(
91
- `org.opencontainers.image.description=${packageManager.content.package.description}`
92
- );
93
- } else if (packageManager.type === "package.json") {
94
- tag = packageManager.content.version;
95
- labels.push(
96
- `org.opencontainers.image.description=${packageManager.content.description}`
97
- );
98
- }
99
- }
100
- project.targets = {
101
- ...project.targets,
102
- container: {
103
- executor: "@nx-tools/nx-container:build",
104
- options: {
105
- file: dockerFilePath,
106
- engine,
107
- labels,
108
- push: true,
109
- platforms: ["linux/amd64"],
110
- metadata: {
111
- images: [
112
- `${config.namespace ? config.namespace : "storm-software"}/${project.name?.replace(`${config.namespace}-`, "")}`,
113
- `ghcr.io/${config.organization ? config.organization : "storm-software"}/${project.name}`
114
- ],
115
- tags: [
116
- "type=schedule",
117
- "type=ref,event=branch",
118
- "type=ref,event=tag",
119
- "type=ref,event=pr",
120
- "type=semver,pattern={{version}}",
121
- "type=semver,pattern={{major}}.{{minor}}",
122
- "type=semver,pattern={{major}}",
123
- "type=sha"
124
- ]
125
- }
126
- },
127
- defaultConfiguration: "production",
128
- configurations: {
129
- development: {
130
- quiet: false,
131
- "build-args": [
132
- "ENVIRONMENT=development",
133
- "DEBUG_IMAGE=true",
134
- `RELEASE=${tag}`
135
- ]
136
- },
137
- production: {
138
- quiet: true,
139
- "build-args": [
140
- "ENVIRONMENT=production",
141
- "DEBUG_IMAGE=false",
142
- `RELEASE=${tag}`
143
- ]
144
- }
145
- }
146
- }
147
- };
148
- if (((0, import_project_tags.isEqualProjectTag)(
149
- project,
150
- import_project_tags.ProjectTagConstants.ProjectType.TAG_ID,
151
- import_project_tags.ProjectTagConstants.ProjectType.APPLICATION
152
- ) || project.projectType === "application") && (0, import_project_tags.hasProjectTag)(project, import_project_tags.ProjectTagConstants.Registry.TAG_ID)) {
153
- if (project.targets["nx-release-publish"]) {
154
- project.targets["nx-release-publish"] = {
155
- ...project.targets["nx-release-publish"],
156
- executor: "@storm-software/k8s-tools:container-publish",
157
- options: {
158
- packageRoot: project.root
159
- }
160
- };
161
- } else {
162
- project.targets["nx-release-publish"] = {
163
- cache: true,
164
- inputs: [
165
- "linting",
166
- "testing",
167
- "documentation",
168
- "rust",
169
- "^production"
170
- ],
171
- dependsOn: ["build", "^nx-release-publish"],
172
- executor: "@storm-software/k8s-tools:container-publish",
173
- options: {
174
- packageRoot: project.root
175
- }
176
- };
177
- }
178
- }
179
- (0, import_project_tags.setDefaultProjectTags)(project);
180
- const projects = {};
181
- const externalNodes = {};
182
- projects[project.root] = {
183
- ...project,
184
- release: {
185
- ...project.release,
186
- version: {
187
- ...project.release?.version,
188
- generator: "@storm-software/workspace-tools:release-version"
189
- }
190
- }
191
- };
192
- return {
193
- projects,
194
- externalNodes
195
- };
196
- }
197
- ];
198
- var createDependencies = (_, context) => {
199
- return [];
200
- };
201
- var titleCase = (input) => {
202
- if (!input) {
203
- return "";
204
- }
205
- return input.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
206
- (s) => s ? s.toLowerCase().charAt(0).toUpperCase() + s.toLowerCase().slice(1) : s
207
- ).join(" ");
208
- };
209
- // Annotate the CommonJS export names for ESM import in node:
210
- 0 && (module.exports = {
211
- createDependencies,
212
- createNodes,
213
- description,
214
- name
215
- });
@@ -1 +0,0 @@
1
- export * from "./docker";
@@ -1,31 +0,0 @@
1
- import { AbstractHelmClient, PackageOptions, PushOptions } from "../types";
2
- /** Helm wrapper class */
3
- export declare class HelmClient extends AbstractHelmClient {
4
- /**
5
- * Creates an instance of HelmClient
6
- */
7
- constructor();
8
- /**
9
- * Package a chart directory into a chart archive
10
- *
11
- * @param {PackageOptions} [options]
12
- */
13
- package(options: PackageOptions): Promise<string | undefined>;
14
- push(options: PushOptions): void;
15
- dependencyUpdate(chartFolder: string): void;
16
- dependencyBuild(chartFolder: string): void;
17
- addRepository(name: string, url: string): void;
18
- /**
19
- * Initialize Helm
20
- *
21
- * @returns A promise
22
- */
23
- initialize(): Promise<void>;
24
- private runCommand;
25
- }
26
- /**
27
- * Create a new Helm client instance
28
- *
29
- * @returns {HelmClient}
30
- */
31
- export declare const createHelmClient: () => HelmClient;
@@ -1,9 +0,0 @@
1
- /**
2
- * Decorator to ensure the class is initialized before executing a method
3
- *
4
- * @param {any} target
5
- * @param {string} propertyKey
6
- * @param {PropertyDescriptor} descriptor
7
- * @returns {PropertyDescriptor}
8
- */
9
- export declare const ensureInitialized: (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -1,9 +0,0 @@
1
- import { Tree } from "@nx/devkit";
2
- import { PrettierConfig } from "../types";
3
- /**
4
- * Resolves the existing Prettier configuration.
5
- *
6
- * @returns The Prettier configuration or undefined if not found.
7
- */
8
- export declare function resolveUserExistingPrettierConfig(): Promise<PrettierConfig | undefined>;
9
- export declare function addToPrettierIgnore(tree: Tree, ignore: string[]): void;