Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: update dependencies for cli package
  • Loading branch information
pavkam committed Sep 3, 2025
commit a65931bfaef7c8a9defd4cf0f8ffc8e426ff0235
30 changes: 15 additions & 15 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,32 @@
"preversion": "yarn lint && yarn prettier && yarn vitest run -c vite.config.js && yarn build"
},
"dependencies": {
"@inquirer/prompts": "^5.3.8",
"@inquirer/prompts": "^7.8.4",
"ajv": "^8.17.1",
"chalk": "^5.3.0",
"chalk": "^5.6.0",
"change-case": "^5.4.4",
"commander": "^12.1.0",
"commander": "^14.0.0",
"comment-json": "^4.2.5",
"express": "^4.21.2",
"express": "^5.1.0",
"fast-deep-equal": "^3.1.3",
"find-up": "^7.0.0",
"open": "^10.1.0",
"ora": "^8.1.0",
"open": "^10.2.0",
"ora": "^8.2.0",
"semver": "^7.7.2",
"slug": "^10.0.0",
"zod": "^3.24.2"
"slug": "^11.0.0",
"zod": "^4.1.5"
},
"devDependencies": {
"@reflag/eslint-config": "^0.0.2",
"@reflag/tsconfig": "^0.0.2",
"@types/express": "^5.0.0",
"@types/node": "^22.5.1",
"@types/express": "^5.0.3",
"@types/node": "^24.3.0",
"@types/semver": "^7.7.0",
"@types/slug": "^5.0.9",
"eslint": "^9.21.0",
"prettier": "^3.5.2",
"shx": "^0.3.4",
"typescript": "^5.5.4",
"vitest": "^3.0.8"
"eslint": "^9.34.0",
"prettier": "^3.6.2",
"shx": "^0.4.0",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
}
}
4 changes: 3 additions & 1 deletion packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"outDir": "./dist/",
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext"
"moduleResolution": "NodeNext",
"skipLibCheck": true,
"types": []
},
"include": ["**/*.ts"],
"exclude": ["node_modules", "dist", "**/*.spec.ts"]
Expand Down
25 changes: 14 additions & 11 deletions packages/cli/utils/json.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we suddenly need all these type casts?

Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ export function mergeTypeASTs(types: TypeAST[]): TypeAST {
if (byKind.union.length > 0) {
// Flatten existing unions and collect types by category
const flattenedTypes: TypeAST[] = [];
const objectsToMerge: ObjectAST[] = [...byKind.object];
const arraysToMerge: ArrayAST[] = [...byKind.array];
const objectsToMerge: ObjectAST[] = [...(byKind.object as ObjectAST[])];
const arraysToMerge: ArrayAST[] = [...(byKind.array as ArrayAST[])];

// Add primitives directly
flattenedTypes.push(...byKind.primitive);

// Process union types
for (const unionType of byKind.union) {
for (const type of unionType.types) {
for (const type of (unionType as UnionAST).types) {
if (type.kind === "object") {
objectsToMerge.push(type);
} else if (type.kind === "array") {
Expand Down Expand Up @@ -115,7 +115,9 @@ export function mergeTypeASTs(types: TypeAST[]): TypeAST {

// Handle primitives
if (byKind.primitive.length === types.length) {
const uniqueTypes = [...new Set(byKind.primitive.map((p) => p.type))];
const uniqueTypes = [
...new Set((byKind.primitive as PrimitiveAST[]).map((p) => p.type)),
];
return uniqueTypes.length === 1
? { kind: "primitive", type: uniqueTypes[0] }
: {
Expand All @@ -128,29 +130,30 @@ export function mergeTypeASTs(types: TypeAST[]): TypeAST {
if (byKind.array.length === types.length) {
return {
kind: "array",
elementType: mergeTypeASTs(byKind.array.map((a) => a.elementType)),
elementType: mergeTypeASTs(
(byKind.array as ArrayAST[]).map((a) => a.elementType),
),
};
}

// Merge objects
if (byKind.object.length === types.length) {
const objects = byKind.object as ObjectAST[];
// Get all unique property keys
const allKeys = [
...new Set(
byKind.object.flatMap((obj) => obj.properties.map((p) => p.key)),
),
...new Set(objects.flatMap((obj) => obj.properties.map((p) => p.key))),
];

// Merge properties with same keys
const mergedProperties = allKeys.map((key) => {
const props = byKind.object
const props = objects
.map((obj) => obj.properties.find((p) => p.key === key))
.filter((obj) => !!obj);
.filter((prop): prop is NonNullable<typeof prop> => !!prop);

return {
key,
type: mergeTypeASTs(props.map((p) => p.type)),
optional: byKind.object.some(
optional: objects.some(
(obj) => !obj.properties.some((p) => p.key === key),
),
};
Expand Down
6 changes: 1 addition & 5 deletions packages/cli/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ export const booleanish = z.preprocess((value) => {
return value === "true" || value === "1";
}
return Boolean(value);
}, z.boolean().describe("Boolean value that can be parsed from strings like 'true' or '1'")) as z.ZodEffects<
z.ZodBoolean,
boolean,
boolean
>;
}, z.boolean().describe("Boolean value that can be parsed from strings like 'true' or '1'"));

export const PaginationQueryBaseSchema = (
{
Expand Down
12 changes: 12 additions & 0 deletions packages/eslint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ module.exports = [
// Workaround until import supports flat config
// https://github.com/import-js/eslint-plugin-import/issues/2556
espree: [".js", ".cjs", ".mjs", ".jsx"],
"@typescript-eslint/parser": [".ts", ".tsx"],
Comment on lines 56 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might have been resolved import-js/eslint-plugin-import#3018

},
"import/ignore": [
"node_modules",
"\\.(coffee|scss|css|less|hbs|svg|json)$",
],
},
rules: {
...jsPlugin.configs.recommended.rules,
Expand Down Expand Up @@ -111,6 +116,13 @@ module.exports = [
languageOptions: {
parser: tsParser,
parserOptions: {
sourceType: "module",
ecmaVersion: "latest",
ecmaFeatures: {
modules: true,
impliedStrict: true,
jsx: true,
},
Comment on lines +119 to +125
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already defined higher up in the config for .ts and .tsx

project: "./tsconfig.eslint.json",
},
},
Expand Down
Loading