Skip to content

Commit b20d4f0

Browse files
authoredFeb 7, 2025··
chore: move interfaces to types dir to easily distinguish api resources (#97)
chore: remove all target from makefile, as remove-unused target is not idempotent (#97)
1 parent ed253a1 commit b20d4f0

File tree

397 files changed

+160
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

397 files changed

+160
-158
lines changed
 

‎Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ k8sUnusedOpenApiFiles := \
1010
"version_openapi.json"
1111

1212

13-
.PHONY: all
14-
all: download-schema parse-schema models core
15-
16-
1713
# Download Kubernetes OpenAPI schemas to packages/cli/input-spec/*.json
1814
.PHONY: download-schema
1915
download-schema:

‎packages/cli/src/moveCore.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ function main() {
2626
for (const sourceFile of project.getSourceFiles()) {
2727
if (sourceFile.getDirectoryPath().startsWith(modelsPath)) {
2828
const fileName = sourceFile.getBaseNameWithoutExtension();
29-
const schema = schemas.classes[fileName] ?? schemas.interfaces[fileName];
29+
const classSchema = schemas.classes[fileName];
30+
const interfaceSchema = schemas.interfaces[fileName];
31+
const schema = classSchema ?? interfaceSchema;
3032

3133
/**
3234
* In the OpenAPI spec file, classes contain .k8s.io, interfaces doesn't.
3335
* Also, flowcontrol.apiserver.k8s.io is used in classes,
3436
* but flowcontrol was used in interfaces.
3537
*/
36-
const destDir = path.join(
38+
let destDir = path.join(
3739
modelsPath,
3840
schema.group
3941
.replace('.k8s.io', '')
@@ -42,6 +44,10 @@ function main() {
4244
schema.version,
4345
);
4446

47+
if (interfaceSchema) {
48+
destDir = path.join(destDir, 'types');
49+
}
50+
4551
if (!fs.existsSync(destDir)) {
4652
log(`Creating directory ${pc.blueBright(destDir)}`);
4753
fs.mkdirSync(destDir, { recursive: true });

0 commit comments

Comments
 (0)
Please sign in to comment.