MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / toValidPackageName

Function toValidPackageName

packages/create-easy-editor/src/utils.ts:18–24  ·  view source on GitHub ↗
(projectName: string)

Source from the content-addressed store, hash-verified

16 /^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(projectName)
17
18export const toValidPackageName = (projectName: string) =>
19 projectName
20 .trim()
21 .toLowerCase()
22 .replace(/\s+/g, '-')
23 .replace(/^[._]/, '')
24 .replace(/[^a-z\d\-~]+/g, '-')
25
26export const copyDir = (srcDir: string, destDir: string) => {
27 fs.mkdirSync(destDir, { recursive: true })

Callers 1

initFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected