diff --git a/.github/workflows/nested-package-build.yml b/.github/workflows/nested-package-build.yml new file mode 100644 index 0000000..e75fc55 --- /dev/null +++ b/.github/workflows/nested-package-build.yml @@ -0,0 +1,47 @@ +name: Nested package build +on: + pull_request: + paths: ['tsdown.config.*', 'package.json', 'pnpm-lock.yaml', 'tsconfig.json', '.github/workflows/nested-package-build.yml'] +permissions: + contents: read +jobs: + prepare: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + with: + persist-credentials: false + path: node_modules/source-consumer + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 + with: + node-version: '24.18.0' + - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 + with: + package_json_file: node_modules/source-consumer/package.json + - name: Install and prepare from the same path class as a Git dependency + working-directory: node_modules/source-consumer + run: | + set -eu + mkdir -p "$RUNNER_TEMP/nested-proof" + git rev-parse HEAD > "$RUNNER_TEMP/nested-proof/head.txt" + pnpm install --frozen-lockfile > "$RUNNER_TEMP/nested-proof/install.log" 2>&1 || { tail -100 "$RUNNER_TEMP/nested-proof/install.log"; exit 1; } + pnpm exec tsc --noEmit > "$RUNNER_TEMP/nested-proof/types.log" 2>&1 || { tail -100 "$RUNNER_TEMP/nested-proof/types.log"; exit 1; } + pnpm build > "$RUNNER_TEMP/nested-proof/build.log" 2>&1 || { tail -100 "$RUNNER_TEMP/nested-proof/build.log"; exit 1; } + node --input-type=module - <<'JS' + import assert from 'node:assert/strict'; + const oauth = await import('./dist/connectors/oauth.js'); + const hub = await import('./dist/hub.js'); + const sandbox = await import('./dist/sandbox.js'); + assert.equal(typeof oauth.startOAuthFlow, 'function'); + assert.equal(typeof oauth.exchangeAuthorizationCode, 'function'); + assert.equal(typeof hub.IntegrationHub, 'function'); + assert.equal(typeof sandbox.buildIntegrationInvocationEnvelope, 'function'); + JS + git diff --exit-code -- package.json pnpm-lock.yaml + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a + if: always() + with: + name: nested-package-build + path: ${{ runner.temp }}/nested-proof/ + retention-days: 7 diff --git a/tests/release.test.ts b/tests/release.test.ts index 3973c7c..1595451 100644 --- a/tests/release.test.ts +++ b/tests/release.test.ts @@ -17,7 +17,7 @@ const FIXTURE_PATHS = [ 'scripts', 'src', 'tsconfig.json', - 'tsdown.config.ts', + 'tsdown.config.mjs', ] describe('release entry point', () => { diff --git a/tsconfig.json b/tsconfig.json index 7192dff..7543823 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,8 @@ "moduleResolution": "Bundler", "types": ["node"], "strict": true, + "allowJs": true, + "checkJs": true, "declaration": true, "declarationMap": true, "sourceMap": true, @@ -13,5 +15,5 @@ "skipLibCheck": true, "outDir": "dist" }, - "include": ["src", "tests", "tsdown.config.ts"] + "include": ["src", "tests", "tsdown.config.mjs"] } diff --git a/tsdown.config.ts b/tsdown.config.mjs similarity index 93% rename from tsdown.config.ts rename to tsdown.config.mjs index a8439ad..618363c 100644 --- a/tsdown.config.ts +++ b/tsdown.config.mjs @@ -1,6 +1,5 @@ -import { defineConfig } from 'tsdown' - -export default defineConfig({ +/** @type {import('tsdown').UserConfig} */ +const config = { entry: { index: 'src/index.ts', consumer: 'src/consumer.ts', @@ -34,4 +33,6 @@ export default defineConfig({ dts: true, sourcemap: true, target: 'es2022', -}) +} + +export default config