From 4d4dd1e01fc5e81f8a7e473309641ee3024201be Mon Sep 17 00:00:00 2001 From: Arthur Green Date: Sat, 7 Oct 2023 23:37:59 +0400 Subject: [PATCH] fix: forkflow for a static nextjs build --- .../{nextjs.yml => deploy-nextjs.yml} | 39 ++------ .prettierrc.yml | 1 + next.config.js | 2 +- package.json | 3 + pnpm-lock.yaml | 90 ++++++++++--------- 5 files changed, 60 insertions(+), 75 deletions(-) rename .github/workflows/{nextjs.yml => deploy-nextjs.yml} (58%) create mode 100644 .prettierrc.yml diff --git a/.github/workflows/nextjs.yml b/.github/workflows/deploy-nextjs.yml similarity index 58% rename from .github/workflows/nextjs.yml rename to .github/workflows/deploy-nextjs.yml index e889601..732db02 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/deploy-nextjs.yml @@ -34,33 +34,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Detect package manager - id: detect-package-manager - run: | - if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then - echo "manager=pnpm" >> $GITHUB_OUTPUT - echo "command=install" >> $GITHUB_OUTPUT - echo "runner=pnpm exec" >> $GITHUB_OUTPUT - exit 0 - elif [ -f "${{ github.workspace }}/yarn.lock" ]; then - echo "manager=yarn" >> $GITHUB_OUTPUT - echo "command=install" >> $GITHUB_OUTPUT - echo "runner=yarn" >> $GITHUB_OUTPUT - exit 0 - elif [ -f "${{ github.workspace }}/package-lock.json" ]; then - echo "manager=npm" >> $GITHUB_OUTPUT - echo "command=ci" >> $GITHUB_OUTPUT - echo "runner=npx --no-install" >> $GITHUB_OUTPUT - exit 0 - else - echo "Unable to determine package manager" - exit 1 - fi - - name: Setup Node ${{ matrix.node-version }} + - uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: ${{ steps.detect-package-manager.outputs.manager }} + cache: "pnpm" - name: Setup Pages uses: actions/configure-pages@v3 with: @@ -75,16 +56,14 @@ jobs: path: | .next/cache # Generate a new cache whenever packages or source files change. - key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} # If source files changed but packages didn't, rebuild from a prior cache. restore-keys: | - ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- + ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}- - name: Install dependencies - run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + run: pnpm install - name: Build with Next.js - run: ${{ steps.detect-package-manager.outputs.runner }} next build - - name: Static HTML export with Next.js - run: ${{ steps.detect-package-manager.outputs.runner }} next export + run: pnpm exec next build - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 0000000..0176969 --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1 @@ +singleQuote: true diff --git a/next.config.js b/next.config.js index b0247ab..c8cc06b 100644 --- a/next.config.js +++ b/next.config.js @@ -3,6 +3,6 @@ const nextConfig = { reactStrictMode: true, output: 'export', basePath: '/auto-manufacturers', -} +}; module.exports = nextConfig; diff --git a/package.json b/package.json index f0ddd8a..71a843f 100644 --- a/package.json +++ b/package.json @@ -45,5 +45,8 @@ "ts-jest": "^29.1.1", "ts-node": "^10.9.1", "typescript": "^5.1.6" + }, + "peerDependencies": { + "@types/node": "^18.18.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index abd199b..cb98c06 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ dependencies: '@reduxjs/toolkit': specifier: ^1.8.1 version: 1.9.5(react@18.2.0) + '@types/node': + specifier: ^18.18.0 + version: 18.18.4 next: specifier: ^13.4.9 version: 13.4.9(@babel/core@7.22.8)(react-dom@18.2.0)(react@18.2.0) @@ -84,7 +87,7 @@ devDependencies: version: 6.0.0 jest: specifier: ^29.6.1 - version: 29.6.1(@types/node@20.4.1)(ts-node@10.9.1) + version: 29.6.1(@types/node@18.18.4)(ts-node@10.9.1) storybook: specifier: ^7.1.0 version: 7.1.0 @@ -93,7 +96,7 @@ devDependencies: version: 29.1.1(@babel/core@7.22.8)(esbuild@0.18.16)(jest@29.6.1)(typescript@5.1.6) ts-node: specifier: ^10.9.1 - version: 10.9.1(@swc/core@1.3.70)(@types/node@20.4.1)(typescript@5.1.6) + version: 10.9.1(@swc/core@1.3.70)(@types/node@18.18.4)(typescript@5.1.6) typescript: specifier: ^5.1.6 version: 5.1.6 @@ -1900,7 +1903,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 chalk: 4.1.2 jest-message-util: 29.6.1 jest-util: 29.6.1 @@ -1921,14 +1924,14 @@ packages: '@jest/test-result': 29.6.1 '@jest/transform': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.8.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.5.0 - jest-config: 29.6.1(@types/node@20.4.1)(ts-node@10.9.1) + jest-config: 29.6.1(@types/node@18.18.4)(ts-node@10.9.1) jest-haste-map: 29.6.1 jest-message-util: 29.6.1 jest-regex-util: 29.4.3 @@ -1955,7 +1958,7 @@ packages: dependencies: '@jest/fake-timers': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 jest-mock: 29.6.1 dev: true @@ -1982,7 +1985,7 @@ packages: dependencies: '@jest/types': 29.6.1 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.4.1 + '@types/node': 18.18.4 jest-message-util: 29.6.1 jest-mock: 29.6.1 jest-util: 29.6.1 @@ -2015,7 +2018,7 @@ packages: '@jest/transform': 29.6.1 '@jest/types': 29.6.1 '@jridgewell/trace-mapping': 0.3.18 - '@types/node': 20.4.1 + '@types/node': 18.18.4 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -2103,7 +2106,7 @@ packages: '@jest/schemas': 29.6.0 '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 '@types/yargs': 17.0.24 chalk: 4.1.2 dev: true @@ -2845,7 +2848,7 @@ packages: remark-slug: 6.1.0 rollup: 3.26.2 typescript: 5.1.6 - vite: 4.4.4(@types/node@20.4.1) + vite: 4.4.4(@types/node@18.18.4) transitivePeerDependencies: - encoding - supports-color @@ -3744,19 +3747,19 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 20.4.1 + '@types/node': 18.18.4 dev: true /@types/connect@3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 dev: true /@types/cross-spawn@6.0.2: resolution: {integrity: sha512-KuwNhp3eza+Rhu8IFI5HUXRP0LIhqH5cAjubUvGXXthh4YYBuP2ntwEX+Cz8GJoZUHlKo247wPWOfA9LYEq4cw==} dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 dev: true /@types/debug@4.1.8: @@ -3810,7 +3813,7 @@ packages: /@types/express-serve-static-core@4.17.35: resolution: {integrity: sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==} dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 '@types/send': 0.17.1 @@ -3832,7 +3835,7 @@ packages: /@types/graceful-fs@4.1.6: resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 dev: true /@types/html-minifier-terser@6.1.0: @@ -3903,7 +3906,7 @@ packages: /@types/node-fetch@2.6.4: resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==} dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 form-data: 3.0.1 dev: true @@ -3911,9 +3914,8 @@ packages: resolution: {integrity: sha512-8q9ZexmdYYyc5/cfujaXb4YOucpQxAV4RMG0himLyDUOEr8Mr79VrqsFI+cQ2M2h89YIuy95lbxuYjxT4Hk4kQ==} dev: true - /@types/node@20.4.1: - resolution: {integrity: sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg==} - dev: true + /@types/node@18.18.4: + resolution: {integrity: sha512-t3rNFBgJRugIhackit2mVcLfF6IRc0JE4oeizPQL8Zrm8n2WY/0wOdpOPhdtG0V9Q2TlW/axbF1MJ6z+Yj/kKQ==} /@types/normalize-package-data@2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -3969,7 +3971,7 @@ packages: resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==} dependencies: '@types/mime': 1.3.2 - '@types/node': 20.4.1 + '@types/node': 18.18.4 dev: true /@types/serve-static@1.15.2: @@ -3977,7 +3979,7 @@ packages: dependencies: '@types/http-errors': 2.0.1 '@types/mime': 1.3.2 - '@types/node': 20.4.1 + '@types/node': 18.18.4 dev: true /@types/stack-utils@2.0.1: @@ -6424,7 +6426,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/expect-utils': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 jest-get-type: 29.4.3 jest-matcher-utils: 29.6.1 jest-message-util: 29.6.1 @@ -7656,7 +7658,7 @@ packages: '@jest/expect': 29.6.1 '@jest/test-result': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 chalk: 4.1.2 co: 4.6.0 dedent: 0.7.0 @@ -7676,7 +7678,7 @@ packages: - supports-color dev: true - /jest-cli@29.6.1(@types/node@20.4.1)(ts-node@10.9.1): + /jest-cli@29.6.1(@types/node@18.18.4)(ts-node@10.9.1): resolution: {integrity: sha512-607dSgTA4ODIN6go9w6xY3EYkyPFGicx51a69H7yfvt7lN53xNswEVLovq+E77VsTRi5fWprLH0yl4DJgE8Ing==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -7693,7 +7695,7 @@ packages: exit: 0.1.2 graceful-fs: 4.2.11 import-local: 3.1.0 - jest-config: 29.6.1(@types/node@20.4.1)(ts-node@10.9.1) + jest-config: 29.6.1(@types/node@18.18.4)(ts-node@10.9.1) jest-util: 29.6.1 jest-validate: 29.6.1 prompts: 2.4.2 @@ -7704,7 +7706,7 @@ packages: - ts-node dev: true - /jest-config@29.6.1(@types/node@20.4.1)(ts-node@10.9.1): + /jest-config@29.6.1(@types/node@18.18.4)(ts-node@10.9.1): resolution: {integrity: sha512-XdjYV2fy2xYixUiV2Wc54t3Z4oxYPAELUzWnV6+mcbq0rh742X2p52pii5A3oeRzYjLnQxCsZmp0qpI6klE2cQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: @@ -7719,7 +7721,7 @@ packages: '@babel/core': 7.22.8 '@jest/test-sequencer': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 babel-jest: 29.6.1(@babel/core@7.22.8) chalk: 4.1.2 ci-info: 3.8.0 @@ -7739,7 +7741,7 @@ packages: pretty-format: 29.6.1 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.9.1(@swc/core@1.3.70)(@types/node@20.4.1)(typescript@5.1.6) + ts-node: 10.9.1(@swc/core@1.3.70)(@types/node@18.18.4)(typescript@5.1.6) transitivePeerDependencies: - supports-color dev: true @@ -7779,7 +7781,7 @@ packages: '@jest/environment': 29.6.1 '@jest/fake-timers': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 jest-mock: 29.6.1 jest-util: 29.6.1 dev: true @@ -7795,7 +7797,7 @@ packages: dependencies: '@jest/types': 29.6.1 '@types/graceful-fs': 4.1.6 - '@types/node': 20.4.1 + '@types/node': 18.18.4 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -7846,7 +7848,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 jest-util: 29.6.1 dev: true @@ -7901,7 +7903,7 @@ packages: '@jest/test-result': 29.6.1 '@jest/transform': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -7932,7 +7934,7 @@ packages: '@jest/test-result': 29.6.1 '@jest/transform': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 chalk: 4.1.2 cjs-module-lexer: 1.2.3 collect-v8-coverage: 1.0.2 @@ -7985,7 +7987,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 chalk: 4.1.2 ci-info: 3.8.0 graceful-fs: 4.2.11 @@ -8010,7 +8012,7 @@ packages: dependencies: '@jest/test-result': 29.6.1 '@jest/types': 29.6.1 - '@types/node': 20.4.1 + '@types/node': 18.18.4 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -8022,7 +8024,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true @@ -8031,13 +8033,13 @@ packages: resolution: {integrity: sha512-U+Wrbca7S8ZAxAe9L6nb6g8kPdia5hj32Puu5iOqBCMTMWFHXuK6dOV2IFrpedbTV8fjMFLdWNttQTBL6u2MRA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 jest-util: 29.6.1 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true - /jest@29.6.1(@types/node@20.4.1)(ts-node@10.9.1): + /jest@29.6.1(@types/node@18.18.4)(ts-node@10.9.1): resolution: {integrity: sha512-Nirw5B4nn69rVUZtemCQhwxOBhm0nsp3hmtF4rzCeWD7BkjAXRIji7xWQfnTNbz9g0aVsBX6aZK3n+23LM6uDw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -8050,7 +8052,7 @@ packages: '@jest/core': 29.6.1(ts-node@10.9.1) '@jest/types': 29.6.1 import-local: 3.1.0 - jest-cli: 29.6.1(@types/node@20.4.1)(ts-node@10.9.1) + jest-cli: 29.6.1(@types/node@18.18.4)(ts-node@10.9.1) transitivePeerDependencies: - '@types/node' - supports-color @@ -11022,7 +11024,7 @@ packages: bs-logger: 0.2.6 esbuild: 0.18.16 fast-json-stable-stringify: 2.1.0 - jest: 29.6.1(@types/node@20.4.1)(ts-node@10.9.1) + jest: 29.6.1(@types/node@18.18.4)(ts-node@10.9.1) jest-util: 29.6.1 json5: 2.2.3 lodash.memoize: 4.1.2 @@ -11032,7 +11034,7 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-node@10.9.1(@swc/core@1.3.70)(@types/node@20.4.1)(typescript@5.1.6): + /ts-node@10.9.1(@swc/core@1.3.70)(@types/node@18.18.4)(typescript@5.1.6): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -11052,7 +11054,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.4.1 + '@types/node': 18.18.4 acorn: 8.10.0 acorn-walk: 8.2.0 arg: 4.1.3 @@ -11467,7 +11469,7 @@ packages: vfile-message: 3.1.4 dev: true - /vite@4.4.4(@types/node@20.4.1): + /vite@4.4.4(@types/node@18.18.4): resolution: {integrity: sha512-4mvsTxjkveWrKDJI70QmelfVqTm+ihFAb6+xf4sjEU2TmUCTlVX87tmg/QooPEMQb/lM9qGHT99ebqPziEd3wg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -11495,7 +11497,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.4.1 + '@types/node': 18.18.4 esbuild: 0.18.16 postcss: 8.4.25 rollup: 3.26.2