-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (26 loc) · 790 Bytes
/
app.js
File metadata and controls
29 lines (26 loc) · 790 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
26
27
28
29
#!/usr/bin/env node
const yargs = require('yargs');
const downloadRepo = require('./modules/download');
const replacePlaceholder = require('./modules/replace');
const setupProject = require('./modules/setup');
const argv = yargs
.command('create', 'Create a new project based on Link Loom boilerplate', {
name: {
description: 'project name',
alias: 'n',
type: 'string',
}
})
.help()
.alias('help', 'h')
.argv;
if (argv._.includes('create') && argv.name) {
console.log(`Creating project: ${argv.name}`);
downloadRepo(argv.name)
.then(() => replacePlaceholder(argv.name))
.then(() => setupProject(argv.name))
.then(() => console.log('Project created successfully.'))
.catch(err => console.error(err));
} else {
yargs.showHelp();
}