1 | #!/usr/bin/env node
|
2 | const path = require("path");
|
3 | const libNpmConfig = require("libnpmconfig");
|
4 | const getStdin = require("get-stdin");
|
5 | const up = require("../src");
|
6 |
|
7 | const PACKAGE_FILE_NAME = path.join(process.cwd(), "package.json");
|
8 |
|
9 | getStdin()
|
10 | .then((pOutdatedObject) => {
|
11 | const lResult = up(PACKAGE_FILE_NAME, pOutdatedObject, PACKAGE_FILE_NAME, {
|
12 | saveExact: libNpmConfig.read().get("save-exact") || false,
|
13 | savePrefix: libNpmConfig.read().get("save-prefix") || "^",
|
14 | });
|
15 |
|
16 | if (lResult.OK) {
|
17 | process.stdout.write(lResult.message);
|
18 | } else {
|
19 | process.stderr.write(lResult.message);
|
20 | }
|
21 | })
|
22 | .catch((pError) => {
|
23 | process.stderr.write(
|
24 | ` Up'em encountered a hitch when reading outdated information:\n${pError}\n\n`
|
25 | );
|
26 | });
|