Skip to content

Commit b4fec97

Browse files
authored
ci: fix nx release not updating our lock file (#2602)
## Summary: In our version action, we overrode `afterAllProjectsVersioned` without calling the base one. The base one updated our Yarn lock. Let's make sure to call the base one.
1 parent 1340454 commit b4fec97

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/nx-release-version/index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-check
22

33
const {REPO_ROOT} = require('../../scripts/consts');
4-
const JsVersionActions = require('@nx/js/src/release/version-actions').default;
4+
const {default: JsVersionActions, afterAllProjectsVersioned: baseAfterAllProjectsVersioned} = require('@nx/js/src/release/version-actions');
55
const fs = require('node:fs');
66
const path = require('node:path');
77

@@ -69,12 +69,15 @@ async function runSetVersion() {
6969
/**
7070
* Custom afterAllProjectsVersioned hook for React Native macOS
7171
* Updates React Native artifacts after all projects have been versioned
72-
* @param {string} _cwd - Current working directory (unused)
73-
* @param {object} _opts - Options object containing versioning information (unused)
72+
* @param {string} cwd - Current working directory
73+
* @param {object} opts - Options object containing versioning information
7474
* @returns {Promise<{changedFiles: string[], deletedFiles: string[]}>}
7575
*/
76-
const afterAllProjectsVersioned = async (_cwd, _opts) => {
77-
const changedFiles = [];
76+
const afterAllProjectsVersioned = async (cwd, opts) => {
77+
const baseResult = await baseAfterAllProjectsVersioned(cwd, opts);
78+
79+
const changedFiles = [...baseResult.changedFiles];
80+
const deletedFiles = [...baseResult.deletedFiles];
7881

7982
try {
8083
// Create the .rnm-publish file to indicate versioning has occurred
@@ -83,7 +86,7 @@ const afterAllProjectsVersioned = async (_cwd, _opts) => {
8386
// Update React Native artifacts
8487
const versionedFiles = await runSetVersion();
8588

86-
// Return the versioned files so Nx can track them
89+
// Add the versioned files to changed files
8790
changedFiles.push(...versionedFiles);
8891

8992
console.log('✅ Updated React Native artifacts');
@@ -96,7 +99,7 @@ const afterAllProjectsVersioned = async (_cwd, _opts) => {
9699

97100
return {
98101
changedFiles,
99-
deletedFiles: [],
102+
deletedFiles,
100103
};
101104
};
102105

0 commit comments

Comments
 (0)