Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: github workflow #222

Merged
merged 9 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .commitlintrc.cjs → .commitlintrc.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const conventional = require("@commitlint/config-conventional");
import conventional from "@commitlint/config-conventional";

module.exports = {

const commitLintConfig = {
extends: ["@commitlint/config-conventional"],
plugins: ["commitlint-plugin-function-rules"],
helpUrl:
Expand All @@ -15,3 +16,5 @@ module.exports = {
"function-rules/header-max-length": [0],
},
};

export default commitLintConfig;
34 changes: 34 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Install"
description: "Sets up Node.js and runs install"

runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Setup node
uses: actions/setup-node@v4
with:
cache: "pnpm"
check-latest: true
node-version-file: ".nvmrc"

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile
18 changes: 5 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,10 @@ jobs:
script: [lint, test, build]
steps:
- name: Checkout Codebase
uses: actions/checkout@v3
- name: Setup Pnpm
uses: pnpm/action-setup@v2
with:
run_install: false
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: "pnpm"
check-latest: true
node-version-file: ".nvmrc"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install

- name: Run Script ${{ matrix.script }}
run: pnpm ${{ matrix.script }}
36 changes: 17 additions & 19 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,29 @@ on: [pull_request]

jobs:
commitlint:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
environment: Preview

steps:
- name: Checkout Codebase
uses: actions/checkout@v3
- name: Checkout codebase
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
run_install: false
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: "pnpm"
check-latest: true
node-version-file: ".nvmrc"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Run Commitlint

- name: Install dependencies
uses: ./.github/actions/install

- name: Run commitlint
id: run_commitlint
uses: wagoid/commitlint-github-action@v5
uses: wagoid/commitlint-github-action@v6
with:
configFile: .commitlintrc.cjs
configFile: .commitlintrc.mjs
env:
NODE_PATH: ${{ github.workspace }}/node_modules
- name: Show Outputs

- name: Show outputs
if: ${{ always() }}
run: echo ${{ toJSON(steps.run_commitlint.outputs.results) }}
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm commitlint --config .commitlintrc.cjs --edit ${1}
pnpm commitlint --config .commitlintrc.mjs --edit ${1}
10 changes: 1 addition & 9 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Avoid excessive outputs
if [ -t 2 ]; then
exec >/dev/tty 2>&1
fi

pnpm lint-staged
pnpm lint-staged -c .lintstagedrc.mjs
9 changes: 6 additions & 3 deletions .lintstagedrc.cjs → .lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {relative} = require("path");
import {relative} from "path";

const {ESLint} = require("eslint");
import {ESLint} from "eslint";

const removeIgnoredFiles = async (files) => {
const cwd = process.cwd();
Expand All @@ -12,7 +12,8 @@ const removeIgnoredFiles = async (files) => {
return filteredFiles.join(" ");
};

module.exports = {

const lintStaged = {
// *.!(js|ts|jsx|tsx|d.ts)
"**/*.{js,cjs,mjs,ts,jsx,tsx,json,md}": async (files) => {
const filesToLint = await removeIgnoredFiles(files);
Expand All @@ -25,3 +26,5 @@ module.exports = {
return [`eslint -c .eslintrc.json --max-warnings=0 --fix ${filesToLint}`];
},
};

export default lintStaged;
5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
auto-install-peers=true
enable-pre-post-scripts=true
lockfile=true
save-exact=true
strict-peer-dependencies=false
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.x
v20.18.0
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ const config = {
},
},
transform: {
"^.+\\.(t|j)sx?$": "@swc-node/jest",
"^.+\\.(t|j)sx?$": "@swc/jest",
},
setupFilesAfterEnv: ["<rootDir>/setupTests.ts"],
extensionsToTreatAsEsm: [".ts"],
};

export default config;
67 changes: 34 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,42 @@
"test:watch": "jest --watch --no-verbose"
},
"dependencies": {
"tailwind-merge": "^2.5.4"
"tailwind-merge": "2.5.4"
},
"devDependencies": {
"@commitlint/cli": "^17.2.0",
"@commitlint/config-conventional": "^17.2.0",
"@jest/globals": "^29.7.0",
"@swc-node/jest": "^1.5.2",
"@swc/cli": "0.1.57",
"@swc/core": "1.2.198",
"@swc/helpers": "^0.4.14",
"@types/jest": "28.1.1",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@jest/globals": "29.7.0",
"@swc-node/jest": "1.8.12",
"@swc/cli": "0.5.0",
"@swc/core": "1.9.2",
"@swc/helpers": "0.5.15",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/node": "22.9.0",
"@typescript-eslint/eslint-plugin": "8.14.0",
"@typescript-eslint/parser": "8.14.0",
"benchmark": "2.1.4",
"class-variance-authority": "^0.7.0",
"clean-package": "2.1.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-ts-lambdas": "^1.2.3",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"expect": "^29.7.0",
"jest": "28.1.1",
"prettier": "^3.2.5",
"prettier-eslint": "^16.3.0",
"prettier-eslint-cli": "^8.0.1",
"tailwindcss": "^3.2.7",
"ts-node": "^10.9.1",
"tsup": "6.6.3",
"typescript": "5.1.3"
"class-variance-authority": "0.7.0",
"clean-package": "2.2.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-ts-lambdas": "1.2.3",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "28.9.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-promise": "7.1.0",
"expect": "29.7.0",
"jest": "29.7.0",
"prettier": "3.3.3",
"prettier-eslint": "16.3.0",
"prettier-eslint-cli": "8.0.1",
"tailwindcss": "3.4.14",
"ts-node": "10.9.2",
"tsup": "8.3.5",
"typescript": "5.6.3"
},
"peerDependencies": {
"tailwindcss": "*"
Expand All @@ -97,7 +98,7 @@
"esm"
]
},
"packageManager": "pnpm@8.6.8",
"packageManager": "pnpm@9.12.3",
"engines": {
"node": ">=16.x",
"pnpm": ">=7.x"
Expand Down
Loading