From c422cc308eb24d8cb62631884a7239ab66ad6183 Mon Sep 17 00:00:00 2001 From: Alexander O'Mara Date: Sun, 3 Nov 2024 16:12:39 -0500 Subject: [PATCH] Minor cleanup --- scripts/npm.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/npm.ts b/scripts/npm.ts index f446483..28a2334 100644 --- a/scripts/npm.ts +++ b/scripts/npm.ts @@ -12,19 +12,23 @@ if (Deno.args.length !== 1 || !/^(dev|prod)$/.test(Deno.args[0])) { const [env] = Deno.args; const GITHUB_REPOSITORY = Deno.env.get('GITHUB_REPOSITORY'); + const readme = (await Deno.readTextFile('README.md')).split(/[\r\n]+/); const [description] = readme.filter((s) => /^\w/.test(s)); -const keywords = readme.map((s) => s.match(/^\!\[(.*)\]\((.*)\)/)) +const keywords = readme.map((s) => s.match(/^\!\[(.*)\]\((.*)\)$/)) .filter((m) => m && m[2].startsWith('https://img.shields.io/badge/')) .map((m) => m![1]); -await emptyDir('./npm'); +const outDir = './npm'; + +await emptyDir(outDir); + await build({ test: env === 'dev', importMap: 'deno.json', entryPoints: Object.entries(denoJson.exports) .map(([name, path]) => name === '.' ? path : { name, path }), - outDir: './npm', + outDir, shims: { deno: env === 'dev' ? 'dev' : false, },