Skip to content

fix(@schematics/angular): resolve windows paths in tsconfig migration #16807

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

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

filipesilva
Copy link
Contributor

Fix #16800

@filipesilva filipesilva added the target: patch This PR is targeted for the next patch release label Jan 31, 2020
@@ -110,12 +110,12 @@ function updateTsConfig(tree: Tree, builderConfig: JsonAstObject, builderName: B

const mainOption = findPropertyInAstObject(option, 'main');
if (mainOption && mainOption.kind === 'string') {
newFiles.push(posix.relative(posix.dirname(tsConfigPath), mainOption.value));
newFiles.push(relative(dirname(tsConfigPath), mainOption.value).replace(/\\/g, '/'));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Posix resolution on Windows will still prefer the windows path separator: https://nodejs.org/api/path.html#path_path_normalize_path

But here what we really want is a "TS-style" separator instead, which is forward slash everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also unfortunate is that this code:

const tsConfigPath = 'projects\\another-app\\tsconfig.app.json';
console.log(dirname(tsConfigPath));
console.log(posix.dirname(tsConfigPath));

Will print . twice on Linux, but on Windows will print projects\another-app and .. So I don't think the posix functions help us at all here.

@filipesilva filipesilva force-pushed the v9-migration-tsconfig-posix branch 2 times, most recently from b5c19da to 29561fd Compare January 31, 2020 10:47
@filipesilva filipesilva force-pushed the v9-migration-tsconfig-posix branch from 29561fd to 74e16dd Compare January 31, 2020 10:49
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Jan 31, 2020
@alan-agius4 alan-agius4 added this to the v9-candidates milestone Jan 31, 2020
@mgechev mgechev merged commit 216af23 into angular:master Feb 4, 2020
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ng update wrote wrong path of main.ts and polyfill.ts in tsconfig.app.json
4 participants