diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 7daa494..8d1eabc 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,6 +2,7 @@ name: checks on: - push - pull_request + - workflow_call jobs: test: diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..af9b6f0 --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,15 @@ +name: Sync labels +on: + workflow_dispatch: +permissions: + issues: write +jobs: + labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: EndBug/label-sync@v2 + with: + config-file: 'https://raw.githubusercontent.com/thetutlage/static/main/labels.yml' + delete-other-labels: true + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fde89b4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: release +on: workflow_dispatch +permissions: + contents: write + id-token: write +jobs: + checks: + uses: ./.github/workflows/checks.yml + release: + needs: checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: git config + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + - name: Init npm config + run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: npm install + - run: npm run release -- --ci + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..e4cad4b --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,2 @@ +import { configPkg } from '@adonisjs/eslint-config' +export default configPkg() diff --git a/package.json b/package.json index ac6b386..5ca99e3 100644 --- a/package.json +++ b/package.json @@ -17,50 +17,46 @@ "./types": "./build/src/types.js" }, "scripts": { - "pretest": "npm run lint && npm run typecheck", + "pretest": "npm run lint", "test": "c8 npm run quick:test", - "quick:test": "cross-env NODE_NO_WARNINGS=1 glob -c \"node --enable-source-maps --loader=ts-node/esm --test\" \"tests/**/*.spec.ts\"", - "clean": "del-cli build", + "lint": "eslint .", + "format": "prettier --write .", + "typecheck": "tsc --noEmit", "precompile": "npm run lint && npm run clean", + "clean": "del-cli build", "compile": "tsup-node && tsc --emitDeclarationOnly --declaration", "build": "npm run compile", - "release": "np", "version": "npm run build", "prepublishOnly": "npm run build", - "lint": "eslint . --ext=.ts", - "typecheck": "tsc --noEmit", - "format": "prettier --write .", - "sync-labels": "github-label-sync --labels .github/labels.json japa/assert" + "release": "release-it", + "quick:test": "node --import=ts-node-maintained/register/esm --enable-source-maps bin/test.ts" }, "devDependencies": { - "@adonisjs/eslint-config": "^1.3.0", - "@adonisjs/prettier-config": "^1.3.0", - "@adonisjs/tsconfig": "^1.3.0", - "@commitlint/cli": "^19.2.1", - "@commitlint/config-conventional": "^19.1.0", - "@japa/errors-printer": "^3.0.3", - "@japa/runner": "^3.1.2", - "@swc/core": "^1.4.11", + "@adonisjs/eslint-config": "^2.0.0-beta.7", + "@adonisjs/prettier-config": "^1.4.0", + "@adonisjs/tsconfig": "^1.4.0", + "@japa/errors-printer": "^3.0.4", + "@japa/runner": "^3.1.4", + "@release-it/conventional-changelog": "^9.0.3", + "@swc/core": "^1.10.1", "@types/luxon": "^3.4.2", - "@types/node": "^20.11.30", - "c8": "^9.1.0", + "@types/node": "^22.10.2", + "c8": "^10.1.3", "cross-env": "^7.0.3", - "del-cli": "^5.1.0", - "eslint": "^8.57.0", - "github-label-sync": "^2.3.1", - "glob": "^10.3.12", - "husky": "^9.0.11", - "luxon": "^3.4.4", - "np": "^10.0.2", - "prettier": "^3.2.5", - "ts-node": "^10.9.2", - "tsup": "^8.0.2", - "typescript": "^5.4.3" + "del-cli": "^6.0.0", + "eslint": "^9.17.0", + "glob": "^11.0.0", + "luxon": "^3.5.0", + "prettier": "^3.4.2", + "release-it": "^17.10.0", + "ts-node-maintained": "^10.9.4", + "tsup": "^8.3.5", + "typescript": "^5.7.2" }, "dependencies": { - "@poppinss/macroable": "^1.0.2", - "@types/chai": "^4.3.14", - "chai": "^5.1.0" + "@poppinss/macroable": "^1.0.3", + "@types/chai": "^5.0.1", + "chai": "^5.1.2" }, "peerDependencies": { "@japa/runner": "^3.1.2" @@ -80,37 +76,9 @@ "chai", "japa" ], - "types": "./build/index.d.ts", - "eslintConfig": { - "extends": "@adonisjs/eslint-config/package" - }, - "prettier": "@adonisjs/prettier-config", - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ] - }, "publishConfig": { "access": "public", - "tag": "latest" - }, - "np": { - "message": "chore(release): %s", - "tag": "latest", - "branch": "main", - "anyBranch": false - }, - "c8": { - "reporter": [ - "text", - "html" - ], - "exclude": [ - "tests/**" - ] - }, - "directories": { - "test": "tests" + "provenance": true }, "tsup": { "entry": [ @@ -121,7 +89,41 @@ "clean": true, "format": "esm", "dts": false, - "sourcemap": true, + "sourcemap": false, "target": "esnext" - } + }, + "release-it": { + "git": { + "requireCleanWorkingDir": true, + "requireUpstream": true, + "commitMessage": "chore(release): ${version}", + "tagAnnotation": "v${version}", + "push": true, + "tagName": "v${version}" + }, + "github": { + "release": true + }, + "npm": { + "publish": true, + "skipChecks": true + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": { + "name": "angular" + } + } + } + }, + "c8": { + "reporter": [ + "text", + "html" + ], + "exclude": [ + "tests/**" + ] + }, + "prettier": "@adonisjs/prettier-config" }