Comparing version 0.0.10 to 0.0.11
@@ -24,3 +24,3 @@ #!/usr/bin/env node | ||
const {{kind}}Model = { | ||
export const {{kind}}Model = { | ||
label: '{{label}}', | ||
@@ -47,4 +47,2 @@ labelPlural: '{{label}}s', | ||
export const {{kind}}ModelRef = '{{apiGroup}}~{{apiVersion}}~{{kind}}'; | ||
export default {{kind}}Model; | ||
`; | ||
@@ -56,3 +54,3 @@ /** | ||
program | ||
.version("0.0.9") | ||
.version("0.0.11") | ||
.description("Convert CRDs to Group Version Kind Typescript constants") | ||
@@ -83,3 +81,3 @@ .option("-i, --in <file>", "Input directory path - required") | ||
yaml.spec.versions.forEach((version) => { | ||
const name = `${version.name}${yaml.spec.names.kind}`; | ||
const name = `${yaml.spec.names.kind}Model.${version.name}`; | ||
models[name] = { | ||
@@ -138,7 +136,10 @@ kind: yaml.spec.names.kind, | ||
const data = yield readSchemaDir(options.in); | ||
let indexFileText = ''; | ||
for (const [key, model] of Object.entries(data)) { | ||
const fileName = `${model.kind}Model.${model.apiVersion}.ts`; | ||
const fileName = `${key}.ts`; | ||
const fileText = mustache_1.default.render(FileTemplate, model); | ||
// output one file | ||
if (options.out) { | ||
(0, promises_1.writeFile)(path_1.default.normalize(`${options.out}/${fileName}`), fileText); | ||
indexFileText = indexFileText + `export * from './${key}';\n`; | ||
} | ||
@@ -151,2 +152,6 @@ else { | ||
} | ||
// dump index file | ||
if (options.out) { | ||
(0, promises_1.writeFile)(path_1.default.normalize(`${options.out}/index.ts`), indexFileText); | ||
} | ||
return true; | ||
@@ -153,0 +158,0 @@ }); |
@@ -26,3 +26,3 @@ #!/usr/bin/env node | ||
program | ||
.version("0.0.9") | ||
.version("0.0.11") | ||
.description("Convert CRDs to OpenAPI file") | ||
@@ -29,0 +29,0 @@ .option("-i, --in <dir>", "Input directory path - required") |
{ | ||
"name": "crdtoapi", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "CustomResourceDefinitions to OpensAPI", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/yaacov/crdtoapi", |
@@ -12,3 +12,3 @@ #!/usr/bin/env node | ||
const {{kind}}Model = { | ||
export const {{kind}}Model = { | ||
label: '{{label}}', | ||
@@ -35,4 +35,2 @@ labelPlural: '{{label}}s', | ||
export const {{kind}}ModelRef = '{{apiGroup}}~{{apiVersion}}~{{kind}}'; | ||
export default {{kind}}Model; | ||
`; | ||
@@ -45,3 +43,3 @@ | ||
program | ||
.version("0.0.10") | ||
.version("0.0.11") | ||
.description("Convert CRDs to Group Version Kind Typescript constants") | ||
@@ -183,2 +181,3 @@ .option("-i, --in <file>", "Input directory path - required") | ||
const data = await readSchemaDir(options.in); | ||
let indexFileText = ''; | ||
@@ -189,4 +188,6 @@ for (const [key, model] of Object.entries(data)) { | ||
// output one file | ||
if (options.out) { | ||
writeFile(path.normalize(`${options.out}/${fileName}`), fileText); | ||
indexFileText = indexFileText + `export * from './${key}';\n` | ||
} else { | ||
@@ -198,2 +199,8 @@ console.log(`${fileName}:`); | ||
} | ||
// dump index file | ||
if (options.out) { | ||
writeFile(path.normalize(`${options.out}/index.ts`), indexFileText); | ||
} | ||
return true; | ||
@@ -200,0 +207,0 @@ }; |
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
program | ||
.version("0.0.10") | ||
.version("0.0.11") | ||
.description("Convert CRDs to OpenAPI file") | ||
@@ -16,0 +16,0 @@ .option("-i, --in <dir>", "Input directory path - required") |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162063
29
837