-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(core): update svelte-social-share-links to export storybook for … #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c8ec6f1
939eb6b
0c90093
fef1f17
bd01178
94d5411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@stephansama/svelte-social-share-links": patch | ||
| --- | ||
|
|
||
| updated the svelte-social-share-links to export storybook website for user testing |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import { getPackages } from "@manypkg/get-packages"; | ||
| import * as fs from "node:fs"; | ||
| import * as path from "node:path"; | ||
|
|
||
| const { packages } = await getPackages(process.cwd()); | ||
|
|
||
| const www = packages.find((pkg) => pkg.packageJson.name === "www"); | ||
| if (!www) throw new Error("unable to find www package"); | ||
|
|
||
| for (const pkg of packages) { | ||
| if (!("storybook" in pkg.packageJson)) continue; | ||
| if (!("url" in pkg.packageJson.storybook)) continue; | ||
| if (typeof pkg.packageJson.storybook.url !== "string") continue; | ||
|
|
||
| const storybookDir = path.resolve(path.join(pkg.dir, "storybook-static")); | ||
| const outputDir = path.resolve( | ||
| path.join(www.dir, "public", "api", pkg.packageJson.name, "storybook"), | ||
| ); | ||
|
Comment on lines
+18
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script uses |
||
|
|
||
| await fs.promises.cp(storybookDir, outputDir, { recursive: true }); | ||
|
stephansama marked this conversation as resolved.
stephansama marked this conversation as resolved.
|
||
|
|
||
| console.info( | ||
| `successfully copied ${pkg.packageJson.name} storybook configuration to documentation site`, | ||
| ); | ||
|
Comment on lines
+22
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script will crash with an unhandled exception if the await fs.promises.cp(storybookDir, outputDir, { recursive: true }).then(() => {
console.info(
`successfully copied ${pkg.packageJson.name} storybook configuration to documentation site`,
);
}).catch((error) => {
if (error.code === 'ENOENT') {
console.warn(`Skipping ${pkg.packageJson.name}: source directory not found at ${storybookDir}.`);
} else {
console.error(`Error copying storybook for ${pkg.packageJson.name}:`);
throw error;
}
}); |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For improved readability and conciseness, you can combine these checks into a single line using optional chaining (
?.).