@otwld/nx-helm 0.0.4 → 0.0.5

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,27 @@
1
+ ## 0.0.5 (2026-08-12)
2
+
3
+ ### Breaking Changes
4
+
5
+ - Infer cache, outputs, and Helm-version runtime inputs directly on standalone
6
+ chart targets.
7
+ - Replace workspace `validateTarget`, `packageTarget`, and `registry` options
8
+ with `validate`, `package`, and `publish.registry`.
9
+ - Infer `nx-release-publish` only for configured OCI registries; project
10
+ `metadata.helm` can override registry and validation settings or disable
11
+ publishing.
12
+ - Stop injecting target defaults during plugin initialization and stop adding
13
+ organization-specific chart tags.
14
+
15
+ ## 0.0.4 (2026-08-12)
16
+
17
+ ### 🚀 Features
18
+
19
+ - **plugins:** add nx helm and argo plugins ([eb30b828](https://github.com/otwld/devops/commit/eb30b828))
20
+
21
+ ### ❤️ Thank You
22
+
23
+ - Tréhout Nathan
24
+
1
25
  ## 0.0.3 (2026-08-12)
2
26
 
3
27
  ### 🚀 Features
package/README.md CHANGED
@@ -19,9 +19,8 @@ charts/service/
19
19
  └── project.json
20
20
  ```
21
21
 
22
- Generated projects use the `helm-<name>` project name and the
23
- `scope:workspace`, `layer:infra`, and `runtime:helm` tags. The `directory`,
24
- `projectName`, and `starter` options customize generation.
22
+ Generated projects use the `helm-<name>` project name. The `directory`,
23
+ `projectName`, `starter`, and `tags` options customize generation.
25
24
 
26
25
  ## Inferred Targets
27
26
 
@@ -29,7 +28,11 @@ Charts with sibling `Chart.yaml` and `project.json` files receive these targets:
29
28
 
30
29
  - `helm:validate` runs `helm lint` and `helm template`.
31
30
  - `helm:package` packages the chart into `dist/<project-root>/helm`.
32
- - `nx-release-publish` pushes the packaged chart to an OCI registry.
31
+ - `nx-release-publish` is inferred only when an OCI registry is configured.
32
+
33
+ Each inferred validate and package target is cacheable, declares its direct
34
+ output where applicable, and includes the installed Helm version as a runtime
35
+ input.
33
36
 
34
37
  ## Configuration
35
38
 
@@ -39,21 +42,41 @@ Charts with sibling `Chart.yaml` and `project.json` files receive these targets:
39
42
  {
40
43
  "plugin": "@otwld/nx-helm",
41
44
  "options": {
42
- "validateTarget": {
43
- "name": "helm:validate",
45
+ "validate": {
46
+ "target": "helm:validate",
44
47
  "kubeVersion": "1.32.0",
45
48
  "strict": false,
49
+ "validationValues": ["values-ci.yaml"],
50
+ },
51
+ "package": {
52
+ "target": "helm:package",
46
53
  },
47
- "packageTarget": {
48
- "name": "helm:package",
54
+ "publish": {
55
+ "registry": "oci://registry.company.test/charts",
49
56
  },
50
- "registry": "oci://registry.example.com/charts",
51
57
  },
52
58
  },
53
59
  ],
54
60
  }
55
61
  ```
56
62
 
63
+ Project-specific settings belong in `project.json` under `metadata.helm`.
64
+ `registry`, `publish`, `kubeVersion`, `strict`, `releaseName`, and
65
+ `validationValues` override workspace options; `publish: false` suppresses the
66
+ release target.
67
+
68
+ ```jsonc
69
+ {
70
+ "metadata": {
71
+ "helm": {
72
+ "registry": "oci://registry.company.test/team-charts",
73
+ "releaseName": "service",
74
+ "validationValues": ["values-ci.yaml"],
75
+ },
76
+ },
77
+ }
78
+ ```
79
+
57
80
  ## Helm Release
58
81
 
59
82
  ```shell
@@ -65,7 +88,7 @@ pnpm exec nx release publish --groups=helm --dry-run
65
88
  Authenticate with the OCI registry before publishing:
66
89
 
67
90
  ```shell
68
- helm registry login registry.example.com
91
+ helm registry login registry.company.test
69
92
  pnpm exec nx release --groups=helm --first-release
70
93
  ```
71
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otwld/nx-helm",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -19,7 +19,7 @@ const runExecutor = async (options, context) => {
19
19
  const registry = normalizeRegistry(options.registry);
20
20
  if (!registry) {
21
21
  console.error('[nx-helm] Helm release publishing requires an OCI registry such as ' +
22
- 'oci://registry.example.com/charts.');
22
+ 'oci://registry.company.test/charts.');
23
23
  return { success: false };
24
24
  }
25
25
  const outputDirectory = (0, node_path_1.resolve)(context.root, options.outputPath);
@@ -36,7 +36,7 @@ async function chartGenerator(tree, options) {
36
36
  (0, devkit_1.addProjectConfiguration)(tree, projectName, {
37
37
  root: projectRoot,
38
38
  projectType: 'application',
39
- tags: ['scope:workspace', 'layer:infra', 'runtime:helm'],
39
+ tags: options.tags,
40
40
  });
41
41
  }
42
42
  /**
@@ -8,4 +8,6 @@ export interface ChartGeneratorSchema {
8
8
  projectName?: string;
9
9
  /** Helm starter name or absolute starter path passed to helm create. */
10
10
  starter?: string;
11
+ /** Nx project tags assigned to the generated chart. */
12
+ tags?: string[];
11
13
  }
@@ -29,6 +29,13 @@
29
29
  "starter": {
30
30
  "type": "string",
31
31
  "description": "Helm starter name or absolute starter path passed to helm create."
32
+ },
33
+ "tags": {
34
+ "type": "array",
35
+ "description": "Nx project tags assigned to the generated chart.",
36
+ "items": {
37
+ "type": "string"
38
+ }
32
39
  }
33
40
  },
34
41
  "required": ["name"],
@@ -1,7 +1,7 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  import type { InitGeneratorSchema } from './schema';
3
3
  /**
4
- * Registers `@otwld/nx-helm` and fills missing shared target defaults.
4
+ * Registers `@otwld/nx-helm` without adding workspace target defaults.
5
5
  * @param tree Workspace tree to update.
6
6
  * @param options Init options supplied by Nx.
7
7
  * @returns A promise that resolves after optional formatting.
@@ -3,12 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = initGenerator;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const pluginName = '@otwld/nx-helm';
6
- const defaultValidateTargetName = 'helm:validate';
7
- const defaultPackageTargetName = 'helm:package';
8
- const defaultKubeVersion = '1.32.0';
9
- const defaultRegistry = 'oci://registry.example.com/charts';
10
6
  /**
11
- * Registers `@otwld/nx-helm` and fills missing shared target defaults.
7
+ * Registers `@otwld/nx-helm` without adding workspace target defaults.
12
8
  * @param tree Workspace tree to update.
13
9
  * @param options Init options supplied by Nx.
14
10
  * @returns A promise that resolves after optional formatting.
@@ -20,20 +16,10 @@ async function initGenerator(tree, options) {
20
16
  }
21
17
  const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
22
18
  const existingPlugin = findPlugin(nxJson.plugins);
23
- const pluginOptions = existingPlugin
24
- ? readPluginOptions(existingPlugin)
25
- : createPluginOptions(options);
26
19
  if (!existingPlugin) {
27
- nxJson.plugins = [
28
- ...(nxJson.plugins ?? []),
29
- {
30
- plugin: pluginName,
31
- options: pluginOptions,
32
- },
33
- ];
20
+ nxJson.plugins = [...(nxJson.plugins ?? []), pluginName];
34
21
  devkit_1.logger.info(`[nx-helm] Added ${pluginName} to nx.json.`);
35
22
  }
36
- addTargetDefaults(nxJson, pluginOptions);
37
23
  (0, devkit_1.updateNxJson)(tree, nxJson);
38
24
  if (!options.skipFormat) {
39
25
  await (0, devkit_1.formatFiles)(tree);
@@ -49,82 +35,3 @@ function findPlugin(plugins) {
49
35
  ? plugin === pluginName
50
36
  : plugin?.plugin === pluginName);
51
37
  }
52
- /**
53
- * Builds default plugin options for a new registration.
54
- * @param options Init generator options.
55
- * @returns Plugin options written to nx.json.
56
- */
57
- function createPluginOptions(options) {
58
- const validateTargetName = options.validateTargetName?.trim() || defaultValidateTargetName;
59
- const packageTargetName = options.packageTargetName?.trim() || defaultPackageTargetName;
60
- return {
61
- validateTarget: {
62
- name: validateTargetName,
63
- kubeVersion: options.kubeVersion?.trim() || defaultKubeVersion,
64
- strict: options.strict ?? false,
65
- },
66
- packageTarget: {
67
- name: packageTargetName,
68
- },
69
- registry: options.registry?.trim() || defaultRegistry,
70
- };
71
- }
72
- /**
73
- * Reads target names from an existing object registration without changing it.
74
- * @param plugin Existing Helm registration.
75
- * @returns Existing plugin options or empty options for default resolution.
76
- */
77
- function readPluginOptions(plugin) {
78
- if (typeof plugin === 'string' || !isRecord(plugin.options)) {
79
- return {};
80
- }
81
- return plugin.options;
82
- }
83
- /**
84
- * Adds shared cache/input defaults only when a target has no existing default.
85
- * @param nxJson Nx workspace configuration.
86
- * @param pluginOptions Helm plugin options.
87
- */
88
- function addTargetDefaults(nxJson, pluginOptions) {
89
- nxJson.targetDefaults ??= {};
90
- const validateTargetName = getNestedString(pluginOptions, 'validateTarget', 'name') ??
91
- defaultValidateTargetName;
92
- const packageTargetName = getNestedString(pluginOptions, 'packageTarget', 'name') ??
93
- defaultPackageTargetName;
94
- nxJson.targetDefaults[validateTargetName] ??= {
95
- cache: true,
96
- inputs: helmInputs,
97
- };
98
- nxJson.targetDefaults[packageTargetName] ??= {
99
- cache: true,
100
- dependsOn: [validateTargetName],
101
- inputs: helmInputs,
102
- };
103
- }
104
- const helmInputs = [
105
- '{projectRoot}/**/*',
106
- { runtime: "helm version --template '{{.Version}}'" },
107
- ];
108
- /**
109
- * Reads a nested string option from an unknown plugin options object.
110
- * @param options Plugin options.
111
- * @param parent Parent property name.
112
- * @param property Nested property name.
113
- * @returns Non-empty nested string, or undefined.
114
- */
115
- function getNestedString(options, parent, property) {
116
- const parentValue = options[parent];
117
- if (!isRecord(parentValue)) {
118
- return undefined;
119
- }
120
- const value = parentValue[property];
121
- return typeof value === 'string' && value.trim() ? value.trim() : undefined;
122
- }
123
- /**
124
- * Narrows unknown values to object records used by init configuration parsing.
125
- * @param value Value to inspect.
126
- * @returns Whether value is a non-null object record.
127
- */
128
- function isRecord(value) {
129
- return typeof value === 'object' && value !== null;
130
- }
@@ -1,15 +1,5 @@
1
1
  /** Options accepted by the `@otwld/nx-helm` init generator. */
2
2
  export interface InitGeneratorSchema {
3
- /** OCI repository used by inferred release publishing. */
4
- registry?: string;
5
- /** Kubernetes version passed to inferred helm template targets. */
6
- kubeVersion?: string;
7
- /** Whether inferred helm lint should fail on warnings. */
8
- strict?: boolean;
9
- /** Inferred Helm validation target name. */
10
- validateTargetName?: string;
11
- /** Inferred Helm packaging target name. */
12
- packageTargetName?: string;
13
3
  /** Skip Prettier formatting after nx.json is updated. */
14
4
  skipFormat?: boolean;
15
5
  }
@@ -2,35 +2,9 @@
2
2
  "$schema": "https://json-schema.org/schema",
3
3
  "$id": "NxHelmInitSchema",
4
4
  "title": "Nx Helm init generator",
5
- "description": "Register @otwld/nx-helm and its inferred-task defaults in nx.json.",
5
+ "description": "Register @otwld/nx-helm in nx.json.",
6
6
  "type": "object",
7
7
  "properties": {
8
- "registry": {
9
- "type": "string",
10
- "description": "OCI repository used by inferred release publishing.",
11
- "pattern": "^oci://",
12
- "default": "oci://registry.example.com/charts"
13
- },
14
- "kubeVersion": {
15
- "type": "string",
16
- "description": "Kubernetes version passed to inferred helm template targets.",
17
- "default": "1.32.0"
18
- },
19
- "strict": {
20
- "type": "boolean",
21
- "description": "Whether inferred helm lint should fail on warnings.",
22
- "default": false
23
- },
24
- "validateTargetName": {
25
- "type": "string",
26
- "description": "Inferred Helm validation target name.",
27
- "default": "helm:validate"
28
- },
29
- "packageTargetName": {
30
- "type": "string",
31
- "description": "Inferred Helm packaging target name.",
32
- "default": "helm:package"
33
- },
34
8
  "skipFormat": {
35
9
  "type": "boolean",
36
10
  "description": "Skip Prettier formatting after nx.json is updated.",
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** Public inferred-task, generator, and release exports for the Helm package. */
2
- export { createNodes, type HelmPackageTargetOptions, type HelmPluginOptions, type HelmValidateTargetOptions, } from './plugins/plugin';
2
+ export { createNodes, type HelmPackageTargetOptions, type HelmPluginOptions, type HelmPublishTargetOptions, type HelmValidateTargetOptions, } from './plugins/plugin';
3
3
  export { default as chartGenerator } from './generators/chart/chart';
4
4
  export type { ChartGeneratorSchema } from './generators/chart/schema';
@@ -2,7 +2,7 @@ import { type CreateNodes } from '@nx/devkit';
2
2
  /** Options for the inferred Helm validation target. */
3
3
  export interface HelmValidateTargetOptions {
4
4
  /** Target name used for Helm lint and template. */
5
- name?: string;
5
+ target?: string;
6
6
  /** Kubernetes version passed to helm template. */
7
7
  kubeVersion?: string;
8
8
  /** Whether helm lint should fail on warnings. */
@@ -10,21 +10,26 @@ export interface HelmValidateTargetOptions {
10
10
  /** Workspace-wide Helm release name override. */
11
11
  releaseName?: string;
12
12
  /** Values files passed to helm lint and helm template. */
13
- valuesFiles?: string[];
13
+ validationValues?: string[];
14
14
  }
15
15
  /** Options for the inferred Helm packaging target. */
16
16
  export interface HelmPackageTargetOptions {
17
17
  /** Target name used for Helm packaging. */
18
- name?: string;
18
+ target?: string;
19
+ }
20
+ /** Options for inferred Helm publishing. */
21
+ export interface HelmPublishTargetOptions {
22
+ /** OCI registry repository used by inferred Nx Release publishing. */
23
+ registry?: string;
19
24
  }
20
25
  /** Workspace options for the Helm inferred-target plugin. */
21
26
  export interface HelmPluginOptions {
22
27
  /** Configuration for the inferred validation target. */
23
- validateTarget?: HelmValidateTargetOptions;
28
+ validate?: HelmValidateTargetOptions;
24
29
  /** Configuration for the inferred packaging target. */
25
- packageTarget?: HelmPackageTargetOptions;
26
- /** OCI repository used by the inferred Nx Release publish target. */
27
- registry?: string;
30
+ package?: HelmPackageTargetOptions;
31
+ /** Configuration for inferred Nx Release publishing. */
32
+ publish?: HelmPublishTargetOptions;
28
33
  }
29
34
  /**
30
35
  * Infers Helm targets for standalone projects whose root contains Chart.yaml.
@@ -9,7 +9,10 @@ const defaultValidateTargetName = 'helm:validate';
9
9
  const defaultPackageTargetName = 'helm:package';
10
10
  const releasePublishTargetName = 'nx-release-publish';
11
11
  const defaultKubeVersion = '1.32.0';
12
- const defaultRegistry = 'oci://registry.example.com/charts';
12
+ const helmInputs = [
13
+ '{projectRoot}/**/*',
14
+ { runtime: "helm version --template '{{.Version}}'" },
15
+ ];
13
16
  /**
14
17
  * Infers Helm targets for standalone projects whose root contains Chart.yaml.
15
18
  * A sibling project.json identifies the chart as an Nx project.
@@ -41,27 +44,32 @@ function createNodesInternal(chartFilePath, options, context) {
41
44
  if (!chartRoot) {
42
45
  return {};
43
46
  }
44
- const projectName = getProjectName(chartRoot.projectRoot, chartRoot.directory);
45
- if (!projectName) {
47
+ const project = getProject(chartRoot.projectRoot, chartRoot.directory);
48
+ if (!project) {
46
49
  return {};
47
50
  }
48
- const validateTargetName = getTargetName(options.validateTarget?.name, defaultValidateTargetName);
49
- const packageTargetName = getTargetName(options.packageTarget?.name, defaultPackageTargetName);
50
- assertTargetNamesAreUnique(validateTargetName, packageTargetName);
51
+ const validateTargetName = getTargetName(options.validate?.target, defaultValidateTargetName);
52
+ const packageTargetName = getTargetName(options.package?.target, defaultPackageTargetName);
51
53
  const outputPath = getPackageOutputPath(chartRoot.projectRoot);
52
- const releaseName = options.validateTarget?.releaseName?.trim() || projectName;
54
+ const releaseName = project.metadata.releaseName?.trim() ||
55
+ options.validate?.releaseName?.trim() ||
56
+ project.name;
53
57
  const validateOptions = {
54
- kubeVersion: options.validateTarget?.kubeVersion?.trim() || defaultKubeVersion,
58
+ kubeVersion: project.metadata.kubeVersion?.trim() ||
59
+ options.validate?.kubeVersion?.trim() ||
60
+ defaultKubeVersion,
55
61
  releaseName,
56
- strict: options.validateTarget?.strict ?? false,
62
+ strict: project.metadata.strict ?? options.validate?.strict ?? false,
57
63
  };
58
- const valuesFiles = options.validateTarget?.valuesFiles;
59
- if (valuesFiles?.length) {
60
- validateOptions['valuesFiles'] = valuesFiles;
64
+ const validationValues = project.metadata.validationValues ?? options.validate?.validationValues;
65
+ if (validationValues?.length) {
66
+ validateOptions['valuesFiles'] = validationValues;
61
67
  }
62
68
  const targets = {
63
69
  [validateTargetName]: {
64
70
  executor: '@otwld/nx-helm:validate',
71
+ cache: true,
72
+ inputs: helmInputs,
65
73
  options: validateOptions,
66
74
  metadata: {
67
75
  technologies: ['helm'],
@@ -70,7 +78,9 @@ function createNodesInternal(chartFilePath, options, context) {
70
78
  },
71
79
  [packageTargetName]: {
72
80
  executor: '@otwld/nx-helm:package',
81
+ cache: true,
73
82
  dependsOn: [validateTargetName],
83
+ inputs: helmInputs,
74
84
  outputs: [`{workspaceRoot}/${outputPath}`],
75
85
  options: {
76
86
  outputPath,
@@ -80,19 +90,24 @@ function createNodesInternal(chartFilePath, options, context) {
80
90
  description: 'Package the root Helm chart.',
81
91
  },
82
92
  },
83
- [releasePublishTargetName]: {
93
+ };
94
+ const registry = normalizeRegistry(project.metadata.registry ?? options.publish?.registry);
95
+ if (registry && project.metadata.publish !== false) {
96
+ targets[releasePublishTargetName] = {
84
97
  executor: '@otwld/nx-helm:release-publish',
85
98
  dependsOn: [packageTargetName],
86
- options: {
87
- outputPath,
88
- registry: options.registry ?? defaultRegistry,
89
- },
99
+ options: { outputPath, registry },
90
100
  metadata: {
91
101
  technologies: ['helm'],
92
102
  description: 'Publish the Helm chart to an OCI registry.',
93
103
  },
94
- },
95
- };
104
+ };
105
+ }
106
+ const targetNames = [validateTargetName, packageTargetName];
107
+ if (releasePublishTargetName in targets) {
108
+ targetNames.push(releasePublishTargetName);
109
+ }
110
+ assertTargetNamesAreUnique(targetNames);
96
111
  return {
97
112
  projects: {
98
113
  [chartRoot.projectRoot]: {
@@ -100,11 +115,7 @@ function createNodesInternal(chartFilePath, options, context) {
100
115
  targets,
101
116
  metadata: {
102
117
  targetGroups: {
103
- Helm: [
104
- validateTargetName,
105
- packageTargetName,
106
- releasePublishTargetName,
107
- ],
118
+ Helm: targetNames,
108
119
  },
109
120
  },
110
121
  },
@@ -130,22 +141,27 @@ function getChartRoot(chartFilePath, workspaceRoot) {
130
141
  return { directory, projectRoot };
131
142
  }
132
143
  /**
133
- * Reads the Nx project name used as the default Helm release name.
144
+ * Reads project metadata used to configure inferred Helm targets.
134
145
  * @param projectRoot Workspace-relative project root.
135
146
  * @param projectDirectory Absolute project directory.
136
- * @returns The project name, or undefined for invalid project metadata.
147
+ * @returns The project name and Helm metadata, or undefined for invalid input.
137
148
  */
138
- function getProjectName(projectRoot, projectDirectory) {
149
+ function getProject(projectRoot, projectDirectory) {
139
150
  const projectConfiguration = (0, devkit_1.readJsonFile)((0, node_path_1.join)(projectDirectory, 'project.json'));
151
+ const metadata = readHelmMetadata(projectConfiguration.metadata?.helm);
140
152
  if (typeof projectConfiguration.name === 'string') {
141
153
  const projectName = projectConfiguration.name.trim();
142
154
  if (projectName) {
143
- return projectName;
155
+ return { name: projectName, metadata };
144
156
  }
145
157
  }
146
- return projectRoot === '.'
147
- ? undefined
148
- : projectRoot.replace(/[\\/\s]+/g, '-').toLowerCase();
158
+ if (projectRoot === '.') {
159
+ return undefined;
160
+ }
161
+ return {
162
+ name: projectRoot.replace(/[\\/\s]+/g, '-').toLowerCase(),
163
+ metadata,
164
+ };
149
165
  }
150
166
  /**
151
167
  * Normalizes optional plugin options while preserving explicit values.
@@ -154,15 +170,15 @@ function getProjectName(projectRoot, projectDirectory) {
154
170
  */
155
171
  function normalizeOptions(options) {
156
172
  return {
157
- validateTarget: {
158
- ...options?.validateTarget,
159
- name: getTargetName(options?.validateTarget?.name, defaultValidateTargetName),
173
+ validate: {
174
+ ...options?.validate,
175
+ target: getTargetName(options?.validate?.target, defaultValidateTargetName),
160
176
  },
161
- packageTarget: {
162
- ...options?.packageTarget,
163
- name: getTargetName(options?.packageTarget?.name, defaultPackageTargetName),
177
+ package: {
178
+ ...options?.package,
179
+ target: getTargetName(options?.package?.target, defaultPackageTargetName),
164
180
  },
165
- registry: options?.registry?.trim() || defaultRegistry,
181
+ publish: { ...options?.publish },
166
182
  };
167
183
  }
168
184
  /**
@@ -175,20 +191,66 @@ function getTargetName(configuredName, defaultName) {
175
191
  return configuredName?.trim() || defaultName;
176
192
  }
177
193
  /**
178
- * Prevents the configurable targets from colliding with one another or the
179
- * Nx Release publish target.
180
- * @param validateTargetName Validation target name.
181
- * @param packageTargetName Packaging target name.
194
+ * Prevents inferred target names from colliding.
195
+ * @param targetNames Inferred target names.
182
196
  */
183
- function assertTargetNamesAreUnique(validateTargetName, packageTargetName) {
184
- const targetNames = [
185
- validateTargetName,
186
- packageTargetName,
187
- releasePublishTargetName,
188
- ];
197
+ function assertTargetNamesAreUnique(targetNames) {
189
198
  if (new Set(targetNames).size !== targetNames.length) {
190
- throw new Error('[nx-helm] Validation, package, and nx-release-publish target names must be unique.');
199
+ throw new Error('[nx-helm] Inferred Helm target names must be unique.');
200
+ }
201
+ }
202
+ /**
203
+ * Reads supported Helm project metadata without exposing arbitrary project data.
204
+ * @param value Potential `metadata.helm` value from project.json.
205
+ * @returns Recognized Helm metadata.
206
+ */
207
+ function readHelmMetadata(value) {
208
+ if (!isRecord(value)) {
209
+ return {};
191
210
  }
211
+ return {
212
+ registry: readString(value['registry']),
213
+ publish: typeof value['publish'] === 'boolean' ? value['publish'] : undefined,
214
+ kubeVersion: readString(value['kubeVersion']),
215
+ strict: typeof value['strict'] === 'boolean' ? value['strict'] : undefined,
216
+ releaseName: readString(value['releaseName']),
217
+ validationValues: readStringArray(value['validationValues']),
218
+ };
219
+ }
220
+ /**
221
+ * Validates an OCI repository reference for inferred publishing.
222
+ * @param registry Configured registry repository.
223
+ * @returns Normalized OCI repository, or undefined when no valid registry exists.
224
+ */
225
+ function normalizeRegistry(registry) {
226
+ const normalized = registry?.trim().replace(/\/+$/, '');
227
+ return normalized?.startsWith('oci://') ? normalized : undefined;
228
+ }
229
+ /**
230
+ * Narrows an unknown value to a non-empty string.
231
+ * @param value Value to inspect.
232
+ * @returns Trimmed string, or undefined.
233
+ */
234
+ function readString(value) {
235
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
236
+ }
237
+ /**
238
+ * Narrows an unknown value to a string array.
239
+ * @param value Value to inspect.
240
+ * @returns Values array, or undefined for invalid input.
241
+ */
242
+ function readStringArray(value) {
243
+ return Array.isArray(value) && value.every((item) => typeof item === 'string')
244
+ ? value
245
+ : undefined;
246
+ }
247
+ /**
248
+ * Narrows an unknown value to an object record.
249
+ * @param value Value to inspect.
250
+ * @returns Whether the value is a non-null object record.
251
+ */
252
+ function isRecord(value) {
253
+ return typeof value === 'object' && value !== null;
192
254
  }
193
255
  /**
194
256
  * Computes the workspace-relative package output directory for a chart.