Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scripts): use solution ts config when enabled within tsc just task #20515

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion scripts/tasks/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ const useTsBuildInfo =
* > - Without setting rootDir we would get output dir mapping following path from monorepo root
*/
function prepareTsTaskConfig(options: TscTaskOptions) {
const tsConfigFilePath = resolveCwd('./tsconfig.json');
const tsConfigMainFilePath = resolveCwd('./tsconfig.json');
const tsConfigLibFilePath = resolveCwd('./tsconfig.lib.json');
const isUsingTsSolutionConfigs = fs.existsSync(tsConfigLibFilePath);

const tsConfigFilePath = isUsingTsSolutionConfigs ? tsConfigLibFilePath : tsConfigMainFilePath;
const tsConfig: TsConfig = jju.parse(fs.readFileSync(tsConfigFilePath, 'utf-8'));

if (tsConfig.extends) {
Expand All @@ -40,10 +44,13 @@ function prepareTsTaskConfig(options: TscTaskOptions) {
const normalizedOptions = { ...options };
normalizedOptions.baseUrl = '.';
normalizedOptions.rootDir = './src';
normalizedOptions.project = path.basename(tsConfigFilePath);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I don't quite understand how the issue relates to this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that we cannot use build mode at this point, which is ok for now.


return normalizedOptions;
}

options.target = 'es5';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you didn't remove any hardcoded es5 targets right ? it seems rather that you added them

Copy link
Contributor Author

@Hotell Hotell Nov 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed them from all tsc tasks by default to maintain old behaviours (please mind the if branch with exit early statement). They are added to non converge/modern packages to not break any behaviours

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually just checked this recently, the hardcoded es5 target is never needed because all v8-related packages explicitly declare a target. (That's why it was removed from this task by @GeoffCoxMSFT's recent PR to update libs/target for converged.)


return options;
}

Expand Down Expand Up @@ -88,6 +95,7 @@ export const ts = {
const extraOptions = getExtraTscParams(getJustArgv());
const options = prepareTsTaskConfig({
...extraOptions,
target: 'es5',
outDir: 'lib-amd',
module: 'amd',
...(useTsBuildInfo && { tsBuildInfoFile: '.amd.tsbuildinfo' }),
Expand Down