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

fix(@angular-devkit/core): Rename to a non-existing dir #16839

Merged
merged 1 commit into from
Feb 7, 2020
Merged

fix(@angular-devkit/core): Rename to a non-existing dir #16839

merged 1 commit into from
Feb 7, 2020

Conversation

sacgrover
Copy link
Contributor

Schematics: rename to a non-existing dir fails on sync to disk #16484

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

@sacgrover thanks for this, see comment above. Also can you kindly add a unit test in https://github.com/angular/angular-cli/blob/dbaa1be12b4897b130a30a34be0a502125e312ae/packages/angular_devkit/core/node/host_spec.ts and also add Fixes #16484 as a commit footer?

@@ -316,6 +317,9 @@ export class NodeJsSyncHost implements virtualFs.Host<fs.Stats> {
// TODO: remove this try+catch when issue https://github.com/ReactiveX/rxjs/issues/3740 is
// fixed.
try {
if (!fs.existsSync(getSystemPath(path.parse(to).dir as Path))) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The castings here are not correct The to and from here are devkit paths are they are not interchangeable with FS paths, so you need to get the system path first.

So the logic here should look more like;

try {
  const toSystemPath = getSystemPath(to);
  if (!fs.existsSync(path.dirname(toSystemPath)) {
      fs.mkdirSync(path.dirname(toSystemPath), { recursive: true });
  }

  fs.renameSync(getSystemPath(from), toSystemPath);
  obs.next();
  obs.complete();
} catch (err) {
  obs.error(err);
}

@sacgrover
Copy link
Contributor Author

@alan-agius4 Asked changes done.

@alan-agius4
Copy link
Collaborator

Can you please squash the commits? Otherwise looks good. Thanks.

Added unit test and requested changes.
Fixes #16484
@sacgrover
Copy link
Contributor Author

Squashing done. @alan-agius4

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Feb 7, 2020
Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

Thanks LGTM

@alan-agius4 alan-agius4 removed the request for review from clydin February 7, 2020 14:13
@sacgrover
Copy link
Contributor Author

@alan-agius4 when it will be merged? I am asking because I can see lot of new issues and I want to work on them but by mistake I committed in master branch now If I take a branch out of it then it will not be in synced with original and will have the pending merge changes in it.

@dgp1130 dgp1130 merged commit 54b79ad into angular:master Feb 7, 2020
@dgp1130
Copy link
Collaborator

dgp1130 commented Feb 7, 2020

Merged to 9.0.x patch branch as well.

We have a caretaking process which merges ready PRs daily, so merging should always be pretty timely after approval and tests pass. Full docs.

@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 9, 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.

4 participants