create-vatts-app 1.1.0 → 1.2.0-canary
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/LICENSE +1 -1
- package/dist/cli.js +20 -13
- package/dist/createApp.js +0 -1
- package/dist/fs.js +16 -0
- package/dist/index.js +16 -0
- package/dist/install.js +16 -0
- package/dist/steps/createExampleRoutes.js +20 -10
- package/dist/steps/createProject.js +16 -0
- package/dist/steps/createProjectStructure.js +17 -6
- package/dist/steps/installDependencies.js +16 -0
- package/dist/steps/setupTailwind.js +16 -0
- package/dist/steps/writeTsConfig.js +16 -0
- package/dist/steps/writeVattsConfig.js +17 -1
- package/dist/summary.js +21 -4
- package/dist/templates.d.ts +3 -3
- package/dist/templates.js +23 -33
- package/dist/types.d.ts +0 -2
- package/dist/validate.js +16 -0
- package/package.json +3 -3
package/LICENSE
CHANGED
package/dist/cli.js
CHANGED
|
@@ -35,6 +35,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.parseArgs = parseArgs;
|
|
37
37
|
exports.promptForMissingOptions = promptForMissingOptions;
|
|
38
|
+
/*
|
|
39
|
+
* This file is part of the Vatts.js Project.
|
|
40
|
+
* Copyright (c) 2026 itsmuzin
|
|
41
|
+
*
|
|
42
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
43
|
+
* you may not use this file except in compliance with the License.
|
|
44
|
+
* You may obtain a copy of the License at
|
|
45
|
+
*
|
|
46
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
47
|
+
*
|
|
48
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
49
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
50
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
51
|
+
* See the License for the specific language governing permissions and
|
|
52
|
+
* limitations under the License.
|
|
53
|
+
*/
|
|
38
54
|
const console_1 = __importStar(require("vatts/console"));
|
|
39
55
|
function normalizeAliasPrefix(raw) {
|
|
40
56
|
const trimmed = raw.trim();
|
|
@@ -67,8 +83,6 @@ function parseArgs(argv) {
|
|
|
67
83
|
const examplesFlag = args.includes("--examples");
|
|
68
84
|
const noAliasFlag = args.includes("--no-alias");
|
|
69
85
|
const aliasValue = readArgValue(args, "--alias");
|
|
70
|
-
const pathRouterFlag = args.includes("--path-router") || args.includes("-p");
|
|
71
|
-
const noPathRouterFlag = args.includes("--no-path-router");
|
|
72
86
|
const reactFlag = args.includes("--react");
|
|
73
87
|
const vueFlag = args.includes("--vue");
|
|
74
88
|
return {
|
|
@@ -79,7 +93,6 @@ function parseArgs(argv) {
|
|
|
79
93
|
install: noInstallFlag ? false : installFlag ? true : undefined,
|
|
80
94
|
moduleAlias: noAliasFlag ? false : aliasValue ? true : undefined,
|
|
81
95
|
alias: aliasValue ? normalizeAliasPrefix(aliasValue) : undefined,
|
|
82
|
-
pathRouter: pathRouterFlag ? true : noPathRouterFlag ? false : undefined,
|
|
83
96
|
typeScript: args.includes("--typescript") || args.includes("-ts") ? true : undefined,
|
|
84
97
|
framework: reactFlag ? 'react' : vueFlag ? 'vue' : undefined
|
|
85
98
|
};
|
|
@@ -92,7 +105,10 @@ async function promptForMissingOptions(opts) {
|
|
|
92
105
|
}
|
|
93
106
|
let framework = opts.framework;
|
|
94
107
|
async function askFramework() {
|
|
95
|
-
const frame = await console_1.default.
|
|
108
|
+
const frame = await console_1.default.selection("What framework do you want to use?", {
|
|
109
|
+
"react": "React",
|
|
110
|
+
"vue": "Vue"
|
|
111
|
+
});
|
|
96
112
|
console.log('');
|
|
97
113
|
if (frame.toLowerCase() !== 'react' && frame.toLowerCase() !== 'vue') {
|
|
98
114
|
return await askFramework();
|
|
@@ -118,11 +134,9 @@ async function promptForMissingOptions(opts) {
|
|
|
118
134
|
let name = framework === 'react' ? 'React' : 'Vue';
|
|
119
135
|
const recommended = await console_1.default.selection(`Would you like to use the recommended options? (${name})`, {
|
|
120
136
|
"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
137
|
"no": "No, customize settings"
|
|
123
138
|
});
|
|
124
139
|
if (recommended !== 'no') {
|
|
125
|
-
recommendedOptions.pathRouter = recommended === 'maybe';
|
|
126
140
|
// Forçar todas as propriedades obrigatórias
|
|
127
141
|
return {
|
|
128
142
|
appName: recommendedOptions.appName,
|
|
@@ -131,7 +145,6 @@ async function promptForMissingOptions(opts) {
|
|
|
131
145
|
install: recommendedOptions.install,
|
|
132
146
|
moduleAlias: recommendedOptions.moduleAlias,
|
|
133
147
|
alias: recommendedOptions.alias,
|
|
134
|
-
pathRouter: recommendedOptions.pathRouter,
|
|
135
148
|
typeScript: recommendedOptions.typeScript,
|
|
136
149
|
framework: recommendedOptions.framework
|
|
137
150
|
};
|
|
@@ -151,11 +164,6 @@ async function promptForMissingOptions(opts) {
|
|
|
151
164
|
examples = await console_1.default.confirm("Do you want to include example routes?", true);
|
|
152
165
|
console.log(" ");
|
|
153
166
|
}
|
|
154
|
-
let pathRouter = opts.pathRouter;
|
|
155
|
-
if (pathRouter === undefined) {
|
|
156
|
-
pathRouter = await console_1.default.confirm("Do you want to use path router?", false);
|
|
157
|
-
console.log(" ");
|
|
158
|
-
}
|
|
159
167
|
let moduleAlias = opts.moduleAlias;
|
|
160
168
|
if (moduleAlias === undefined) {
|
|
161
169
|
moduleAlias = await console_1.default.confirm("Do you want to set a module alias?", true);
|
|
@@ -185,7 +193,6 @@ async function promptForMissingOptions(opts) {
|
|
|
185
193
|
install: install,
|
|
186
194
|
moduleAlias: moduleAlias,
|
|
187
195
|
alias: alias,
|
|
188
|
-
pathRouter: pathRouter,
|
|
189
196
|
typeScript: typescript,
|
|
190
197
|
framework: framework
|
|
191
198
|
};
|
package/dist/createApp.js
CHANGED
package/dist/fs.js
CHANGED
|
@@ -37,6 +37,22 @@ exports.ensureDir = ensureDir;
|
|
|
37
37
|
exports.writeFile = writeFile;
|
|
38
38
|
exports.writeJson = writeJson;
|
|
39
39
|
exports.exists = exists;
|
|
40
|
+
/*
|
|
41
|
+
* This file is part of the Vatts.js Project.
|
|
42
|
+
* Copyright (c) 2026 itsmuzin
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
40
56
|
const fs = __importStar(require("node:fs"));
|
|
41
57
|
const path = __importStar(require("node:path"));
|
|
42
58
|
function ensureDir(dirPath) {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
/*
|
|
4
|
+
* This file is part of the Vatts.js Project.
|
|
5
|
+
* Copyright (c) 2026 itsmuzin
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
3
19
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
20
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
21
|
};
|
package/dist/install.js
CHANGED
|
@@ -34,6 +34,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.npmInstall = npmInstall;
|
|
37
|
+
/*
|
|
38
|
+
* This file is part of the Vatts.js Project.
|
|
39
|
+
* Copyright (c) 2026 itsmuzin
|
|
40
|
+
*
|
|
41
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
|
+
* you may not use this file except in compliance with the License.
|
|
43
|
+
* You may obtain a copy of the License at
|
|
44
|
+
*
|
|
45
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
46
|
+
*
|
|
47
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
49
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
+
* See the License for the specific language governing permissions and
|
|
51
|
+
* limitations under the License.
|
|
52
|
+
*/
|
|
37
53
|
const node_child_process_1 = require("node:child_process");
|
|
38
54
|
const path = __importStar(require("node:path"));
|
|
39
55
|
const fs = __importStar(require("node:fs"));
|
|
@@ -37,6 +37,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.createExampleRoutes = createExampleRoutes;
|
|
40
|
+
/*
|
|
41
|
+
* This file is part of the Vatts.js Project.
|
|
42
|
+
* Copyright (c) 2026 itsmuzin
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
40
56
|
const console_1 = __importDefault(require("vatts/console"));
|
|
41
57
|
const path = __importStar(require("node:path"));
|
|
42
58
|
const fs_1 = require("../fs");
|
|
@@ -44,18 +60,12 @@ const templates_1 = require("../templates");
|
|
|
44
60
|
async function createExampleRoutes(ctx) {
|
|
45
61
|
const dynamic = console_1.default.dynamicLine("Creating example routes...");
|
|
46
62
|
if (ctx.framework === 'react') {
|
|
47
|
-
let pathResolve = path.join(ctx.rootDir, "src", "web",
|
|
48
|
-
|
|
49
|
-
pathResolve = path.join(ctx.rootDir, "src", "web", `page.${ctx.typeScript ? 'tsx' : 'jsx'}`);
|
|
50
|
-
}
|
|
51
|
-
(0, fs_1.writeFile)(pathResolve, (0, templates_1.webIndexRouteTemplate)(ctx.willTailwind, ctx.pathRouter, ctx.typeScript));
|
|
63
|
+
let pathResolve = path.join(ctx.rootDir, "src", "web", `page.${ctx.typeScript ? 'tsx' : 'jsx'}`);
|
|
64
|
+
(0, fs_1.writeFile)(pathResolve, (0, templates_1.webIndexRouteTemplate)(ctx.willTailwind, ctx.typeScript));
|
|
52
65
|
}
|
|
53
66
|
else if (ctx.framework === 'vue') {
|
|
54
|
-
let pathResolve = path.join(ctx.rootDir, "src", "web",
|
|
55
|
-
|
|
56
|
-
pathResolve = path.join(ctx.rootDir, "src", "web", `page.vue`);
|
|
57
|
-
}
|
|
58
|
-
(0, fs_1.writeFile)(pathResolve, (0, templates_1.vueExampleRoute)(ctx.typeScript, ctx.pathRouter, ctx.willTailwind));
|
|
67
|
+
let pathResolve = path.join(ctx.rootDir, "src", "web", `page.vue`);
|
|
68
|
+
(0, fs_1.writeFile)(pathResolve, (0, templates_1.vueExampleRoute)(ctx.typeScript, ctx.willTailwind));
|
|
59
69
|
}
|
|
60
70
|
(0, fs_1.writeFile)(path.join(ctx.rootDir, "src", "backend", "routes", `Example.${ctx.typeScript ? 'ts' : 'js'}`), (0, templates_1.backendExampleRouteTemplate)(ctx.typeScript));
|
|
61
71
|
dynamic.end("Example routes created.");
|
|
@@ -37,6 +37,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.createProject = createProject;
|
|
40
|
+
/*
|
|
41
|
+
* This file is part of the Vatts.js Project.
|
|
42
|
+
* Copyright (c) 2026 itsmuzin
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
40
56
|
const console_1 = __importDefault(require("vatts/console"));
|
|
41
57
|
const path = __importStar(require("node:path"));
|
|
42
58
|
const fs_1 = require("../fs");
|
|
@@ -37,6 +37,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.createProjectStructure = createProjectStructure;
|
|
40
|
+
/*
|
|
41
|
+
* This file is part of the Vatts.js Project.
|
|
42
|
+
* Copyright (c) 2026 itsmuzin
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
40
56
|
const console_1 = __importDefault(require("vatts/console"));
|
|
41
57
|
const path = __importStar(require("node:path"));
|
|
42
58
|
const fs_1 = require("../fs");
|
|
@@ -44,12 +60,7 @@ const templates_1 = require("../templates");
|
|
|
44
60
|
async function createProjectStructure(ctx) {
|
|
45
61
|
const dynamic = console_1.default.dynamicLine("Creating project structure...");
|
|
46
62
|
(0, fs_1.ensureDir)(path.join(ctx.rootDir, "src", "backend", "routes"));
|
|
47
|
-
|
|
48
|
-
(0, fs_1.ensureDir)(path.join(ctx.rootDir, "src", "web", "routes"));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
(0, fs_1.ensureDir)(path.join(ctx.rootDir, "src", "web"));
|
|
52
|
-
}
|
|
63
|
+
(0, fs_1.ensureDir)(path.join(ctx.rootDir, "src", "web"));
|
|
53
64
|
(0, fs_1.writeFile)(path.join(ctx.rootDir, "src", "web", "globals.css"), (0, templates_1.globalsCssTemplate)(ctx.willTailwind));
|
|
54
65
|
if (ctx.framework === 'react') {
|
|
55
66
|
(0, fs_1.writeFile)(path.join(ctx.rootDir, "src", "web", `layout.${ctx.typeScript ? 'tsx' : 'jsx'}`), ctx.typeScript ? (0, templates_1.layoutTsxTemplate)() : (0, templates_1.layoutJsxTemplate)());
|
|
@@ -34,6 +34,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.installDependencies = installDependencies;
|
|
37
|
+
/*
|
|
38
|
+
* This file is part of the Vatts.js Project.
|
|
39
|
+
* Copyright (c) 2026 itsmuzin
|
|
40
|
+
*
|
|
41
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
|
+
* you may not use this file except in compliance with the License.
|
|
43
|
+
* You may obtain a copy of the License at
|
|
44
|
+
*
|
|
45
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
46
|
+
*
|
|
47
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
49
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
+
* See the License for the specific language governing permissions and
|
|
51
|
+
* limitations under the License.
|
|
52
|
+
*/
|
|
37
53
|
const console_1 = __importStar(require("vatts/console"));
|
|
38
54
|
const install_1 = require("../install");
|
|
39
55
|
async function installDependencies(ctx) {
|
|
@@ -37,6 +37,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.setupTailwind = setupTailwind;
|
|
40
|
+
/*
|
|
41
|
+
* This file is part of the Vatts.js Project.
|
|
42
|
+
* Copyright (c) 2026 itsmuzin
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
40
56
|
const console_1 = __importDefault(require("vatts/console"));
|
|
41
57
|
const path = __importStar(require("node:path"));
|
|
42
58
|
const fs_1 = require("../fs");
|
|
@@ -37,6 +37,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.writeTsConfig = writeTsConfig;
|
|
40
|
+
/*
|
|
41
|
+
* This file is part of the Vatts.js Project.
|
|
42
|
+
* Copyright (c) 2026 itsmuzin
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
40
56
|
const console_1 = __importDefault(require("vatts/console"));
|
|
41
57
|
const path = __importStar(require("node:path"));
|
|
42
58
|
const fs_1 = require("../fs");
|
|
@@ -34,9 +34,25 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.writeVattsConfig = writeVattsConfig;
|
|
37
|
+
/*
|
|
38
|
+
* This file is part of the Vatts.js Project.
|
|
39
|
+
* Copyright (c) 2026 itsmuzin
|
|
40
|
+
*
|
|
41
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
|
+
* you may not use this file except in compliance with the License.
|
|
43
|
+
* You may obtain a copy of the License at
|
|
44
|
+
*
|
|
45
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
46
|
+
*
|
|
47
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
49
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
+
* See the License for the specific language governing permissions and
|
|
51
|
+
* limitations under the License.
|
|
52
|
+
*/
|
|
37
53
|
const path = __importStar(require("node:path"));
|
|
38
54
|
const fs_1 = require("../fs");
|
|
39
55
|
const templates_1 = require("../templates");
|
|
40
56
|
async function writeVattsConfig(ctx) {
|
|
41
|
-
(0, fs_1.writeFile)(path.join(ctx.rootDir, `vatts.config.${ctx.typeScript ? 'ts' : 'js'}`), (0, templates_1.vattsConfigTemplate)(ctx.typeScript
|
|
57
|
+
(0, fs_1.writeFile)(path.join(ctx.rootDir, `vatts.config.${ctx.typeScript ? 'ts' : 'js'}`), (0, templates_1.vattsConfigTemplate)(ctx.typeScript));
|
|
42
58
|
}
|
package/dist/summary.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printSummary = printSummary;
|
|
4
|
+
/*
|
|
5
|
+
* This file is part of the Vatts.js Project.
|
|
6
|
+
* Copyright (c) 2026 itsmuzin
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
4
20
|
const console_1 = require("vatts/console");
|
|
5
21
|
function printSummary(ctx) {
|
|
6
22
|
console.clear();
|
|
@@ -34,10 +50,11 @@ function printSummary(ctx) {
|
|
|
34
50
|
console.log(`${timer}${label} or${console_1.Colors.Reset}`);
|
|
35
51
|
console.log(`${timer}${label} ${cmd}npm run dev${console_1.Colors.Reset}`);
|
|
36
52
|
console.log("");
|
|
37
|
-
console.log(`${timer}${label}Production:${console_1.Colors.Reset}`);
|
|
38
|
-
console.log(`${timer}${label}
|
|
39
|
-
console.log(`${timer}${label}
|
|
40
|
-
console.log(`${timer}${label}
|
|
53
|
+
console.log(`${timer}${label}Production steps:${console_1.Colors.Reset}`);
|
|
54
|
+
console.log(`${timer}${label} 1. ${cmd}vatts build${console_1.Colors.Reset}`);
|
|
55
|
+
console.log(`${timer}${label} 2. ${cmd}vatts start${console_1.Colors.Reset}`);
|
|
56
|
+
console.log(`${timer}${label} or${console_1.Colors.Reset}`);
|
|
57
|
+
console.log(`${timer}${label} ${cmd}npm run start${console_1.Colors.Reset}`);
|
|
41
58
|
console.log("");
|
|
42
59
|
console.log(`${timer}${dim}Website:${console_1.Colors.Reset} ${console_1.Colors.FgCyan}https://vatts.mfraz.ovh${console_1.Colors.Reset}`);
|
|
43
60
|
console.log("");
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare function globalsCssTemplate(willTailwind: boolean): "@import \"tailwindcss\";\n" | "body {\nbackground-color: #030712; \n}";
|
|
2
2
|
export declare function layoutTsxTemplate(): string;
|
|
3
3
|
export declare function layoutJsxTemplate(): string;
|
|
4
|
-
export declare function vattsConfigTemplate(typescript: boolean,
|
|
4
|
+
export declare function vattsConfigTemplate(typescript: boolean): "\nconst vattsConfig = (phase, { defaultConfig }) => {\n return {\n ...defaultConfig\n };\n};\n\nexport default vattsConfig;\n " | "import type { VattsConfigFunction } from 'vatts';\n\nconst vattsConfig: VattsConfigFunction = (phase, { defaultConfig }) => {\n return {\n ...defaultConfig\n };\n};\n\nexport default vattsConfig;";
|
|
5
5
|
export declare function tsconfigTemplate(opts?: {
|
|
6
6
|
moduleAlias?: string | false;
|
|
7
7
|
}): string;
|
|
8
8
|
export declare function postcssConfigTemplate(): string;
|
|
9
9
|
export declare function tailwindConfigTemplate(): string;
|
|
10
|
-
export declare function webIndexRouteTemplate(willTailwind: boolean,
|
|
10
|
+
export declare function webIndexRouteTemplate(willTailwind: boolean, typescript: boolean): string;
|
|
11
11
|
export declare function backendExampleRouteTemplate(typescript: boolean): "import {VattsResponse} from \"vatts\"\n\nconst ExampleRoute = {\n pattern: '/api/example',\n GET(request, params) {\n return VattsResponse.json({\n message: 'Welcome to the Example API!'\n })\n },\n POST: async (request, params) => {\n const data = await request.json();\n return VattsResponse.json({\n message: 'POST request received at Example API!',\n body: data\n })\n }\n};\n\nexport default ExampleRoute;" | "import {BackendRouteConfig, VattsRequest, VattsResponse} from \"vatts\"\n\nconst ExampleRoute: BackendRouteConfig = {\n pattern: '/api/example',\n GET(request: VattsRequest, params) {\n return VattsResponse.json({\n message: 'Welcome to the Example API!'\n })\n },\n POST: async (request: VattsRequest, params) => {\n const data = await request.json();\n return VattsResponse.json({\n message: 'POST request received at Example API!',\n body: data\n })\n }\n};\n\nexport default ExampleRoute;";
|
|
12
|
-
export declare function vueExampleRoute(typescript: boolean,
|
|
12
|
+
export declare function vueExampleRoute(typescript: boolean, tailwind: boolean): string;
|
|
13
13
|
export declare function vueExampleLayout(typescript: boolean): string;
|
package/dist/templates.js
CHANGED
|
@@ -11,6 +11,22 @@ exports.webIndexRouteTemplate = webIndexRouteTemplate;
|
|
|
11
11
|
exports.backendExampleRouteTemplate = backendExampleRouteTemplate;
|
|
12
12
|
exports.vueExampleRoute = vueExampleRoute;
|
|
13
13
|
exports.vueExampleLayout = vueExampleLayout;
|
|
14
|
+
/*
|
|
15
|
+
* This file is part of the Vatts.js Project.
|
|
16
|
+
* Copyright (c) 2026 itsmuzin
|
|
17
|
+
*
|
|
18
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License.
|
|
20
|
+
* You may obtain a copy of the License at
|
|
21
|
+
*
|
|
22
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
+
*
|
|
24
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
25
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
+
* See the License for the specific language governing permissions and
|
|
28
|
+
* limitations under the License.
|
|
29
|
+
*/
|
|
14
30
|
function globalsCssTemplate(willTailwind) {
|
|
15
31
|
// even without tailwind, leave empty file to avoid import errors
|
|
16
32
|
return willTailwind ? `@import "tailwindcss";\n` : `body {
|
|
@@ -61,13 +77,12 @@ export default function Layout({ children }) {
|
|
|
61
77
|
}
|
|
62
78
|
`;
|
|
63
79
|
}
|
|
64
|
-
function vattsConfigTemplate(typescript
|
|
80
|
+
function vattsConfigTemplate(typescript) {
|
|
65
81
|
if (!typescript) {
|
|
66
82
|
return `
|
|
67
83
|
const vattsConfig = (phase, { defaultConfig }) => {
|
|
68
84
|
return {
|
|
69
|
-
...defaultConfig
|
|
70
|
-
pathRouter: true` : ''}
|
|
85
|
+
...defaultConfig
|
|
71
86
|
};
|
|
72
87
|
};
|
|
73
88
|
|
|
@@ -78,8 +93,7 @@ export default vattsConfig;
|
|
|
78
93
|
|
|
79
94
|
const vattsConfig: VattsConfigFunction = (phase, { defaultConfig }) => {
|
|
80
95
|
return {
|
|
81
|
-
...defaultConfig
|
|
82
|
-
pathRouter: true` : ''}
|
|
96
|
+
...defaultConfig
|
|
83
97
|
};
|
|
84
98
|
};
|
|
85
99
|
|
|
@@ -143,8 +157,8 @@ module.exports = {
|
|
|
143
157
|
plugins: [],
|
|
144
158
|
}`;
|
|
145
159
|
}
|
|
146
|
-
function webIndexRouteTemplate(willTailwind,
|
|
147
|
-
const functionName =
|
|
160
|
+
function webIndexRouteTemplate(willTailwind, typescript) {
|
|
161
|
+
const functionName = 'export default function';
|
|
148
162
|
let base = `import React from 'react';
|
|
149
163
|
import {RouteConfig} from "vatts/react";`;
|
|
150
164
|
if (willTailwind) {
|
|
@@ -257,20 +271,6 @@ ${functionName} Welcome() {
|
|
|
257
271
|
</div>
|
|
258
272
|
);
|
|
259
273
|
}`;
|
|
260
|
-
}
|
|
261
|
-
if (!pathRouter) {
|
|
262
|
-
base += `
|
|
263
|
-
|
|
264
|
-
export const config${typescript ? ': RouteConfig' : ''} = {
|
|
265
|
-
pattern: '/',
|
|
266
|
-
component: Welcome,
|
|
267
|
-
generateMetadata: () => ({
|
|
268
|
-
title: 'Vatts.js | Home'
|
|
269
|
-
})
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
export default config;
|
|
273
|
-
`;
|
|
274
274
|
}
|
|
275
275
|
return base;
|
|
276
276
|
}
|
|
@@ -316,18 +316,8 @@ const ExampleRoute: BackendRouteConfig = {
|
|
|
316
316
|
|
|
317
317
|
export default ExampleRoute;`;
|
|
318
318
|
}
|
|
319
|
-
function vueExampleRoute(typescript,
|
|
320
|
-
return `${
|
|
321
|
-
${typescript ? 'import type { RouteConfig } from "vatts/vue";\n' : ''}
|
|
322
|
-
export const config${typescript ? ': RouteConfig' : ''} = {
|
|
323
|
-
pattern: '/',
|
|
324
|
-
component: undefined,
|
|
325
|
-
generateMetadata: () => ({
|
|
326
|
-
title: 'Vatts.js | Home'
|
|
327
|
-
})
|
|
328
|
-
};
|
|
329
|
-
</script>`}
|
|
330
|
-
${tailwind ? `<template>
|
|
319
|
+
function vueExampleRoute(typescript, tailwind) {
|
|
320
|
+
return `${tailwind ? `<template>
|
|
331
321
|
<div class="flex min-h-screen flex-col items-center justify-center bg-gray-950 p-4 text-center">
|
|
332
322
|
<div class="group relative">
|
|
333
323
|
<div class="absolute -inset-1 rounded-lg bg-gradient-to-r from-purple-600 to-cyan-400 opacity-25 blur transition duration-500 group-hover:opacity-50"></div>
|
package/dist/types.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export type CreateAppOptions = {
|
|
|
8
8
|
moduleAlias?: boolean;
|
|
9
9
|
/** Alias prefix to use when moduleAlias=true (default: "@/") */
|
|
10
10
|
alias?: string;
|
|
11
|
-
pathRouter?: boolean;
|
|
12
11
|
typeScript?: boolean;
|
|
13
12
|
framework?: 'react' | 'vue';
|
|
14
13
|
};
|
|
@@ -19,7 +18,6 @@ export type CreateAppContext = {
|
|
|
19
18
|
willRouteExample: boolean;
|
|
20
19
|
willInstallDependencies: boolean;
|
|
21
20
|
willUseModuleAlias: boolean;
|
|
22
|
-
pathRouter: boolean;
|
|
23
21
|
/** Normalized alias prefix (ex: "@/") */
|
|
24
22
|
moduleAlias: string;
|
|
25
23
|
/** computed */
|
package/dist/validate.js
CHANGED
|
@@ -35,6 +35,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.validateAppName = validateAppName;
|
|
37
37
|
exports.assertTargetDirIsSafeEmpty = assertTargetDirIsSafeEmpty;
|
|
38
|
+
/*
|
|
39
|
+
* This file is part of the Vatts.js Project.
|
|
40
|
+
* Copyright (c) 2026 itsmuzin
|
|
41
|
+
*
|
|
42
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
43
|
+
* you may not use this file except in compliance with the License.
|
|
44
|
+
* You may obtain a copy of the License at
|
|
45
|
+
*
|
|
46
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
47
|
+
*
|
|
48
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
49
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
50
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
51
|
+
* See the License for the specific language governing permissions and
|
|
52
|
+
* limitations under the License.
|
|
53
|
+
*/
|
|
38
54
|
const fs = __importStar(require("node:fs"));
|
|
39
55
|
const path = __importStar(require("node:path"));
|
|
40
56
|
const WINDOWS_RESERVED_NAMES = new Set([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vatts-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-canary",
|
|
4
4
|
"description": "CLI tool to create a new Vatts.js application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
|
-
"author": "
|
|
20
|
+
"author": "mfraz",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^20.11.24",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"commander": "^14.0.2",
|
|
29
29
|
"ts-node": "^10.9.2",
|
|
30
|
-
"vatts": "1.2
|
|
30
|
+
"vatts": "2.1.0-canary.2"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "rimraf dist && tsc",
|