@stormycms/cli 0.0.19 → 0.0.22

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/boilerplate.zip CHANGED
Binary file
package/dist/cli.js CHANGED
@@ -33,6 +33,8 @@ var import_commander = require("commander");
33
33
  // src/plugin-registry.ts
34
34
  var import_node_fs = __toESM(require("fs"));
35
35
  var import_node_path = __toESM(require("path"));
36
+ var import_node_module = require("module");
37
+ var import_node_url = require("url");
36
38
  var PluginRegistry = class {
37
39
  #frameworkPlugins = /* @__PURE__ */ new Map();
38
40
  #customPlugins = /* @__PURE__ */ new Map();
@@ -114,11 +116,14 @@ var PluginRegistry = class {
114
116
  }
115
117
  };
116
118
  var pluginRegistry = new PluginRegistry();
117
- async function loadBuiltInPlugins() {
119
+ async function loadBuiltInPlugins(cwd = process.cwd()) {
118
120
  try {
119
- const reactPlugin = await import("@stormycms/react/plugin");
120
- if (reactPlugin.default) {
121
- pluginRegistry.registerFrameworkPlugin(reactPlugin.default);
121
+ const projectRequire = (0, import_node_module.createRequire)(import_node_path.default.join(cwd, "package.json"));
122
+ const pluginPath = projectRequire.resolve("@stormycms/react/plugin");
123
+ const reactPlugin = await import((0, import_node_url.pathToFileURL)(pluginPath).href);
124
+ const plugin = reactPlugin.default?.default ?? reactPlugin.default;
125
+ if (plugin) {
126
+ pluginRegistry.registerFrameworkPlugin(plugin);
122
127
  }
123
128
  } catch {
124
129
  }
@@ -159,14 +164,14 @@ async function detectFrameworkFromDeps(cwd) {
159
164
  if (deps["vue"] || deps["@vue/runtime-core"]) return "vue";
160
165
  if (deps["svelte"] || deps["svelte-check"]) return "svelte";
161
166
  if (deps["solid-js"]) return "solid";
162
- if (deps["react"] || deps["react-dom"]) return "react";
167
+ if (deps["react"] || deps["react-dom"] || deps["@stormycms/react"]) return "react";
163
168
  return null;
164
169
  } catch {
165
170
  return null;
166
171
  }
167
172
  }
168
173
 
169
- // src/generate.ts
174
+ // src/commands/generate.ts
170
175
  var import_node_fs3 = __toESM(require("fs"));
171
176
  var import_node_path3 = __toESM(require("path"));
172
177
  async function generate(options = {}) {
@@ -176,9 +181,9 @@ async function generate(options = {}) {
176
181
  components: options.components ?? config.components,
177
182
  output: options.output ?? config.output
178
183
  };
179
- await loadBuiltInPlugins();
184
+ await loadBuiltInPlugins(cwd);
180
185
  await pluginRegistry.loadConfigPlugins(cwd);
181
- let framework = config.framework;
186
+ let framework = options.framework ?? config.framework;
182
187
  if (!framework) {
183
188
  framework = await detectFrameworkFromDeps(cwd);
184
189
  if (!framework) {
@@ -229,16 +234,16 @@ function runGeneration(plugin, options) {
229
234
  console.log(`Generated ${outputPath} with ${components.length} component(s) and ${totalFields} field(s)`);
230
235
  }
231
236
 
232
- // src/init.ts
237
+ // src/commands/init.ts
233
238
  var import_node_fs4 = __toESM(require("fs"));
234
239
  var import_node_path4 = __toESM(require("path"));
235
- var import_node_url = require("url");
240
+ var import_node_url2 = require("url");
236
241
  var import_node_child_process = require("child_process");
237
242
  var import_node_util = require("util");
238
243
  var import_adm_zip = __toESM(require("adm-zip"));
239
244
  var import_prompts = __toESM(require("prompts"));
240
245
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
241
- var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
246
+ var __filename2 = (0, import_node_url2.fileURLToPath)(importMetaUrl);
242
247
  var __dirname = import_node_path4.default.dirname(__filename2);
243
248
  var DEFAULT_PROJECT_NAME = "my-stormy-site";
244
249
  var filesToReplaceProjectName = ["package.json", "package-lock.json", "pnpm-lock.yaml", "README.md"];
@@ -457,7 +462,8 @@ async function runPnpmInstall(targetDir) {
457
462
  await execFileAsync("pnpm", ["install"], { cwd: targetDir, timeout: 3e5 });
458
463
  } catch (error) {
459
464
  const execError = error;
460
- throw new Error(`Failed to install dependencies: ${execError.stderr ?? execError.stdout ?? String(error)}`);
465
+ const commandOutput = [execError.stderr, execError.stdout].filter((output) => output?.trim()).join("\n");
466
+ throw new Error(`Failed to install dependencies: ${commandOutput || String(error)}`);
461
467
  }
462
468
  }
463
469
 
@@ -467,7 +473,8 @@ program.name("stormy").description("Stormy CMS CLI tools").version("0.1.0");
467
473
  program.command("generate").description("Generate CMS-wrapped components from component files").option("-c, --components <path>", `Path to the components directory (default: ${DEFAULT_CONFIG.components})`).option("-o, --output <path>", `Output file path (default: ${DEFAULT_CONFIG.output})`).option("-f, --framework <name>", "Framework to use (auto-detected if not specified)").action(async (options) => {
468
474
  await generate({
469
475
  components: options.components,
470
- output: options.output
476
+ output: options.output,
477
+ framework: options.framework
471
478
  });
472
479
  });
473
480
  program.command("init").description("Initialize a new Stormy CMS project from the boilerplate").option("-n, --name <name>", "Project name").option("-t, --target <path>", "Target directory (defaults to ./{project name})").option("--skip-env", "Skip environment variable prompts and use example values").option("--skip-install", "Create the project without installing dependencies").action(async (options) => {
package/dist/index.d.mts CHANGED
@@ -24,6 +24,7 @@ type ComponentInfo = {
24
24
  type GenerateOptions = {
25
25
  components: string;
26
26
  output: string;
27
+ framework?: string;
27
28
  };
28
29
  type InitOptions = {
29
30
  projectName?: string;
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ type ComponentInfo = {
24
24
  type GenerateOptions = {
25
25
  components: string;
26
26
  output: string;
27
+ framework?: string;
27
28
  };
28
29
  type InitOptions = {
29
30
  projectName?: string;
package/dist/index.js CHANGED
@@ -44,6 +44,8 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
44
44
  // src/plugin-registry.ts
45
45
  var import_node_fs = __toESM(require("fs"));
46
46
  var import_node_path = __toESM(require("path"));
47
+ var import_node_module = require("module");
48
+ var import_node_url = require("url");
47
49
  var PluginRegistry = class {
48
50
  #frameworkPlugins = /* @__PURE__ */ new Map();
49
51
  #customPlugins = /* @__PURE__ */ new Map();
@@ -161,23 +163,23 @@ async function detectFrameworkFromDeps(cwd) {
161
163
  if (deps["vue"] || deps["@vue/runtime-core"]) return "vue";
162
164
  if (deps["svelte"] || deps["svelte-check"]) return "svelte";
163
165
  if (deps["solid-js"]) return "solid";
164
- if (deps["react"] || deps["react-dom"]) return "react";
166
+ if (deps["react"] || deps["react-dom"] || deps["@stormycms/react"]) return "react";
165
167
  return null;
166
168
  } catch {
167
169
  return null;
168
170
  }
169
171
  }
170
172
 
171
- // src/init.ts
173
+ // src/commands/init.ts
172
174
  var import_node_fs3 = __toESM(require("fs"));
173
175
  var import_node_path3 = __toESM(require("path"));
174
- var import_node_url = require("url");
176
+ var import_node_url2 = require("url");
175
177
  var import_node_child_process = require("child_process");
176
178
  var import_node_util = require("util");
177
179
  var import_adm_zip = __toESM(require("adm-zip"));
178
180
  var import_prompts = __toESM(require("prompts"));
179
181
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
180
- var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
182
+ var __filename2 = (0, import_node_url2.fileURLToPath)(importMetaUrl);
181
183
  var __dirname = import_node_path3.default.dirname(__filename2);
182
184
  var DEFAULT_PROJECT_NAME = "my-stormy-site";
183
185
  var filesToReplaceProjectName = ["package.json", "package-lock.json", "pnpm-lock.yaml", "README.md"];
@@ -396,7 +398,8 @@ async function runPnpmInstall(targetDir) {
396
398
  await execFileAsync("pnpm", ["install"], { cwd: targetDir, timeout: 3e5 });
397
399
  } catch (error) {
398
400
  const execError = error;
399
- throw new Error(`Failed to install dependencies: ${execError.stderr ?? execError.stdout ?? String(error)}`);
401
+ const commandOutput = [execError.stderr, execError.stdout].filter((output) => output?.trim()).join("\n");
402
+ throw new Error(`Failed to install dependencies: ${commandOutput || String(error)}`);
400
403
  }
401
404
  }
402
405
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  // src/plugin-registry.ts
2
2
  import fs from "fs";
3
3
  import path from "path";
4
+ import { createRequire } from "module";
5
+ import { pathToFileURL } from "url";
4
6
  var PluginRegistry = class {
5
7
  #frameworkPlugins = /* @__PURE__ */ new Map();
6
8
  #customPlugins = /* @__PURE__ */ new Map();
@@ -118,14 +120,14 @@ async function detectFrameworkFromDeps(cwd) {
118
120
  if (deps["vue"] || deps["@vue/runtime-core"]) return "vue";
119
121
  if (deps["svelte"] || deps["svelte-check"]) return "svelte";
120
122
  if (deps["solid-js"]) return "solid";
121
- if (deps["react"] || deps["react-dom"]) return "react";
123
+ if (deps["react"] || deps["react-dom"] || deps["@stormycms/react"]) return "react";
122
124
  return null;
123
125
  } catch {
124
126
  return null;
125
127
  }
126
128
  }
127
129
 
128
- // src/init.ts
130
+ // src/commands/init.ts
129
131
  import fs3 from "fs";
130
132
  import path3 from "path";
131
133
  import { fileURLToPath } from "url";
@@ -353,7 +355,8 @@ async function runPnpmInstall(targetDir) {
353
355
  await execFileAsync("pnpm", ["install"], { cwd: targetDir, timeout: 3e5 });
354
356
  } catch (error) {
355
357
  const execError = error;
356
- throw new Error(`Failed to install dependencies: ${execError.stderr ?? execError.stdout ?? String(error)}`);
358
+ const commandOutput = [execError.stderr, execError.stdout].filter((output) => output?.trim()).join("\n");
359
+ throw new Error(`Failed to install dependencies: ${commandOutput || String(error)}`);
357
360
  }
358
361
  }
359
362
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stormycms/cli",
3
- "version": "0.0.19",
3
+ "version": "0.0.22",
4
4
  "description": "Stormy CMS CLI - Framework-agnostic core with plugin system",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -18,9 +18,11 @@
18
18
  "prompts": "^2.4.2"
19
19
  },
20
20
  "devDependencies": {
21
+ "@microsoft/tui-test": "0.1.0-beta.1",
21
22
  "@types/adm-zip": "^0.5.8",
22
23
  "@types/node": "^18.15.11",
23
24
  "@types/prompts": "^2.4.9",
25
+ "tree-kill": "^1.2.2",
24
26
  "tsup": "^8.5.0",
25
27
  "typescript": "^5.0.0"
26
28
  },
@@ -32,7 +34,8 @@
32
34
  "publish:dev": "pnpm publish --registry=https://gitlab.com/api/v4/projects/78099267/packages/npm/ --no-git-checks",
33
35
  "dev": "tsup --watch",
34
36
  "typecheck": "tsc --noEmit",
35
- "test": "vitest run",
37
+ "test": "vitest run --exclude test/init.certification.test.ts",
38
+ "test:e2e": "vitest run test/init.certification.test.ts",
36
39
  "lint": "eslint . --cache --cache-location=node_modules/.cache/eslint/.eslint-cache",
37
40
  "lint:fix": "npm run lint -- --fix",
38
41
  "format": "prettier . --check --cache --cache-location=node_modules/.cache/prettier/.prettier-cache --ignore-path=../../.gitignore",