@configjs/cli 1.1.16 → 1.1.17
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/{angular-command-XN26G6L3.js → angular-command-WRBFDIV6.js} +8 -8
- package/dist/{angular-installer-FY43HE72.js → angular-installer-TKZDPFLD.js} +9 -1
- package/dist/angular-setup-QDTWXOB4.js +30 -0
- package/dist/check-5QZOSS2F.js +168 -0
- package/dist/{chunk-NYCK4R4K.js → chunk-56AR5ZW2.js} +361 -96
- package/dist/{chunk-TN27AX4L.js → chunk-5FBN3L7R.js} +797 -18
- package/dist/{chunk-FIB2J36N.js → chunk-5NXT5HCC.js} +142 -20
- package/dist/chunk-EDCNW4UO.js +92 -0
- package/dist/{chunk-UKEHW2LH.js → chunk-F3VNGA2S.js} +17 -3
- package/dist/{chunk-JYWGJJ4M.js → chunk-IY4KX4KL.js} +476 -28
- package/dist/chunk-V2IBYLVH.js +932 -0
- package/dist/chunk-VN4XTFDK.js +315 -0
- package/dist/cli.js +31 -21
- package/dist/{installed-D6CUYQM5.js → installed-DI77OQIT.js} +4 -4
- package/dist/{list-VZDUWV5O.js → list-HWRVKXWR.js} +4 -4
- package/dist/{nextjs-command-WKKOAY7I.js → nextjs-command-H5WRXK5R.js} +8 -9
- package/dist/{nextjs-installer-2ZC5IWJ6.js → nextjs-installer-UM3YQT5Z.js} +9 -2
- package/dist/{nextjs-setup-DYOFF72S.js → nextjs-setup-JIKPIJCX.js} +21 -9
- package/dist/{react-command-2T6IOTHB.js → react-command-XNOHP6WY.js} +8 -9
- package/dist/{remove-ZY3MLPGN.js → remove-AJK2IHVJ.js} +4 -4
- package/dist/{svelte-command-B2DNNQ5Z.js → svelte-command-Q7UBBWXP.js} +8 -8
- package/dist/svelte-installer-WLGID6Z2.js +105 -0
- package/dist/{svelte-setup-FWXLXJAC.js → svelte-setup-33E46IBT.js} +16 -5
- package/dist/{vite-installer-Y6VMFHIM.js → vite-installer-U7XUU3D7.js} +9 -2
- package/dist/{vite-setup-JRELX6K2.js → vite-setup-VO5BOI46.js} +16 -4
- package/dist/{vue-command-IOTC32AI.js → vue-command-FL6OQ6GV.js} +8 -9
- package/dist/{vue-installer-DGBBVF6F.js → vue-installer-BH2O2Y3M.js} +9 -2
- package/dist/{vue-setup-G44DLT2U.js → vue-setup-FK5QT7AY.js} +16 -4
- package/package.json +12 -4
- package/dist/angular-setup-Z6TCKNBG.js +0 -18
- package/dist/check-KNGZSCMM.js +0 -131
- package/dist/chunk-6GV4NKUX.js +0 -122
- package/dist/chunk-QPEUT7QG.js +0 -157
- package/dist/svelte-installer-EOSC3EP3.js +0 -65
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseFrameworkCommand,
|
|
3
3
|
getFrameworkMetadata
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-5FBN3L7R.js";
|
|
5
|
+
import "./chunk-56AR5ZW2.js";
|
|
6
|
+
import "./chunk-IY4KX4KL.js";
|
|
7
7
|
import {
|
|
8
8
|
DetectionError,
|
|
9
9
|
detectContext
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-F3VNGA2S.js";
|
|
11
|
+
import "./chunk-V2IBYLVH.js";
|
|
12
12
|
import "./chunk-KAMPBTFG.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-5NXT5HCC.js";
|
|
14
|
+
import "./chunk-VN4XTFDK.js";
|
|
15
15
|
import {
|
|
16
16
|
getTranslations
|
|
17
17
|
} from "./chunk-L4GX22RG.js";
|
|
18
18
|
import "./chunk-QGM4M3NI.js";
|
|
19
19
|
|
|
20
20
|
// src/cli/commands/angular-command.ts
|
|
21
|
-
import pc from "
|
|
21
|
+
import pc from "chalk";
|
|
22
22
|
var AngularCommand = class extends BaseFrameworkCommand {
|
|
23
23
|
getFramework() {
|
|
24
24
|
return "angular";
|
|
@@ -9,9 +9,16 @@ import "./chunk-QGM4M3NI.js";
|
|
|
9
9
|
// src/cli/utils/angular-installer.ts
|
|
10
10
|
import { spawn } from "child_process";
|
|
11
11
|
import { resolve } from "path";
|
|
12
|
+
function validateProjectName(name) {
|
|
13
|
+
if (!/^[a-zA-Z0-9._-]+$/.test(name)) return false;
|
|
14
|
+
return !name.includes("..") && !name.includes("/") && !name.includes("\\");
|
|
15
|
+
}
|
|
12
16
|
async function createAngularProject(options, currentDir, language) {
|
|
13
17
|
const t = getTranslations(language);
|
|
14
18
|
const spinner = new SpinnerManager();
|
|
19
|
+
if (!validateProjectName(options.projectName)) {
|
|
20
|
+
throw new Error(`Invalid project name: ${options.projectName}`);
|
|
21
|
+
}
|
|
15
22
|
const projectPath = resolve(currentDir, options.projectName);
|
|
16
23
|
try {
|
|
17
24
|
spinner.start(t.angular.creatingProject);
|
|
@@ -30,7 +37,8 @@ async function createAngularProject(options, currentDir, language) {
|
|
|
30
37
|
await new Promise((resolve2, reject) => {
|
|
31
38
|
const child = spawn("npx", args, {
|
|
32
39
|
cwd: currentDir,
|
|
33
|
-
stdio: "pipe"
|
|
40
|
+
stdio: "pipe",
|
|
41
|
+
shell: false
|
|
34
42
|
});
|
|
35
43
|
child.on("error", reject);
|
|
36
44
|
child.on("close", (code) => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
angularSetupSchema,
|
|
3
|
+
getValidationErrorMessage,
|
|
4
|
+
validateInput
|
|
5
|
+
} from "./chunk-EDCNW4UO.js";
|
|
6
|
+
import "./chunk-QGM4M3NI.js";
|
|
7
|
+
|
|
8
|
+
// src/cli/prompts/angular-setup.ts
|
|
9
|
+
import pc from "chalk";
|
|
10
|
+
function promptAngularSetup() {
|
|
11
|
+
console.log();
|
|
12
|
+
console.log(pc.cyan("\u2699\uFE0F Angular Project Setup"));
|
|
13
|
+
console.log();
|
|
14
|
+
const options = {
|
|
15
|
+
projectName: "my-angular-app",
|
|
16
|
+
useTypeScript: true,
|
|
17
|
+
useRouting: true,
|
|
18
|
+
useStylesheet: "scss"
|
|
19
|
+
};
|
|
20
|
+
try {
|
|
21
|
+
const validated = validateInput(angularSetupSchema, options);
|
|
22
|
+
return Promise.resolve(validated);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error(pc.red(`\u274C ${getValidationErrorMessage(error)}`));
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
promptAngularSetup
|
|
30
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CompatibilityValidator,
|
|
3
|
+
allCompatibilityRules
|
|
4
|
+
} from "./chunk-56AR5ZW2.js";
|
|
5
|
+
import {
|
|
6
|
+
ConfigSanitizer,
|
|
7
|
+
pluginRegistry
|
|
8
|
+
} from "./chunk-IY4KX4KL.js";
|
|
9
|
+
import "./chunk-V2IBYLVH.js";
|
|
10
|
+
import {
|
|
11
|
+
getPathValidationErrorMessage,
|
|
12
|
+
validatePathInProjectWithSymlinks
|
|
13
|
+
} from "./chunk-5NXT5HCC.js";
|
|
14
|
+
import {
|
|
15
|
+
logger
|
|
16
|
+
} from "./chunk-VN4XTFDK.js";
|
|
17
|
+
import "./chunk-QGM4M3NI.js";
|
|
18
|
+
|
|
19
|
+
// src/cli/commands/check.ts
|
|
20
|
+
import { readFile, pathExists } from "fs-extra";
|
|
21
|
+
import { join, resolve, relative } from "path";
|
|
22
|
+
import { createHash } from "crypto";
|
|
23
|
+
function hashContent(content) {
|
|
24
|
+
return createHash("sha256").update(content).digest("hex");
|
|
25
|
+
}
|
|
26
|
+
function parseConfigFile(content) {
|
|
27
|
+
const parsed = ConfigSanitizer.validateJSON(content);
|
|
28
|
+
const plugins = parsed["plugins"];
|
|
29
|
+
if (!Array.isArray(plugins)) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
'Le champ "plugins" doit \xEAtre un tableau de noms de packages'
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
const normalizedPlugins = plugins.filter(
|
|
35
|
+
(plugin) => typeof plugin === "string"
|
|
36
|
+
);
|
|
37
|
+
if (normalizedPlugins.length !== plugins.length) {
|
|
38
|
+
throw new Error('Le champ "plugins" doit contenir uniquement des cha\xEEnes');
|
|
39
|
+
}
|
|
40
|
+
return { plugins: normalizedPlugins };
|
|
41
|
+
}
|
|
42
|
+
async function readConfigFileSafely(configPath, projectRoot) {
|
|
43
|
+
const resolvedRoot = resolve(projectRoot);
|
|
44
|
+
const resolvedConfigPath = resolve(configPath);
|
|
45
|
+
const relativePath = relative(resolvedRoot, resolvedConfigPath);
|
|
46
|
+
let safePath = resolvedConfigPath;
|
|
47
|
+
try {
|
|
48
|
+
safePath = await validatePathInProjectWithSymlinks(
|
|
49
|
+
resolvedRoot,
|
|
50
|
+
relativePath
|
|
51
|
+
);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
const errorMessage = getPathValidationErrorMessage(error);
|
|
54
|
+
throw new Error(`Chemin de config invalide: ${errorMessage}`);
|
|
55
|
+
}
|
|
56
|
+
if (!await pathExists(safePath)) {
|
|
57
|
+
throw new Error(`Fichier de configuration introuvable: ${safePath}`);
|
|
58
|
+
}
|
|
59
|
+
const firstRead = await readFile(safePath, "utf-8");
|
|
60
|
+
const firstHash = hashContent(firstRead);
|
|
61
|
+
const secondRead = await readFile(safePath, "utf-8");
|
|
62
|
+
const secondHash = hashContent(secondRead);
|
|
63
|
+
if (firstHash !== secondHash) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"Le fichier de configuration a chang\xE9 pendant la lecture (TOCTOU d\xE9tect\xE9). Relancez la commande."
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return parseConfigFile(firstRead);
|
|
69
|
+
}
|
|
70
|
+
async function checkCompatibility(options) {
|
|
71
|
+
try {
|
|
72
|
+
logger.header("V\xE9rification de la compatibilit\xE9");
|
|
73
|
+
const configPath = options.config || join(process.cwd(), ".confjs.json");
|
|
74
|
+
let config;
|
|
75
|
+
try {
|
|
76
|
+
config = await readConfigFileSafely(configPath, process.cwd());
|
|
77
|
+
} catch (error) {
|
|
78
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
79
|
+
logger.error(
|
|
80
|
+
`Erreur de lecture du fichier de configuration: ${errorMessage}`
|
|
81
|
+
);
|
|
82
|
+
logger.info("Cr\xE9ez un fichier .confjs.json avec le format suivant:");
|
|
83
|
+
logger.info(
|
|
84
|
+
JSON.stringify(
|
|
85
|
+
{
|
|
86
|
+
plugins: ["react-router-dom", "zustand", "tailwindcss"]
|
|
87
|
+
},
|
|
88
|
+
null,
|
|
89
|
+
2
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
if (!config.plugins || !Array.isArray(config.plugins)) {
|
|
95
|
+
logger.error("Format de configuration invalide");
|
|
96
|
+
logger.info('Le champ "plugins" doit \xEAtre un tableau de noms de packages');
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
const selectedPlugins = config.plugins.map((name) => pluginRegistry.find((p) => p.name === name)).filter(Boolean);
|
|
100
|
+
if (selectedPlugins.length === 0) {
|
|
101
|
+
logger.error("Aucun plugin valide trouv\xE9 dans la configuration");
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
const notFound = config.plugins.filter(
|
|
105
|
+
(name) => !pluginRegistry.find((p) => p.name === name)
|
|
106
|
+
);
|
|
107
|
+
if (notFound.length > 0) {
|
|
108
|
+
logger.warn("Plugins non trouv\xE9s:");
|
|
109
|
+
for (const name of notFound) {
|
|
110
|
+
logger.item(name, "yellow");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
logger.section(`Plugins \xE0 v\xE9rifier: ${selectedPlugins.length}`);
|
|
114
|
+
for (const plugin of selectedPlugins) {
|
|
115
|
+
if (plugin) {
|
|
116
|
+
logger.item(`${plugin.displayName} (${plugin.name})`, "blue");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
logger.section("Analyse de compatibilit\xE9...");
|
|
120
|
+
const validator = new CompatibilityValidator(allCompatibilityRules);
|
|
121
|
+
const validation = validator.validate(
|
|
122
|
+
selectedPlugins
|
|
123
|
+
);
|
|
124
|
+
if (validation.errors.length === 0) {
|
|
125
|
+
logger.success("Aucun conflit d\xE9tect\xE9");
|
|
126
|
+
} else {
|
|
127
|
+
logger.error("Conflits d\xE9tect\xE9s:");
|
|
128
|
+
for (const error of validation.errors) {
|
|
129
|
+
logger.item(error.message, "yellow");
|
|
130
|
+
if ("plugins" in error && error.plugins) {
|
|
131
|
+
logger.dim(`Plugins: ${error.plugins.join(", ")}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (validation.warnings.length > 0) {
|
|
136
|
+
logger.warn("Avertissements:");
|
|
137
|
+
for (const warning of validation.warnings) {
|
|
138
|
+
logger.item(warning.message, "yellow");
|
|
139
|
+
if ("plugins" in warning && warning.plugins) {
|
|
140
|
+
logger.dim(`Plugins: ${warning.plugins.join(", ")}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (validation.suggestions.length > 0) {
|
|
145
|
+
logger.info("Suggestions:");
|
|
146
|
+
for (const suggestion of validation.suggestions) {
|
|
147
|
+
logger.item(suggestion, "blue");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (validation.valid) {
|
|
151
|
+
logger.success(
|
|
152
|
+
"Configuration valide. Vous pouvez proc\xE9der \xE0 l'installation."
|
|
153
|
+
);
|
|
154
|
+
process.exit(0);
|
|
155
|
+
} else {
|
|
156
|
+
logger.error(
|
|
157
|
+
"Configuration invalide. Corrigez les erreurs avant d'installer."
|
|
158
|
+
);
|
|
159
|
+
process.exit(2);
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
logger.error("Erreur lors de la v\xE9rification:", error);
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
checkCompatibility
|
|
168
|
+
};
|