-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
5,099 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env node | ||
|
||
import spawn from "cross-spawn"; | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
const projectName = process.argv[2]; | ||
|
||
const currentDir = process.cwd(); | ||
const projectDir = path.resolve(currentDir, projectName); | ||
fs.mkdirSync(projectDir, { recursive: true }); | ||
|
||
const templateDir = path.resolve(__dirname, 'template'); | ||
fs.cpSync(templateDir, projectDir, { recursive: true }); | ||
|
||
fs.renameSync( | ||
path.join(projectDir, 'gitignore'), | ||
path.join(projectDir, '.gitignore') | ||
); | ||
|
||
const projectPackageJson = require(path.join(projectDir, 'package.json')); | ||
|
||
projectPackageJson.name = projectName; | ||
|
||
fs.writeFileSync( | ||
path.join(projectDir, 'package.json'), | ||
JSON.stringify(projectPackageJson, null, 2) | ||
); | ||
|
||
spawn.sync('npm', ['install'], { stdio: 'inherit' }); | ||
|
||
console.log('Success! Your new project is ready.'); | ||
console.log(`Created ${projectName} at ${projectDir}`); |
Oops, something went wrong.