Skip to content

Commit 273d0b6

Browse files
feat: add target dir support
1 parent 22980b3 commit 273d0b6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/create-lang/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function required(s: string): string | true {
1010
return true
1111
}
1212

13+
// https://github.com/vitejs/vite/blob/76082e3d3033b09b02b6db64de6e36942593c753/packages/create-vite/src/index.ts#L557
1314
function isValidPackageName(projectName: string) {
1415
return /^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(
1516
projectName,
@@ -110,7 +111,11 @@ function installTreeSitterPackage(answer: Answers) {
110111
}
111112

112113
async function main() {
113-
const cwd = process.cwd()
114+
let cwd = process.cwd()
115+
if (process.argv.length > 2) {
116+
const targetDir = process.argv[2]
117+
cwd = path.join(cwd, targetDir)
118+
}
114119
const config = await askConfiguration()
115120
await copyTemplate(cwd, config.includeDotFiles)
116121
await renameFiles(cwd, config)

0 commit comments

Comments
 (0)