timonel 2.10.0 → 2.10.2

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,16 @@
1
+ ## [2.10.2](https://github.com/KenkoGeek/timonel/compare/v2.10.1...v2.10.2) (2025-09-20)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **cli:** consolidate path validation and improve error handling ([239a50f](https://github.com/KenkoGeek/timonel/commit/239a50fb30be451301d2af6a586b77748a3db6ec))
6
+
7
+ ## [2.10.1](https://github.com/KenkoGeek/timonel/compare/v2.10.0...v2.10.1) (2025-09-20)
8
+
9
+ ### Bug Fixes
10
+
11
+ - **cli:** improve version display and fallback handling ([#117](https://github.com/KenkoGeek/timonel/issues/117)) ([7ad67e2](https://github.com/KenkoGeek/timonel/commit/7ad67e23f936edcc6e9e7d886c257046ca4dccc6))
12
+ - **helm:** remove debug logs from helmChartWriter ([742e1c9](https://github.com/KenkoGeek/timonel/commit/742e1c94f2858ec1afaf90cf5f2955b692e18f6b))
13
+
1
14
  # [2.10.0](https://github.com/KenkoGeek/timonel/compare/v2.9.2...v2.10.0) (2025-09-20)
2
15
 
3
16
  ### Bug Fixes
package/dist/cli.js CHANGED
@@ -8,14 +8,39 @@ const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = path.dirname(__filename);
9
9
  const UMBRELLA_CONFIG_FILE = 'umbrella.config.json';
10
10
  const UMBRELLA_FILE_NAME = 'umbrella.ts';
11
+ const PACKAGE_JSON_FILE = 'package.json';
11
12
  function getVersion() {
12
13
  try {
13
- const packagePath = path.join(__dirname, '..', 'package.json');
14
- const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
15
- return packageJson.version || '0.1.0';
14
+ const possiblePaths = [
15
+ path.resolve(__dirname, '..', PACKAGE_JSON_FILE),
16
+ path.resolve(__dirname, '..', '..', PACKAGE_JSON_FILE),
17
+ path.resolve(process.cwd(), PACKAGE_JSON_FILE),
18
+ path.resolve(__dirname, PACKAGE_JSON_FILE),
19
+ ];
20
+ for (const packagePath of possiblePaths) {
21
+ try {
22
+ const validatedPath = SecurityUtils.validatePath(packagePath, process.cwd());
23
+ if (fs.existsSync(validatedPath)) {
24
+ try {
25
+ const packageJson = JSON.parse(fs.readFileSync(validatedPath, 'utf8'));
26
+ return packageJson.version || 'unknown';
27
+ }
28
+ catch {
29
+ continue;
30
+ }
31
+ }
32
+ }
33
+ catch {
34
+ continue;
35
+ }
36
+ }
37
+ if (process.env.npm_package_version) {
38
+ return process.env.npm_package_version;
39
+ }
40
+ return 'unknown';
16
41
  }
17
42
  catch {
18
- return '0.1.0';
43
+ return 'unknown';
19
44
  }
20
45
  }
21
46
  function log(msg, silent = false) {
@@ -25,7 +50,7 @@ function log(msg, silent = false) {
25
50
  }
26
51
  function logError(msg, silent = false) {
27
52
  if (!silent) {
28
- console.error(msg);
53
+ console.error(SecurityUtils.sanitizeLogMessage(msg));
29
54
  }
30
55
  }
31
56
  function usageAndExit(msg, silent = false) {
@@ -469,7 +494,7 @@ async function main() {
469
494
  main().catch((error) => {
470
495
  const flags = parseFlags(process.argv.slice(2));
471
496
  if (!flags.silent) {
472
- console.error('Error:', error.message);
497
+ console.error('Error:', SecurityUtils.sanitizeLogMessage(error.message));
473
498
  }
474
499
  process.exit(1);
475
500
  });
@@ -133,27 +133,14 @@ function getTargetDirectory(target) {
133
133
  return target === 'crds' ? 'crds' : 'templates';
134
134
  }
135
135
  function writeSingleAssetFile(outDir, targetDir, assetId, yaml) {
136
- if (assetId === 'ingress' && yaml.includes('number:')) {
137
- console.log('Writing ingress file with number fields');
138
- const numberLines = yaml.split('\n').filter((line) => line.includes('number:'));
139
- console.log('Number lines:', numberLines);
140
- }
141
136
  const filename = `${assetId}.yaml`;
142
137
  fs.mkdirSync(path.join(outDir, targetDir), { recursive: true });
143
138
  fs.writeFileSync(path.join(outDir, targetDir, filename), yaml + '\n');
144
139
  }
145
140
  function writeMultipleAssetFiles(outDir, targetDir, assetId, yaml) {
146
- if (assetId === 'ingress' && yaml.includes('number:')) {
147
- console.log('🔍 Writing ingress file (multiple) with content:');
148
- const numberLines = yaml.split('\n').filter((line) => line.includes('number:'));
149
- console.log('Number lines:', numberLines);
150
- }
151
141
  const parts = splitDocs(yaml);
152
142
  parts.forEach((doc, index) => {
153
143
  const filename = `${assetId}${parts.length > 1 ? `-${index + 1}` : ''}.yaml`;
154
- if (assetId === 'ingress' && doc.includes('number:')) {
155
- console.log(`🔍 Writing document ${index + 1} for ingress:`, doc.split('\n').filter((line) => line.includes('number:')));
156
- }
157
144
  fs.mkdirSync(path.join(outDir, targetDir), { recursive: true });
158
145
  fs.writeFileSync(path.join(outDir, targetDir, filename), doc + '\n');
159
146
  });
@@ -168,7 +168,7 @@ ${yamlContent.trim()}
168
168
  return [...this.assets];
169
169
  }
170
170
  toSynthArray() {
171
- console.log(`📦 Synthesizing chart assets for: ${this.meta.name}`);
171
+ console.log(`Synthesizing chart assets for: ${this.meta.name}`);
172
172
  const apiObjectIds = [];
173
173
  for (const child of this.chart.node.children) {
174
174
  if (child instanceof ApiObject && !child.node.id.endsWith('-placeholder')) {
@@ -184,7 +184,7 @@ ${yamlContent.trim()}
184
184
  }
185
185
  return true;
186
186
  });
187
- console.log(`📋 Found ${manifestObjs.length} manifest objects to process`);
187
+ console.log(`Found ${manifestObjs.length} manifest objects to process`);
188
188
  const enriched = manifestObjs.map((obj) => {
189
189
  if (obj && typeof obj === 'object') {
190
190
  const o = obj;
@@ -420,7 +420,7 @@ ${helper.template}
420
420
  helpersContent = generateHelpersTemplate(this.props.cloudProvider);
421
421
  }
422
422
  const synthAssets = this.toSynthArray();
423
- console.log(`📄 Generated ${synthAssets.length} assets for chart`);
423
+ console.log(`Generated ${synthAssets.length} assets for chart`);
424
424
  HelmChartWriter.write({
425
425
  outDir,
426
426
  meta: this.meta,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "timonel",
3
3
  "type": "module",
4
- "version": "2.10.0",
4
+ "version": "2.10.2",
5
5
  "description": "Timonel: programmatic Helm chart generator using cdk8s (TypeScript)",
6
6
  "bin": {
7
7
  "timonel": "dist/cli.js",
@@ -37,7 +37,9 @@
37
37
  "deps:update": "pnpm update --latest",
38
38
  "md:lint": "markdownlint \"**/*.md\"",
39
39
  "md:fix": "markdownlint --fix \"**/*.md\"",
40
- "test:integration": "vitest run --config vitest.config.ts",
40
+ "test": "vitest run --config vitest.config.ts",
41
+ "test:unit": "vitest run --config vitest.config.ts",
42
+ "test:integration": "vitest run --config vitest.integration.config.ts",
41
43
  "test:watch": "vitest",
42
44
  "test:coverage": "vitest run --coverage",
43
45
  "ci:check": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm build",
@@ -86,7 +88,7 @@
86
88
  "constructs": "^10.4.2",
87
89
  "handlebars": "^4.7.8",
88
90
  "js-yaml": "^4.1.0",
89
- "timonel": "^2.9.2",
91
+ "timonel": "^2.10.0",
90
92
  "ts-node": "^10.9.2",
91
93
  "yaml": "^2.8.1"
92
94
  },