@platform/ts
Version:
TypesScript build, prepare and publish toolchain.
50 lines (49 loc) • 1.92 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepare = void 0;
var tslib_1 = require("tslib");
var common_1 = require("../common");
function prepare(args) {
if (args === void 0) { args = {}; }
return tslib_1.__awaiter(this, void 0, void 0, function () {
var silent, log, dir, _a, cmds, res, error_1;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
silent = args.silent;
log = (0, common_1.getLog)(args.silent);
_a = args.dir;
if (_a) return [3, 2];
return [4, common_1.paths.closestParentOf('package.json')];
case 1:
_a = (_b.sent());
_b.label = 2;
case 2:
dir = _a;
if (!dir) {
return [2, common_1.result.fail("A module root with [package.json] could not be found.")];
}
_b.label = 3;
case 3:
_b.trys.push([3, 5, , 6]);
log.info();
cmds = ['yarn build', 'yarn lint', 'yarn test'];
return [4, common_1.exec.cmd.runList(cmds, {
cwd: common_1.fs.resolve(dir),
silent: silent,
concurrent: true,
exitOnError: false,
})];
case 4:
res = _b.sent();
res.errors.log({ log: log });
return [2, res];
case 5:
error_1 = _b.sent();
return [2, common_1.result.fail(error_1)];
case 6: return [2];
}
});
});
}
exports.prepare = prepare;
;