Skip to content

Commit

Permalink
Publish to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
rbardini committed Sep 2, 2024
1 parent eb3da7b commit 235bc74
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 8 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,15 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: 1
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npx jsr publish
- run: deno run -A build.ts
- run: pushd npm && npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
npm
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @rbardini/html

[![JSR](https://jsr.io/badges/@rbardini/html)](https://jsr.io/@rbardini/html)
[![JSR Score](https://jsr.io/badges/@rbardini/html/score)](https://jsr.io/@rbardini/html)
![JSR](https://img.shields.io/jsr/v/@rbardini/html)
![npm](https://img.shields.io/npm/v/@rbardini/html)

Tiny `html` tag function for no-build JSX-like syntax, compatible with all
modern browsers and runtimes.
Expand Down Expand Up @@ -29,11 +29,8 @@ Inspired by [jimniels/html](https://github.com/jimniels/html).
# Deno
deno add @rbardini/html

# npm (one of the below, depending on your package manager)
npx jsr add @rbardini/html
yarn dlx jsr add @rbardini/html
pnpm dlx jsr add @rbardini/html
bunx jsr add @rbardini/html
# npm
npm install @rbardini/html
```

Or copy-paste the contents of [`mod.ts`](./mod.ts).
40 changes: 40 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { build, emptyDir } from '@deno/dnt'
import denoJSON from './deno.json' with { type: 'json' }

await emptyDir('./npm')

await build({
entryPoints: ['./mod.ts'],
outDir: './npm',
shims: {},
package: {
name: denoJSON.name,
version: denoJSON.version,
description:
'Tiny html tag function for no-build JSX-like syntax, compatible with all modern browsers and runtimes.',
keywords: ['html', 'tagged', 'template', 'string', 'literal', 'jsx'],
homepage: 'https://github.com/rbardini/html',
bugs: {
url: 'https://github.com/rbardini/html/issues',
},
repository: {
type: 'git',
url: 'git+https://github.com/rbardini/html.git',
},
license: 'MIT',
author: {
name: 'Rafael Bardini',
email: '[email protected]',
url: 'https://rbardini.com/',
},
engines: {
node: '>=20',
},
},
scriptModule: false,
test: false,
postBuild() {
Deno.copyFileSync('LICENSE', 'npm/LICENSE')
Deno.copyFileSync('README.md', 'npm/README.md')
},
})
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.1",
"exports": "./mod.ts",
"imports": {
"@deno/dnt": "jsr:@deno/[email protected]",
"@std/assert": "jsr:@std/assert@1"
},
"publish": {
Expand Down
118 changes: 117 additions & 1 deletion deno.lock

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

0 comments on commit 235bc74

Please sign in to comment.