@nx-plugins/slidev
Version:
The Nx Plugin for Slidev that contains executors, generators, and utilities for managing Slidev applications within an Nx workspace.
52 lines • 1.7 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.output) {
args.push(`--output=${options.output}`);
}
if (options.base) {
args.push(`--base=${options.base}`);
}
if (options.timeout) {
args.push(`--timeout=${options.timeout}`);
}
if (options.range) {
args.push(`--range=${options.range}`);
}
if (options.dark) {
args.push(`--dark`);
}
if (options.withClicks) {
args.push(`--with-clicks`);
}
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 export ${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');
}
return 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