summaryrefslogtreecommitdiff
path: root/tools/ts_library_builder/main.ts
blob: c3192a7530516e8f77a5f78f94ee4300802d84fe (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
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import * as path from "path";
import { main as buildRuntimeLib } from "./build_library";

// this is very simplistic argument parsing, just enough to integrate into
// the build scripts, versus being very robust
let basePath = process.cwd();
let buildPath = path.join(basePath, "out", "debug");
let outFile = path.join(buildPath, "gen", "lib", "lib.d.ts");
let inline: string[] = [];
let debug = false;
let silent = false;

process.argv.forEach((arg, i, argv) => {
  // tslint:disable-next-line:switch-default
  switch (arg) {
    case "--basePath":
      basePath = path.resolve(argv[i + 1]);
      break;
    case "--buildPath":
      buildPath = path.resolve(argv[i + 1]);
      break;
    case "--inline":
      inline = argv[i + 1].split(",").map(filename => {
        return path.resolve(filename);
      });
      break;
    case "--outFile":
      outFile = path.resolve(argv[i + 1]);
      break;
    case "--debug":
      debug = true;
      break;
    case "--silent":
      silent = true;
      break;
  }
});

buildRuntimeLib({
  basePath,
  buildPath,
  debug,
  inline,
  outFile,
  silent
});