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 31, 2024
1 parent 12c9b63 commit 4d3c793
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 319 deletions.
4 changes: 3 additions & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
"!template/package-lock.json",
"!template/yarn.lock",
"third-party-podspecs",
"types"
"types",
"visionos_modules",
"local-cli/localCommands.js"
],
"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
Loading

0 comments on commit 4d3c793

Please sign in to comment.