Skip to content

Conversation

@arunim2405
Copy link

Helps bring 35bcf93 to 0.67 stable branch

Summary:
React-native Xcode build steps (such as "Build JS Bundle") rely on `find.node-sh` to find the correct node binary, using nvm if present. We do this because Xcode may run build steps in a fresh shell environment, presumably for repeatable builds.

This PR fixes `find-node.sh`, to respect any `.nvmrc` file that may be present in the build environment.

Today: `find-node.sh` will set the shell environment to the system node version, and ignores any `.nvmrc` the project may provide to pin node for repeatable builds. By ignoring `.nvmrc`, node versions may differ depending on system environment — between developer laptops, or between developer and CI environments. 😞

This problem has been been noticed before in facebook#8887

### Should this fix happen upstream?

Unfortunately this nvm behavior [is intended](nvm-sh/nvm#2053),  for backwards compatibility

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - find-node.sh now respects .nvmrc

Pull Request resolved: facebook#32712

Test Plan:
Before:
```bash
# nvm isn't loaded
$ which nvm

# we're on default system node
$ which node && node --version
/usr/local/bin/node
v17.0.1

$ echo v16.13.0 > .nvmrc
$ source ./scripts/find-node.sh

# Expected: v16.13.0
$ node --version
v17.0.1
```

After:
```bash
# we're on default system node
$ which node && node --version
/usr/local/bin/node
v17.0.1

$ echo v16.13.0 > .nvmrc
$ source ./scripts/find-node.sh

# Expected: v16.13.0
$ node --version
v16.13.0
```

After (no .nvmrc, should preserve previous behavior):
```bash
# we're on default system node
$ which node && node --version
/usr/local/bin/node
v17.0.1

$ source ./scripts/find-node.sh

$  nvm ls|grep default
default -> v14.17.1

# Expected: v14.17.1
$ node --version
v14.17.1
```

Reviewed By: sota000

Differential Revision: D32889629

Pulled By: ShikaSD

fbshipit-source-id: 527384055e303a87bad43413fb66a7fd117d1a63
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 23, 2022
@pull-bot
Copy link

pull-bot commented Jan 23, 2022

Warnings
⚠️

❔ Base Branch - The base branch for this PR is something other than main. Are you sure you want to merge these changes into a stable release? If you are interested in backporting updates to an older release, the suggested approach is to land those changes on main first and then cherry-pick the commits into the branch for that release. The Releases Guide has more information.

Messages
📖

📋 Missing Changelog - Can you add a Changelog? To do so, add a "## Changelog" section to your PR description. A changelog entry has the following format: [CATEGORY] [TYPE] - Message.

CATEGORY may be:
  • General
  • iOS
  • Android
  • JavaScript
  • Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

  • Added, for new features.
  • Changed, for changes in existing functionality.
  • Deprecated, for soon-to-be removed features.
  • Removed, for now removed features.
  • Fixed, for any bug fixes.
  • Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level. Use this to briefly tell React Native users about notable changes.

📖 📋 Missing Test Plan - Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.
📖 📋 Missing Summary - Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.

Generated by 🚫 dangerJS against d10f9b2

@pull-bot
Copy link

PR build artifact for fb0332b is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@analysis-bot
Copy link

analysis-bot commented Jan 23, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 45244eb
Branch: main

@analysis-bot
Copy link

analysis-bot commented Jan 23, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,718,533 -578,732
android hermes armeabi-v7a 7,246,211 -388,141
android hermes x86 8,137,957 -632,615
android hermes x86_64 8,103,260 -604,337
android jsc arm64-v8a 9,637,764 -145,288
android jsc armeabi-v7a 8,552,963 -215,362
android jsc x86 9,651,467 -97,490
android jsc x86_64 10,260,454 -84,398

Base commit: 45244eb
Branch: main

@pull-bot
Copy link

PR build artifact for d10f9b2 is ready.
To use, download tarball from "Artifacts" tab in this CircleCI job then run yarn add <path to tarball> in your React Native project.

@lunaleaps
Copy link
Contributor

Thanks! We have picked the original commit into 0.67.2!

@lunaleaps lunaleaps closed this Feb 1, 2022
facebook-github-bot pushed a commit that referenced this pull request Feb 2, 2022
Summary:
Danger 7 -> 11

## Changelog

[Internal] [Changed] - Updates Danger used in PR checking from v7 to v11

Pull Request resolved: #33027

Test Plan:
Works when testing locally

```
> DANGER_GITHUB_API_TOKEN=XXYYZZ yarn danger pr #32955
yarn run v1.22.15
$ node ./node_modules/.bin/danger pr #32955
Starting Danger PR on #32955
 --- Accurate Error due to not being able to write to labels ---

## Failures
`node` failed.
## Messages
:clipboard: Missing Summary - <i>Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.</i>
-
:clipboard: Missing Test Plan - <i>Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.</i>
-
:clipboard: Missing Changelog - <i>Can you add a Changelog? To do so, add a "## Changelog" section to your PR description. A changelog entry has the following format: `[CATEGORY] [TYPE] - Message`.

<details>CATEGORY may be:

- General
- iOS
- Android
- JavaScript
- Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

- Added, for new features.
- Changed, for changes in existing functionality.
- Deprecated, for soon-to-be removed features.
- Removed, for now removed features.
- Fixed, for any bug fixes.
- Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level.   Use this to briefly tell React Native users about notable changes.</details></i>
## Markdowns

Danger: ⅹ Failing the build, there is 1 fail.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

Reviewed By: GijsWeterings

Differential Revision: D33941271

Pulled By: cortinico

fbshipit-source-id: 359c0076a160a8eeac897a2e1556d3e4d3db5e04
amgleitman pushed a commit to amgleitman/react-native-macos that referenced this pull request Apr 20, 2022
Summary:
Danger 7 -> 11

[Internal] [Changed] - Updates Danger used in PR checking from v7 to v11

Pull Request resolved: facebook#33027

Test Plan:
Works when testing locally

```
> DANGER_GITHUB_API_TOKEN=XXYYZZ yarn danger pr facebook#32955
yarn run v1.22.15
$ node ./node_modules/.bin/danger pr facebook#32955
Starting Danger PR on facebook#32955
 --- Accurate Error due to not being able to write to labels ---
`node` failed.
:clipboard: Missing Summary - <i>Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.</i>
-
:clipboard: Missing Test Plan - <i>Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.</i>
-
:clipboard: Missing Changelog - <i>Can you add a Changelog? To do so, add a "## Changelog" section to your PR description. A changelog entry has the following format: `[CATEGORY] [TYPE] - Message`.

<details>CATEGORY may be:

- General
- iOS
- Android
- JavaScript
- Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

- Added, for new features.
- Changed, for changes in existing functionality.
- Deprecated, for soon-to-be removed features.
- Removed, for now removed features.
- Fixed, for any bug fixes.
- Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level.   Use this to briefly tell React Native users about notable changes.</details></i>

Danger: ⅹ Failing the build, there is 1 fail.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

Reviewed By: GijsWeterings

Differential Revision: D33941271

Pulled By: cortinico

fbshipit-source-id: 359c0076a160a8eeac897a2e1556d3e4d3db5e04
amgleitman pushed a commit to amgleitman/react-native-macos that referenced this pull request Apr 20, 2022
Summary:
Danger 7 -> 11

[Internal] [Changed] - Updates Danger used in PR checking from v7 to v11

Pull Request resolved: facebook#33027

Test Plan:
Works when testing locally

```
> DANGER_GITHUB_API_TOKEN=XXYYZZ yarn danger pr facebook#32955
yarn run v1.22.15
$ node ./node_modules/.bin/danger pr facebook#32955
Starting Danger PR on facebook#32955
 --- Accurate Error due to not being able to write to labels ---
`node` failed.
:clipboard: Missing Summary - <i>Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.</i>
-
:clipboard: Missing Test Plan - <i>Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.</i>
-
:clipboard: Missing Changelog - <i>Can you add a Changelog? To do so, add a "## Changelog" section to your PR description. A changelog entry has the following format: `[CATEGORY] [TYPE] - Message`.

<details>CATEGORY may be:

- General
- iOS
- Android
- JavaScript
- Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

- Added, for new features.
- Changed, for changes in existing functionality.
- Deprecated, for soon-to-be removed features.
- Removed, for now removed features.
- Fixed, for any bug fixes.
- Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level.   Use this to briefly tell React Native users about notable changes.</details></i>

Danger: ⅹ Failing the build, there is 1 fail.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

Reviewed By: GijsWeterings

Differential Revision: D33941271

Pulled By: cortinico

fbshipit-source-id: 359c0076a160a8eeac897a2e1556d3e4d3db5e04
shwanton pushed a commit to shwanton/react-native-macos that referenced this pull request Feb 13, 2023
Summary:
Danger 7 -> 11

## Changelog

[Internal] [Changed] - Updates Danger used in PR checking from v7 to v11

Pull Request resolved: facebook#33027

Test Plan:
Works when testing locally

```
> DANGER_GITHUB_API_TOKEN=XXYYZZ yarn danger pr facebook#32955
yarn run v1.22.15
$ node ./node_modules/.bin/danger pr facebook#32955
Starting Danger PR on facebook#32955
 --- Accurate Error due to not being able to write to labels ---

## Failures
`node` failed.
## Messages
:clipboard: Missing Summary - <i>Can you add a Summary? To do so, add a "## Summary" section to your PR description. This is a good place to explain the motivation for making this change.</i>
-
:clipboard: Missing Test Plan - <i>Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.</i>
-
:clipboard: Missing Changelog - <i>Can you add a Changelog? To do so, add a "## Changelog" section to your PR description. A changelog entry has the following format: `[CATEGORY] [TYPE] - Message`.

<details>CATEGORY may be:

- General
- iOS
- Android
- JavaScript
- Internal (for changes that do not need to be called out in the release notes)

TYPE may be:

- Added, for new features.
- Changed, for changes in existing functionality.
- Deprecated, for soon-to-be removed features.
- Removed, for now removed features.
- Fixed, for any bug fixes.
- Security, in case of vulnerabilities.

MESSAGE may answer "what and why" on a feature level.   Use this to briefly tell React Native users about notable changes.</details></i>
## Markdowns

Danger: ⅹ Failing the build, there is 1 fail.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

```

Reviewed By: GijsWeterings

Differential Revision: D33941271

Pulled By: cortinico

fbshipit-source-id: 359c0076a160a8eeac897a2e1556d3e4d3db5e04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants