summaryrefslogtreecommitdiffhomepage
path: root/packages/server/build_npm.ts
blob: 1b9084969da8cdd0322c40b70983d1445fc9b300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { build, emptyDir } from "https://deno.land/x/dnt@0.38.0/mod.ts";

const outDir = "./npm";
const lernaPackageJSON: { version: string } = JSON.parse(
  await Deno.readTextFile("./package.json"),
);

await emptyDir(outDir);

await build({
  entryPoints: [
    { name: ".", path: "./src/index.ts" },
    { name: "./helpers", path: "./src/helpers/index.ts" },
  ],
  outDir,
  shims: {
    deno: "dev",
    crypto: false,
  },
  test: false,
  // TODO: Re-enable if https://github.com/denoland/dnt/issues/331 can get resolved
  typeCheck: false,
  // package.json values
  package: {
    name: "@simplewebauthn/server",
    version: lernaPackageJSON.version,
    description: "SimpleWebAuthn for Servers",
    license: "MIT",
    author: "Matthew Miller <matthew@millerti.me>",
    repository: {
      type: "git",
      url: "https://github.com/MasterKale/SimpleWebAuthn.git",
      directory: "packages/server",
    },
    homepage:
      "https://github.com/MasterKale/SimpleWebAuthn/tree/master/packages/server#readme",
    publishConfig: {
      access: "public",
    },
    bugs: {
      url: "https://github.com/MasterKale/SimpleWebAuthn/issues",
    },
    keywords: [
      "typescript",
      "webauthn",
      "passkeys",
      "fido",
      "node",
    ],
    typesVersions: {
      "*": {
        ".": [
          "esm/index.d.ts",
        ],
        "helpers": [
          "esm/helpers/index.d.ts",
        ],
      },
    },
  },
  // Map from Deno package to NPM package for Node build
  mappings: {
    "https://deno.land/x/b64@1.1.27/src/base64.js": {
      name: "@hexagon/base64",
      version: "^1.1.25",
    },
    "https://deno.land/x/cbor@v1.5.2/index.js": {
      name: "cbor-x",
      version: "^1.5.2",
    },
    // Mapping for '../../typescript-types/src/index.ts' in deps.ts
    "../typescript-types/src/index.ts": {
      name: "@simplewebauthn/typescript-types",
      version: "^7.4.0",
    },
  },
  // TypeScript tsconfig.json config
  compilerOptions: {
    lib: ["ES2021"],
  },
});

// Deno.copyFileSync('LICENSE', 'npm/LICENSE');
Deno.copyFileSync("README.md", `${outDir}/README.md`);