@cappa/plugin-storybook 0.0.15 → 0.0.16

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,6 +1,6 @@
1
1
 
2
2
 
3
- > @cappa/plugin-storybook@0.0.14 build /home/tim/code/work/cappa/packages/plugins/plugin-storybook
3
+ > @cappa/plugin-storybook@0.0.15 build /home/tim/code/work/cappa/packages/plugins/plugin-storybook
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: src/index.ts
@@ -27,13 +27,13 @@
27
27
  ESM Build start
28
28
  ESM dist/browser.mjs 138.00 B
29
29
  ESM ⚡️ Build success in 6ms
30
- ESM dist/index.mjs 5.96 KB
31
- ESM ⚡️ Build success in 9ms
32
- CJS dist/index.js 7.32 KB
30
+ CJS dist/index.js 7.14 KB
33
31
  CJS ⚡️ Build success in 9ms
34
- ESM dist/preview.mjs 1.39 KB
32
+ ESM dist/preview.mjs 1.34 KB
35
33
  ESM ⚡️ Build success in 7ms
34
+ ESM dist/index.mjs 5.84 KB
35
+ ESM ⚡️ Build success in 10ms
36
36
  DTS Build start
37
- DTS ⚡️ Build success in 839ms
37
+ DTS ⚡️ Build success in 777ms
38
38
  DTS dist/index.d.ts 593.00 B
39
39
  DTS dist/index.d.mts 593.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @cappa/plugin-storybook
2
2
 
3
+ ## 0.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 92d164e: Fix directory creation
8
+ - Updated dependencies [92d164e]
9
+ - @cappa/core@0.0.16
10
+
3
11
  ## 0.0.15
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -57,8 +57,6 @@ var buildFilename = (story) => {
57
57
  };
58
58
 
59
59
  // src/cappa/plugin.ts
60
- var import_path = __toESM(require("path"));
61
- var import_fs = __toESM(require("fs"));
62
60
  function createLatch() {
63
61
  let resolve;
64
62
  const p = new Promise((r) => resolve = r);
@@ -145,7 +143,6 @@ var cappaPluginStorybook = (options) => {
145
143
  await page.waitForTimeout(options2.delay);
146
144
  }
147
145
  const filename = buildFilename(story);
148
- import_fs.default.mkdirSync(import_path.default.dirname(filename), { recursive: true });
149
146
  const actualFilepath = await screenshotTool.takeScreenshot(page, filename, {
150
147
  fullPage: options2.fullPage ?? screenshotOptions.fullPage,
151
148
  type: options2.type ?? screenshotOptions.type,
package/dist/index.mjs CHANGED
@@ -27,8 +27,6 @@ var buildFilename = (story) => {
27
27
  };
28
28
 
29
29
  // src/cappa/plugin.ts
30
- import path from "path";
31
- import fs from "fs";
32
30
  function createLatch() {
33
31
  let resolve;
34
32
  const p = new Promise((r) => resolve = r);
@@ -115,7 +113,6 @@ var cappaPluginStorybook = (options) => {
115
113
  await page.waitForTimeout(options2.delay);
116
114
  }
117
115
  const filename = buildFilename(story);
118
- fs.mkdirSync(path.dirname(filename), { recursive: true });
119
116
  const actualFilepath = await screenshotTool.takeScreenshot(page, filename, {
120
117
  fullPage: options2.fullPage ?? screenshotOptions.fullPage,
121
118
  type: options2.type ?? screenshotOptions.type,
package/dist/preview.mjs CHANGED
@@ -40,12 +40,7 @@ var withCappaDecorator = makeDecorator({
40
40
 
41
41
  // src/storybook/addon/preview.ts
42
42
  var decorators = [withCappaDecorator];
43
- var parameters = {
44
- layout: "full",
45
- cappa: {
46
- enabled: true
47
- }
48
- };
43
+ var parameters = {};
49
44
  var afterEach = () => {
50
45
  window.playAfterEach = true;
51
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cappa/plugin-storybook",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Storybook plugin for Cappa - takes screenshots of Storybook stories",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@swc/core": "^1.13.5",
32
32
  "storybook": "^9.1.5",
33
- "@cappa/core": "0.0.15"
33
+ "@cappa/core": "0.0.16"
34
34
  },
35
35
  "devDependencies": {
36
36
  "playwright-core": "^1.55.0",
@@ -1,7 +1,5 @@
1
1
  import type { Plugin, ScreenshotOptions, ScreenshotTool } from "@cappa/core";
2
2
  import { buildFilename, freezeUI, waitForVisualIdle } from "./util";
3
- import path from "path";
4
- import fs from "fs";
5
3
 
6
4
  export interface StorybookStory {
7
5
  id: string;
@@ -158,8 +156,6 @@ export const cappaPluginStorybook: Plugin<StorybookPluginOptions> = (options) =>
158
156
  // Take screenshot with story-specific filename
159
157
  const filename = buildFilename(story);
160
158
 
161
- fs.mkdirSync(path.dirname(filename), { recursive: true });
162
-
163
159
  // Actually take the screenshot
164
160
  const actualFilepath = await screenshotTool.takeScreenshot(page, filename, {
165
161
  fullPage: options.fullPage ?? screenshotOptions.fullPage,
@@ -1,7 +1,7 @@
1
- import { describe, it, expect } from "vitest";
2
- import { buildFilename } from "./util";
1
+ import { describe, expect, it } from "vitest";
3
2
  import type { StorybookStory } from "./plugin";
4
-
3
+ import { buildFilename } from "./util";
4
+
5
5
  describe("buildFilename", () => {
6
6
  it("should build a filename for a story", () => {
7
7
  const story: StorybookStory = {
@@ -26,7 +26,7 @@ describe("buildFilename", () => {
26
26
  story: "Story",
27
27
  type: "story",
28
28
  };
29
-
29
+
30
30
  const filename = buildFilename(story);
31
31
  expect(filename).toBe("Folder/Story/Primary.jpeg");
32
32
  });
@@ -44,4 +44,4 @@ describe("buildFilename", () => {
44
44
  const filename = buildFilename(story);
45
45
  expect(filename).toBe("Story123/Primary123.jpeg");
46
46
  });
47
- });
47
+ });
package/src/cappa/util.ts CHANGED
@@ -39,4 +39,4 @@ export const waitForVisualIdle = async (page: Page) => {
39
39
  */
40
40
  export const buildFilename = (story: StorybookStory) => {
41
41
  return `${story.title.replace(/[^a-zA-Z0-9/]/g, "")}/${story.name.replace(/[^a-zA-Z0-9]/g, "")}.jpeg`;
42
- };
42
+ };
package/src/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "@cappa/config-ts/base.json",
3
3
  "compilerOptions": {
4
- "types": ["vitest/globals"],
4
+ "types": ["vitest/globals"]
5
5
  },
6
6
  "include": ["src/**/*.ts"]
7
- }
7
+ }