-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·51 lines (48 loc) · 1.22 KB
/
index.js
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
#!/usr/bin/env node
"use strict";
const yargs = require("yargs/yargs");
const { hideBin } = require("yargs/helpers");
const packageJson = require("./package.json");
// get some params
const argv = yargs(hideBin(process.argv))
.version(packageJson.version)
.option("source", {
alias: "s",
type: "string",
default: "./package.json",
description: "Which packages.json to use",
})
.option("dist", {
alias: "d",
type: "string",
default: "./dist",
description: "Where to put the final node_modules",
})
.option("command", {
alias: "c",
type: "string",
default: "npm install --omit=dev --prefer-offline --no-audit --no-fund",
description: "Command to install dependencies",
})
.option("cache-dir", {
type: "string",
default: `${process.env.HOME}/.cache`,
description: "Command to install dependencies",
})
.option("omit-json", {
type: "boolean",
default: false,
description: "Avoid output package.json",
})
.help()
.parseSync();
const cwd = process.cwd();
const { installPkg } = require("./main");
installPkg({
cwd,
source: argv.source,
dist: argv.dist,
command: argv.command,
cacheDir: argv["cache-dir"],
omitJson: argv["omit-json"],
});