-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (22 loc) · 720 Bytes
/
Copy pathindex.js
File metadata and controls
29 lines (22 loc) · 720 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 path = require('path');
const program = require("commander");
const file = require("./helpers/file");
const Case = require('change-case');
const pkg = require('./package');
let location = process.cwd();
let prefix = null;
program
.version(pkg.version)
.option("-n, --name [name]", "component name")
.option("-d, --dir [dir]", "target directory relative or absolute path")
.option("-p, --prefix [prefix]", "prefix for the component name and its files")
.parse(process.argv);
if (program.dir) {
location = path.resolve(program.dir);
}
if (program.prefix) {
prefix = program.prefix;
}
const name = program.name;
file.createFilesInDir(Case.paramCase(name), location, prefix);