@nx/remix
Version:
21 lines (20 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.addTsconfigEntryPoints = addTsconfigEntryPoints;
const devkit_1 = require("@nx/devkit");
const js_1 = require("@nx/js");
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
function addTsconfigEntryPoints(tree, options) {
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
const projectSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
const serverFilePath = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'server.ts');
tree.write(serverFilePath, `// This file should be used to export ONLY server-code from the library.`);
const baseTsConfig = (0, js_1.getRootTsConfigPathInTree)(tree);
(0, devkit_1.updateJson)(tree, baseTsConfig, (json) => {
if (json.compilerOptions.paths &&
json.compilerOptions.paths[options.importPath]) {
json.compilerOptions.paths[(0, devkit_1.joinPathFragments)(options.importPath, 'server')] = [serverFilePath];
}
return json;
});
}