@cedarjs/cli-storybook-vite 5.0.4-next.167 → 5.0.4

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.
@@ -1,5 +1,5 @@
1
1
  import type { Argv } from 'yargs';
2
- import type { StorybookYargsOptions } from '../types.js';
2
+ import type { StorybookYargsOptions } from '../types';
3
3
  export declare const command = "storybook";
4
4
  export declare const aliases: string[];
5
5
  export declare const description = "Launch Storybook: a tool for building UI components and pages in isolation";
@@ -1 +1 @@
1
- {"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../../src/commands/storybook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD,eAAO,MAAM,OAAO,cAAc,CAAA;AAClC,eAAO,MAAM,OAAO,UAAS,CAAA;AAC7B,eAAO,MAAM,WAAW,+EACsD,CAAA;AAE9E,eAAO,MAAM,cAAc,EAAE,qBAO5B,CAAA;AAED,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,CAAC,qBAAqB,CAAC,GACjC,IAAI,CAAC,qBAAqB,CAAC,CAwC7B;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB3E"}
1
+ {"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../../src/commands/storybook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAIjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAErD,eAAO,MAAM,OAAO,cAAc,CAAA;AAClC,eAAO,MAAM,OAAO,UAAS,CAAA;AAC7B,eAAO,MAAM,WAAW,+EACsD,CAAA;AAE9E,eAAO,MAAM,cAAc,EAAE,qBAO5B,CAAA;AAED,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,CAAC,qBAAqB,CAAC,GACjC,IAAI,CAAC,qBAAqB,CAAC,CAwC7B;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB3E"}
@@ -1,5 +1,43 @@
1
- import { terminalLink } from "termi-link";
2
- import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var storybook_exports = {};
30
+ __export(storybook_exports, {
31
+ aliases: () => aliases,
32
+ builder: () => builder,
33
+ command: () => command,
34
+ defaultOptions: () => defaultOptions,
35
+ description: () => description,
36
+ handler: () => handler
37
+ });
38
+ module.exports = __toCommonJS(storybook_exports);
39
+ var import_termi_link = require("termi-link");
40
+ var import_cli_helpers = require("@cedarjs/cli-helpers");
3
41
  const command = "storybook";
4
42
  const aliases = ["sb"];
5
43
  const description = "Launch Storybook: a tool for building UI components and pages in isolation";
