create-nexo 1.1.5 → 1.1.6
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/api/index.js +1 -233
- package/dist/bin/nexo.js +36 -430
- package/dist/configurators/core/framework.js +5 -51
- package/dist/configurators/core/index.js +1 -9
- package/dist/configurators/core/language.js +1 -58
- package/dist/configurators/core/variant.js +1 -22
- package/dist/configurators/factory.js +1 -48
- package/dist/configurators/index.js +1 -5
- package/dist/configurators/project/ai-instructions.js +116 -172
- package/dist/configurators/project/auth.js +2 -29
- package/dist/configurators/project/cicd.js +11 -83
- package/dist/configurators/project/i18n.js +3 -53
- package/dist/configurators/project/index.js +1 -16
- package/dist/configurators/project/mandatory.js +7 -60
- package/dist/configurators/project/structure.js +1 -79
- package/dist/configurators/state/animation.js +1 -18
- package/dist/configurators/state/dataFetching.js +1 -36
- package/dist/configurators/state/forms.js +1 -31
- package/dist/configurators/state/index.js +1 -13
- package/dist/configurators/state/routing.js +1 -17
- package/dist/configurators/state/state.js +14 -56
- package/dist/configurators/styling/icons.js +1 -25
- package/dist/configurators/styling/index.js +1 -9
- package/dist/configurators/styling/styling.js +7 -75
- package/dist/configurators/styling/ui.js +6 -104
- package/dist/constants/index.js +1 -94
- package/dist/core/config.js +1 -121
- package/dist/core/index.js +1 -12
- package/dist/core/lazy-loader.js +1 -211
- package/dist/core/parallel.js +1 -100
- package/dist/core/presets.js +2 -76
- package/dist/core/prompts/core.js +1 -424
- package/dist/core/prompts/filter.js +1 -28
- package/dist/core/prompts/index.js +1 -71
- package/dist/core/prompts/optional.js +1 -290
- package/dist/core/prompts/utils.js +1 -25
- package/dist/core/prompts.js +1 -2
- package/dist/core/setup.js +1 -110
- package/dist/core/wizard.js +6 -241
- package/dist/errors/index.js +1 -213
- package/dist/errors/messages.js +11 -214
- package/dist/generators/index.js +52 -306
- package/dist/index.js +1 -97
- package/dist/plugins/index.js +1 -25
- package/dist/plugins/loader.js +1 -173
- package/dist/plugins/manager.js +1 -144
- package/dist/plugins/types.js +0 -1
- package/dist/security/index.js +1 -189
- package/dist/templates/entry.js +1 -24
- package/dist/templates/index.js +1 -12
- package/dist/templates/main.js +14 -82
- package/dist/templates/readme.js +20 -111
- package/dist/templates/styles.js +2 -15
- package/dist/templates/welcome.js +6 -146
- package/dist/types/index.js +0 -1
- package/dist/utils/batch-writer.js +1 -155
- package/dist/utils/cache.js +1 -114
- package/dist/utils/detection.js +1 -36
- package/dist/utils/fileTree.js +2 -84
- package/dist/utils/fs.js +2 -79
- package/dist/utils/helpers.js +2 -154
- package/dist/utils/index.js +1 -15
- package/dist/utils/logger.js +21 -159
- package/dist/utils/package-manager.js +1 -64
- package/dist/utils/progress.js +4 -147
- package/dist/utils/spinner.js +1 -59
- package/dist/validation/index.js +1 -234
- package/package.json +1 -2
- package/dist/api/index.d.ts +0 -196
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js.map +0 -7
- package/dist/bin/nexo.d.ts +0 -2
- package/dist/bin/nexo.d.ts.map +0 -1
- package/dist/bin/nexo.js.map +0 -7
- package/dist/configurators/core/framework.d.ts +0 -3
- package/dist/configurators/core/framework.d.ts.map +0 -1
- package/dist/configurators/core/framework.js.map +0 -7
- package/dist/configurators/core/index.d.ts +0 -4
- package/dist/configurators/core/index.d.ts.map +0 -1
- package/dist/configurators/core/index.js.map +0 -7
- package/dist/configurators/core/language.d.ts +0 -3
- package/dist/configurators/core/language.d.ts.map +0 -1
- package/dist/configurators/core/language.js.map +0 -7
- package/dist/configurators/core/variant.d.ts +0 -3
- package/dist/configurators/core/variant.d.ts.map +0 -1
- package/dist/configurators/core/variant.js.map +0 -7
- package/dist/configurators/factory.d.ts +0 -36
- package/dist/configurators/factory.d.ts.map +0 -1
- package/dist/configurators/factory.js.map +0 -7
- package/dist/configurators/index.d.ts +0 -5
- package/dist/configurators/index.d.ts.map +0 -1
- package/dist/configurators/index.js.map +0 -7
- package/dist/configurators/project/ai-instructions.d.ts +0 -7
- package/dist/configurators/project/ai-instructions.d.ts.map +0 -1
- package/dist/configurators/project/ai-instructions.js.map +0 -7
- package/dist/configurators/project/auth.d.ts +0 -3
- package/dist/configurators/project/auth.d.ts.map +0 -1
- package/dist/configurators/project/auth.js.map +0 -7
- package/dist/configurators/project/cicd.d.ts +0 -30
- package/dist/configurators/project/cicd.d.ts.map +0 -1
- package/dist/configurators/project/cicd.js.map +0 -7
- package/dist/configurators/project/i18n.d.ts +0 -3
- package/dist/configurators/project/i18n.d.ts.map +0 -1
- package/dist/configurators/project/i18n.js.map +0 -7
- package/dist/configurators/project/index.d.ts +0 -7
- package/dist/configurators/project/index.d.ts.map +0 -1
- package/dist/configurators/project/index.js.map +0 -7
- package/dist/configurators/project/mandatory.d.ts +0 -3
- package/dist/configurators/project/mandatory.d.ts.map +0 -1
- package/dist/configurators/project/mandatory.js.map +0 -7
- package/dist/configurators/project/structure.d.ts +0 -3
- package/dist/configurators/project/structure.d.ts.map +0 -1
- package/dist/configurators/project/structure.js.map +0 -7
- package/dist/configurators/state/animation.d.ts +0 -2
- package/dist/configurators/state/animation.d.ts.map +0 -1
- package/dist/configurators/state/animation.js.map +0 -7
- package/dist/configurators/state/dataFetching.d.ts +0 -3
- package/dist/configurators/state/dataFetching.d.ts.map +0 -1
- package/dist/configurators/state/dataFetching.js.map +0 -7
- package/dist/configurators/state/forms.d.ts +0 -2
- package/dist/configurators/state/forms.d.ts.map +0 -1
- package/dist/configurators/state/forms.js.map +0 -7
- package/dist/configurators/state/index.d.ts +0 -6
- package/dist/configurators/state/index.d.ts.map +0 -1
- package/dist/configurators/state/index.js.map +0 -7
- package/dist/configurators/state/routing.d.ts +0 -2
- package/dist/configurators/state/routing.d.ts.map +0 -1
- package/dist/configurators/state/routing.js.map +0 -7
- package/dist/configurators/state/state.d.ts +0 -3
- package/dist/configurators/state/state.d.ts.map +0 -1
- package/dist/configurators/state/state.js.map +0 -7
- package/dist/configurators/styling/icons.d.ts +0 -2
- package/dist/configurators/styling/icons.d.ts.map +0 -1
- package/dist/configurators/styling/icons.js.map +0 -7
- package/dist/configurators/styling/index.d.ts +0 -4
- package/dist/configurators/styling/index.d.ts.map +0 -1
- package/dist/configurators/styling/index.js.map +0 -7
- package/dist/configurators/styling/styling.d.ts +0 -3
- package/dist/configurators/styling/styling.d.ts.map +0 -1
- package/dist/configurators/styling/styling.js.map +0 -7
- package/dist/configurators/styling/ui.d.ts +0 -3
- package/dist/configurators/styling/ui.d.ts.map +0 -1
- package/dist/configurators/styling/ui.js.map +0 -7
- package/dist/constants/index.d.ts +0 -94
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js.map +0 -7
- package/dist/core/config.d.ts +0 -62
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js.map +0 -7
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -7
- package/dist/core/lazy-loader.d.ts +0 -57
- package/dist/core/lazy-loader.d.ts.map +0 -1
- package/dist/core/lazy-loader.js.map +0 -7
- package/dist/core/parallel.d.ts +0 -29
- package/dist/core/parallel.d.ts.map +0 -1
- package/dist/core/parallel.js.map +0 -7
- package/dist/core/presets.d.ts +0 -10
- package/dist/core/presets.d.ts.map +0 -1
- package/dist/core/presets.js.map +0 -7
- package/dist/core/prompts/core.d.ts +0 -18
- package/dist/core/prompts/core.d.ts.map +0 -1
- package/dist/core/prompts/core.js.map +0 -7
- package/dist/core/prompts/filter.d.ts +0 -34
- package/dist/core/prompts/filter.d.ts.map +0 -1
- package/dist/core/prompts/filter.js.map +0 -7
- package/dist/core/prompts/index.d.ts +0 -10
- package/dist/core/prompts/index.d.ts.map +0 -1
- package/dist/core/prompts/index.js.map +0 -7
- package/dist/core/prompts/optional.d.ts +0 -16
- package/dist/core/prompts/optional.d.ts.map +0 -1
- package/dist/core/prompts/optional.js.map +0 -7
- package/dist/core/prompts/utils.d.ts +0 -25
- package/dist/core/prompts/utils.d.ts.map +0 -1
- package/dist/core/prompts/utils.js.map +0 -7
- package/dist/core/prompts.d.ts +0 -6
- package/dist/core/prompts.d.ts.map +0 -1
- package/dist/core/prompts.js.map +0 -7
- package/dist/core/setup.d.ts +0 -38
- package/dist/core/setup.d.ts.map +0 -1
- package/dist/core/setup.js.map +0 -7
- package/dist/core/wizard.d.ts +0 -39
- package/dist/core/wizard.d.ts.map +0 -1
- package/dist/core/wizard.js.map +0 -7
- package/dist/errors/index.d.ts +0 -67
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -7
- package/dist/errors/messages.d.ts +0 -56
- package/dist/errors/messages.d.ts.map +0 -1
- package/dist/errors/messages.js.map +0 -7
- package/dist/generators/index.d.ts +0 -86
- package/dist/generators/index.d.ts.map +0 -1
- package/dist/generators/index.js.map +0 -7
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -7
- package/dist/plugins/index.d.ts +0 -48
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js.map +0 -7
- package/dist/plugins/loader.d.ts +0 -38
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js.map +0 -7
- package/dist/plugins/manager.d.ts +0 -32
- package/dist/plugins/manager.d.ts.map +0 -1
- package/dist/plugins/manager.js.map +0 -7
- package/dist/plugins/types.d.ts +0 -186
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/plugins/types.js.map +0 -7
- package/dist/security/index.d.ts +0 -59
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/index.js.map +0 -7
- package/dist/templates/entry.d.ts +0 -9
- package/dist/templates/entry.d.ts.map +0 -1
- package/dist/templates/entry.js.map +0 -7
- package/dist/templates/index.d.ts +0 -7
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/templates/index.js.map +0 -7
- package/dist/templates/main.d.ts +0 -6
- package/dist/templates/main.d.ts.map +0 -1
- package/dist/templates/main.js.map +0 -7
- package/dist/templates/readme.d.ts +0 -3
- package/dist/templates/readme.d.ts.map +0 -1
- package/dist/templates/readme.js.map +0 -7
- package/dist/templates/styles.d.ts +0 -6
- package/dist/templates/styles.d.ts.map +0 -1
- package/dist/templates/styles.js.map +0 -7
- package/dist/templates/welcome.d.ts +0 -10
- package/dist/templates/welcome.d.ts.map +0 -1
- package/dist/templates/welcome.js.map +0 -7
- package/dist/types/index.d.ts +0 -51
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -7
- package/dist/utils/batch-writer.d.ts +0 -101
- package/dist/utils/batch-writer.d.ts.map +0 -1
- package/dist/utils/batch-writer.js.map +0 -7
- package/dist/utils/cache.d.ts +0 -60
- package/dist/utils/cache.d.ts.map +0 -1
- package/dist/utils/cache.js.map +0 -7
- package/dist/utils/detection.d.ts +0 -4
- package/dist/utils/detection.d.ts.map +0 -1
- package/dist/utils/detection.js.map +0 -7
- package/dist/utils/fileTree.d.ts +0 -3
- package/dist/utils/fileTree.d.ts.map +0 -1
- package/dist/utils/fileTree.js.map +0 -7
- package/dist/utils/fs.d.ts +0 -22
- package/dist/utils/fs.d.ts.map +0 -1
- package/dist/utils/fs.js.map +0 -7
- package/dist/utils/helpers.d.ts +0 -91
- package/dist/utils/helpers.d.ts.map +0 -1
- package/dist/utils/helpers.js.map +0 -7
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -7
- package/dist/utils/logger.d.ts +0 -98
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -7
- package/dist/utils/package-manager.d.ts +0 -26
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -7
- package/dist/utils/progress.d.ts +0 -85
- package/dist/utils/progress.d.ts.map +0 -1
- package/dist/utils/progress.js.map +0 -7
- package/dist/utils/spinner.d.ts +0 -9
- package/dist/utils/spinner.d.ts.map +0 -1
- package/dist/utils/spinner.js.map +0 -7
- package/dist/validation/index.d.ts +0 -63
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -7
package/dist/api/index.js
CHANGED
|
@@ -1,233 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { setup } from "../core/setup.js";
|
|
4
|
-
import { generateFileTree } from "../utils/fileTree.js";
|
|
5
|
-
import { pathExists } from "../utils/fs.js";
|
|
6
|
-
import {
|
|
7
|
-
getCompatibilityWarnings,
|
|
8
|
-
validateProjectName,
|
|
9
|
-
validateSelections
|
|
10
|
-
} from "../validation/index.js";
|
|
11
|
-
const DEFAULT_SELECTIONS = {
|
|
12
|
-
projectName: "my-app",
|
|
13
|
-
framework: "react",
|
|
14
|
-
variant: "ts",
|
|
15
|
-
language: "typescript",
|
|
16
|
-
styling: "tailwind",
|
|
17
|
-
ui: "none",
|
|
18
|
-
forms: "none",
|
|
19
|
-
state: "none",
|
|
20
|
-
routing: "none",
|
|
21
|
-
dataFetching: "none",
|
|
22
|
-
icons: "none",
|
|
23
|
-
structure: "simple",
|
|
24
|
-
i18n: "none",
|
|
25
|
-
auth: "none"
|
|
26
|
-
};
|
|
27
|
-
const mergeSelections = (partial, projectName) => {
|
|
28
|
-
const merged = {
|
|
29
|
-
...DEFAULT_SELECTIONS,
|
|
30
|
-
...partial,
|
|
31
|
-
projectName
|
|
32
|
-
};
|
|
33
|
-
merged.language = merged.variant.startsWith("ts") ? "typescript" : "javascript";
|
|
34
|
-
merged.hasCompiler = merged.variant.includes("compiler");
|
|
35
|
-
merged.hasSWC = merged.variant.includes("swc");
|
|
36
|
-
return merged;
|
|
37
|
-
};
|
|
38
|
-
const getDependencies = (selections) => {
|
|
39
|
-
const deps = [];
|
|
40
|
-
deps.push({ name: "react", version: "^19.0.0", isDev: false, reason: "Framework" });
|
|
41
|
-
deps.push({ name: "react-dom", version: "^19.0.0", isDev: false, reason: "Framework" });
|
|
42
|
-
if (selections.styling === "tailwind") {
|
|
43
|
-
deps.push({ name: "tailwindcss", version: "^4.0.0", isDev: true, reason: "Styling" });
|
|
44
|
-
deps.push({ name: "@tailwindcss/vite", version: "^4.0.0", isDev: true, reason: "Styling" });
|
|
45
|
-
} else if (selections.styling === "sass") {
|
|
46
|
-
deps.push({ name: "sass", version: "^1.83.0", isDev: true, reason: "Styling" });
|
|
47
|
-
}
|
|
48
|
-
if (selections.ui === "shadcn") {
|
|
49
|
-
deps.push({ name: "class-variance-authority", version: "^0.7.1", isDev: false, reason: "UI Library" });
|
|
50
|
-
deps.push({ name: "clsx", version: "^2.1.1", isDev: false, reason: "UI Library" });
|
|
51
|
-
deps.push({ name: "tailwind-merge", version: "^2.6.0", isDev: false, reason: "UI Library" });
|
|
52
|
-
} else if (selections.ui === "mantine") {
|
|
53
|
-
deps.push({ name: "@mantine/core", version: "^7.15.0", isDev: false, reason: "UI Library" });
|
|
54
|
-
deps.push({ name: "@mantine/hooks", version: "^7.15.0", isDev: false, reason: "UI Library" });
|
|
55
|
-
}
|
|
56
|
-
if (selections.state === "zustand") {
|
|
57
|
-
deps.push({ name: "zustand", version: "^5.0.0", isDev: false, reason: "State Management" });
|
|
58
|
-
} else if (selections.state === "redux") {
|
|
59
|
-
deps.push({ name: "@reduxjs/toolkit", version: "^2.5.0", isDev: false, reason: "State Management" });
|
|
60
|
-
deps.push({ name: "react-redux", version: "^9.2.0", isDev: false, reason: "State Management" });
|
|
61
|
-
} else if (selections.state === "jotai") {
|
|
62
|
-
deps.push({ name: "jotai", version: "^2.10.0", isDev: false, reason: "State Management" });
|
|
63
|
-
}
|
|
64
|
-
if (selections.forms?.includes("rhf")) {
|
|
65
|
-
deps.push({ name: "react-hook-form", version: "^7.54.0", isDev: false, reason: "Forms" });
|
|
66
|
-
if (selections.forms.includes("zod")) {
|
|
67
|
-
deps.push({ name: "zod", version: "^3.24.0", isDev: false, reason: "Forms Validation" });
|
|
68
|
-
deps.push({ name: "@hookform/resolvers", version: "^3.9.0", isDev: false, reason: "Forms Validation" });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (selections.routing === "react-router") {
|
|
72
|
-
deps.push({ name: "react-router-dom", version: "^7.1.0", isDev: false, reason: "Routing" });
|
|
73
|
-
} else if (selections.routing === "tanstack-router") {
|
|
74
|
-
deps.push({ name: "@tanstack/react-router", version: "^1.93.0", isDev: false, reason: "Routing" });
|
|
75
|
-
}
|
|
76
|
-
if (selections.dataFetching === "tanstack-query") {
|
|
77
|
-
deps.push({ name: "@tanstack/react-query", version: "^5.62.0", isDev: false, reason: "Data Fetching" });
|
|
78
|
-
} else if (selections.dataFetching === "axios") {
|
|
79
|
-
deps.push({ name: "axios", version: "^1.7.0", isDev: false, reason: "Data Fetching" });
|
|
80
|
-
}
|
|
81
|
-
if (selections.icons === "lucide") {
|
|
82
|
-
deps.push({ name: "lucide-react", version: "^0.468.0", isDev: false, reason: "Icons" });
|
|
83
|
-
}
|
|
84
|
-
if (selections.i18n === "i18next") {
|
|
85
|
-
deps.push({ name: "i18next", version: "^24.0.0", isDev: false, reason: "Internationalization" });
|
|
86
|
-
deps.push({ name: "react-i18next", version: "^15.1.0", isDev: false, reason: "Internationalization" });
|
|
87
|
-
}
|
|
88
|
-
return deps;
|
|
89
|
-
};
|
|
90
|
-
const collectFiles = async (dir, base = "") => {
|
|
91
|
-
const files = [];
|
|
92
|
-
try {
|
|
93
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
94
|
-
for (const entry of entries) {
|
|
95
|
-
const relativePath = base ? `${base}/${entry.name}` : entry.name;
|
|
96
|
-
if (entry.isDirectory()) {
|
|
97
|
-
if (entry.name === "node_modules") continue;
|
|
98
|
-
files.push(...await collectFiles(path.join(dir, entry.name), relativePath));
|
|
99
|
-
} else {
|
|
100
|
-
files.push(relativePath);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
} catch {
|
|
104
|
-
}
|
|
105
|
-
return files;
|
|
106
|
-
};
|
|
107
|
-
const create = async (options) => {
|
|
108
|
-
const startTime = Date.now();
|
|
109
|
-
const errors = [];
|
|
110
|
-
const warnings = [];
|
|
111
|
-
const selections = mergeSelections(options.selections, options.projectName);
|
|
112
|
-
const projectPath = path.resolve(options.targetDir, options.projectName);
|
|
113
|
-
const validation = validateSelections(selections);
|
|
114
|
-
if (!validation.valid) {
|
|
115
|
-
return {
|
|
116
|
-
success: false,
|
|
117
|
-
projectPath,
|
|
118
|
-
duration: Date.now() - startTime,
|
|
119
|
-
files: [],
|
|
120
|
-
errors: validation.errors,
|
|
121
|
-
warnings: validation.warnings,
|
|
122
|
-
dryRun: options.dryRun ?? false
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
warnings.push(...validation.warnings);
|
|
126
|
-
warnings.push(...getCompatibilityWarnings(selections));
|
|
127
|
-
if (!options.force && await pathExists(projectPath)) {
|
|
128
|
-
return {
|
|
129
|
-
success: false,
|
|
130
|
-
projectPath,
|
|
131
|
-
duration: Date.now() - startTime,
|
|
132
|
-
files: [],
|
|
133
|
-
errors: [`Directory "${projectPath}" already exists. Use force: true to overwrite.`],
|
|
134
|
-
warnings,
|
|
135
|
-
dryRun: options.dryRun ?? false
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
if (options.dryRun) {
|
|
139
|
-
const _previewResult = await preview({ selections, projectName: options.projectName });
|
|
140
|
-
return {
|
|
141
|
-
success: true,
|
|
142
|
-
projectPath,
|
|
143
|
-
duration: Date.now() - startTime,
|
|
144
|
-
files: [],
|
|
145
|
-
// Would need to parse fileTree for actual files
|
|
146
|
-
errors: [],
|
|
147
|
-
warnings,
|
|
148
|
-
dryRun: true
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
const originalConsole = {
|
|
152
|
-
log: console.log,
|
|
153
|
-
error: console.error,
|
|
154
|
-
warn: console.warn
|
|
155
|
-
};
|
|
156
|
-
if (options.silent) {
|
|
157
|
-
console.log = () => {
|
|
158
|
-
};
|
|
159
|
-
console.error = () => {
|
|
160
|
-
};
|
|
161
|
-
console.warn = () => {
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
165
|
-
await setup({
|
|
166
|
-
selections,
|
|
167
|
-
targetDir: options.targetDir,
|
|
168
|
-
parallel: options.parallel ?? false
|
|
169
|
-
});
|
|
170
|
-
const files = await collectFiles(projectPath);
|
|
171
|
-
return {
|
|
172
|
-
success: true,
|
|
173
|
-
projectPath,
|
|
174
|
-
duration: Date.now() - startTime,
|
|
175
|
-
files,
|
|
176
|
-
errors: [],
|
|
177
|
-
warnings,
|
|
178
|
-
dryRun: false
|
|
179
|
-
};
|
|
180
|
-
} catch (error) {
|
|
181
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
182
|
-
errors.push(errorMessage);
|
|
183
|
-
return {
|
|
184
|
-
success: false,
|
|
185
|
-
projectPath,
|
|
186
|
-
duration: Date.now() - startTime,
|
|
187
|
-
files: [],
|
|
188
|
-
errors,
|
|
189
|
-
warnings,
|
|
190
|
-
dryRun: false
|
|
191
|
-
};
|
|
192
|
-
} finally {
|
|
193
|
-
if (options.silent) {
|
|
194
|
-
console.log = originalConsole.log;
|
|
195
|
-
console.error = originalConsole.error;
|
|
196
|
-
console.warn = originalConsole.warn;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
const validate = (selections) => {
|
|
201
|
-
const merged = mergeSelections(selections, selections.projectName || "temp-project");
|
|
202
|
-
return validateSelections(merged);
|
|
203
|
-
};
|
|
204
|
-
const preview = async (options) => {
|
|
205
|
-
const projectName = options.projectName || "preview-project";
|
|
206
|
-
const selections = mergeSelections(options.selections, projectName);
|
|
207
|
-
const validation = validateSelections(selections);
|
|
208
|
-
const fileTree = generateFileTree(selections);
|
|
209
|
-
const dependencies = getDependencies(selections);
|
|
210
|
-
const estimatedFileCount = (fileTree.match(/[^/]\n/g) || []).length;
|
|
211
|
-
return {
|
|
212
|
-
fileTree,
|
|
213
|
-
dependencies,
|
|
214
|
-
validation,
|
|
215
|
-
estimatedFileCount
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
const nexo = {
|
|
219
|
-
create,
|
|
220
|
-
validate,
|
|
221
|
-
preview,
|
|
222
|
-
validateProjectName
|
|
223
|
-
};
|
|
224
|
-
var api_default = nexo;
|
|
225
|
-
export {
|
|
226
|
-
create,
|
|
227
|
-
api_default as default,
|
|
228
|
-
nexo,
|
|
229
|
-
preview,
|
|
230
|
-
validate,
|
|
231
|
-
validateProjectName
|
|
232
|
-
};
|
|
233
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import v from"node:fs/promises";import m from"node:path";import{setup as g}from"../core/setup.js";import{generateFileTree as h}from"../utils/fileTree.js";import{pathExists as w}from"../utils/fs.js";import{getCompatibilityWarnings as y,validateProjectName as D,validateSelections as c}from"../validation/index.js";const x={projectName:"my-app",framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"none",forms:"none",state:"none",routing:"none",dataFetching:"none",icons:"none",structure:"simple",i18n:"none",auth:"none"},u=(e,r)=>{const n={...x,...e,projectName:r};return n.language=n.variant.startsWith("ts")?"typescript":"javascript",n.hasCompiler=n.variant.includes("compiler"),n.hasSWC=n.variant.includes("swc"),n},R=e=>{const r=[];return r.push({name:"react",version:"^19.0.0",isDev:!1,reason:"Framework"}),r.push({name:"react-dom",version:"^19.0.0",isDev:!1,reason:"Framework"}),e.styling==="tailwind"?(r.push({name:"tailwindcss",version:"^4.0.0",isDev:!0,reason:"Styling"}),r.push({name:"@tailwindcss/vite",version:"^4.0.0",isDev:!0,reason:"Styling"})):e.styling==="sass"&&r.push({name:"sass",version:"^1.83.0",isDev:!0,reason:"Styling"}),e.ui==="shadcn"?(r.push({name:"class-variance-authority",version:"^0.7.1",isDev:!1,reason:"UI Library"}),r.push({name:"clsx",version:"^2.1.1",isDev:!1,reason:"UI Library"}),r.push({name:"tailwind-merge",version:"^2.6.0",isDev:!1,reason:"UI Library"})):e.ui==="mantine"&&(r.push({name:"@mantine/core",version:"^7.15.0",isDev:!1,reason:"UI Library"}),r.push({name:"@mantine/hooks",version:"^7.15.0",isDev:!1,reason:"UI Library"})),e.state==="zustand"?r.push({name:"zustand",version:"^5.0.0",isDev:!1,reason:"State Management"}):e.state==="redux"?(r.push({name:"@reduxjs/toolkit",version:"^2.5.0",isDev:!1,reason:"State Management"}),r.push({name:"react-redux",version:"^9.2.0",isDev:!1,reason:"State Management"})):e.state==="jotai"&&r.push({name:"jotai",version:"^2.10.0",isDev:!1,reason:"State Management"}),e.forms?.includes("rhf")&&(r.push({name:"react-hook-form",version:"^7.54.0",isDev:!1,reason:"Forms"}),e.forms.includes("zod")&&(r.push({name:"zod",version:"^3.24.0",isDev:!1,reason:"Forms Validation"}),r.push({name:"@hookform/resolvers",version:"^3.9.0",isDev:!1,reason:"Forms Validation"}))),e.routing==="react-router"?r.push({name:"react-router-dom",version:"^7.1.0",isDev:!1,reason:"Routing"}):e.routing==="tanstack-router"&&r.push({name:"@tanstack/react-router",version:"^1.93.0",isDev:!1,reason:"Routing"}),e.dataFetching==="tanstack-query"?r.push({name:"@tanstack/react-query",version:"^5.62.0",isDev:!1,reason:"Data Fetching"}):e.dataFetching==="axios"&&r.push({name:"axios",version:"^1.7.0",isDev:!1,reason:"Data Fetching"}),e.icons==="lucide"&&r.push({name:"lucide-react",version:"^0.468.0",isDev:!1,reason:"Icons"}),e.i18n==="i18next"&&(r.push({name:"i18next",version:"^24.0.0",isDev:!1,reason:"Internationalization"}),r.push({name:"react-i18next",version:"^15.1.0",isDev:!1,reason:"Internationalization"})),r},f=async(e,r="")=>{const n=[];try{const t=await v.readdir(e,{withFileTypes:!0});for(const s of t){const a=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){if(s.name==="node_modules")continue;n.push(...await f(m.join(e,s.name),a))}else n.push(a)}}catch{}return n},j=async e=>{const r=Date.now(),n=[],t=[],s=u(e.selections,e.projectName),a=m.resolve(e.targetDir,e.projectName),i=c(s);if(!i.valid)return{success:!1,projectPath:a,duration:Date.now()-r,files:[],errors:i.errors,warnings:i.warnings,dryRun:e.dryRun??!1};if(t.push(...i.warnings),t.push(...y(s)),!e.force&&await w(a))return{success:!1,projectPath:a,duration:Date.now()-r,files:[],errors:[`Directory "${a}" already exists. Use force: true to overwrite.`],warnings:t,dryRun:e.dryRun??!1};if(e.dryRun){const o=await p({selections:s,projectName:e.projectName});return{success:!0,projectPath:a,duration:Date.now()-r,files:[],errors:[],warnings:t,dryRun:!0}}const l={log:console.log,error:console.error,warn:console.warn};e.silent&&(console.log=()=>{},console.error=()=>{},console.warn=()=>{});try{await g({selections:s,targetDir:e.targetDir,parallel:e.parallel??!1});const o=await f(a);return{success:!0,projectPath:a,duration:Date.now()-r,files:o,errors:[],warnings:t,dryRun:!1}}catch(o){const d=o instanceof Error?o.message:String(o);return n.push(d),{success:!1,projectPath:a,duration:Date.now()-r,files:[],errors:n,warnings:t,dryRun:!1}}finally{e.silent&&(console.log=l.log,console.error=l.error,console.warn=l.warn)}},S=e=>{const r=u(e,e.projectName||"temp-project");return c(r)},p=async e=>{const r=e.projectName||"preview-project",n=u(e.selections,r),t=c(n),s=h(n),a=R(n),i=(s.match(/[^/]\n/g)||[]).length;return{fileTree:s,dependencies:a,validation:t,estimatedFileCount:i}};const k={create:j,validate:S,preview:p,validateProjectName:D};var C=k;export{j as create,C as default,k as nexo,p as preview,S as validate,D as validateProjectName};
|