diff --git a/packages/optc/package.json b/packages/optc/package.json
index b7df284e..7d0a5613 100644
--- a/packages/optc/package.json
+++ b/packages/optc/package.json
@@ -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",
diff --git a/packages/optc/src/cli.ts b/packages/optc/src/cli.ts
index b4ab6764..82bead0e 100644
--- a/packages/optc/src/cli.ts
+++ b/packages/optc/src/cli.ts
@@ -94,7 +94,7 @@ async function createNewScript(_filename: string) {
'',
isLocal ? `/// ` : `/// `,
'',
- 'export default async function() {',
+ 'export default async function () {',
' ',
'}',
''
diff --git a/packages/optc/src/reflect/babel.ts b/packages/optc/src/reflect/babel.ts
index 497e5e3f..e7539058 100644
--- a/packages/optc/src/reflect/babel.ts
+++ b/packages/optc/src/reflect/babel.ts
@@ -8,6 +8,7 @@ import type {
} from '@babel/types';
import createDebug from 'debug';
+import { kebabCase } from 'scule';
import { logWarn } from '../utils';
@@ -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)
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5b278c9b..476ac9da 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -93,6 +93,9 @@ importers:
kolorist:
specifier: ^1.8.0
version: 1.8.0
+ scule:
+ specifier: ^1.1.1
+ version: 1.1.1
devDependencies:
'@babel/types':
specifier: ^7.23.6
@@ -2656,7 +2659,6 @@ packages:
/scule@1.1.1:
resolution: {integrity: sha512-sHtm/SsIK9BUBI3EFT/Gnp9VoKfY6QLvlkvAE6YK7454IF8FSgJEAnJpVdSC7K5/pjI5NfxhzBLW2JAfYA/shQ==}
- dev: true
/semver@6.3.1:
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}