repos / starfx

supercharged async flow control library.
git clone https://github.com/neurosnap/starfx.git

Eric Bower · 02 Oct 24

npm.ts

 1import { build, emptyDir } from "https://deno.land/x/dnt@0.38.1/mod.ts";
 2
 3const [version] = Deno.args;
 4if (!version) {
 5  throw new Error("a version argument is required to build the npm package");
 6}
 7
 8init().then(console.log).catch(console.error);
 9
10async function init() {
11  await emptyDir("./npm");
12  await build({
13    declaration: "inline",
14    scriptModule: "cjs",
15    entryPoints: [
16      {
17        name: ".",
18        path: "mod.ts",
19      },
20      {
21        name: "./react",
22        path: "react.ts",
23      },
24    ],
25    mappings: {
26      "https://deno.land/x/effection@3.0.0-beta.3/mod.ts": {
27        name: "effection",
28        version: "3.0.0-beta.3",
29      },
30      "https://esm.sh/react@18.2.0?pin=v135": {
31        name: "react",
32        version: "^18.2.0",
33        peerDependency: true,
34      },
35      "https://esm.sh/react-redux@8.0.5?pin=v135": {
36        name: "react-redux",
37        version: "^8.0.5",
38      },
39      "https://esm.sh/immer@10.0.2?pin=v135": {
40        name: "immer",
41        version: "^10.0.2",
42      },
43      "https://esm.sh/reselect@4.1.8?pin=v135": {
44        name: "reselect",
45        version: "^4.1.8",
46      },
47    },
48    outDir: "./npm",
49    shims: {
50      deno: false,
51    },
52    test: false,
53    typeCheck: "both",
54    compilerOptions: {
55      target: "ES2020",
56      sourceMap: true,
57      lib: ["DOM", "DOM.Iterable", "ESNext"],
58    },
59    package: {
60      name: "starfx",
61      version,
62      description:
63        "Async flow control and state management system for deno, node, and browser",
64      license: "MIT",
65      author: {
66        name: "Eric Bower",
67        email: "me@erock.io",
68      },
69      repository: {
70        type: "git",
71        url: "git+https://github.com/neurosnap/starfx.git",
72      },
73      bugs: {
74        url: "https://github.com/neurosnap/starfx/issues",
75      },
76      engines: {
77        node: ">= 18",
78      },
79      sideEffects: false,
80    },
81    postBuild() {
82      Deno.copyFileSync("LICENSE.md", "npm/LICENSE.md");
83      Deno.copyFileSync("README.md", "npm/README.md");
84    },
85  });
86}