diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 59a28d8..f075f58 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,4 +1,4 @@ -name: Node CI +name: PR Checks on: push: @@ -21,4 +21,5 @@ jobs: cache: yarn - run: yarn - run: yarn build + - run: yarn prettier:check - run: yarn test --maxWorkers 2 diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 693d974..15e59c2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,8 +1,8 @@ -name: Node.js CI +name: GitHub Pages on: push: - branches: [ main ] + branches: [main] jobs: gh-pages: @@ -18,9 +18,11 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn - run: yarn install --frozen-lockfile - - run: npx typedoc + - run: yarn typedoc + - run: yarn coverage + - run: yarn build:pages - name: Publish to gh-pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./typedocs + publish_dir: ./gh-pages diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1217052..cf48146 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,12 @@ -name: Node.js CI +name: Release on: push: - branches: [ main ] + branches: [main, next] jobs: release: + if: ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/main' || github.event.ref == 'refs/heads/next') }} runs-on: ubuntu-latest strategy: matrix: @@ -17,9 +18,10 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: yarn - - run: yarn - - run: yarn test + - run: yarn install --frozen-lockfile - run: yarn build + - run: yarn prettier:check + - run: yarn test --maxWorkers 2 - name: Semantic Release uses: cycjimmy/semantic-release-action@v4 env: diff --git a/.gitignore b/.gitignore index 16cbede..02538e0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ pids lib-cov # Coverage directory used by tools like istanbul -coverage +/coverage/ *.lcov # nyc test coverage @@ -122,3 +122,4 @@ es2020/ /docs/ /typedocs/ +/gh-pages/ diff --git a/package.json b/package.json index d8cf139..bcef8cb 100644 --- a/package.json +++ b/package.json @@ -23,16 +23,19 @@ "typings": "lib/index.d.ts", "scripts": { "prettier": "prettier --ignore-path .gitignore --write 'src/**/*.{ts,tsx,js,jsx}'", - "prettier:diff": "prettier -l 'src/**/*.{ts,tsx,js,jsx}'", + "prettier:check": "prettier --check 'src/**/*.{ts,tsx,js,jsx}'", "tslint": "tslint 'src/**/*.{js,jsx,ts,tsx}' -t verbose", "lint": "yarn tslint", - "clean": "rimraf lib es6 es2020", + "clean": "rimraf lib es6 es2020 coverage typedocs gh-pages", "build:cjs": "tsc", "build:es6": "tsc --module commonjs --target es6 --outDir es6", "build:es2020": "tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir es2020", "build": "yarn build:cjs && yarn build:es6 && yarn build:es2020", "test": "jest --no-cache --config='jest.config.js'", - "release": "semantic-release" + "coverage": "yarn test --collectCoverage", + "typedoc": "npx typedoc@0.25.13 --tsconfig tsconfig.build.json", + "build:pages": "npx rimraf@5.0.5 gh-pages && mkdir -p gh-pages && cp -r typedocs/* gh-pages && cp -r coverage gh-pages/coverage", + "deploy:pages": "gh-pages -d gh-pages" }, "keywords": [], "dependencies": {}, @@ -40,16 +43,12 @@ "tslib": "^2" }, "devDependencies": { - "@semantic-release/changelog": "^6.0.0", - "@semantic-release/git": "^10.0.0", - "@semantic-release/npm": "^8.0.2", "@types/jest": "^29.5.12", "husky": "^8.0.0", "jest": "^29.7.0", "prettier": "^3.0.0", "pretty-quick": "^3.1.1", "rimraf": "^3.0.2", - "semantic-release": "^18.0.0", "ts-jest": "^29.1.2", "tslint": "^6.1.3", "tslint-config-common": "^1.6.2", @@ -57,18 +56,22 @@ "tslib": "^2.6.2" }, "release": { - "verifyConditions": [ + "branches": [ + "main", + { + "name": "next", + "prerelease": true + } + ], + "prepare": [ "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/git" ], - "prepare": [ + "verifyConditions": [ "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/git" - ], - "branches": [ - "main" ] } }