From 235bc745feb685f2f779a7a4fae51cb238cf04e4 Mon Sep 17 00:00:00 2001 From: Rafael Bardini Date: Mon, 2 Sep 2024 03:10:56 +0200 Subject: [PATCH] Publish to npm --- .github/workflows/publish.yml | 11 ++++ .gitignore | 1 + README.md | 11 ++-- build.ts | 40 ++++++++++++ deno.json | 1 + deno.lock | 118 +++++++++++++++++++++++++++++++++- 6 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 build.ts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e509609..958b41a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index e43b0f9..2a832fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +npm diff --git a/README.md b/README.md index 5d166d6..d6452a3 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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). diff --git a/build.ts b/build.ts new file mode 100644 index 0000000..1e19019 --- /dev/null +++ b/build.ts @@ -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: 'rafael@rbardini.com', + url: 'https://rbardini.com/', + }, + engines: { + node: '>=20', + }, + }, + scriptModule: false, + test: false, + postBuild() { + Deno.copyFileSync('LICENSE', 'npm/LICENSE') + Deno.copyFileSync('README.md', 'npm/README.md') + }, +}) diff --git a/deno.json b/deno.json index 4508f76..d195f34 100644 --- a/deno.json +++ b/deno.json @@ -3,6 +3,7 @@ "version": "1.0.1", "exports": "./mod.ts", "imports": { + "@deno/dnt": "jsr:@deno/dnt@0.41.3", "@std/assert": "jsr:@std/assert@1" }, "publish": { diff --git a/deno.lock b/deno.lock index b083dd1..d1b7e04 100644 --- a/deno.lock +++ b/deno.lock @@ -2,24 +2,140 @@ "version": "3", "packages": { "specifiers": { + "jsr:@david/code-block-writer@^13.0.2": "jsr:@david/code-block-writer@13.0.2", + "jsr:@deno/cache-dir@^0.10.3": "jsr:@deno/cache-dir@0.10.3", + "jsr:@deno/dnt@0.41.3": "jsr:@deno/dnt@0.41.3", + "jsr:@deno/graph@^0.73.1": "jsr:@deno/graph@0.73.1", "jsr:@std/assert@1": "jsr:@std/assert@1.0.2", - "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.1" + "jsr:@std/assert@^0.223.0": "jsr:@std/assert@0.223.0", + "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0", + "jsr:@std/bytes@^0.223.0": "jsr:@std/bytes@0.223.0", + "jsr:@std/fmt@1": "jsr:@std/fmt@1.0.1", + "jsr:@std/fmt@^0.223": "jsr:@std/fmt@0.223.0", + "jsr:@std/fs@1": "jsr:@std/fs@1.0.2", + "jsr:@std/fs@^0.223": "jsr:@std/fs@0.223.0", + "jsr:@std/fs@^0.229.3": "jsr:@std/fs@0.229.3", + "jsr:@std/internal@^1.0.1": "jsr:@std/internal@1.0.1", + "jsr:@std/io@^0.223": "jsr:@std/io@0.223.0", + "jsr:@std/path@1": "jsr:@std/path@1.0.3", + "jsr:@std/path@1.0.0-rc.1": "jsr:@std/path@1.0.0-rc.1", + "jsr:@std/path@^0.223": "jsr:@std/path@0.223.0", + "jsr:@std/path@^0.225.2": "jsr:@std/path@0.225.2", + "jsr:@std/path@^1.0.3": "jsr:@std/path@1.0.3", + "jsr:@ts-morph/bootstrap@^0.24.0": "jsr:@ts-morph/bootstrap@0.24.0", + "jsr:@ts-morph/common@^0.24.0": "jsr:@ts-morph/common@0.24.0" }, "jsr": { + "@david/code-block-writer@13.0.2": { + "integrity": "14dd3baaafa3a2dea8bf7dfbcddeccaa13e583da2d21d666c01dc6d681cd74ad" + }, + "@deno/cache-dir@0.10.3": { + "integrity": "eb022f84ecc49c91d9d98131c6e6b118ff63a29e343624d058646b9d50404776", + "dependencies": [ + "jsr:@deno/graph@^0.73.1", + "jsr:@std/fmt@^0.223", + "jsr:@std/fs@^0.223", + "jsr:@std/io@^0.223", + "jsr:@std/path@^0.223" + ] + }, + "@deno/dnt@0.41.3": { + "integrity": "b2ef2c8a5111eef86cb5bfcae103d6a2938e8e649e2461634a7befb7fc59d6d2", + "dependencies": [ + "jsr:@david/code-block-writer@^13.0.2", + "jsr:@deno/cache-dir@^0.10.3", + "jsr:@std/fmt@1", + "jsr:@std/fs@1", + "jsr:@std/path@1", + "jsr:@ts-morph/bootstrap@^0.24.0" + ] + }, + "@deno/graph@0.73.1": { + "integrity": "cd69639d2709d479037d5ce191a422eabe8d71bb68b0098344f6b07411c84d41" + }, + "@std/assert@0.223.0": { + "integrity": "eb8d6d879d76e1cc431205bd346ed4d88dc051c6366365b1af47034b0670be24" + }, + "@std/assert@0.226.0": { + "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3" + }, "@std/assert@1.0.2": { "integrity": "ccacec332958126deaceb5c63ff8b4eaf9f5ed0eac9feccf124110435e59e49c", "dependencies": [ "jsr:@std/internal@^1.0.1" ] }, + "@std/bytes@0.223.0": { + "integrity": "84b75052cd8680942c397c2631318772b295019098f40aac5c36cead4cba51a8" + }, + "@std/fmt@0.223.0": { + "integrity": "6deb37794127dfc7d7bded2586b9fc6f5d50e62a8134846608baf71ffc1a5208" + }, + "@std/fmt@1.0.1": { + "integrity": "ef76c37faa7720faa8c20fd8cc74583f9b1e356dfd630c8714baa716a45856ab" + }, + "@std/fs@0.223.0": { + "integrity": "3b4b0550b2c524cbaaa5a9170c90e96cbb7354e837ad1bdaf15fc9df1ae9c31c" + }, + "@std/fs@0.229.3": { + "integrity": "783bca21f24da92e04c3893c9e79653227ab016c48e96b3078377ebd5222e6eb", + "dependencies": [ + "jsr:@std/path@1.0.0-rc.1" + ] + }, + "@std/fs@1.0.2": { + "integrity": "af57555c7a224a6f147d5cced5404692974f7a628ced8eda67e0d22d92d474ec", + "dependencies": [ + "jsr:@std/path@^1.0.3" + ] + }, "@std/internal@1.0.1": { "integrity": "6f8c7544d06a11dd256c8d6ba54b11ed870aac6c5aeafff499892662c57673e6" + }, + "@std/io@0.223.0": { + "integrity": "2d8c3c2ab3a515619b90da2c6ff5ea7b75a94383259ef4d02116b228393f84f1", + "dependencies": [ + "jsr:@std/assert@^0.223.0", + "jsr:@std/bytes@^0.223.0" + ] + }, + "@std/path@0.223.0": { + "integrity": "593963402d7e6597f5a6e620931661053572c982fc014000459edc1f93cc3989", + "dependencies": [ + "jsr:@std/assert@^0.223.0" + ] + }, + "@std/path@0.225.2": { + "integrity": "0f2db41d36b50ef048dcb0399aac720a5348638dd3cb5bf80685bf2a745aa506", + "dependencies": [ + "jsr:@std/assert@^0.226.0" + ] + }, + "@std/path@1.0.0-rc.1": { + "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6" + }, + "@std/path@1.0.3": { + "integrity": "cd89d014ce7eb3742f2147b990f6753ee51d95276bfc211bc50c860c1bc7df6f" + }, + "@ts-morph/bootstrap@0.24.0": { + "integrity": "a826a2ef7fa8a7c3f1042df2c034d20744d94da2ee32bf29275bcd4dffd3c060", + "dependencies": [ + "jsr:@ts-morph/common@^0.24.0" + ] + }, + "@ts-morph/common@0.24.0": { + "integrity": "12b625b8e562446ba658cdbe9ad77774b4bd96b992ae8bd34c60dbf24d06c1f3", + "dependencies": [ + "jsr:@std/fs@^0.229.3", + "jsr:@std/path@^0.225.2" + ] } } }, "remote": {}, "workspace": { "dependencies": [ + "jsr:@deno/dnt@0.41.3", "jsr:@std/assert@1" ] }