From 980b410957f8c6859ea7380bf3280d9d1d941b72 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 16 Apr 2023 11:51:35 -0500 Subject: [PATCH] Add NPM build script --- scripts/npm.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 scripts/npm.ts diff --git a/scripts/npm.ts b/scripts/npm.ts new file mode 100644 index 0000000..db3b22b --- /dev/null +++ b/scripts/npm.ts @@ -0,0 +1,30 @@ +import { build, emptyDir } from "https://deno.land/x/dnt@0.34.0/mod.ts"; + +await emptyDir('./npm'); + +await build({ + entryPoints: ['./mod.ts'], + outDir: './npm', + shims: { + // see JS docs for overview and more options + deno: true, + }, + package: { + name: 'strfry-policies', + version: Deno.args[0], + description: 'Your package.', + license: 'Unlicense', + repository: { + type: 'git', + url: 'git+https://gitlab.com/soapbox-pub/strfry-policies.git', + }, + bugs: { + url: 'https://gitlab.com/soapbox-pub/strfry-policies/-/issues', + }, + }, + postBuild() { + // steps to run after building and before running the tests + Deno.copyFileSync('LICENSE', 'npm/LICENSE'); + Deno.copyFileSync('README.md', 'npm/README.md'); + }, +});