-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e2c55b
commit 2ec6377
Showing
6 changed files
with
120 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
# types: [opened, synchronize, reopened, ready_for_review] | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
codeQuality: | ||
name: Check code quality (lint and format) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Format check | ||
run: npm run format | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
test: | ||
name: Test on node ${{ matrix.node }} and ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node: [ '20.x', '18.x' ] | ||
os: [ubuntu-latest] | ||
# Collect coverage only for node 20 and ubuntu-latest, no need to run it twice | ||
# @see https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations | ||
include: | ||
- collectCoverage: true | ||
node: '20.x' | ||
os: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Test | ||
if: ${{ !matrix.collectCoverage }} | ||
run: npm test | ||
|
||
- name: Test with coverage | ||
if: ${{ matrix.collectCoverage }} | ||
run: npm run test:coverage | ||
|
||
- name: Coveralls | ||
if: ${{ matrix.collectCoverage }} | ||
uses: coverallsapp/github-action@v2 | ||
|
||
testTypescript: | ||
name: Test typescript | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Test | ||
run: npm run test:typescript |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,8 @@ | |
"scripts": { | ||
"clean": "rimraf dist && mkdirp dist", | ||
"lint": "eslint ./src ./test", | ||
"format": "prettier \"{,**/}*.{ts,tsx,mts,js,json,md}\" --check", | ||
"format:fix": "prettier \"{,**/}*.{ts,tsx,mts,js,json,md}\" --write", | ||
"copy": "cp-cli ./dist/umd/react-i18next.min.js ./react-i18next.min.js && cp-cli ./dist/umd/react-i18next.js ./react-i18next.js && echo '{\"type\":\"module\"}' > dist/es/package.json", | ||
"build:es": "cross-env BABEL_ENV=jsnext babel src --out-dir dist/es", | ||
"build:cjs": "babel src --out-dir dist/commonjs", | ||
|
@@ -144,13 +146,11 @@ | |
"fix_dist_package": "node -e 'console.log(`{\"type\":\"module\",\"version\":\"${process.env.npm_package_version}\"}`)' > dist/es/package.json", | ||
"preversion": "npm run build && git push", | ||
"postversion": "npm run fix_dist_package && git push && git push --tags", | ||
"pretest": "npm run lint", | ||
"test": "vitest run --typecheck --workspace vitest.workspace.mts", | ||
"test:runtime": "npm run test -- --project runtime", | ||
"test:coverage": "npm run test:runtime -- --coverage --run", | ||
"test": "vitest", | ||
"test:coverage": "npm run test -- --coverage --run", | ||
"test:typescript": "vitest --workspace vitest.workspace.typescript.mts", | ||
"contributors:add": "all-contributors add", | ||
"contributors:generate": "all-contributors generate", | ||
"prettier": "prettier --write \"{,**/}*.{mts,ts,tsx,js,json,md}\"", | ||
"prepare": "husky install" | ||
}, | ||
"author": "Jan Mühlemann <[email protected]> (https://github.com/jamuhl)", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters