@adpt/cli
Version:
AdaptJS command line interface
43 lines • 1.73 kB
JavaScript
;
/*
* Copyright 2020 Unbounded Systems, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const utils_1 = require("@adpt/utils");
const debug_1 = tslib_1.__importDefault(require("debug"));
const load_1 = require("../config/load");
const upgrade_checker_1 = require("./upgrade_checker");
// Always log to stderr, which is normally directed to a log file.
const oldDebugs = debug_1.default.disable();
debug_1.default.enable(oldDebugs + oldDebugs ? "," : "" + "adapt:upgrade");
const debug = debug_1.default("adapt:upgrade");
async function main() {
debug("Starting upgrade check");
debug("Arguments:", process.argv.join(" "));
const config = JSON.parse(process.argv[2]);
const state = load_1.createState(config.configDir, false);
const checker = new upgrade_checker_1.UpgradeChecker(config, state);
const upgrade = await checker.fetch();
state.set({
lastUpgradeCheck: Date.now(),
upgrade
});
}
main().catch((err) => {
debug("FAILED: Error running upgrade check:", utils_1.formatUserError(err));
process.exit(1);
});
//# sourceMappingURL=check.js.map