@authereum/zos
Version:
Command-line interface for the ZeppelinOS smart contract platform
34 lines • 1.54 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_extra_1 = __importDefault(require("fs-extra"));
const zos_lib_1 = require("zos-lib");
const lockfile_1 = require("lockfile");
const program_1 = __importDefault(require("./program"));
const helpers_1 = __importDefault(require("./helpers"));
const constants_1 = require("../models/files/constants");
const IGNORED_COMMANDS_IN_ROOT_DIR = ['init', 'unpack'];
const [nodePath, zosPath, command] = process.argv;
if (!IGNORED_COMMANDS_IN_ROOT_DIR.includes(command)) {
const currentPath = process.cwd();
const rootDirectory = helpers_1.default(currentPath) || currentPath;
if (rootDirectory !== process.cwd())
process.chdir(rootDirectory);
}
// Acquire file lock to ensure no other instance is running
try {
fs_extra_1.default.ensureDirSync(constants_1.OPEN_ZEPPELIN_FOLDER);
lockfile_1.lockSync(constants_1.LOCK_FILE_PATH, { retries: 0 });
}
catch (e) {
console.error(`Cannot run more than one instance of 'openzeppelin' at the same time.\nIf you are sure that no other instances are actually running, manually remove the file ${constants_1.LOCK_FILE_PATH} and try again.`);
process.exit(1);
}
zos_lib_1.Loggy.silent(false);
program_1.default.parse(process.argv);
if (program_1.default.args.length === 0)
program_1.default.help();
//# sourceMappingURL=zos-cli.js.map