@crvy/strybk 0.0.1 → 0.0.2
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/CHANGELOG.md +42 -0
- package/README.md +16 -4
- package/dist/src/cli.js +9 -4
- package/dist/src/config.d.ts +0 -6
- package/dist/src/generate/index.js +0 -3
- package/dist/src/generate/render.d.ts +0 -2
- package/dist/src/generate/render.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/playwright/index.d.ts +4 -1
- package/dist/src/playwright/index.js +4 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,4 +5,46 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.0.2] - 2026-06-11
|
|
9
|
+
## [0.0.1] - 2026-06-11
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Add lean config and generator core
|
|
14
|
+
- Support creevey skip metadata extraction
|
|
15
|
+
- Add Storybook channel driver and switchStory helper
|
|
16
|
+
- Add shared-page Playwright fixtures
|
|
17
|
+
- Add strybk CLI
|
|
18
|
+
- Simplify generated spec imports to use @crvy/strybk directly
|
|
19
|
+
|
|
20
|
+
### Documentation
|
|
21
|
+
|
|
22
|
+
- Correct Yarn 4 local link instructions
|
|
23
|
+
- Add minimal config example and improve fetch error message
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Default generated region marker in renderer
|
|
28
|
+
- Harden creevey metadata filtering
|
|
29
|
+
- Support meta-level creevey skip
|
|
30
|
+
- Harden Storybook channel driver
|
|
31
|
+
- Keep switch timeout through font readiness
|
|
32
|
+
- Preserve sharedPage fixture typing
|
|
33
|
+
- Hide internal worker page fixture
|
|
34
|
+
- Preserve built-in playwright fixture types
|
|
35
|
+
- Harden linked playwright runtime and generation
|
|
36
|
+
|
|
37
|
+
### Miscellaneous
|
|
38
|
+
|
|
39
|
+
- Bootstrap strybk package
|
|
40
|
+
- Align strybk bootstrap with plan
|
|
41
|
+
- Fix strybk bin entry
|
|
42
|
+
- Make strybk bootstrap manifest honest
|
|
43
|
+
- Tighten strybk bootstrap packaging
|
|
44
|
+
- Ignore strybk build artifacts
|
|
45
|
+
- Sync strybk lockfile
|
|
46
|
+
- Build strybk before packing
|
|
47
|
+
- Sync current workspace
|
|
48
|
+
- Align publish setup with crvy-rprtr
|
|
49
|
+
- Bump version to 0.0.1 and update bin field format
|
|
8
50
|
## [Unreleased]
|
package/README.md
CHANGED
|
@@ -25,17 +25,29 @@ bun run check
|
|
|
25
25
|
Generate screenshot specs from a Storybook index:
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
strybk generate --config ./strybk.config.ts
|
|
28
|
+
crvy-strybk generate --config ./strybk.config.ts
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Use `--dry-run` to compute outputs without writing files:
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
|
-
strybk generate --config ./strybk.config.ts --dry-run
|
|
34
|
+
crvy-strybk generate --config ./strybk.config.ts --dry-run
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
The config module should export a `StrybkConfig` object, typically as the default export from `defineConfig(...)`.
|
|
38
38
|
|
|
39
|
+
Minimal `strybk.config.ts`:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { defineConfig } from "@crvy/strybk";
|
|
43
|
+
|
|
44
|
+
export default defineConfig({
|
|
45
|
+
storybookUrl: "http://localhost:6006",
|
|
46
|
+
storyGlobs: ["src/**/*.stories.tsx"],
|
|
47
|
+
resolveSpecPath: ({ storyFilePath }) => storyFilePath.replace(/\.stories\.tsx$/, ".spec.ts"),
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
39
51
|
## Changelog
|
|
40
52
|
|
|
41
53
|
Preview the next changelog entry:
|
|
@@ -69,7 +81,7 @@ Link it into the consumer project:
|
|
|
69
81
|
|
|
70
82
|
```sh
|
|
71
83
|
cd /path/to/consumer-project
|
|
72
|
-
bun link strybk
|
|
84
|
+
bun link @crvy/strybk
|
|
73
85
|
```
|
|
74
86
|
|
|
75
87
|
If you want to persist the link in the consumer's manifest, Bun supports a `link:` dependency entry:
|
|
@@ -77,7 +89,7 @@ If you want to persist the link in the consumer's manifest, Bun supports a `link
|
|
|
77
89
|
```json
|
|
78
90
|
{
|
|
79
91
|
"dependencies": {
|
|
80
|
-
"strybk": "link:strybk"
|
|
92
|
+
"@crvy/strybk": "link:strybk"
|
|
81
93
|
}
|
|
82
94
|
}
|
|
83
95
|
```
|
package/dist/src/cli.js
CHANGED
|
@@ -32,8 +32,7 @@ const resolveConfigExport = (moduleNamespace) => {
|
|
|
32
32
|
const isStrybkConfig = (value) => isRecord(value) &&
|
|
33
33
|
typeof value.storybookUrl === "string" &&
|
|
34
34
|
Array.isArray(value.storyGlobs) &&
|
|
35
|
-
typeof value.resolveSpecPath === "function"
|
|
36
|
-
typeof value.resolveHarnessImports === "function";
|
|
35
|
+
typeof value.resolveSpecPath === "function";
|
|
37
36
|
const getIndexEntriesRecord = (payload) => {
|
|
38
37
|
if (!isRecord(payload)) {
|
|
39
38
|
throw new Error("Storybook index response must be an object");
|
|
@@ -77,9 +76,15 @@ const loadConfig = async (configPath) => {
|
|
|
77
76
|
};
|
|
78
77
|
const fetchStoryIndex = async (config) => {
|
|
79
78
|
const indexUrl = resolveStorybookIndexUrl(config.storybookUrl);
|
|
80
|
-
|
|
79
|
+
let response;
|
|
80
|
+
try {
|
|
81
|
+
response = await fetch(indexUrl);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw new Error(`Failed to fetch Storybook index at ${indexUrl.toString()} — is Storybook running?`, { cause: error });
|
|
85
|
+
}
|
|
81
86
|
if (!response.ok) {
|
|
82
|
-
throw new Error(`Failed to fetch ${indexUrl.toString()}: ${response.status} ${response.statusText}`.trim());
|
|
87
|
+
throw new Error(`Failed to fetch Storybook index at ${indexUrl.toString()}: ${response.status} ${response.statusText}`.trim());
|
|
83
88
|
}
|
|
84
89
|
const payload = asUnknown(await response.json());
|
|
85
90
|
const entries = getIndexEntriesRecord(payload);
|
package/dist/src/config.d.ts
CHANGED
|
@@ -7,12 +7,6 @@ export interface StrybkConfig {
|
|
|
7
7
|
resolveSpecPath: (args: {
|
|
8
8
|
storyFilePath: string;
|
|
9
9
|
}) => string;
|
|
10
|
-
resolveHarnessImports: (args: {
|
|
11
|
-
outputPath: string;
|
|
12
|
-
}) => {
|
|
13
|
-
fixturesImport: string;
|
|
14
|
-
switchStoryImport: string;
|
|
15
|
-
};
|
|
16
10
|
generatedRegionName?: string;
|
|
17
11
|
deleteOrphans?: boolean;
|
|
18
12
|
metadataExtractors?: "creevey"[];
|
|
@@ -35,14 +35,11 @@ export async function generateScreenshots(args) {
|
|
|
35
35
|
if (filteredStories.length === 0 && manualRegion.length === 0) {
|
|
36
36
|
return [];
|
|
37
37
|
}
|
|
38
|
-
const harnessImports = args.config.resolveHarnessImports({ outputPath });
|
|
39
38
|
return [
|
|
40
39
|
{
|
|
41
40
|
outputPath,
|
|
42
41
|
content: renderScreenshotSpec({
|
|
43
42
|
config: args.config,
|
|
44
|
-
fixturesImport: harnessImports.fixturesImport,
|
|
45
|
-
switchStoryImport: harnessImports.switchStoryImport,
|
|
46
43
|
title: storyFile.title,
|
|
47
44
|
stories: filteredStories,
|
|
48
45
|
manualRegion,
|
|
@@ -4,5 +4,5 @@ export function renderScreenshotSpec(args) {
|
|
|
4
4
|
const tests = args.stories
|
|
5
5
|
.map((story) => ` test('${escapeSingleQuotes(story.name)}', async ({ sharedPage }) => {\n await switchStory(sharedPage, '${story.id}');\n await expect(sharedPage).toHaveScreenshot();\n });`)
|
|
6
6
|
.join("\n\n");
|
|
7
|
-
return `import { test, expect
|
|
7
|
+
return `import { test, expect, switchStory } from '@crvy/strybk';\n\n// @generated-begin ${generatedRegionName}\ntest.describe('${escapeSingleQuotes(args.title)}', () => {\n${tests}\n});\n// @generated-end ${generatedRegionName}\n\n${args.manualRegion}`;
|
|
8
8
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { defineConfig } from "./config.js";
|
|
2
2
|
export type { StrybkConfig, StorybookGlobals } from "./config.js";
|
|
3
3
|
export { generateScreenshots } from "./generate/index.js";
|
|
4
|
-
export {
|
|
4
|
+
export { test, expect, switchStory } from "./playwright/index.js";
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { createStrybkFixtures } from "./fixtures.js";
|
|
2
1
|
export { switchStory } from "./switchStory.js";
|
|
2
|
+
export declare const test: import("playwright/test").TestType<import("playwright/test").PlaywrightTestArgs & import("playwright/test").PlaywrightTestOptions & {
|
|
3
|
+
sharedPage: import("playwright-core").Page;
|
|
4
|
+
}, import("playwright/test").PlaywrightWorkerArgs & import("playwright/test").PlaywrightWorkerOptions>;
|
|
5
|
+
export declare const expect: import("playwright/test").Expect<{}>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { createStrybkFixtures } from "./fixtures.js";
|
|
2
2
|
export { switchStory } from "./switchStory.js";
|
|
3
|
+
const fixtures = createStrybkFixtures();
|
|
4
|
+
export const test = fixtures.test;
|
|
5
|
+
export const expect = fixtures.expect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvy/strybk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Generator-first Playwright screenshot testing for Storybook.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"crvy",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"url": "git+https://github.com/creevey/strybk.git"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
|
-
"strybk": "./dist/src/cli.js"
|
|
23
|
+
"crvy-strybk": "./dist/src/cli.js"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist/",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
91
|
"bun": ">=1.3.0",
|
|
92
|
-
"node": ">=
|
|
92
|
+
"node": ">=22"
|
|
93
93
|
},
|
|
94
94
|
"packageManager": "bun@1.3.13"
|
|
95
95
|
}
|