From e3b91878bdae7b9d7b2ecc0687ad4be11d094a18 Mon Sep 17 00:00:00 2001 From: Keisuke Umeno <9renpoto@gmail.com> Date: Fri, 23 Feb 2024 15:47:08 +0900 Subject: [PATCH] feat: approve patch (#2041) * feat: approve patch * chore: use vite-plugin-turbosnap --- .github/workflows/dependabot.yml | 6 ++++++ .github/workflows/node.js.yml | 2 ++ .gitignore | 1 + cspell.json | 10 +++++++++- package-lock.json | 9 ++++++++- packages/ui/.storybook/main.ts | 11 +++++++++++ packages/ui/package.json | 3 ++- 7 files changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 16a9d634..1241fe03 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -15,6 +15,12 @@ jobs: uses: dependabot/fetch-metadata@v1 with: github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + if: steps.metadata.outputs.update-type == 'version-update:semver-patch' + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Enable auto-merge for Dependabot PRs if: steps.metadata.outputs.update-type == 'version-update:semver-patch' run: gh pr merge --auto --merge "$PR_URL" diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 3207db25..6305c81f 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -71,3 +71,5 @@ jobs: uses: chromaui/action@v10 with: projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + onlyChanged: true # 👈 Required option to enable TurboSnap + skip: "@(renovate/**|dependabot/**)" diff --git a/.gitignore b/.gitignore index 2086380c..ed5bba17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.turbo/ lib/ storybook-static/ diff --git a/cspell.json b/cspell.json index 1c801798..658fcac4 100644 --- a/cspell.json +++ b/cspell.json @@ -12,5 +12,13 @@ "rust", "typescript" ], - "words": ["Autoprefix", "gtag", "lucide", "preact", "serde"] + "words": [ + "autodocs", + "Autoprefix", + "gtag", + "lucide", + "preact", + "serde", + "turbosnap" + ] } diff --git a/package-lock.json b/package-lock.json index 0e254eca..e1e5a19a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16337,6 +16337,12 @@ "test-exclude": "^6.0.0" } }, + "node_modules/vite-plugin-turbosnap": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/vite-plugin-turbosnap/-/vite-plugin-turbosnap-1.0.3.tgz", + "integrity": "sha512-p4D8CFVhZS412SyQX125qxyzOgIFouwOcvjZWk6bQbNPR1wtaEzFT6jZxAjf1dejlGqa6fqHcuCvQea6EWUkUA==", + "dev": true + }, "node_modules/vite/node_modules/@esbuild/android-arm": { "version": "0.19.7", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.7.tgz", @@ -17392,7 +17398,8 @@ "@testing-library/preact": "^3.2.3", "@twind/preset-autoprefix": "^1.0.7", "@twind/preset-tailwind": "^1.1.4", - "storybook": "^7.6.17" + "storybook": "^7.6.17", + "vite-plugin-turbosnap": "^1.0.3" } }, "packages/ui/node_modules/@twind/core": { diff --git a/packages/ui/.storybook/main.ts b/packages/ui/.storybook/main.ts index f248f6d0..686765fc 100644 --- a/packages/ui/.storybook/main.ts +++ b/packages/ui/.storybook/main.ts @@ -1,4 +1,6 @@ import type { StorybookConfig } from "@storybook/preact-vite"; +import { mergeConfig } from "vite"; +import turbosnap from "vite-plugin-turbosnap"; const config: StorybookConfig = { stories: ["../src/**/*.stories.@(ts|tsx)"], @@ -12,6 +14,15 @@ const config: StorybookConfig = { name: "@storybook/preact-vite", options: {}, }, + async viteFinal(config, { configType }) { + const isProduction = configType === "PRODUCTION"; + + return mergeConfig(config, { + plugins: isProduction + ? [turbosnap({ rootDir: config.root ?? process.cwd() })] + : [], + }); + }, docs: { autodocs: "tag", }, diff --git a/packages/ui/package.json b/packages/ui/package.json index 82cedf35..53ac089e 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -23,7 +23,8 @@ "@testing-library/preact": "^3.2.3", "@twind/preset-autoprefix": "^1.0.7", "@twind/preset-tailwind": "^1.1.4", - "storybook": "^7.6.17" + "storybook": "^7.6.17", + "vite-plugin-turbosnap": "^1.0.3" }, "typings": "lib/index.d.ts", "dependencies": {