Skip to content

fix(core): ensure that setWorkspaceContext is run only on main nx packages#28706

Merged
FrozenPandaz merged 5 commits intomasterfrom
feature/nxc-1151-investigate-bus-errors-135
Nov 5, 2024
Merged

fix(core): ensure that setWorkspaceContext is run only on main nx packages#28706
FrozenPandaz merged 5 commits intomasterfrom
feature/nxc-1151-investigate-bus-errors-135

Conversation

@Cammisuli
Copy link
Copy Markdown
Member

@Cammisuli Cammisuli commented Oct 30, 2024

Current Behavior

When running postinstall with Nx, we create a files archive file. When there are multiple versions of nx installed, the post install would run for all versions. This causes issues where one version might overwrite the archive files while another version is writing to the same location.

Expected Behavior

The setupWorkspaceContext is now only ran when we detect that it is the main nx package. This also makes the creation of the archive file more atomic so that we dont overwrite files while its being written by other processes

Related Issue(s)

Fixes #

Also makes creation of the archive file more atomic so that we dont
overwrite files while its being written by other processes
@Cammisuli Cammisuli requested review from a team as code owners October 30, 2024 17:52
@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Nov 4, 2024 10:43pm

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Oct 30, 2024

@github-actions
Copy link
Copy Markdown
Contributor

🐳 We have a release for that!

This PR has a release associated with it. You can try it out using this command:

npx create-nx-workspace@0.0.0-pr-28706-16b6403 my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-28706-16b6403
Release details 📑
Published version 0.0.0-pr-28706-16b6403
Triggered by @Cammisuli
Branch feature/nxc-1151-investigate-bus-errors-135
Commit 16b6403
Workflow run 11599484860

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

@github-actions
Copy link
Copy Markdown
Contributor

🐳 We have a release for that!

This PR has a release associated with it. You can try it out using this command:

npx create-nx-workspace@0.0.0-pr-28706-f21dc7c my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-28706-f21dc7c
Release details 📑
Published version 0.0.0-pr-28706-f21dc7c
Triggered by @Cammisuli
Branch feature/nxc-1151-investigate-bus-errors-135
Commit f21dc7c
Workflow run 11613164968

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

@github-actions
Copy link
Copy Markdown
Contributor

🐳 We have a release for that!

This PR has a release associated with it. You can try it out using this command:

npx create-nx-workspace@0.0.0-pr-28706-97af084 my-workspace

Or just copy this version and use it in your own command:

0.0.0-pr-28706-97af084
Release details 📑
Published version 0.0.0-pr-28706-97af084
Triggered by @Cammisuli
Branch feature/nxc-1151-investigate-bus-errors-135
Commit 97af084
Workflow run 11614447201

To request a new release for this pull request, mention someone from the Nx team or the @nrwl/nx-pipelines-reviewers.

@Cammisuli Cammisuli force-pushed the feature/nxc-1151-investigate-bus-errors-135 branch from aa33ceb to 1c6e035 Compare November 4, 2024 22:40
@Cammisuli Cammisuli changed the title fix(core): add nx version to nx files archive fix(core): ensure that setWorkspaceContext is run only on main nx packages Nov 4, 2024
@FrozenPandaz FrozenPandaz merged commit b925f8c into master Nov 5, 2024
@FrozenPandaz FrozenPandaz deleted the feature/nxc-1151-investigate-bus-errors-135 branch November 5, 2024 02:23
FrozenPandaz pushed a commit that referenced this pull request Nov 5, 2024
…ackages (#28706)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When running postinstall with Nx, we create a files archive file. When
there are multiple versions of nx installed, the post install would run
for all versions. This causes issues where one version might overwrite
the archive files while another version is writing to the same location.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The `setupWorkspaceContext` is now only ran when we detect that it is
the main nx package. This also makes the creation of the archive file
more atomic so that we dont overwrite files while its being written by
other processes

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

(cherry picked from commit b925f8c)
FrozenPandaz pushed a commit that referenced this pull request Nov 6, 2024
…ackages (#28706)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When running postinstall with Nx, we create a files archive file. When
there are multiple versions of nx installed, the post install would run
for all versions. This causes issues where one version might overwrite
the archive files while another version is writing to the same location.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The `setupWorkspaceContext` is now only ran when we detect that it is
the main nx package. This also makes the creation of the archive file
more atomic so that we dont overwrite files while its being written by
other processes

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

(cherry picked from commit b925f8c)
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants