Skip to content

Commit afe41c0

Browse files
Dedupe node & pnpm versions; bump pnpm to 10.33.1
Address feedback: make package.json the single source of truth for node and pnpm versions where possible, and bump pnpm to the latest release. - package.json: bump `packageManager` to `pnpm@10.33.1` (pinned with the upstream sha512 integrity hash so corepack/pnpm verify the binary). - package.json: tighten `engines.node` from `>=22` to `22.14.0` so dev's built-in node-version validator catches any drift against dev.yml on every `dev up`. - dev.yml: bump to `package_manager: pnpm@10.33.1` and add a comment noting the versions must stay in lockstep with package.json. - .github/actions/setup: read node from `engines.node` via `node-version-file: package.json`, and let `pnpm/action-setup` read the version from the `packageManager` field (drop the hardcoded `version: 10.28.0` and `node-version: 22.22.1`). dev.yml itself is plain YAML (no ERB/interpolation) and the node task requires an explicit `version:` + `package_manager:`, so full deduplication into a single literal isn't supported upstream. Every other pnpm-using zone in World mirrors the value. The setup we have here — package.json as SoT, dev's validator as the enforcer, CI reading directly from package.json — is the closest equivalent. Requested by Kieran Osgood <kieran.osgood@shopify.com>
1 parent 129488b commit afe41c0

10 files changed

Lines changed: 164 additions & 68 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ description: Setup Node.js and install dependencies
44
runs:
55
using: composite
66
steps:
7+
# Versions are sourced from package.json:
8+
# - pnpm: `packageManager` field (read by pnpm/action-setup)
9+
# - node: `engines.node` field (read by setup-node via node-version-file)
10+
# Keep package.json as the single source of truth.
711
- name: Install pnpm
812
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
9-
with:
10-
version: 10.28.0
1113

1214
- name: Setup Node.js
1315
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
1416
with:
15-
node-version: 22.22.1
17+
node-version-file: package.json
1618
registry-url: 'https://registry.npmjs.org'
1719
cache: pnpm
1820

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
uses: ./.github/actions/setup
3333

3434
- run: |
35-
yarn module clean
36-
yarn module build
37-
yarn compare-snapshot
35+
pnpm module clean
36+
pnpm module build
37+
pnpm compare-snapshot
3838
3939
lint:
4040
name: Lint module + sample
@@ -52,9 +52,9 @@ jobs:
5252
uses: ./.github/actions/setup
5353

5454
- run: |
55-
yarn module build
56-
yarn module lint
57-
yarn sample lint
55+
pnpm module build
56+
pnpm module lint
57+
pnpm sample lint
5858
5959
test:
6060
name: Run jest tests
@@ -70,7 +70,7 @@ jobs:
7070
uses: ./.github/actions/setup
7171

7272
- run:
73-
yarn test --coverage
73+
pnpm test --coverage
7474
--testPathPatterns="modules/@shopify/checkout-sheet-kit/tests"
7575
--coverageReporters=json-summary
7676

@@ -111,8 +111,8 @@ jobs:
111111
java -version
112112
javac -version
113113
echo "STOREFRONT_DOMAIN=myshopify.com" > sample/.env
114-
yarn module build
115-
yarn sample test:android --no-daemon
114+
pnpm module build
115+
pnpm sample test:android --no-daemon
116116
117117
test-ios:
118118
name: Run Swift Tests
@@ -138,4 +138,4 @@ jobs:
138138

139139
- name: Run Swift tests
140140
run: |
141-
yarn sample test:ios
141+
pnpm sample test:ios

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
- name: Prepare release
3939
run: |
4040
cp README.md modules/@shopify/checkout-sheet-kit
41-
yarn module clean
42-
yarn module build
41+
pnpm module clean
42+
pnpm module build
4343
cd modules/@shopify/checkout-sheet-kit
4444
npm publish --access public --tag ${{ steps.npm-tag.outputs.tag }}
4545
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ upload-keystore.jks
4242
# node.js
4343
#
4444
node_modules/
45+
.yarn/
4546
npm-debug.log
4647
yarn-error.log
4748
pnpm-debug.log

dev.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,18 @@ up:
1515
ios:
1616
- version: 23C54 # 26.2
1717
architecture_variant: arm64
18+
# Node / pnpm versions are mirrored from package.json (engines.node,
19+
# packageManager). dev validates engines.node matches the version below on
20+
# every `dev up`, so drift is caught automatically. If you bump one, bump
21+
# both.
1822
- node:
1923
version: v22.14.0
20-
package_manager: pnpm@10.28.0
24+
package_manager: pnpm@10.33.1
25+
- custom:
26+
name: Remove stale Yarn artifacts
27+
met?: test ! -d .yarn
28+
meet: |
29+
rm -rf .yarn
2130
- custom:
2231
name: Install NPM dependencies
2332
met?: ls -l | grep node_modules

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "https://github.com/Shopify/checkout-sheet-kit-react-native/issues"
1111
},
1212
"homepage": "https://github.com/Shopify/checkout-sheet-kit-react-native",
13-
"packageManager": "pnpm@10.28.0",
13+
"packageManager": "pnpm@10.33.1+sha512.05ba3c1d5d1c18f68df06470d74055e62d41fc110a0c660db1b2dfb2785327f04cf0f68345d4609bc52089e7fa0343c31593b2f9594e2c5d5da426230acc9820",
1414
"pnpm": {
1515
"onlyBuiltDependencies": [
1616
"unrs-resolver"
@@ -58,7 +58,7 @@
5858
"typescript": "^5.9.2"
5959
},
6060
"engines": {
61-
"node": ">=22"
61+
"node": "22.14.0"
6262
},
6363
"prettier": {
6464
"arrowParens": "avoid",

sample/android/app/build.gradle

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,27 @@ apply plugin: "com.android.application"
22
apply plugin: "org.jetbrains.kotlin.android"
33
apply plugin: "com.facebook.react"
44

5-
project.ext["REACT_NATIVE_NODE_MODULES_DIR"] = file("../../../node_modules/react-native")
5+
def resolveNodeModuleDir(String packageName) {
6+
def output = new ByteArrayOutputStream()
7+
def workspaceRoot = new File(rootProject.projectDir, "../..").canonicalFile
8+
exec {
9+
commandLine(
10+
"node",
11+
"--print",
12+
"require.resolve('${packageName}/package.json', { paths: [process.argv[1], process.argv[2]] })",
13+
workspaceRoot.getAbsolutePath(),
14+
rootProject.projectDir.getAbsolutePath()
15+
)
16+
standardOutput = output
17+
}
18+
return file(output.toString().trim()).parentFile
19+
}
20+
21+
def reactNativeDirPath = resolveNodeModuleDir("react-native")
22+
def reactNativeCodegenDirPath = resolveNodeModuleDir("@react-native/codegen")
23+
def vectorIconsDirPath = resolveNodeModuleDir("react-native-vector-icons")
24+
25+
project.ext["REACT_NATIVE_NODE_MODULES_DIR"] = reactNativeDirPath
626

727
/**
828
* This is the configuration block to customize your React Native Android app.
@@ -13,11 +33,11 @@ react {
1333
// The root of your project, i.e. where "package.json" lives. Default is '..'
1434
root = file("../../")
1535
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
16-
reactNativeDir = file("../../../node_modules/react-native")
36+
reactNativeDir = reactNativeDirPath
1737
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
18-
codegenDir = file("../../../node_modules/@react-native/codegen")
38+
codegenDir = reactNativeCodegenDirPath
1939
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
20-
cliFile = file("../../node_modules/react-native/cli.js")
40+
cliFile = new File(reactNativeDirPath, "cli.js")
2141

2242
/* Variants */
2343
// The list of variants to that are debuggable. For those we're going to
@@ -47,7 +67,7 @@ react {
4767

4868
/* Hermes Commands */
4969
// The hermes compiler command to run. By default it is 'hermesc'
50-
hermesCommand = "../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
70+
hermesCommand = new File(reactNativeDirPath, "sdks/hermesc/%OS-BIN%/hermesc").getAbsolutePath()
5171
//
5272
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5373
hermesFlags = ["-O", "-output-source-map"]
@@ -158,7 +178,7 @@ project.ext.vectoricons = [
158178
iconFontNames: [ 'Entypo.ttf' ]
159179
]
160180

161-
apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
181+
apply from: new File(vectorIconsDirPath, "fonts.gradle")
162182

163183
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
164184

sample/android/settings.gradle

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
pluginManagement { includeBuild("../../node_modules/@react-native/gradle-plugin") }
22
plugins { id("com.facebook.react.settings") }
3-
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
3+
extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
4+
ex.autolinkLibrariesFromCommand(
5+
["pnpm", "exec", "react-native", "config"],
6+
file(".."),
7+
files("../package.json", "../react-native.config.js", "../../package.json", "../../pnpm-lock.yaml")
8+
)
9+
}
410

511
rootProject.name = 'ReactNative'
612

@@ -9,4 +15,22 @@ include ':react-native-config'
915

1016
includeBuild('../../node_modules/@react-native/gradle-plugin')
1117

12-
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
18+
def resolveNodeModuleDir(String packageName) {
19+
def workspaceRoot = new File(rootProject.projectDir, "../..").canonicalFile
20+
def process = [
21+
"node",
22+
"--print",
23+
"require.resolve('${packageName}/package.json', { paths: [process.argv[1], process.argv[2]] })",
24+
workspaceRoot.getAbsolutePath(),
25+
rootProject.projectDir.getAbsolutePath()
26+
].execute(null, rootProject.projectDir)
27+
def output = new StringBuffer()
28+
def error = new StringBuffer()
29+
process.consumeProcessOutput(output, error)
30+
if (process.waitFor() != 0) {
31+
throw new GradleException("Failed to resolve ${packageName}: ${error}")
32+
}
33+
return new File(output.toString().trim()).parentFile
34+
}
35+
36+
project(':react-native-config').projectDir = new File(resolveNodeModuleDir('react-native-config'), 'android')

0 commit comments

Comments
 (0)