@@ -37,14 +75,14 @@ function builder(yargs) {
37
75
  type: "boolean",
38
76
  default: defaultOptions.smokeTest
39
77
  }).epilogue(
40
- `Also see the ${terminalLink(
78
+ `Also see the ${(0, import_termi_link.terminalLink)(
41
79
  "CedarJS CLI Reference",
42
80
  "https://cedarjs.com/docs/cli-commands#storybook"
43
81
  )}`
44
82
  );
45
83
  }
46
84
  async function handler(options) {
47
- recordTelemetryAttributes({
85
+ (0, import_cli_helpers.recordTelemetryAttributes)({
48
86
  command: "storybook",
49
87
  build: options.build,
50
88
  ci: options.ci,
@@ -55,11 +93,12 @@ async function handler(options) {
55
93
  const { handler: storybookHandler } = await import("./storybookHandler.js");
56
94
  await storybookHandler(options);
57
95
  }
58
- export {
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
59
98
  aliases,
60
99
  builder,
61
100
  command,
62
101
  defaultOptions,
63
102
  description,
64
103
  handler
65
- };
104
+ });
@@ -1,3 +1,3 @@
1
- import type { StorybookYargsOptions } from '../types.js';
1
+ import type { StorybookYargsOptions } from '../types';
2
2
  export declare function handler({ build, buildDirectory, ci, open, port, smokeTest, }: StorybookYargsOptions): Promise<void>;
3
3
  //# sourceMappingURL=storybookHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storybookHandler.d.ts","sourceRoot":"","sources":["../../src/commands/storybookHandler.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAkBxD,wBAAsB,OAAO,CAAC,EAC5B,KAAK,EACL,cAAc,EACd,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,SAAS,GACV,EAAE,qBAAqB,iBA+IvB"}
1
+ {"version":3,"file":"storybookHandler.d.ts","sourceRoot":"","sources":["../../src/commands/storybookHandler.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAkBrD,wBAAsB,OAAO,CAAC,EAC5B,KAAK,EACL,cAAc,EACd,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,SAAS,GACV,EAAE,qBAAqB,iBA+IvB"}
@@ -1,26 +1,55 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
- import process from "node:process";
4
- import execa from "execa";
5
- import semver from "semver";
6
- import {
7
- isTypeScriptProject,
8
- transformTSToJS,
9
- colors as c
10
- } from "@cedarjs/cli-helpers";
11
- import { getPaths } from "@cedarjs/project-config";
12
- import { errorTelemetry } from "@cedarjs/telemetry";
13
- const readFile = (target) => fs.readFileSync(target, { encoding: "utf8" });
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var storybookHandler_exports = {};
30
+ __export(storybookHandler_exports, {
31
+ handler: () => handler
32
+ });
33
+ module.exports = __toCommonJS(storybookHandler_exports);
34
+ var import_node_fs = __toESM(require("node:fs"));
35
+ var import_node_path = __toESM(require("node:path"));
36
+ var import_node_process = __toESM(require("node:process"));
37
+ var import_execa = __toESM(require("execa"));
38
+ var import_semver = __toESM(require("semver"));
39
+ var import_cli_helpers = require("@cedarjs/cli-helpers");
40
+ var import_project_config = require("@cedarjs/project-config");
41
+ var import_telemetry = require("@cedarjs/telemetry");
42
+ const readFile = (target) => import_node_fs.default.readFileSync(target, { encoding: "utf8" });
14
43
  const writeFile = (target, contents) => {
15
- const { base } = getPaths();
16
- if (fs.existsSync(target)) {
44
+ const { base } = (0, import_project_config.getPaths)();
45
+ if (import_node_fs.default.existsSync(target)) {
17
46
  throw new Error(`${target} already exists.`);
18
47
  }
19
- const filename = path.basename(target);
48
+ const filename = import_node_path.default.basename(target);
20
49
  const targetDir = target.replace(filename, "");
21
- fs.mkdirSync(targetDir, { recursive: true });
22
- fs.writeFileSync(target, contents);
23
- console.log(`Successfully wrote file \`./${path.relative(base, target)}\``);
50
+ import_node_fs.default.mkdirSync(targetDir, { recursive: true });
51
+ import_node_fs.default.writeFileSync(target, contents);
52
+ console.log(`Successfully wrote file \`./${import_node_path.default.relative(base, target)}\``);
24
53
  };
