Skip to content

Commit

Permalink
fix(cli): fix cli usage
Browse files Browse the repository at this point in the history
  • Loading branch information
shinebayar-g committed Feb 7, 2025
1 parent 3c5e299 commit 68130a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions packages/cli/src/generateCRDs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { compile } from 'json-schema-to-typescript';
import pc from 'picocolors';
import { ClassDeclarationStructure, Project, StructureKind } from 'ts-morph';
import * as yaml from 'yaml';
import { formatCode } from './utils';
import { formatCode } from './utils.ts';

interface CRD {
apiVersion: string;
Expand Down Expand Up @@ -159,16 +159,16 @@ export async function generateCRDs(crdPathOrUrl?: string, config?: K8sKonfig) {
namedImports: ['K8sApp'],
});
if (isNamespaced) {
metadata?.setType('NamespacedObjectMetav1');
metadata?.setType('NamespacedObjectMeta');
sourceFile.addImportDeclaration({
moduleSpecifier: '@k8skonf/core',
namedImports: ['NamespacedApiObject', 'NamespacedObjectMetav1'],
namedImports: ['NamespacedApiObject', 'NamespacedObjectMeta'],
});
} else {
metadata?.setType('ObjectMetav1');
metadata?.setType('ObjectMeta');
sourceFile.addImportDeclaration({
moduleSpecifier: '@k8skonf/core',
namedImports: ['ApiObject', 'ObjectMetav1'],
namedImports: ['ApiObject', 'ObjectMeta'],
});
}

Expand All @@ -190,7 +190,7 @@ export async function generateCRDs(crdPathOrUrl?: string, config?: K8sKonfig) {
},
{
name: 'metadata',
type: isNamespaced ? 'NamespacedObjectMetav1' : 'ObjectMetav1',
type: isNamespaced ? 'NamespacedObjectMeta' : 'ObjectMeta',
isReadonly: true,
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/generateCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
StructureKind,
SyntaxKind,
} from 'ts-morph';
import type { Schemas } from './parseSchemas';
import { formatCode, removeUnusedFiles } from './utils';
import type { Schemas } from './parseSchemas.ts';
import { formatCode, removeUnusedFiles } from './utils.ts';

function removeUnusedThings(
sourceFile: SourceFile,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Command } from 'commander';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { generateCRDs, readConfig } from './generateCRDs.js';
import { generateCRDs, readConfig } from './generateCRDs.ts';

async function main() {
const version = JSON.parse(
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/moveCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import pc from 'picocolors';
import { IndentationText, Project, QuoteKind } from 'ts-morph';
import { Schemas } from './parseSchemas';
import { Schemas } from './parseSchemas.ts';

function main() {
const corePath = path.join(import.meta.dirname, '../../core');
Expand Down

0 comments on commit 68130a0

Please sign in to comment.