From 978fcb6f4c975b144a1361a8d4216a38ba80d924 Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 4 Apr 2024 11:05:39 -0500 Subject: [PATCH] ci: Add validation workflow --- .github/actions/setup/action.yml | 8 ++++++++ .github/workflows/validate.yml | 28 ++++++++++++++++++++++++++++ build.npm.ts | 6 +++++- tsconfig.json | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/validate.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..d6bd3f9 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,8 @@ +name: Basic Setup +description: Install PNPM, Node, and dependencies +runs: + using: composite + steps: + - uses: oven-sh/setup-bun@v1 + - run: bun install + shell: bash diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..945b5f4 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,28 @@ +name: Validate +on: + workflow_call: + pull_request: + push: + branches: + - main + +jobs: + checks: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - run: bun build:npm + - run: bun check + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - run: bun build:web:nuxt + tests: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - uses: bun test diff --git a/build.npm.ts b/build.npm.ts index c389167..313029e 100644 --- a/build.npm.ts +++ b/build.npm.ts @@ -1,6 +1,7 @@ // Cleanup import { rmdir } from 'node:fs/promises'; await rmdir('dist/npm', { recursive: true }).catch(() => {}); +import pkg from './package.json'; // Build Declaration File const tsc = Bun.spawn(['tsc', '-p', 'tsconfig.build.json'], { @@ -11,10 +12,13 @@ if (tsc.exitCode != null && tsc.exitCode > 0) process.exit(tsc.exitCode); // Build JS await Bun.build({ - entrypoints: ['src/index.ts', 'src/cli.ts'], + entrypoints: ['src/index.ts'], outdir: 'dist/npm', target: 'node', splitting: true, + external: Object.keys(pkg.dependencies).concat( + Object.keys(pkg.devDependencies), + ), }); console.log('\x1b[1m\x1b[32m✔\x1b[0m Build \x1b[36mdist/npm\x1b[0m'); diff --git a/tsconfig.json b/tsconfig.json index b5bf71d..2d6dabd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,6 @@ "skipLibCheck": true, "noFallthroughCasesInSwitch": true, // Other - "types": ["@nuxtjs/auth-next", "@nuxtjs/axios"] + "types": ["@types/bun"] } }