From abac59803e494da6c1afe965df7a92e3d3d0eee9 Mon Sep 17 00:00:00 2001 From: Geoffrey Chong Date: Tue, 27 Aug 2024 12:17:06 +1000 Subject: [PATCH] Fix-storybook-issues (#4974) * fix buildkite command * fix build commands to include docs * fix tailwind docs scan * fix more commands * fix more commands * fix docs flag * add fake changeset * fix gha * fix turbo command * fix turbo commands * remove caches * fix typo * wait for tailwind to finish * fix turbo commands * removed unused command * update gitignore * turn turbo cache off * turn turbo cache off --------- Co-authored-by: Geoffrey Chong --- .buildkite/scripts/build-storybook.sh | 2 +- .changeset/olive-shirts-clap.md | 5 +++++ .github/workflows/test-stories.yaml | 10 +++++----- .gitignore | 3 --- docs/package.json | 9 +++++---- docs/tailwind.config.mjs | 1 + pnpm-lock.yaml | 28 ++++++++++++++++++++++----- turbo.json | 20 +++++++++++++++++-- 8 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 .changeset/olive-shirts-clap.md diff --git a/.buildkite/scripts/build-storybook.sh b/.buildkite/scripts/build-storybook.sh index d7df4285a2a..e761e28e5f7 100755 --- a/.buildkite/scripts/build-storybook.sh +++ b/.buildkite/scripts/build-storybook.sh @@ -6,5 +6,5 @@ set -e corepack enable pnpm install --frozen-lockfile -pnpm turbo @docs/storybook#build -- --docs +pnpm turbo @docs/storybook#build:docs tar -czf ./storybook.tar.gz ./docs/storybook-static diff --git a/.changeset/olive-shirts-clap.md b/.changeset/olive-shirts-clap.md new file mode 100644 index 00000000000..0b098f9b472 --- /dev/null +++ b/.changeset/olive-shirts-clap.md @@ -0,0 +1,5 @@ +--- +"@kaizen/hosted-assets": patch +--- + +Remove this diff --git a/.github/workflows/test-stories.yaml b/.github/workflows/test-stories.yaml index 0c75c39e904..dad599d6e91 100644 --- a/.github/workflows/test-stories.yaml +++ b/.github/workflows/test-stories.yaml @@ -33,14 +33,14 @@ jobs: steps: - run: echo "Run the Storybook tests" - build-storybook: + build-test-storybook: needs: run-check runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - uses: ./.github/actions/setup - - run: pnpm turbo @docs/storybook#build:docs -- --test + - run: pnpm turbo @docs/storybook#build:test - name: Upload Storybook build as artifact uses: actions/upload-artifact@v3 with: @@ -50,7 +50,7 @@ jobs: storybook-tests-1: name: "test-storybook" - needs: build-storybook + needs: build-test-storybook runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -66,7 +66,7 @@ jobs: storybook-tests-2: name: "test-storybook" - needs: build-storybook + needs: build-test-storybook runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -82,7 +82,7 @@ jobs: storybook-tests-3: name: "test-storybook" - needs: build-storybook + needs: build-test-storybook runs-on: ubuntu-latest timeout-minutes: 10 steps: diff --git a/.gitignore b/.gitignore index e71e0cb56e3..99e32f22162 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,4 @@ docs/storybook-static docs/.storybook/preview.css .DS_Store dist -.cache -.yalc -yalc.loc .turbo diff --git a/docs/package.json b/docs/package.json index 4d47a3a53e7..3d2ed905ee7 100644 --- a/docs/package.json +++ b/docs/package.json @@ -6,13 +6,14 @@ "scripts": { "lint": "eslint .", "lint:ts": "tsc --noEmit", - "dev": "pnpm build:tailwind && storybook dev -p 6006", + "dev": "storybook dev -p 6006", "preview": "NODE_ENV=production pnpm dev --docs", - "build:docs": "pnpm build:tailwind && storybook build", - "build:chromatic": "pnpm build:docs --webpack-stats-json", + "build:docs": "storybook build --docs", + "build:test": "storybook build --test", + "build:chromatic": "storybook build --webpack-stats-json", "build:tailwind": "npx tailwindcss -i ./tailwind.css -o ./.storybook/preview.css", "test": "test-storybook --skipTags='skip-test' --url http://127.0.0.1:6006", - "clean": "rimraf ./storybook-static && rimraf ./node_modules" + "clean": "rimraf './storybook-static' './node_modules' '.turbo'" }, "dependencies": { "react": "^18.3.1", diff --git a/docs/tailwind.config.mjs b/docs/tailwind.config.mjs index dad8dde0d3a..a2d4a7c6836 100644 --- a/docs/tailwind.config.mjs +++ b/docs/tailwind.config.mjs @@ -5,6 +5,7 @@ import { Preset } from "@kaizen/tailwind" module.exports = { content: [ + "../packages/tailwind/src/_docs/**/*.{ts,tsx}", "../packages/**/*.mdx", "../packages/**/*.stories.{ts,tsx}", "./**/*.{ts,tsx,mdx}", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2d9f3c1c53e..c6e343fbb2c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1932,6 +1932,11 @@ packages: '@cultureamp/next-head-hook': '>=1 || ~0.0.0' next: '>=13.5.0' react: '>=16.14.0' + peerDependenciesMeta: + '@cultureamp/next-head-hook': + optional: true + next: + optional: true '@cultureamp/frontend-env@2.1.2': resolution: {integrity: sha512-0GBVGeJDeQL+XmUMvIbUjSsJiRxb46RRTuDhfbB0aViwZ3tG7t88GbnPznolCrp7d+xj0TaknbGS80kzgXL/1w==, tarball: https://npm.pkg.github.com/download/@cultureamp/frontend-env/2.1.2/3478449ef282fcb929efc4f3955531ad3f0cdaca} @@ -1943,6 +1948,9 @@ packages: '@cultureamp/frontend-apis': '>=9 || ~0.0.0' next: '>=13.5.0' react: ^18.2.0 + peerDependenciesMeta: + next: + optional: true '@cultureamp/next-head-hook@1.1.11': resolution: {integrity: sha512-FyaCA3oKHnxZ+pPHcPTCDoRCG4/1y0W16U1O5eyTgSxjuJfWTui3vz65MNvNxlJ20+DZ8BXmV3M0y93t/Fubog==, tarball: https://npm.pkg.github.com/download/@cultureamp/next-head-hook/1.1.11/5444465f7d6ce0d79ba33d60180245ed245956ad} @@ -12181,7 +12189,6 @@ snapshots: dependencies: '@cultureamp/fetch-sgw': 2.0.4(@cultureamp/fetch@4.0.2(encoding@0.1.13))(encoding@0.1.13) '@cultureamp/frontend-env': 2.1.2 - '@cultureamp/next-head-hook': 1.1.11(next@14.2.3(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8)) '@cultureamp/redirect-to-login': 2.0.3 '@readme/openapi-parser': 2.6.0(openapi-types@12.1.3) '@tanstack/react-query': 5.51.23(react@18.3.1) @@ -12194,7 +12201,6 @@ snapshots: js-yaml: 4.1.0 jsrsasign: 11.1.0 msw: 2.2.14(typescript@5.5.4) - next: 14.2.3(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) openapi-types: 12.1.3 openapi-typescript: 6.7.6 react: 18.3.1 @@ -12203,6 +12209,9 @@ snapshots: url-parse: 1.5.10 uuid: 9.0.1 yargs: 17.7.2 + optionalDependencies: + '@cultureamp/next-head-hook': 1.1.11(next@14.2.3(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8)) + next: 14.2.3(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) transitivePeerDependencies: - '@chromatic-com/cypress' - '@chromatic-com/playwright' @@ -12230,11 +12239,12 @@ snapshots: isomorphic-resolve: 1.0.0 json-stable-stringify: 1.1.1 limiter-es6-compat: 2.1.2 - next: 14.2.3(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) react: 18.3.1 react-intl: 6.6.8(react@18.3.1)(typescript@5.5.4) smartling-api-sdk-nodejs: 2.11.0(encoding@0.1.13) yargs: 17.7.2 + optionalDependencies: + next: 14.2.3(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) transitivePeerDependencies: - '@glimmer/env' - '@glimmer/reference' @@ -12254,6 +12264,7 @@ snapshots: dependencies: next: 14.2.3(@babel/core@7.25.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) react: 18.3.1 + optional: true '@cultureamp/redirect-to-login@2.0.3': {} @@ -12947,7 +12958,8 @@ snapshots: outvariant: 1.4.2 strict-event-emitter: 0.5.1 - '@next/env@14.2.3': {} + '@next/env@14.2.3': + optional: true '@next/swc-darwin-arm64@14.2.3': optional: true @@ -14719,6 +14731,7 @@ snapshots: dependencies: '@swc/counter': 0.1.3 tslib: 2.6.3 + optional: true '@swc/jest@0.2.36(@swc/core@1.7.10(@swc/helpers@0.5.11))': dependencies: @@ -15791,6 +15804,7 @@ snapshots: busboy@1.6.0: dependencies: streamsearch: 1.1.0 + optional: true bytes@3.1.2: {} @@ -19544,6 +19558,7 @@ snapshots: transitivePeerDependencies: - '@babel/core' - babel-plugin-macros + optional: true no-case@3.0.4: dependencies: @@ -20749,6 +20764,7 @@ snapshots: nanoid: 3.3.7 picocolors: 1.0.1 source-map-js: 1.2.0 + optional: true postcss@8.4.41: dependencies: @@ -21780,7 +21796,8 @@ snapshots: - supports-color - utf-8-validate - streamsearch@1.1.0: {} + streamsearch@1.1.0: + optional: true strict-event-emitter@0.5.1: {} @@ -21921,6 +21938,7 @@ snapshots: react: 18.3.1 optionalDependencies: '@babel/core': 7.25.2 + optional: true stylehacks@5.1.1(postcss@8.4.41): dependencies: diff --git a/turbo.json b/turbo.json index b94f3c85eea..790eaafdf64 100644 --- a/turbo.json +++ b/turbo.json @@ -9,6 +9,10 @@ "dev": { "dependsOn": ["^build"] }, + "@docs/storybook#dev": { + "dependsOn": ["^build", "build:tailwind"], + "cache": false + }, "lint:ts": { "dependsOn": ["^build"] }, @@ -17,14 +21,26 @@ "clean": { "cache": false }, - "@docs/storybook#build:docs": { + "@docs/storybook#build:tailwind": { "dependsOn": ["^build"], "inputs": ["packages/**", "docs/**"], + "outputs": ["docs/.storybook/preview.css"], + "cache": false + }, + "@docs/storybook#build:docs": { + "dependsOn": ["^build", "build:tailwind"], + "inputs": ["packages/**", "docs/**"], + "outputs": ["docs/storybook-static/**"], + "cache": false + }, + "@docs/storybook#build:test": { + "dependsOn": ["^build", "build:tailwind"], + "inputs": ["packages/**", "docs/**"], "outputs": ["docs/storybook-static/**"], "cache": false }, "@docs/storybook#build:chromatic": { - "dependsOn": ["^build"], + "dependsOn": ["^build", "build:tailwind"], "outputs": ["docs/storybook-static/**"], "cache": false },