diff --git a/.changeset/red-carpets-wave.md b/.changeset/red-carpets-wave.md new file mode 100644 index 00000000..addb67bc --- /dev/null +++ b/.changeset/red-carpets-wave.md @@ -0,0 +1,5 @@ +--- +"@stephansama/svelte-social-share-links": patch +--- + +updated the svelte-social-share-links to export storybook website for user testing diff --git a/.config/www/package.json b/.config/www/package.json index 709bec5e..4d5c4fdb 100644 --- a/.config/www/package.json +++ b/.config/www/package.json @@ -3,7 +3,6 @@ "private": true, "type": "module", "scripts": { - "prebuild": "pnpm run setup", "build": "vitepress build", "predev": "pnpm run setup", "dev": "vitepress dev", diff --git a/.config/www/setup.sh b/.config/www/setup.sh index c0ce2424..bd7b7ad7 100644 --- a/.config/www/setup.sh +++ b/.config/www/setup.sh @@ -2,12 +2,14 @@ pnpm --workspace-root run scripts:generate-examples -./node_modules/.bin/typedoc +pnpm exec typedoc -./node_modules/.bin/eslint-config-inspector build --base /eslint --outDir public/eslint +pnpm exec eslint-config-inspector build --base /eslint --outDir public/eslint -./node_modules/.bin/node-modules-inspector build --base /node_modules --outDir public/node_modules +pnpm exec node-modules-inspector build --base /node_modules --outDir public/node_modules node -e "console.log(JSON.stringify({message: Date.now()}))" >public/healthcheck.json -pnpm --workspace-root run --silent scripts:meta >public/meta.json +pnpm --workspace-root run scripts:meta >public/meta.json + +pnpm --workspace-root run scripts:storybook diff --git a/.config/www/turbo.json b/.config/www/turbo.json index 280e236b..d75f1941 100644 --- a/.config/www/turbo.json +++ b/.config/www/turbo.json @@ -6,8 +6,10 @@ "./api/", "./public/healthcheck.json", "./public/node_modules", - "./public/eslint" - ] + "./public/eslint", + "./public/api" + ], + "dependsOn": ["@stephansama/svelte-social-share-links#build:storybook"] }, "build": { "dependsOn": ["create-stephansama-example#build", "www#setup"], diff --git a/core/svelte-social-share-links/README.md b/core/svelte-social-share-links/README.md index 24cfba2d..654f73ad 100644 --- a/core/svelte-social-share-links/README.md +++ b/core/svelte-social-share-links/README.md @@ -3,6 +3,7 @@ [![Source code](https://img.shields.io/badge/Source%20code-211F1F?style=flat&logo=github&labelColor=211F1F)](https://github.com/stephansama/packages/tree/main/core/svelte-social-share-links) [![Documentation](https://img.shields.io/badge/Documentation-211F1F?style=flat&logo=Wikibooks&labelColor=211F1F)](https://packages.stephansama.info/api/@stephansama/svelte-social-share-links) [![NPM Version](https://img.shields.io/npm/v/%40stephansama%2Fsvelte-social-share-links?logo=npm&logoColor=red&color=211F1F&labelColor=211F1F)](https://www.npmx.dev/package/@stephansama/svelte-social-share-links) +[![storybook](https://img.shields.io/badge/storybook-211F1F?logo=storybook)](https://packages.stephansama.info/api/@stephansama/svelte-social-share-links/storybook) [![npm downloads](https://img.shields.io/npm/dw/@stephansama/svelte-social-share-links?labelColor=211F1F)](https://www.npmx.dev/package/@stephansama/svelte-social-share-links) Simple social sharing for the web diff --git a/core/svelte-social-share-links/package.json b/core/svelte-social-share-links/package.json index a9c5ef5f..5f320688 100644 --- a/core/svelte-social-share-links/package.json +++ b/core/svelte-social-share-links/package.json @@ -1,13 +1,18 @@ { "name": "@stephansama/svelte-social-share-links", "version": "1.1.1", - "private": false, "description": "Svelte/Web component to share the current url with various social media providers", + "homepage": "https://packages.stephansama.info/api/@stephansama/svelte-social-share-links", "repository": { "type": "git", "url": "git+https://github.com/stephansama/packages.git", "directory": "core/svelte-social-share-links" }, + "author": { + "name": "Stephan Randle", + "email": "stephanrandle.dev@gmail.com", + "url": "https://stephansama.info" + }, "type": "module", "exports": { ".": { @@ -30,13 +35,14 @@ "!dist/**/*.spec.*" ], "scripts": { - "prebuild": "svelte-package", - "build": "vite -c ./vite.webcomponent.config.ts build", + "build": "pnpm run build:svelte && pnpm run build:vite", "postbuild": "publint", + "build:storybook": "storybook build", + "build:svelte": "svelte-package", + "build:vite": "vite -c ./vite.webcomponent.config.ts build", "check": "svelte-check --tsconfig ./tsconfig.json", "dev": "svelte-package --watch", - "storybook": "storybook dev -p 6006", - "storybook:build": "storybook build" + "dev:storybook": "storybook dev -p 6006" }, "devDependencies": { "@chromatic-com/storybook": "catalog:storybook", @@ -60,5 +66,8 @@ "access": "public", "provenance": true }, - "readme": "./README.md" + "readme": "./README.md", + "storybook": { + "url": "https://packages.stephansama.info/api/@stephansama/svelte-social-share-links/storybook" + } } diff --git a/package.json b/package.json index 2542ae58..31d4288c 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "scripts:lint-examples": "node ./scripts/lint-examples.js", "scripts:meta": "node ./scripts/meta.js", "scripts:pkg-pr-new": "node ./scripts/pkg-pr-new.js", + "scripts:storybook": "node ./scripts/storybook.js", "test": "turbo test", "pretest:ci": "pnpm run scripts:generate-examples", "test:ci": "vitest --run --coverage", diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index f74a9fe3..abc94fde 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -23,6 +23,7 @@ catalog: '@types/react': ^19.2.14 '@types/vfile': ^4.0.0 '@types/yargs': ^17.0.35 + actions-up: ^1.11.0 astro: 5.9.3 deepmerge: ^4.3.1 es-toolkit: 1.43.0 @@ -40,6 +41,7 @@ catalog: remark: ^15.0.1 tailwind-scrollbar: ^4.0.2 tailwindcss: ^4.1.18 + taze: ^19.9.2 tsdown: 0.15.12 tsx: 4.21.0 typescript: 5.9.3 diff --git a/scripts/storybook.js b/scripts/storybook.js new file mode 100644 index 00000000..47491428 --- /dev/null +++ b/scripts/storybook.js @@ -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"), + ); + + await fs.promises.cp(storybookDir, outputDir, { recursive: true }); + + console.info( + `successfully copied ${pkg.packageJson.name} storybook configuration to documentation site`, + ); +} diff --git a/turbo.json b/turbo.json index 04e8bff5..5ffd34c3 100644 --- a/turbo.json +++ b/turbo.json @@ -11,13 +11,13 @@ "dependsOn": ["^build"], "outputs": ["dist*/**", "config", "!.next/cache/**"] }, - "lint:fix": { "cache": false }, - "lint": { - "dependsOn": ["^lint"] - }, - "check-types": { - "dependsOn": ["^check-types"] + "build:storybook": { + "dependsOn": ["^build"], + "outputs": ["storybook-static"] }, + "lint": { "dependsOn": ["^lint"] }, + "lint:fix": { "cache": false }, + "check-types": { "dependsOn": ["^check-types"] }, "publish": { "persistent": true, "cache": false, diff --git a/vercel.json b/vercel.json index f2614801..cee7ace1 100644 --- a/vercel.json +++ b/vercel.json @@ -4,6 +4,17 @@ { "source": "/node_modules/:path*", "destination": "/node_modules/index.html" + }, + { + "source": "/api/@stephansama/svelte-social-share-links/storybook/:path((?!.*\\.).*)", + "destination": "/api/@stephansama/svelte-social-share-links/storybook/index.html" + } + ], + "redirects": [ + { + "source": "/api/@stephansama/svelte-social-share-links/storybook", + "destination": "/api/@stephansama/svelte-social-share-links/storybook/", + "permanent": true } ] }