25
54
  async function handler({
26
55
  build,
@@ -31,7 +60,7 @@ async function handler({
31
60
  smokeTest
32
61
  }) {
33
62
  console.log(
34
- c.bold(
63
+ import_cli_helpers.colors.bold(
35
64
  `
36
65
  Please find documentation and links to provide feedback for this new command at:
37
66
  -> https://community.redwoodjs.com/t/7212
@@ -39,8 +68,8 @@ Please find documentation and links to provide feedback for this new command at:
39
68
  `
40
69
  )
41
70
  );
42
- fs.rmSync(
43
- path.join(getPaths().generated.types.includes, "web-storybook.d.ts"),
71
+ import_node_fs.default.rmSync(
72
+ import_node_path.default.join((0, import_project_config.getPaths)().generated.types.includes, "web-storybook.d.ts"),
44
73
  { force: true }
45
74
  );
46
75
  if (build && smokeTest) {
@@ -48,38 +77,38 @@ Please find documentation and links to provide feedback for this new command at:
48
77
  }
49
78
  if (build && open) {
50
79
  console.warn(
51
- c.warning(
80
+ import_cli_helpers.colors.warning(
52
81
  "Warning: --open option has no effect when running Storybook build"
53
82
  )
54
83
  );
55
84
  }
56
- const cwd = getPaths().web.base;
57
- const staticAssetsFolder = path.join(cwd, "public");
85
+ const cwd = (0, import_project_config.getPaths)().web.base;
86
+ const staticAssetsFolder = import_node_path.default.join(cwd, "public");
58
87
  const execaOptions = {
59
88
  stdio: "inherit",
60
89
  shell: true,
61
90
  cwd
62
91
  };
63
- await execa.command(
92
+ await import_execa.default.command(
64
93
  `yarn msw init "${staticAssetsFolder}" --no-save`,
65
94
  execaOptions
66
95
  );
67
- const usingTS = isTypeScriptProject();
96
+ const usingTS = (0, import_cli_helpers.isTypeScriptProject)();
68
97
  const mainFileName = usingTS ? "main.ts" : "main.js";
69
- const cedarProjectPaths = getPaths();
70
- const storybookConfigPath = path.dirname(
98
+ const cedarProjectPaths = (0, import_project_config.getPaths)();
99
+ const storybookConfigPath = import_node_path.default.dirname(
71
100
  `${cedarProjectPaths.web.storybook}/${mainFileName}`
72
101
  );
73
- const storybookMainFilePath = path.join(storybookConfigPath, mainFileName);
74
- const storybookPreviewBodyFilePath = path.join(
102
+ const storybookMainFilePath = import_node_path.default.join(storybookConfigPath, mainFileName);
103
+ const storybookPreviewBodyFilePath = import_node_path.default.join(
75
104
  storybookConfigPath,
76
105
  "preview-body.html"
77
106
  );
78
- if (!fs.existsSync(storybookMainFilePath)) {
79
- const isTSProject = isTypeScriptProject();
107
+ if (!import_node_fs.default.existsSync(storybookMainFilePath)) {
108
+ const isTSProject = (0, import_cli_helpers.isTypeScriptProject)();
80
109
  console.log(`Storybook's ${mainFileName} not found. Creating it now...`);
81
- const mainConfigTemplatePath = path.join(
82
- import.meta.dirname,
110
+ const mainConfigTemplatePath = import_node_path.default.join(
111
+ __dirname,
83
112
  "templates/main.ts.template"
84
113
  // The template is TS, and we'll convert it to JS if needed
85
114
  );
@@ -87,7 +116,7 @@ Please find documentation and links to provide feedback for this new command at:
87
116
  if (isTSProject) {
88
117
  writeFile(storybookMainFilePath, mainConfigContentTS);
89
118
  } else {
90
- const mainConfigContentJS = await transformTSToJS(
119
+ const mainConfigContentJS = await (0, import_cli_helpers.transformTSToJS)(
91
120
  storybookMainFilePath,
92
121
  mainConfigContentTS
93
122
  );
@@ -95,10 +124,10 @@ Please find documentation and links to provide feedback for this new command at:
95
124
  }
96
125
  console.log(`${mainFileName} created!`);
97
126
  }
98
- if (!fs.existsSync(storybookPreviewBodyFilePath)) {
127
+ if (!import_node_fs.default.existsSync(storybookPreviewBodyFilePath)) {
99
128
  console.log("Storybook's preview-body.html not found. Creating it now...");
100
- const previewBodyTemplatePath = path.join(
101
- import.meta.dirname,
129
+ const previewBodyTemplatePath = import_node_path.default.join(
130
+ __dirname,
102
131
  "templates/preview-body.html.template"
103
132
  );
104
133
  const previewBodyConfigContent = readFile(previewBodyTemplatePath);
@@ -130,19 +159,20 @@ Please find documentation and links to provide feedback for this new command at:
130
159
  ].filter(Boolean).join(" ")}`;
131
160
  }
132
161
  const env = {};
133
- if (semver.parse(process.version) !== null && semver.lt(process.version, "22.0.0") && semver.gte(process.version, "20.19.0")) {
162
+ if (import_semver.default.parse(import_node_process.default.version) !== null && import_semver.default.lt(import_node_process.default.version, "22.0.0") && import_semver.default.gte(import_node_process.default.version, "20.19.0")) {
134
163
  env.NODE_OPTIONS = "--no-experimental-require-module";
135
164
  }
136
165
  try {
137
- await execa.command(command, { ...execaOptions, env });
166
+ await import_execa.default.command(command, { ...execaOptions, env });
138
167
  } catch (e) {
139
168
  if (e.signal !== "SIGINT") {
140
- console.log(c.error(e.message));
141
- errorTelemetry(process.argv, e.message);
169
+ console.log(import_cli_helpers.colors.error(e.message));
170
+ (0, import_telemetry.errorTelemetry)(import_node_process.default.argv, e.message);
142
171
  }
143
- process.exit(e.exitCode ?? 1);
172
+ import_node_process.default.exit(e.exitCode ?? 1);
144
173
  }
145
174
  }
146
- export {
175
+ // Annotate the CommonJS export names for ESM import in node:
176
+ 0 && (module.exports = {
147
177
  handler
148
- };
178
+ });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { builder, handler } from './commands/storybook.js';
1
+ import { builder, handler } from './commands/storybook';
2
2
  export declare const commands: {
3
3
  command: string;
4
4
  aliases: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACP,OAAO,EACR,MAAM,yBAAyB,CAAA;AAEhC,eAAO,MAAM,QAAQ;;;;;;GAQpB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACP,OAAO,EACR,MAAM,sBAAsB,CAAA;AAE7B,eAAO,MAAM,QAAQ;;;;;;GAQpB,CAAA"}
package/dist/index.js CHANGED
@@ -1,19 +1,37 @@
1
- import {
2
- command,
3
- aliases,
4
- description,
5
- builder,
6
- handler
7
- } from "./commands/storybook.js";
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ commands: () => commands
22
+ });
23
+ module.exports = __toCommonJS(index_exports);
24
+ var import_storybook = require("./commands/storybook");
8
25
  const commands = [
9
26
  {
10
- command,
11
- aliases,
12
- description,
13
- builder,
14
- handler
27
+ command: import_storybook.command,
28
+ aliases: import_storybook.aliases,
29
+ description: import_storybook.description,
30
+ builder: import_storybook.builder,
31
+ handler: import_storybook.handler
15
32
  }
16
33
  ];
17
- export {
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
18
36
  commands
19
- };
37
+ });
package/dist/types.js CHANGED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
1
  {
2
2
  "name": "@cedarjs/cli-storybook-vite",
3
- "version": "5.0.4-next.167",
3
+ "version": "5.0.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cedarjs/cedar.git",
7
7
  "directory": "packages/cli-packages/storybook-vite"
8
8
  },
9
9
  "license": "MIT",
10
- "type": "module",
10
+ "type": "commonjs",
11
11
  "main": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts",
13
13
  "files": [
14
14
  "dist"
15
15
  ],
16
16
  "scripts": {
17
- "build": "node ./build.mts",
17
+ "build": "node ./build.mts && yarn build:types",
18
18
  "build:pack": "yarn pack -o cedarjs-cli-storybook-vite.tgz",
19
- "build:types": "tsc --build --verbose ./tsconfig.build.json",
19
+ "build:types": "tsc --build --verbose",
20
20
  "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
21
21
  "prepublishOnly": "NODE_ENV=production yarn build",
22
22
  "test": "yarn test:unit",
23
23
  "test:unit": "vitest run"
24
24
  },
25
25
  "dependencies": {
26
- "@cedarjs/cli-helpers": "5.0.4-next.167",
27
- "@cedarjs/project-config": "5.0.4-next.167",
28
- "@cedarjs/telemetry": "5.0.4-next.167",
26
+ "@cedarjs/cli-helpers": "5.0.4",
27
+ "@cedarjs/project-config": "5.0.4",
28
+ "@cedarjs/telemetry": "5.0.4",
29
29
  "execa": "5.1.1",
30
30
  "semver": "7.7.4",
31
31
  "storybook": "8.6.18",
32
- "storybook-framework-cedarjs": "5.0.4-next.167",
32
+ "storybook-framework-cedarjs": "5.0.4",
33
33
  "termi-link": "1.1.0",
34
- "vitest": "4.1.10",
34
+ "vitest": "3.2.6",
35
35
  "yargs": "17.7.3"
36
36
  },
37
37
  "devDependencies": {
38
- "@cedarjs/framework-tools": "5.0.4-next.167",
38
+ "@cedarjs/framework-tools": "5.0.4",
39
39
  "@types/semver": "^7",
40
40
  "@types/yargs": "17.0.35",
41
41
  "typescript": "5.9.3"