Skip to content

Commit 35b3ba7

Browse files
authored
feat(commands): Validate given project name (#365)
* fix: Ignore `.idea` folder * feat(commands): Validate given project name * feat(commands): Use Regexp instead of `validateDenoLand` package
1 parent 5a5aff3 commit 35b3ba7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
.env
33
.env.*
4+
**/.idea
45
Thumbs.db
56
compiler/target/
67
compiler/pkg/

commands/init.ts

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export default async function (
3434
return
3535
}
3636

37+
if (!/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) {
38+
console.error(`Invalid project name: ${red(name)}`)
39+
return
40+
}
41+
3742
const hasTemplate = await util.isUrlOk('https://api.github.com/repos/alephjs/alephjs-templates/contents/' + template)
3843

3944
if (!hasTemplate) {

0 commit comments

Comments
 (0)