Skip to content

Commit e312fef

Browse files
authored
fix: github workflow (#222)
* chore: update version of package manager * fix: lockfile * chore: install dependencies with npmrc * fix: jest transform * chore: update node version * chore: update workflow and related configs * fix: install action * fix: duplicate installation
1 parent 21367ec commit e312fef

File tree

12 files changed

+3042
-2790
lines changed

12 files changed

+3042
-2790
lines changed

.commitlintrc.cjs renamed to .commitlintrc.mjs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
const conventional = require("@commitlint/config-conventional");
1+
import conventional from "@commitlint/config-conventional";
22

3-
module.exports = {
3+
4+
const commitLintConfig = {
45
extends: ["@commitlint/config-conventional"],
56
plugins: ["commitlint-plugin-function-rules"],
67
helpUrl:
@@ -15,3 +16,5 @@ module.exports = {
1516
"function-rules/header-max-length": [0],
1617
},
1718
};
19+
20+
export default commitLintConfig;

.github/actions/install/action.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Install"
2+
description: "Sets up Node.js and runs install"
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup pnpm
8+
uses: pnpm/action-setup@v4
9+
with:
10+
run_install: false
11+
12+
- name: Setup node
13+
uses: actions/setup-node@v4
14+
with:
15+
cache: "pnpm"
16+
check-latest: true
17+
node-version-file: ".nvmrc"
18+
19+
- name: Get pnpm store directory
20+
shell: bash
21+
run: |
22+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
23+
24+
- name: Setup pnpm cache
25+
uses: actions/cache@v4
26+
with:
27+
path: ${{ env.STORE_PATH }}
28+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
29+
restore-keys: |
30+
${{ runner.os }}-pnpm-store-
31+
32+
- name: Install dependencies
33+
shell: bash
34+
run: pnpm install --frozen-lockfile

.github/workflows/ci.yml

+5-13
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,10 @@ jobs:
1515
script: [lint, test, build]
1616
steps:
1717
- name: Checkout Codebase
18-
uses: actions/checkout@v3
19-
- name: Setup Pnpm
20-
uses: pnpm/action-setup@v2
21-
with:
22-
run_install: false
23-
- name: Setup Node
24-
uses: actions/setup-node@v3
25-
with:
26-
cache: "pnpm"
27-
check-latest: true
28-
node-version-file: ".nvmrc"
29-
- name: Install Dependencies
30-
run: pnpm install --frozen-lockfile
18+
uses: actions/checkout@v4
19+
20+
- name: Install dependencies
21+
uses: ./.github/actions/install
22+
3123
- name: Run Script ${{ matrix.script }}
3224
run: pnpm ${{ matrix.script }}

.github/workflows/commitlint.yml

+17-19
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,29 @@ on: [pull_request]
44

55
jobs:
66
commitlint:
7-
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest]
10+
runs-on: ${{ matrix.os }}
11+
environment: Preview
12+
813
steps:
9-
- name: Checkout Codebase
10-
uses: actions/checkout@v3
14+
- name: Checkout codebase
15+
uses: actions/checkout@v4
1116
with:
1217
fetch-depth: 0
13-
- name: Setup pnpm
14-
uses: pnpm/action-setup@v2
15-
with:
16-
run_install: false
17-
- name: Setup Node
18-
uses: actions/setup-node@v3
19-
with:
20-
cache: "pnpm"
21-
check-latest: true
22-
node-version-file: ".nvmrc"
23-
- name: Install Dependencies
24-
run: pnpm install --frozen-lockfile
25-
- name: Run Commitlint
18+
19+
- name: Install dependencies
20+
uses: ./.github/actions/install
21+
22+
- name: Run commitlint
2623
id: run_commitlint
27-
uses: wagoid/commitlint-github-action@v5
24+
uses: wagoid/commitlint-github-action@v6
2825
with:
29-
configFile: .commitlintrc.cjs
26+
configFile: .commitlintrc.mjs
3027
env:
3128
NODE_PATH: ${{ github.workspace }}/node_modules
32-
- name: Show Outputs
29+
30+
- name: Show outputs
3331
if: ${{ always() }}
3432
run: echo ${{ toJSON(steps.run_commitlint.outputs.results) }}

.husky/commit-msg

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
pnpm commitlint --config .commitlintrc.cjs --edit ${1}
1+
pnpm commitlint --config .commitlintrc.mjs --edit ${1}

.husky/pre-commit

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
# Avoid excessive outputs
5-
if [ -t 2 ]; then
6-
exec >/dev/tty 2>&1
7-
fi
8-
9-
pnpm lint-staged
1+
pnpm lint-staged -c .lintstagedrc.mjs

.lintstagedrc.cjs renamed to .lintstagedrc.mjs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const {relative} = require("path");
1+
import {relative} from "path";
22

3-
const {ESLint} = require("eslint");
3+
import {ESLint} from "eslint";
44

55
const removeIgnoredFiles = async (files) => {
66
const cwd = process.cwd();
@@ -12,7 +12,8 @@ const removeIgnoredFiles = async (files) => {
1212
return filteredFiles.join(" ");
1313
};
1414

15-
module.exports = {
15+
16+
const lintStaged = {
1617
// *.!(js|ts|jsx|tsx|d.ts)
1718
"**/*.{js,cjs,mjs,ts,jsx,tsx,json,md}": async (files) => {
1819
const filesToLint = await removeIgnoredFiles(files);
@@ -25,3 +26,5 @@ module.exports = {
2526
return [`eslint -c .eslintrc.json --max-warnings=0 --fix ${filesToLint}`];
2627
},
2728
};
29+
30+
export default lintStaged;

.npmrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
auto-install-peers=true
2+
enable-pre-post-scripts=true
3+
lockfile=true
4+
save-exact=true
5+
strict-peer-dependencies=false

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.x
1+
v20.18.0

jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ const config = {
66
},
77
},
88
transform: {
9-
"^.+\\.(t|j)sx?$": "@swc-node/jest",
9+
"^.+\\.(t|j)sx?$": "@swc/jest",
1010
},
1111
setupFilesAfterEnv: ["<rootDir>/setupTests.ts"],
12+
extensionsToTreatAsEsm: [".ts"],
1213
};
1314

1415
export default config;

package.json

+34-33
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,42 @@
3737
"test:watch": "jest --watch --no-verbose"
3838
},
3939
"dependencies": {
40-
"tailwind-merge": "^2.5.4"
40+
"tailwind-merge": "2.5.4"
4141
},
4242
"devDependencies": {
43-
"@commitlint/cli": "^17.2.0",
44-
"@commitlint/config-conventional": "^17.2.0",
45-
"@jest/globals": "^29.7.0",
46-
"@swc-node/jest": "^1.5.2",
47-
"@swc/cli": "0.1.57",
48-
"@swc/core": "1.2.198",
49-
"@swc/helpers": "^0.4.14",
50-
"@types/jest": "28.1.1",
51-
"@types/node": "^18.11.18",
52-
"@typescript-eslint/eslint-plugin": "^7.3.1",
53-
"@typescript-eslint/parser": "^7.3.1",
43+
"@commitlint/cli": "19.5.0",
44+
"@commitlint/config-conventional": "19.5.0",
45+
"@jest/globals": "29.7.0",
46+
"@swc-node/jest": "1.8.12",
47+
"@swc/cli": "0.5.0",
48+
"@swc/core": "1.9.2",
49+
"@swc/helpers": "0.5.15",
50+
"@swc/jest": "0.2.37",
51+
"@types/jest": "29.5.14",
52+
"@types/node": "22.9.0",
53+
"@typescript-eslint/eslint-plugin": "8.14.0",
54+
"@typescript-eslint/parser": "8.14.0",
5455
"benchmark": "2.1.4",
55-
"class-variance-authority": "^0.7.0",
56-
"clean-package": "2.1.1",
57-
"eslint": "^8.57.0",
58-
"eslint-config-prettier": "^9.1.0",
59-
"eslint-config-ts-lambdas": "^1.2.3",
60-
"eslint-import-resolver-typescript": "^3.6.1",
61-
"eslint-plugin-import": "^2.29.1",
62-
"eslint-plugin-jest": "^27.9.0",
63-
"eslint-plugin-node": "^11.1.0",
64-
"eslint-plugin-prettier": "^5.1.3",
65-
"eslint-plugin-promise": "^6.1.1",
66-
"expect": "^29.7.0",
67-
"jest": "28.1.1",
68-
"prettier": "^3.2.5",
69-
"prettier-eslint": "^16.3.0",
70-
"prettier-eslint-cli": "^8.0.1",
71-
"tailwindcss": "^3.2.7",
72-
"ts-node": "^10.9.1",
73-
"tsup": "6.6.3",
74-
"typescript": "5.1.3"
56+
"class-variance-authority": "0.7.0",
57+
"clean-package": "2.2.0",
58+
"eslint": "8.57.0",
59+
"eslint-config-prettier": "9.1.0",
60+
"eslint-config-ts-lambdas": "1.2.3",
61+
"eslint-import-resolver-typescript": "3.6.3",
62+
"eslint-plugin-import": "2.31.0",
63+
"eslint-plugin-jest": "28.9.0",
64+
"eslint-plugin-node": "11.1.0",
65+
"eslint-plugin-prettier": "5.2.1",
66+
"eslint-plugin-promise": "7.1.0",
67+
"expect": "29.7.0",
68+
"jest": "29.7.0",
69+
"prettier": "3.3.3",
70+
"prettier-eslint": "16.3.0",
71+
"prettier-eslint-cli": "8.0.1",
72+
"tailwindcss": "3.4.14",
73+
"ts-node": "10.9.2",
74+
"tsup": "8.3.5",
75+
"typescript": "5.6.3"
7576
},
7677
"peerDependencies": {
7778
"tailwindcss": "*"
@@ -97,7 +98,7 @@
9798
"esm"
9899
]
99100
},
100-
"packageManager": "pnpm@8.6.8",
101+
"packageManager": "pnpm@9.12.3",
101102
"engines": {
102103
"node": ">=16.x",
103104
"pnpm": ">=7.x"

0 commit comments

Comments
 (0)