Skip to content

Commit

Permalink
add iife and create a release automatically on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioCoser committed Mar 29, 2024
1 parent 4034e0e commit 3016c19
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 14 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,25 @@ jobs:
- run: npm run release ${{ github.ref_name }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
release:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- uses: actions/create-release@v1
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
asset_path: ./cdn/doom-reactive-state.global.js
asset_name: doom-reactive-state.global.js
asset_content_type: application/javascript
env:
GITHUB_TOKEN: ${{ github.token }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
build
.DS_Store
.parcel-cache
coverage
coverage
cdn
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dist
build
.DS_Store
.parcel-cache
coverage
coverage
cdn
60 changes: 60 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test": "vitest",
"coverage": "vitest --coverage",
"dev": "vite",
"build": "rm -rf dist && tsup ./src",
"build": "rm -rf dist && rm -rf cdn && tsup",
"release": "npm run build && ./publish.sh $1"
},
"author": "Alessio Coser",
Expand Down
39 changes: 28 additions & 11 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
import { defineConfig } from 'tsup'
import { defineConfig } from "tsup";

export default defineConfig({
target: 'es2020',
format: ['cjs', 'esm'],
splitting: false,
sourcemap: true,
clean: true,
minify: true,
dts: true,
treeshake: true,
})
export default defineConfig([
{
entryPoints: { "index": "src/index.ts" },
target: "es2020",
format: ["cjs", "esm"],
splitting: false,
sourcemap: true,
clean: true,
minify: true,
dts: true,
treeshake: true,
outDir: "dist",
},
{
entryPoints: { "doom-reactive-state": "src/index.ts" },
target: "es2020",
format: ["iife"],
splitting: false,
sourcemap: false,
clean: true,
minify: true,
dts: false,
treeshake: true,
outDir: "cdn",
globalName: "doom",
},
]);

0 comments on commit 3016c19

Please sign in to comment.