-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export commonjs and esm from package
- Loading branch information
1 parent
e7eaff2
commit 4da7d7a
Showing
6 changed files
with
1,327 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: prerelease | ||
on: | ||
push: | ||
branches: | ||
# releases/<tag>/<version> | ||
# releases/rc.1/2.0.0 - will result in 2.0.0-rc.0 | ||
- releases/*/* | ||
jobs: | ||
prerelease: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install core dependencies | ||
run: npm ci --no-audit | ||
- name: Extract tag and version | ||
id: extract | ||
run: |- | ||
ref=${{ github.ref }} | ||
branch=${ref:11} | ||
tag_version=${branch:9} | ||
tag=${tag_version%/*} | ||
version=${tag_version##*/} | ||
echo "tag=${tag}" >> $GITHUB_OUTPUT | ||
echo "version=${version}" >> $GITHUB_OUTPUT | ||
- name: Log versions | ||
run: |- | ||
echo tag=${{ steps.extract.outputs.tag }} | ||
echo version=${{ steps.extract.outputs.version }} | ||
- name: Setup git user | ||
run: git config --global user.name github-actions | ||
- name: Setup git email | ||
run: git config --global user.email [email protected] | ||
- name: Run npm version | ||
run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }} --allow-same-version | ||
- name: Push changes | ||
run: git push --follow-tags | ||
- name: Run npm publish | ||
run: npm publish --tag=${{ steps.extract.outputs.tag }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env node | ||
import { rm } from 'node:fs/promises' | ||
import { argv } from 'process' | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { build } from 'tsup' | ||
|
||
const dist = './dist' | ||
|
||
await rm(dist, { recursive: true, force: true }) | ||
|
||
/** @type {import('tsup').Options} */ | ||
const options = { | ||
entry: ['src/main.ts'], | ||
tsconfig: 'tsconfig.json', | ||
bundle: true, | ||
dts: true, | ||
outDir: dist, | ||
watch: argv.includes('--watch'), | ||
} | ||
|
||
await Promise.all(['esm', 'cjs'].map((format) => build({ ...options, format }))) |
Oops, something went wrong.