diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 81ab21c..ed8dd17 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -60,7 +60,7 @@ jobs: # coverageLocations: | # ${{github.workspace}}/target/coverage/lcov.info:lcov - - name: Semantic Release + - name: Semantic Release (npm) if: github.ref == 'refs/heads/main' env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -72,6 +72,11 @@ jobs: GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} run: npm_config_yes=true npx zx-semrel + - name: jsr publish + if: github.ref == 'refs/heads/main' + run: | + node src/scripts/build-jsr.mjs + npx jsr publish pr: if: github.event_name == 'pull_request' diff --git a/.gitignore b/.gitignore index 0b0aecf..5a13bd3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ target/* !target/esm/ !target/dts/ typings +jsr.json # Temp assets .temp diff --git a/src/scripts/build-jsr.mjs b/src/scripts/build-jsr.mjs new file mode 100644 index 0000000..3865f1c --- /dev/null +++ b/src/scripts/build-jsr.mjs @@ -0,0 +1,18 @@ +import fs from 'fs' +import path from 'path' +const cwd = process.cwd() +const pkgJson = JSON.parse(fs.readFileSync(path.resolve(cwd, 'package.json'), 'utf-8')) + +fs.writeFileSync(path.resolve(cwd, 'jsr.json'), JSON.stringify({ + name: '@webpod/zurk', + version: pkgJson.version, + exports: { + '.': './src/main/ts/index.ts', + './spawn': './src/main/ts/spawn.ts', + './util': './src/main/ts/util.ts', + './zurk': './src/main/ts/zurk.ts' + }, + publish: { + include: ['src/main/ts'] + } +}, null, 2))