"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateTsConfig = generateTsConfig;
const generator_1 = require("@postxl/generator");
function generateTsConfig({ backend: { modules, packageJson, tsConfigReferences } }) {
    const paths = [];
    for (const m of modules) {
        paths.push(`"@${m.name}/*": ["./libs/${m.name}/src/*"]`, `"@${m.name}": ["./libs/${m.name}/src"]`);
    }
    for (const reference of tsConfigReferences) {
        paths.push(`"@${reference}/*": ["./libs/${reference}/src/*"]`, `"@${reference}": ["./libs/${reference}/src"]`);
    }
    for (const d of packageJson.dependencies) {
        if (!(0, generator_1.isLocalProjectDependency)(d)) {
            continue;
        }
        const relativePath = (0, generator_1.getRelativePath)({ from: './backend/', to: d.path });
        paths.push(`"${d.backendModuleName}/*": ["${relativePath}*"]`, `"${d.backendModuleName}": ["${relativePath}"]`);
    }
    return /*json*/ `
  {
  "ts-node": {
    "require": ["tsconfig-paths/register"]
  },
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ESNext",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "noImplicitAny": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "noImplicitOverride": true,
    "strictBindCallApply": true,
    "strictFunctionTypes": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "resolveJsonModule": true,
    "useUnknownInCatchVariables": true,
    "esModuleInterop": true,

    "paths": {
      ${paths.toSorted((a, b) => a.localeCompare(b)).join(',\n')}
    }
  }
}
`;
}
//# sourceMappingURL=tsconfig.generator.js.map