create-vatts-app 1.1.0-alpha.1 → 1.1.0
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/dist/cli.js +78 -18
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.parseArgs = parseArgs;
|
|
7
37
|
exports.promptForMissingOptions = promptForMissingOptions;
|
|
8
|
-
const console_1 =
|
|
38
|
+
const console_1 = __importStar(require("vatts/console"));
|
|
9
39
|
function normalizeAliasPrefix(raw) {
|
|
10
40
|
const trimmed = raw.trim();
|
|
11
41
|
if (!trimmed)
|
|
@@ -60,11 +90,6 @@ async function promptForMissingOptions(opts) {
|
|
|
60
90
|
appName = await console_1.default.ask("What is the name of your app?", "my-vatts-app");
|
|
61
91
|
console.log(" ");
|
|
62
92
|
}
|
|
63
|
-
let typescript = opts.typeScript;
|
|
64
|
-
if (typescript === undefined) {
|
|
65
|
-
typescript = await console_1.default.confirm("Do you want to use typescript?", true);
|
|
66
|
-
console.log(" ");
|
|
67
|
-
}
|
|
68
93
|
let framework = opts.framework;
|
|
69
94
|
async function askFramework() {
|
|
70
95
|
const frame = await console_1.default.ask("What framework do you want to use? (React/Vue)", 'react');
|
|
@@ -80,6 +105,42 @@ async function promptForMissingOptions(opts) {
|
|
|
80
105
|
// @ts-ignore
|
|
81
106
|
framework = await askFramework();
|
|
82
107
|
}
|
|
108
|
+
const recommendedOptions = {
|
|
109
|
+
appName,
|
|
110
|
+
tailwind: true,
|
|
111
|
+
examples: true,
|
|
112
|
+
install: true,
|
|
113
|
+
moduleAlias: true,
|
|
114
|
+
alias: "@/",
|
|
115
|
+
typeScript: true,
|
|
116
|
+
framework
|
|
117
|
+
};
|
|
118
|
+
let name = framework === 'react' ? 'React' : 'Vue';
|
|
119
|
+
const recommended = await console_1.default.selection(`Would you like to use the recommended options? (${name})`, {
|
|
120
|
+
"yes": `${console_1.Colors.Underscore}Yes, use recommended defaults - TypeScript, Tailwind CSS, Module Alias`,
|
|
121
|
+
"maybe": `Maybe, use Path Router defaults - TypeScript, Tailwind CSS`,
|
|
122
|
+
"no": "No, customize settings"
|
|
123
|
+
});
|
|
124
|
+
if (recommended !== 'no') {
|
|
125
|
+
recommendedOptions.pathRouter = recommended === 'maybe';
|
|
126
|
+
// Forçar todas as propriedades obrigatórias
|
|
127
|
+
return {
|
|
128
|
+
appName: recommendedOptions.appName,
|
|
129
|
+
tailwind: recommendedOptions.tailwind,
|
|
130
|
+
examples: recommendedOptions.examples,
|
|
131
|
+
install: recommendedOptions.install,
|
|
132
|
+
moduleAlias: recommendedOptions.moduleAlias,
|
|
133
|
+
alias: recommendedOptions.alias,
|
|
134
|
+
pathRouter: recommendedOptions.pathRouter,
|
|
135
|
+
typeScript: recommendedOptions.typeScript,
|
|
136
|
+
framework: recommendedOptions.framework
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
let typescript = opts.typeScript;
|
|
140
|
+
if (typescript === undefined) {
|
|
141
|
+
typescript = await console_1.default.confirm("Do you want to use typescript?", true);
|
|
142
|
+
console.log(" ");
|
|
143
|
+
}
|
|
83
144
|
let tailwind = opts.tailwind;
|
|
84
145
|
if (tailwind === undefined) {
|
|
85
146
|
tailwind = await console_1.default.confirm("Do you want to include Tailwind CSS?", true);
|
|
@@ -118,15 +179,14 @@ async function promptForMissingOptions(opts) {
|
|
|
118
179
|
console.log(" ");
|
|
119
180
|
}
|
|
120
181
|
return {
|
|
121
|
-
appName,
|
|
122
|
-
tailwind,
|
|
123
|
-
examples,
|
|
124
|
-
install,
|
|
125
|
-
moduleAlias,
|
|
126
|
-
alias,
|
|
127
|
-
pathRouter,
|
|
182
|
+
appName: appName,
|
|
183
|
+
tailwind: tailwind,
|
|
184
|
+
examples: examples,
|
|
185
|
+
install: install,
|
|
186
|
+
moduleAlias: moduleAlias,
|
|
187
|
+
alias: alias,
|
|
188
|
+
pathRouter: pathRouter,
|
|
128
189
|
typeScript: typescript,
|
|
129
|
-
|
|
130
|
-
framework
|
|
190
|
+
framework: framework
|
|
131
191
|
};
|
|
132
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vatts-app",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI tool to create a new Vatts.js application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"commander": "^14.0.2",
|
|
29
29
|
"ts-node": "^10.9.2",
|
|
30
|
-
"vatts": "1.2.0
|
|
30
|
+
"vatts": "1.2.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "rimraf dist && tsc",
|