Skip to content

Commit

Permalink
fix(optc): handle kebabCase options
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Dec 20, 2023
1 parent c2ff551 commit a4b4135
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/optc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"fs-extra": "^11.2.0",
"globby": "^14.0.0",
"jiti": "^1.21.0",
"kolorist": "^1.8.0"
"kolorist": "^1.8.0",
"scule": "^1.1.1"
},
"devDependencies": {
"@babel/types": "^7.23.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/optc/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function createNewScript(_filename: string) {
'',
isLocal ? `/// <reference types="optc/globals" />` : `/// <reference path="${globalsDts}" />`,
'',
'export default async function() {',
'export default async function () {',
' ',
'}',
''
Expand Down
3 changes: 2 additions & 1 deletion packages/optc/src/reflect/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
} from '@babel/types';

import createDebug from 'debug';
import { kebabCase } from 'scule';

import { logWarn } from '../utils';

Expand Down Expand Up @@ -197,7 +198,7 @@ function parseOptions(body: TSTypeElement[]): Option[] {
}

return {
name,
name: kebabCase(name),
type: type ?? ValueType.String,
required: !sig.optional,
description: parseComment(sig.leadingComments)
Expand Down
4 changes: 3 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a4b4135

Please sign in to comment.