@configjs/cli 1.0.4 → 1.0.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.
|
@@ -2273,15 +2273,20 @@ function injectProvider2(content, isTypeScript) {
|
|
|
2273
2273
|
importLines.splice(lastImportIndex + 1, 0, storeImport.trim());
|
|
2274
2274
|
modifiedContent = importLines.join("\n");
|
|
2275
2275
|
}
|
|
2276
|
-
const appFunctionRegex = /(export\s+default\s+)?function\s+App\s*\([^)]*\)\s*\{[\s\S]*?\n\s*return\s
|
|
2276
|
+
const appFunctionRegex = /(export\s+default\s+)?function\s+App\s*\([^)]*\)\s*\{[\s\S]*?\n\s*return\s+[\s\S]*?\n\s*\}/m;
|
|
2277
|
+
const normalizeReturn = (returnBlock) => {
|
|
2278
|
+
const raw = returnBlock.replace(/return\s+/, "").trim();
|
|
2279
|
+
const withoutParens = raw.startsWith("(") && raw.endsWith(")") ? raw.slice(1, -1).trim() : raw;
|
|
2280
|
+
return withoutParens;
|
|
2281
|
+
};
|
|
2277
2282
|
if (appFunctionRegex.test(modifiedContent)) {
|
|
2278
2283
|
modifiedContent = modifiedContent.replace(appFunctionRegex, (match) => {
|
|
2279
2284
|
const signatureMatch = match.match(
|
|
2280
2285
|
/((export\s+default\s+)?function\s+App\s*\([^)]*\))/
|
|
2281
2286
|
);
|
|
2282
2287
|
if (signatureMatch) {
|
|
2283
|
-
const returnMatch = match.match(/return
|
|
2284
|
-
const innerContent = returnMatch
|
|
2288
|
+
const returnMatch = match.match(/return[\s\S]*?\n\s*\}/m);
|
|
2289
|
+
const innerContent = returnMatch ? normalizeReturn(returnMatch[0].replace(/\}\s*$/, "")) : "<div>App</div>";
|
|
2285
2290
|
const returnStatement = isTypeScript ? ` return (
|
|
2286
2291
|
<Provider store={store}>
|
|
2287
2292
|
${innerContent.trim()}
|
|
@@ -2300,19 +2305,18 @@ ${returnStatement}}
|
|
|
2300
2305
|
return match;
|
|
2301
2306
|
});
|
|
2302
2307
|
} else {
|
|
2303
|
-
const
|
|
2304
|
-
if (
|
|
2305
|
-
modifiedContent = modifiedContent.replace(
|
|
2306
|
-
const
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
</Provider>
|
|
2311
|
-
)` : `return (
|
|
2308
|
+
const arrowFunctionRegex = /(const|let|var)\s+App\s*=\s*\([^)]*\)\s*=>\s*\{?[\s\S]*?return\s+[\s\S]*?\}?/m;
|
|
2309
|
+
if (arrowFunctionRegex.test(modifiedContent)) {
|
|
2310
|
+
modifiedContent = modifiedContent.replace(arrowFunctionRegex, (match) => {
|
|
2311
|
+
const returnMatch = match.match(/return[\s\S]*/m);
|
|
2312
|
+
const innerContent = returnMatch ? normalizeReturn(returnMatch[0].replace(/\}?\s*$/, "")) : "<div>App</div>";
|
|
2313
|
+
return `const App = () => {
|
|
2314
|
+
return (
|
|
2312
2315
|
<Provider store={store}>
|
|
2313
|
-
${innerContent}
|
|
2316
|
+
${innerContent.trim()}
|
|
2314
2317
|
</Provider>
|
|
2315
|
-
)
|
|
2318
|
+
)
|
|
2319
|
+
}`;
|
|
2316
2320
|
});
|
|
2317
2321
|
} else {
|
|
2318
2322
|
modifiedContent += `
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import "./chunk-QGM4M3NI.js";
|
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
|
|
7
7
|
// package.json
|
|
8
|
-
var version = "1.0.
|
|
8
|
+
var version = "1.0.6";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
11
11
|
var program = new Command();
|
|
@@ -13,7 +13,7 @@ program.name("confjs").description("Configure your frontend stack, instantly").v
|
|
|
13
13
|
program.command("react").description("Configure a React project").option("-y, --yes", "Accept all defaults").option("-d, --dry-run", "Simulate without writing to disk").option("-s, --silent", "Non-interactive mode").option("--debug", "Enable debug logs").option("-c, --config <file>", "Use configuration file").option("-f, --force", "Force installation (overwrite configs)").option("--no-install", "Generate configs only, skip package installation").action(
|
|
14
14
|
async (options) => {
|
|
15
15
|
try {
|
|
16
|
-
const { installReact } = await import("./install-
|
|
16
|
+
const { installReact } = await import("./install-GBC5BFJA.js");
|
|
17
17
|
await installReact(options);
|
|
18
18
|
} catch (error) {
|
|
19
19
|
console.error("Error:", error);
|
|
@@ -23,7 +23,7 @@ program.command("react").description("Configure a React project").option("-y, --
|
|
|
23
23
|
);
|
|
24
24
|
program.command("list").description("List available libraries").option("-c, --category <category>", "Filter by category").action(async (options) => {
|
|
25
25
|
try {
|
|
26
|
-
const { listLibraries } = await import("./list-
|
|
26
|
+
const { listLibraries } = await import("./list-HKDWBO2I.js");
|
|
27
27
|
listLibraries(options);
|
|
28
28
|
} catch (error) {
|
|
29
29
|
console.error("Error:", error);
|
|
@@ -32,7 +32,7 @@ program.command("list").description("List available libraries").option("-c, --ca
|
|
|
32
32
|
});
|
|
33
33
|
program.command("check").description("Check compatibility without installing").option("-c, --config <file>", "Configuration file to check").action(async (options) => {
|
|
34
34
|
try {
|
|
35
|
-
const { checkCompatibility } = await import("./check-
|
|
35
|
+
const { checkCompatibility } = await import("./check-4Y5YGVVD.js");
|
|
36
36
|
await checkCompatibility(options);
|
|
37
37
|
} catch (error) {
|
|
38
38
|
console.error("Error:", error);
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ConfigWriter,
|
|
8
8
|
getPluginsByCategory,
|
|
9
9
|
pluginRegistry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UB6NBZEM.js";
|
|
11
11
|
import {
|
|
12
12
|
PluginTracker,
|
|
13
13
|
detectContext
|
|
@@ -600,21 +600,28 @@ var Installer = class {
|
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
603
|
+
const allPackagesToInstall = [...allDependencies, ...allDevDependencies];
|
|
604
|
+
if (allPackagesToInstall.length > 0) {
|
|
605
|
+
const depsToInstall = allDependencies;
|
|
606
|
+
const devDepsToInstall = allDevDependencies;
|
|
607
|
+
if (depsToInstall.length > 0) {
|
|
608
|
+
await installPackages(depsToInstall, {
|
|
609
|
+
packageManager: this.ctx.packageManager,
|
|
610
|
+
projectRoot: this.ctx.projectRoot,
|
|
611
|
+
dev: false,
|
|
612
|
+
silent: false
|
|
613
|
+
});
|
|
614
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
615
|
+
}
|
|
616
|
+
if (devDepsToInstall.length > 0) {
|
|
617
|
+
await installPackages(devDepsToInstall, {
|
|
618
|
+
packageManager: this.ctx.packageManager,
|
|
619
|
+
projectRoot: this.ctx.projectRoot,
|
|
620
|
+
dev: true,
|
|
621
|
+
silent: false
|
|
622
|
+
});
|
|
623
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
624
|
+
}
|
|
618
625
|
}
|
|
619
626
|
return results;
|
|
620
627
|
}
|