Skip to content

Commit

Permalink
fix: remove all the Status classes (#26)
Browse files Browse the repository at this point in the history
Release-As: 0.2.0
  • Loading branch information
shinebayar-g authored Dec 17, 2024
1 parent 7df8620 commit 65b35d1
Show file tree
Hide file tree
Showing 66 changed files with 14 additions and 1,419 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
ci
requireScope: false


- uses: marocchino/sticky-pull-request-comment@v2
if: always() && steps.lint_pr_title.outputs.error_message != null
with:
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/src/generateCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ function morph() {

if (classDeclaration && className) {
removeUnusedThings(sourceFile, classDeclaration, className, groupVersionKindMap);
/**
* Remove all the Status classes.
*/
const isStatus = /^[A-Za-z]+Statusv\d/;
if (sourceFile.getBaseNameWithoutExtension().match(isStatus)) {
sourceFile.delete();
continue;
}
/**
* If the groupVersionKindMap contains the "path" property, then it's a Kubernetes API resource.
* Everything else should be interfaces.
Expand Down
9 changes: 6 additions & 3 deletions packages/cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ export function formatCode(modelsPath: string) {
}

export function removeUnusedFiles(modelsPath: string) {
const unusedFiles = new Set(['V1Event.ts']);
const keepStatusFiles = new Set(['V1IngressPortStatus.ts', 'V1PortStatus.ts']);
const unusedFiles = new Set([
'V1Event.ts',
'LoadBalancerIngressv1.ts',
'IngressLoadBalancerIngressv1.ts',
]);
fs.readdirSync(modelsPath).forEach((file) => {
if ((file.endsWith('Status.ts') && !keepStatusFiles.has(file)) || unusedFiles.has(file)) {
if (file.endsWith('Status.ts') || unusedFiles.has(file)) {
fs.rmSync(path.join(modelsPath, file));
}
});
Expand Down
11 changes: 0 additions & 11 deletions packages/core/src/models/APIServiceStatusv1.ts

This file was deleted.

15 changes: 0 additions & 15 deletions packages/core/src/models/CertificateSigningRequestStatusv1.ts

This file was deleted.

24 changes: 0 additions & 24 deletions packages/core/src/models/ComponentStatusv1.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/core/src/models/ContainerResourceMetricStatusv2.ts

This file was deleted.

67 changes: 0 additions & 67 deletions packages/core/src/models/ContainerStatusv1.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/core/src/models/CronJobStatusv1.ts

This file was deleted.

20 changes: 0 additions & 20 deletions packages/core/src/models/CustomResourceDefinitionStatusv1.ts

This file was deleted.

47 changes: 0 additions & 47 deletions packages/core/src/models/DaemonSetStatusv1.ts

This file was deleted.

39 changes: 0 additions & 39 deletions packages/core/src/models/DeploymentStatusv1.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/core/src/models/ExternalMetricStatusv2.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/core/src/models/FlowSchemaStatusv1.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/core/src/models/FlowSchemaStatusv1beta3.ts

This file was deleted.

25 changes: 0 additions & 25 deletions packages/core/src/models/HorizontalPodAutoscalerStatusv1.ts

This file was deleted.

Loading

0 comments on commit 65b35d1

Please sign in to comment.