Skip to content

Commit

Permalink
chore(scripts): add back code from bad cherry pick conflict resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Hotell committed Nov 15, 2022
1 parent b6ca30c commit 675d36c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/tasks/api-extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export function apiExtractor() {
tsConfig,
tsConfigPath,
packageJson,
definitionsRootPath: 'dist/out-tsc/types',
});

config.compiler = compilerConfig;
Expand Down
16 changes: 16 additions & 0 deletions scripts/tasks/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,26 @@ function enableAllowSyntheticDefaultImports(options: { pkgJson: PackageJson }) {
return shouldEnable ? { allowSyntheticDefaultImports: true } : null;
}

const rootTsConfig = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../../tsconfig.base.json'), 'utf-8'),
) as TsConfig;

function createNormalizedTsPaths(options: { definitionsRootPath: string; rootTsConfig: TsConfig }) {
const paths = (options.rootTsConfig.compilerOptions.paths as unknown) as Record<string, string[]>;

const normalizedPaths = Object.entries(paths).reduce((acc, [pkgName, pathAliases]) => {
acc[pkgName] = [path.join(options.definitionsRootPath, pathAliases[0].replace('index.ts', 'index.d.ts'))];
return acc;
}, {} as typeof paths);

return normalizedPaths;
}

export function getTsPathAliasesApiExtractorConfig(options: {
tsConfig: TsConfig;
tsConfigPath: string;
packageJson: PackageJson;
definitionsRootPath: string;
}) {
/**
* Customized TSConfig that uses `tsconfig.lib.json` as base with some required overrides:
Expand Down

0 comments on commit 675d36c

Please sign in to comment.