@nx-plugins/slidev
Version:
The Nx Plugin for Slidev that contains executors, generators, and utilities for managing Slidev applications within an Nx workspace.
49 lines • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const run_commands_impl_1 = require("@nrwl/workspace/src/executors/run-commands/run-commands.impl");
const path_1 = require("path");
function getArgs(options) {
const args = [];
if (options.port) {
args.push(`--port=${options.port}`);
}
if (options.open) {
args.push('--open');
}
if (options.remote) {
args.push(`--remote=${options.remote}`);
}
if (options.log) {
args.push(`--log=${options.log}`);
}
if (options.force) {
args.push('--force');
}
if (options.theme) {
args.push(`--theme=${options.theme}`);
}
return args;
}
function runExecutor(options, context) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const args = getArgs(options);
const command = `slidev ${args.join(' ').trimEnd()}`;
let projectRoot;
if (context.projectName) {
projectRoot = (0, path_1.join)(context.root, context.workspace.projects[context.projectName].root);
}
else {
throw new Error('projectRoot not defined');
}
yield (0, run_commands_impl_1.default)({
command: `${command.trimEnd()} ${options.entry}`,
parallel: false,
color: true,
__unparsed__: [],
cwd: projectRoot,
}, context);
});
}
exports.default = runExecutor;
//# sourceMappingURL=executor.js.map