From e85077acc4dc90d7b02209e47c4dc67d5d9dac87 Mon Sep 17 00:00:00 2001 From: Muthu Kumar Date: Mon, 27 Feb 2023 17:21:57 +0530 Subject: [PATCH] build: add build_npm script --- .gitignore | 2 +- build_npm.ts | 26 ++++++++++++++++++++++++++ package.json.old | 30 ------------------------------ test.ts | 2 +- 4 files changed, 28 insertions(+), 32 deletions(-) create mode 100644 build_npm.ts delete mode 100644 package.json.old diff --git a/.gitignore b/.gitignore index b512c09..b235581 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -node_modules \ No newline at end of file +npm diff --git a/build_npm.ts b/build_npm.ts new file mode 100644 index 0000000..05b48f2 --- /dev/null +++ b/build_npm.ts @@ -0,0 +1,26 @@ +// ex. scripts/build_npm.ts +import { build, emptyDir } from "https://deno.land/x/dnt@0.33.1/mod.ts"; + +await emptyDir("./npm"); + +await build({ + entryPoints: ["./index.ts"], + outDir: "./npm", + shims: { deno: { test: true } }, + package: { + name: "promise.object", + version: Deno.args[0], + description: "Deep resolve promises in objects.", + keywords: ["Promise", "A+", "objects", "deep resolve"], + author: "Muthu Kumar <@MKRhere> (https://mkr.pw)", + contributors: ["Thomas Rory Gummerson <@TRGWII> (https://rory.no)"], + repository: { type: "git", url: "git+https://github.com/codefeathers/Promise.object.git" }, + bugs: { url: "https://github.com/codefeathers/Promise.object/issues" }, + homepage: "https://github.com/codefeathers/Promise.object#readme", + license: "MIT", + }, +}); + +// post build steps +Deno.copyFileSync("LICENSE", "npm/LICENSE"); +Deno.copyFileSync("README.md", "npm/README.md"); diff --git a/package.json.old b/package.json.old deleted file mode 100644 index d760f2c..0000000 --- a/package.json.old +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@codefeathers/promise.object", - "version": "0.9.5", - "description": "Deep resolve promises in objects.", - "main": "es5/index.min.js", - "scripts": { - "test": "jasmine", - "build": "./build.sh" - }, - "keywords": [ - "Promise", - "A+", - "objects", - "deep resolve" - ], - "author": "Muthu Kumar <@MKRhere> (https://mkr.pw)", - "contributors": [ - "Thomas Rory Gummerson <@TRGWII> (https://rory.no)" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/codefeathers/Promise.object.git" - }, - "bugs": { - "url": "https://github.com/codefeathers/Promise.object/issues" - }, - "homepage": "https://github.com/codefeathers/Promise.object#readme", - "license": "MIT", - "devDependencies": {} -} diff --git a/test.ts b/test.ts index 2c9e5a6..a444057 100644 --- a/test.ts +++ b/test.ts @@ -43,6 +43,6 @@ Deno.test("Should resolve cyclic objects", async () => { assertEquals(await promiseObject(nested.test), nested.resolved); }); -Deno.test("Should resolve deeply cyclic objects", async () => { +Deno.test("Should resolve deeply cyclic promises", async () => { assertEquals(await promiseObject(deeplyNested.test), deeplyNested.resolved); });