Skip to content

Commit

Permalink
chore: build npm package with dnt
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Oct 10, 2021
1 parent f9d5781 commit e531b0c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 90 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
id: get_tag_version
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
- name: Package
if: startsWith(github.ref, 'refs/tags/')
run: deno run --unstable --allow-read --allow-write deployment/npm/setup.js ${{steps.get_tag_version.outputs.TAG_VERSION}}
- uses: actions/setup-node@v2
if: startsWith(github.ref, 'refs/tags/')
with:
Expand All @@ -25,5 +22,6 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd deployment/npm
deno run --allow-read --allow-write=./npm --allow-net --allow-run --no-check ./scripts/build_npm.ts ${{steps.get_tag_version.outputs.TAG_VERSION}}
cd npm
npm publish --access public
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm
1 change: 0 additions & 1 deletion deployment/npm/.npmignore

This file was deleted.

23 changes: 0 additions & 23 deletions deployment/npm/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions deployment/npm/package.json

This file was deleted.

40 changes: 0 additions & 40 deletions deployment/npm/setup.js

This file was deleted.

1 change: 1 addition & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export function createStreaming(
if (
// deno-lint-ignore no-explicit-any
(WebAssembly as any).instantiateStreaming == null
// deno-shim-ignore
|| typeof globalThis?.Deno != null
) {
return getArrayBuffer()
Expand Down
30 changes: 30 additions & 0 deletions scripts/build_npm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { build } from "https://deno.land/x/[email protected]/mod.ts";

await build({
entryPoint: "mod.ts",
typeCheck: true,
outDir: "./npm",
package: {
name: "@dprint/formatter",
version: Deno.args[0],
description: "Wasm formatter for dprint plugins.",
repository: {
type: "git",
url: "git+https://github.com/dprint/js-formatter.git",
},
keywords: [
"dprint",
"formatter",
"wasm",
],
author: "David Sherret",
license: "MIT",
bugs: {
url: "https://github.com/dprint/js-formatter/issues",
},
homepage: "https://github.com/dprint/js-formatter#readme",
},
});

Deno.copyFileSync("LICENSE", "npm/LICENSE");
Deno.copyFileSync("README.md", "npm/README.md");

0 comments on commit e531b0c

Please sign in to comment.