UNPKG

780 BJavaScriptView Raw
1#!/usr/bin/env node
2const path = require("path");
3const libNpmConfig = require("libnpmconfig");
4const getStdin = require("get-stdin");
5const up = require("../src");
6
7const PACKAGE_FILE_NAME = path.join(process.cwd(), "package.json");
8
9getStdin()
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 });