UNPKG

takin

Version:

Front end engineering base toolchain and scaffold

29 lines 1.07 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); /** * 用于修改当前工作目录 cwd */ class ChangeCwdPlugin { constructor() { this.name = 'TakinChangeCwdPlugin'; } apply(runner) { runner.hooks.cli.tap(this.name, function (cli) { cli.option('--cwd <cwd>', '当前工作目录, 默认为 process.cwd()'); }); runner.hooks.matchedCommand.tap({ name: this.name, stage: Number.NEGATIVE_INFINITY }, function (command) { var _a; const cwd = ((_a = command === null || command === void 0 ? void 0 : command.options) === null || _a === void 0 ? void 0 : _a['cwd']) || runner.config.cwd; runner.config.cwd = path_1.default.resolve(cwd); }); } } exports.default = ChangeCwdPlugin; //# sourceMappingURL=ChangeCwdPlugin.js.map