UNPKG

@ts-dev-tools/core

Version:
34 lines (33 loc) 1.17 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const node_path_1 = require("node:path"); const constants_1 = require("./constants"); const command_1 = require("./install/command"); const PackageJson_1 = require("./services/PackageJson"); async function bin() { const [, , arg, ...params] = process.argv; switch (true) { case arg === "install": // Check if script is not run by the package himself if (process.cwd() === (0, node_path_1.dirname)(__dirname)) { console.info("Do not install itself!"); break; } await (0, command_1.install)({ cwd: process.cwd(), dir: params[0], }); break; case ["--version", "-v"].includes(arg): console.info(PackageJson_1.PackageJson.fromDirPath((0, node_path_1.join)(__dirname, "..")).getPackageVersion()); break; default: console.info(`Usage ${constants_1.PROJECT_NAME} install [path from project root] `); } } bin() .then() .catch((error) => console.error(error));