@dcupl/cli 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
File without changes
package/bin/dcupl ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("../dist/index.js");
package/dist/index.js ADDED
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const yargs_1 = (0, tslib_1.__importDefault)(require("yargs"));
5
+ const helpers_1 = require("yargs/helpers");
6
+ const fs_extra_1 = require("fs-extra");
7
+ const path_1 = require("path");
8
+ const inquirer_1 = (0, tslib_1.__importDefault)(require("inquirer"));
9
+ const kleur_1 = require("kleur");
10
+ const initFn = () => {
11
+ inquirer_1.default
12
+ .prompt([
13
+ {
14
+ type: 'input',
15
+ name: 'projectName',
16
+ message: "What's your project name",
17
+ },
18
+ {
19
+ type: 'list',
20
+ name: 'projectType',
21
+ message: 'Do you want to start from scratch or a demo application?',
22
+ choices: [
23
+ {
24
+ name: 'Empty Project',
25
+ value: 'empty',
26
+ checked: true,
27
+ },
28
+ {
29
+ name: 'Demo Project',
30
+ value: 'demo',
31
+ },
32
+ {
33
+ name: 'Demo Bookstore',
34
+ value: 'bookstore',
35
+ },
36
+ ],
37
+ },
38
+ ])
39
+ .then(({ projectName, projectType }) => {
40
+ const codeBasePath = (0, path_1.resolve)(__dirname, '../');
41
+ const filesBasePath = (0, path_1.join)(codeBasePath, 'files');
42
+ const demoBasePath = (0, path_1.join)(filesBasePath, 'demo', 'demo_01');
43
+ const bookstoreBasePath = (0, path_1.join)(filesBasePath, 'demo', 'bookstore_01');
44
+ const empty01BasePath = (0, path_1.join)(filesBasePath, 'empty', 'empty_01');
45
+ const currentBasePath = (0, path_1.join)(process.cwd());
46
+ const projectFolderPath = (0, path_1.join)(currentBasePath, projectName);
47
+ (0, fs_extra_1.mkdirSync)(projectFolderPath, { recursive: true });
48
+ if (projectType === 'demo') {
49
+ (0, fs_extra_1.copySync)(demoBasePath, projectFolderPath, {
50
+ recursive: true,
51
+ overwrite: true,
52
+ });
53
+ }
54
+ else if (projectType === 'bookstore') {
55
+ (0, fs_extra_1.copySync)(bookstoreBasePath, projectFolderPath, {
56
+ recursive: true,
57
+ overwrite: true,
58
+ });
59
+ }
60
+ else if (projectType === 'empty') {
61
+ (0, fs_extra_1.copySync)(empty01BasePath, projectFolderPath, {
62
+ recursive: true,
63
+ overwrite: true,
64
+ });
65
+ }
66
+ else {
67
+ throw new Error('you have to select a project type');
68
+ }
69
+ console.log((0, kleur_1.blue)('All done! - Next Steps:'));
70
+ console.log('cd ' + projectName);
71
+ console.log('npm i');
72
+ console.log('npm run serve');
73
+ });
74
+ };
75
+ (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
76
+ .command('init', 'Init a Project', () => { }, (argv) => {
77
+ initFn();
78
+ })
79
+ .demandCommand(1)
80
+ .parse();
81
+ //# sourceMappingURL=index.js.map