-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·26 lines (20 loc) · 823 Bytes
/
cli.js
File metadata and controls
executable file
·26 lines (20 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
const fs = require('fs-extra');
const path = require('path');
const packageJson = require('./package.json');
// Grab args
const [,, ...args] = process.argv
// Set appname - default name is 'basic-app'
const appname = (args[0] === undefined) ? 'basic-app' : args[0]
// Starting Project Generation
console.log(`Initializing project ${appname} ...`);
// Make directory called 'appname' and change dir to 'appname'
if(!fs.existsSync(appname))
fs.mkdirSync(appname);
process.chdir('./' + appname);
// Copy files from basic-react-app to new app
const files = ['.babelrc', '.gitignore', 'package.json', 'package-lock.json', 'README.md', 'webpack.config.js'];
files.forEach((file) => {
fs.copy(path.join(__dirname, file), file, () => {});
})
fs.copy(path.join(__dirname, './src'), './src', () => {})