Skip to content

Commit

Permalink
fix: update oot-release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Jul 29, 2024
1 parent 26ac277 commit d296722
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
3 changes: 2 additions & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"!template/package-lock.json",
"!template/yarn.lock",
"third-party-podspecs",
"types"
"types",
"visionos_modules"
],
"scripts": {
"prepack": "node ./scripts/prepack.js",
Expand Down
46 changes: 32 additions & 14 deletions scripts/oot-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

const forEachPackage = require('./monorepo/for-each-package');
const newGithubReleaseUrl = require('./new-github-release-url');
const {applyPackageVersions, publishPackage} = require('./npm-utils');
const updateTemplatePackage = require('./releases/update-template-package');
const {publishPackage} = require('./npm-utils');
const {execSync} = require('child_process');
const fs = require('fs');
const path = require('path');
Expand All @@ -18,6 +17,37 @@ const yargs = require('yargs');

const REPO_ROOT = path.resolve(__dirname, '../');


/**
* `package` is an object form of package.json
* `dependencies` is a map of dependency to version string
*
* This replaces both dependencies and devDependencies in package.json
*/
function applyPackageVersions(
originalPackageJson /*: PackageJSON */,
packageVersions /*: {[string]: string} */,
) /*: PackageJSON */ {
const packageJson = {...originalPackageJson};

for (const name of Object.keys(packageVersions)) {
if (
packageJson.dependencies != null &&
packageJson.dependencies[name] != null
) {
packageJson.dependencies[name] = packageVersions[name];
}

if (
packageJson.devDependencies != null &&
packageJson.devDependencies[name] != null
) {
packageJson.devDependencies[name] = packageVersions[name];
}
}
return packageJson;
}

/**
* This script updates core packages to the version of React Native that we are basing on,
* updates internal visionOS packages and releases them.
Expand Down Expand Up @@ -126,18 +156,6 @@ function releaseOOT(
});
}

// Update template package.json
updateTemplatePackage({
'react-native': reactNativeVersion,
...visionOSPackagesVersions,
});

if (isNightly) {
updateTemplatePackage(corePackagesVersions);
}

echo(`Updating template and it's dependencies to ${reactNativeVersion}`);

echo('Building packages...\n');
execSync('node ./scripts/build/build.js', {
cwd: REPO_ROOT,
Expand Down

0 comments on commit d296722

Please sign in to comment.