From 78dbb6f1c2c378d11e0f44d3dfaf501fdce573dc Mon Sep 17 00:00:00 2001 From: 0xtito Date: Mon, 4 Dec 2023 15:04:21 -0500 Subject: [PATCH] added workflow + esm only --- .github/labeler.yml | 5 +++ .github/workflows/ci.yml | 68 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 49 +++++++++++++++++++++++ .npmrc | 7 ++++ packages/newtonxr/tsup.config.ts | 2 +- 5 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .npmrc diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..3a7bef3 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,5 @@ +"📚 documentation": + - any: ["docs/**", "!docs/**/package.json"] + +"playground": + - any: ["playground/**", "!playground/**/package.json"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..41ac3a9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: ci + +on: + pull_request: + branches: ["*"] + push: + branches: ["main"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +env: + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./tooling/github/setup + + - name: Build + run: pnpm build + + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./tooling/github/setup + + - name: Lint + run: pnpm lint + + format: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./tooling/github/setup + + - name: Format + run: pnpm format:check + + typecheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./tooling/github/setup + + - name: Typecheck + run: pnpm typecheck diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2ff033b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release +on: + push: + branches: + - main + +env: + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Use PNPM + uses: pnpm/action-setup@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Get pnpm store directory + id: pnpm-cache + run: | + echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install deps (with cache) + run: pnpm install + + - name: Check packages for common errors + run: pnpm turbo --filter "./packages/*" build lint typecheck + + - name: Create release + run: pnpm publish packages/newtonxr --dry-run --no-git-checks --access restricted --tag alpha diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..e347f3b --- /dev/null +++ b/.npmrc @@ -0,0 +1,7 @@ +# Prevent pnpm from adding the "workspace:"" prefix to local +# packages as it casues issues with manypkg +# @link https://pnpm.io/npmrc#prefer-workspace-packages +save-workspace-protocol=false +prefer-workspace-packages=true + +engine-strict=true \ No newline at end of file diff --git a/packages/newtonxr/tsup.config.ts b/packages/newtonxr/tsup.config.ts index e7e350d..427d2e9 100644 --- a/packages/newtonxr/tsup.config.ts +++ b/packages/newtonxr/tsup.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from "tsup"; export default defineConfig((opts) => ({ entry: ["./src/**/*"], dts: true, - format: ["esm", "cjs"], + format: ["esm"], clean: !opts.watch, esbuildOptions: (option) => { option.banner = {