Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 1x 1x 6x 6x 1x 1x 6x 6x 6x 6x 6x 7x 6x 6x 6x 6x 7x 1x 1x 1x 1x 1x 7x 6x 6x | import { javascript, typescript } from 'projen';
export function defaultTsConfig(): javascript.TypescriptConfigOptions {
return {
compilerOptions: {
esModuleInterop: true,
forceConsistentCasingInFileNames: true,
lib: ['ES2023'],
module: 'NodeNext',
moduleResolution: javascript.TypeScriptModuleResolution.NODE_NEXT,
skipLibCheck: true,
strict: true,
target: 'ES2022',
// TODO: Update this to allow injecting types
types: ['vitest/globals'],
},
};
}
export function createTsNodeCmd(tsFilePath: string) {
return `TS_NODE_PROJECT=tsconfig.dev.json node --no-warnings --loader ts-node/esm ${tsFilePath}`;
}
export function useTsNodeEsm(project: typescript.TypeScriptProject) {
const defaultTask = project.tasks.tryFind('default');
if (defaultTask) {
const { steps } = defaultTask;
defaultTask.reset();
for (const step of steps) {
if (step.exec) {
const hasTsNode = step.exec.includes('ts-node');
defaultTask.exec(
hasTsNode ? createTsNodeCmd('.projenrc.ts') : step.exec,
);
} else if (step.spawn) {
const subTask = project.tasks.tryFind(step.spawn);
if (subTask) {
defaultTask.spawn(subTask);
}
}
}
}
}
|