create-tezos-smart-contract
Version:
Node.js toolset to write, test and deploy Tezos smart contracts
47 lines (46 loc) • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const compile_1 = require("./commands/compile");
const deploy_1 = require("./commands/deploy");
const e2e_test_1 = require("./commands/e2e-test");
const init_1 = require("./commands/init");
const postinstall_1 = require("./commands/postinstall");
const start_sandbox_1 = require("./commands/start-sandbox");
const test_1 = require("./commands/test");
const console_1 = require("./console");
const program = new commander_1.Command();
program
.version("1.3.0")
.option('--debug', 'run the command in debug mode, with a lot more details about it')
.option('-f, --folder <cwd>', 'change the working directory to the specified folder')
.hook('preAction', (cmd) => {
const options = cmd.opts();
if (options.debug) {
(0, console_1.setDebug)(true);
}
if (options.folder) {
(0, console_1.debug)(`Change working directory to ${options.folder}`);
(0, console_1.setCWD)(options.folder);
}
});
const debugHook = (cmd) => {
const options = cmd.opts();
const optionsString = JSON.stringify(options, null, 2);
// Debug options code
if (options && optionsString !== "{}") {
(0, console_1.debug)(`Command options:\n${optionsString}\n`);
}
else {
(0, console_1.debug)('No options were passed to this command.\n');
}
};
(0, init_1.addInitCommand)(program, debugHook);
(0, start_sandbox_1.addStartSandboxCommand)(program, debugHook);
(0, compile_1.addCompileCommand)(program, debugHook);
(0, test_1.addTestCommand)(program, debugHook);
(0, e2e_test_1.addE2ETestCommand)(program, debugHook);
(0, deploy_1.addDeployCommand)(program, debugHook);
(0, postinstall_1.addPostInstallCommand)(program, debugHook);
program.parse(process.argv);