From 4928c71b7ed480444e644f2e7a952eebe39e7929 Mon Sep 17 00:00:00 2001 From: Nutthapat Pongtanyavichai Date: Mon, 23 Dec 2024 22:16:51 +0700 Subject: [PATCH] pls work --- .github/workflows/deploy-docker.yaml | 2 +- .github/workflows/e2e.yaml | 2 +- .github/workflows/release-without-versioning.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/reusable-ci.yaml | 2 +- apps/storybook/package.json | 3 ++- apps/storybook/scripts/patch-sb-csf.js | 15 +++++++++++++++ 7 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 apps/storybook/scripts/patch-sb-csf.js diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 20c9802b9..f5450d712 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -58,7 +58,7 @@ jobs: steps: - name: Checkout with tags - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ matrix.packages.ref }} diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 03f3f1079..c50f7dcae 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -11,7 +11,7 @@ jobs: name: Checkout - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 id: pnpm-install with: run_install: false diff --git a/.github/workflows/release-without-versioning.yaml b/.github/workflows/release-without-versioning.yaml index b1ec94c1d..0909656c4 100644 --- a/.github/workflows/release-without-versioning.yaml +++ b/.github/workflows/release-without-versioning.yaml @@ -48,7 +48,7 @@ jobs: node-version-file: .nvmrc - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 id: pnpm-install with: run_install: false diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 71088d3f9..7d54e2fc1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -76,7 +76,7 @@ jobs: node-version-file: .nvmrc - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 id: pnpm-install with: run_install: false diff --git a/.github/workflows/reusable-ci.yaml b/.github/workflows/reusable-ci.yaml index de88a080a..722f14c2c 100644 --- a/.github/workflows/reusable-ci.yaml +++ b/.github/workflows/reusable-ci.yaml @@ -22,7 +22,7 @@ jobs: fetch-depth: 0 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 id: pnpm-install with: run_install: false diff --git a/apps/storybook/package.json b/apps/storybook/package.json index 90434bf52..f07670c21 100644 --- a/apps/storybook/package.json +++ b/apps/storybook/package.json @@ -8,7 +8,8 @@ "build": "storybook build", "check": "svelte-check --tsconfig ./tsconfig.json", "lint": "eslint . && prettier --check \"src/**/*.mdx\"", - "format": "eslint . --fix && prettier --write \"src/**/*.mdx\"" + "format": "eslint . --fix && prettier --write \"src/**/*.mdx\"", + "postinstall": "node scripts/patch-sb-csf.js" }, "dependencies": { "@repo/ui": "workspace:*" diff --git a/apps/storybook/scripts/patch-sb-csf.js b/apps/storybook/scripts/patch-sb-csf.js new file mode 100644 index 000000000..134858d2d --- /dev/null +++ b/apps/storybook/scripts/patch-sb-csf.js @@ -0,0 +1,15 @@ +/* eslint-disable no-undef */ + +import fs from 'node:fs/promises' + +const patchLocation = './node_modules/@storybook/addon-svelte-csf/package.json' + +const pkgJson = await fs.readFile(patchLocation, 'utf8') +const pkg = JSON.parse(pkgJson) + +if (!pkg.main || !pkg.types) { + console.log('Patching Storybook Svelte CSF package.json') + pkg.main = './dist/index.js' + pkg.types = './dist/index.d.ts' + await fs.writeFile(patchLocation, JSON.stringify(pkg, null, 2)) +}