@configjs/cli 1.0.4 → 1.0.5

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.
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-G5QBS6TL.js";
5
5
  import {
6
6
  pluginRegistry
7
- } from "./chunk-GICPMTU2.js";
7
+ } from "./chunk-UB6NBZEM.js";
8
8
  import {
9
9
  logger
10
10
  } from "./chunk-5S5KGCVY.js";
@@ -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+\([\s\S]*?\)\s*;?\s*\n\s*\}/m;
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\s+\(([\s\S]*?)\)/m);
2284
- const innerContent = returnMatch?.[1] || "<div>App</div>";
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 returnRegex = /return\s+\([\s\S]*?\)\s*;?/m;
2304
- if (returnRegex.test(modifiedContent)) {
2305
- modifiedContent = modifiedContent.replace(returnRegex, (match) => {
2306
- const innerContent = match.replace(/return\s+\(|\)\s*;?/g, "").trim();
2307
- return isTypeScript ? `return (
2308
- <Provider store={store}>
2309
- ${innerContent}
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.4";
8
+ var version = "1.0.5";
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-LJAWO26W.js");
16
+ const { installReact } = await import("./install-M6JANAU5.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-QC4T762H.js");
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-OTK3GSIY.js");
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-GICPMTU2.js";
10
+ } from "./chunk-UB6NBZEM.js";
11
11
  import {
12
12
  PluginTracker,
13
13
  detectContext
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginRegistry
3
- } from "./chunk-GICPMTU2.js";
3
+ } from "./chunk-UB6NBZEM.js";
4
4
  import "./chunk-5S5KGCVY.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configjs/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "description": "Configure your frontend stack, instantly - Utilitaire CLI d'installation modulaire de bibliothèques frontend",
6
6
  "keywords": [