@onlook/storybook-plugin 0.3.3 → 0.3.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.
- package/README.md +21 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +14 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -76,6 +76,27 @@ Screenshots are saved to `.storybook-cache/screenshots/`.
|
|
|
76
76
|
|
|
77
77
|
The plugin auto-disables when `CHROMATIC` or `CI` environment variables are set.
|
|
78
78
|
|
|
79
|
+
## Publishing
|
|
80
|
+
|
|
81
|
+
Three release paths:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# 1. Ship the current version to npm as `latest` (default dist-tag).
|
|
85
|
+
bun run publish-pkg
|
|
86
|
+
|
|
87
|
+
# 2. Ship under the `next` dist-tag — for testing against preview deploys
|
|
88
|
+
# without affecting consumers pinned to ^x.y.z ranges. Consumers opt in
|
|
89
|
+
# via `@onlook/storybook-plugin@next`.
|
|
90
|
+
bun run publish-pkg:next
|
|
91
|
+
|
|
92
|
+
# 3. Promote a previously-published version to `latest`. Reads the version
|
|
93
|
+
# from package.json, so bump first if you want to promote something else.
|
|
94
|
+
bun run promote-latest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The typical flow for risky changes: `publish-pkg:next` → test against a
|
|
98
|
+
Vercel preview deploy → `promote-latest` once confident.
|
|
99
|
+
|
|
79
100
|
## License
|
|
80
101
|
|
|
81
102
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PluginOption } from 'vite';
|
|
2
|
+
import { Indexer } from 'storybook/internal/types';
|
|
2
3
|
|
|
3
4
|
type OnlookPluginOptions = {
|
|
4
5
|
/** Storybook port (default: 6006) */
|
|
@@ -8,4 +9,6 @@ type OnlookPluginOptions = {
|
|
|
8
9
|
};
|
|
9
10
|
declare function storybookOnlookPlugin(options?: OnlookPluginOptions): PluginOption[];
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
declare const tolerantCsfIndexer: Indexer;
|
|
13
|
+
|
|
14
|
+
export { type OnlookPluginOptions, storybookOnlookPlugin, tolerantCsfIndexer };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import traverseModule from '@babel/traverse';
|
|
|
7
7
|
import * as t from '@babel/types';
|
|
8
8
|
import crypto from 'crypto';
|
|
9
9
|
import { chromium } from 'playwright';
|
|
10
|
+
import { readCsf } from 'storybook/internal/csf-tools';
|
|
10
11
|
|
|
11
12
|
// src/storybook-onlook-plugin.ts
|
|
12
13
|
function componentLocPlugin(options = {}) {
|
|
@@ -538,5 +539,17 @@ function storybookOnlookPlugin(options = {}) {
|
|
|
538
539
|
};
|
|
539
540
|
return [componentLocPlugin(), mainPlugin];
|
|
540
541
|
}
|
|
542
|
+
var tolerantCsfIndexer = {
|
|
543
|
+
test: /(stories|story)\.(m?js|ts)x?$/,
|
|
544
|
+
createIndex: async (fileName, options) => {
|
|
545
|
+
try {
|
|
546
|
+
return (await readCsf(fileName, options)).parse().indexInputs;
|
|
547
|
+
} catch (err) {
|
|
548
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
549
|
+
console.warn("[onbook] Skipping broken story file:", fileName, msg);
|
|
550
|
+
return [];
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
};
|
|
541
554
|
|
|
542
|
-
export { storybookOnlookPlugin };
|
|
555
|
+
export { storybookOnlookPlugin, tolerantCsfIndexer };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlook/storybook-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
|
-
"onlook-storybook": "
|
|
6
|
+
"onlook-storybook": "dist/cli/index.js"
|
|
7
7
|
},
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit",
|
|
30
30
|
"prepublishOnly": "bun run build && bun scripts/prepublish.ts",
|
|
31
31
|
"postpublish": "bun scripts/postpublish.ts",
|
|
32
|
-
"publish-pkg": "npm publish"
|
|
32
|
+
"publish-pkg": "npm publish",
|
|
33
|
+
"publish-pkg:next": "npm publish --tag next",
|
|
34
|
+
"promote-latest": "npm dist-tag add @onlook/storybook-plugin@$(node -p \"require('./package.json').version\") latest"
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"@babel/generator": "^7.26.9",
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
"access": "public"
|
|
54
56
|
},
|
|
55
57
|
"peerDependencies": {
|
|
58
|
+
"storybook": "^10.0.0",
|
|
56
59
|
"vite": "^5.0.0 || ^6.0.0"
|
|
57
60
|
}
|
|
58
61
|
}
|