From 536eb76dce9849c1f08249b726964b59b54a685c Mon Sep 17 00:00:00 2001 From: Hamcha Date: Thu, 24 Aug 2023 16:49:16 +0200 Subject: [PATCH] add npm script --- .gitignore | 3 ++- .npmrc | 1 + domutil.ts | 2 +- scripts/npm.ts | 27 +++++++++++++++++++++++++++ tsconfig.json | 3 ++- 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .npmrc create mode 100644 scripts/npm.ts diff --git a/.gitignore b/.gitignore index 7773828..9a1b98b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -dist/ \ No newline at end of file +dist/ +npm/ \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..5731b64 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@hamcha:registry=https://git.fromouter.space/api/packages/hamcha/npm/ \ No newline at end of file diff --git a/domutil.ts b/domutil.ts index e133efb..3e4e538 100644 --- a/domutil.ts +++ b/domutil.ts @@ -1 +1 @@ -export * from "./makeDOM"; +export * from "./makeDOM.ts"; diff --git a/scripts/npm.ts b/scripts/npm.ts new file mode 100644 index 0000000..124b940 --- /dev/null +++ b/scripts/npm.ts @@ -0,0 +1,27 @@ +import { build, emptyDir } from "https://deno.land/x/dnt@0.38.1/mod.ts"; + +await emptyDir("./npm"); + +await build({ + entryPoints: ["./domutil.ts"], + outDir: "./npm", + shims: {}, + esModule: true, + compilerOptions: { + lib: ["ES2017", "DOM"], + }, + package: { + name: "@hamcha/domutil", + version: Deno.args[0], + description: "Cursed DOM microlibrary", + license: "AGPL-3.0", + repository: { + type: "git", + url: "git+https://git.fromouter.space/Hamcha/domutil", + }, + }, + postBuild() { + Deno.copyFileSync("LICENSE", "npm/LICENSE"); + Deno.copyFileSync(".npmrc", "npm/.npmrc"); + }, +}); diff --git a/tsconfig.json b/tsconfig.json index 6aa1f25..745d5e0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,8 +14,9 @@ "alwaysStrict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, + "allowImportingTsExtensions": true, "outDir": "./dist", "lib": ["ES2017", "dom"] }, - "exclude": ["dist", "scripts"], + "exclude": ["dist", "scripts", "npm"], }