diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..857807b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,18 @@ +name: Build + +on: + push: + pull_request: + +jobs: + build: + uses: AwesomeHamster/workflows/.github/workflows/build.yml@master + permissions: + pull-requests: write + issues: write + with: + lint: true + test: true + yarn-no-immutable: true + approve: true + secrets: inherit diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9d047cd..31b9037 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,10 +6,14 @@ on: jobs: publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: AwesomeHamster/actions-publish@master - with: - token: ${{ secrets.NPM_TOKEN }} - test: yarn test + uses: AwesomeHamster/workflows/.github/workflows/publish.yml@master + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + with: + yarn-no-immutable: true + test-before-publish: true + secrets: + npm-token: ${{ secrets.NPM_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 5d005df..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Test -on: [push, pull_request] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: AwesomeHamster/actions-test@master - with: - test: | - yarn lint - yarn test diff --git a/package.json b/package.json index 3896cb7..d1e9325 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "build": "yarn build:tsup --minify", "dev": "yarn build:tsup", "build:tsup": "tsup", - "test": "mocha -r ts-node/register -r yml-register --extension .spec.ts ./__tests__", + "test": "mocha -r tsx -r yml-register --extension .spec.ts ./__tests__", "lint": "eslint src/**/*.ts && yarn prettier --check", "format": "yarn prettier --write", "prettier": "prettier '**/*.{js,ts,json,yml,yaml,md}' '!lib/**/*'" @@ -75,7 +75,6 @@ "peerDependencies": { "koishi": "^4.8.2" }, - "packageManager": "yarn@3.1.1", "prettier": "@hamster-bot/prettier-config", "devDependencies": { "@hamster-bot/eslint-config": "*", @@ -86,13 +85,15 @@ "@types/node": "^17.0.12", "@typescript-eslint/eslint-plugin": "^5.30.5", "@typescript-eslint/parser": "^5.30.5", + "esbuild-plugin-yaml": "^0.0.1", "eslint": "^8.19.0", "eslint-import-resolver-typescript": "^3.4.1", + "koishi": "^4.8.2", "mocha": "^9.2.0", "prettier": "^2.7.1", - "ts-node": "^10.8.1", "tsup": "^8.0.1", - "typescript": "^4.7.3", + "tsx": "^4.7.1", + "typescript": "^5.3.3", "yml-register": "^1.1.0" } } diff --git a/tsconfig.json b/tsconfig.json index 1f9fba4..b453566 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,11 @@ { "extends": "@hamster-bot/tsconfig", "compilerOptions": { - "outDir": "dist" + "outDir": "dist", + "types": ["node", "mocha"], + "skipLibCheck": true, + "jsx": "react-jsx", + "jsxImportSource": "@satorijs/element" }, "include": ["src/**/*.ts"] } diff --git a/tsup.config.ts b/tsup.config.ts index b4b6e3e..2b535e5 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -8,6 +8,5 @@ export default defineConfig({ clean: true, outDir: 'lib', esbuildPlugins: [yaml.yamlPlugin()], - esbuildOptions(options, context) { - }, + esbuildOptions(options, context) {}, })