@nx/rspack
Version:
36 lines (35 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const tslib_1 = require("tslib");
const devkit_1 = require("@nx/devkit");
const application_1 = tslib_1.__importDefault(require("../application/application"));
async function default_1(tree, options) {
const appTask = (0, application_1.default)(tree, {
...options,
directory: '.',
// Since `--style` is not passed down to custom preset, we're using individual flags for now.
style: options.sass
? 'scss'
: options.less
? 'less'
: options.stylus
? 'styl'
: 'css',
});
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
json.scripts ??= {};
json.scripts.build ??= 'npx nx build';
json.scripts.start ??= 'npx nx serve';
json.scripts.lint ??= 'npx nx lint';
json.scripts.test ??= 'npx nx test';
json.scripts.e2e ??= 'npx nx e2e e2e';
return json;
});
if (options.rootProject) {
// Remove these folders so projects will be generated at the root.
tree.delete('apps');
tree.delete('libs');
}
return appTask;
}