Skip to content

Commit

Permalink
Fix build step for @callstack/out-of-tree-platforms (#46)
Browse files Browse the repository at this point in the history
* feat: setup @callstack/out-of-tree-platforms to build properly

* feat: add build packages step to `oot-release.js` script

* chore: format package.json
  • Loading branch information
okwasniewski committed Feb 2, 2024
1 parent cf4af38 commit 5135230
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .circleci/verdaccio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ packages:
'@react-native/*':
access: $all
publish: $all
proxy: npmjs
'@callstack/*':
access: $all
publish: $all
'@*/*':
access: $all
publish: $authenticated
Expand Down
2 changes: 2 additions & 0 deletions packages/out-of-tree-platforms/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Build output
/dist
1 change: 1 addition & 0 deletions packages/out-of-tree-platforms/index.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src';
23 changes: 13 additions & 10 deletions packages/out-of-tree-platforms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@
"name": "@callstack/out-of-tree-platforms",
"version": "0.74.0",
"description": "Utils for React Native out of tree platforms.",
"license": "MIT",
"keywords": ["out-of-tree", "react-native"],
"homepage": "https://github.com/callstack/react-native-visionos/tree/HEAD/packages/out-of-tree-platforms#readme",
"bugs": "https://github.com/callstack/react-native-visionos/issues",
"repository": {
"type": "git",
"url": "https://github.com/callstack/react-native-visionos.git",
"directory": "packages/out-of-tree-platforms"
},
"homepage": "https://github.com/callstack/react-native-visionos/tree/HEAD/packages/out-of-tree-platforms#readme",
"keywords": [
"out-of-tree",
"react-native"
"license": "MIT",
"exports": {
".": "./dist/index.js",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"bugs": "https://github.com/facebook/react-native/issues",
"devDependencies": {
"metro-resolver": "^0.80.0"
},
"engines": {
"node": ">=18"
},
"exports": "./index.js",
"devDependencies": {
"metro-resolver": "^0.80.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type ResolverConfig = {
* Creates a custom Metro resolver that maps platform extensions to package names.
* To be used in app's `metro.config.js` as `resolver.resolveRequest`.
*/
const getPlatformResolver = (config: ResolverConfig): CustomResolver => {
export const getPlatformResolver = (config: ResolverConfig): CustomResolver => {
return (context, moduleName, platform) => {
// `customResolverOptions` is populated through `?resolver.platformExtension` query params
// in the jsBundleURLForBundleRoot method of the react-native/React/Base/RCTBundleURLProvider.mm
Expand All @@ -42,5 +42,3 @@ const getPlatformResolver = (config: ResolverConfig): CustomResolver => {
return context.resolveRequest(context, modifiedModuleName, platform);
};
};

module.exports = {getPlatformResolver};
4 changes: 4 additions & 0 deletions scripts/build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const buildConfig /*: BuildConfig */ = {
'community-cli-plugin': {
target: 'node',
},
'out-of-tree-platforms': {
target: 'node',
emitTypeScriptDefs: true,
},
'dev-middleware': {
target: 'node',
emitTypeScriptDefs: true,
Expand Down
9 changes: 9 additions & 0 deletions scripts/oot-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
const forEachPackage = require('./monorepo/for-each-package');
const {applyPackageVersions, publishPackage} = require('./npm-utils');
const updateTemplatePackage = require('./update-template-package');
const {execSync} = require('child_process');
const fs = require('fs');
const path = require('path');
const {cat, echo, exit} = require('shelljs');
const yargs = require('yargs');

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

/**
* 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 @@ -116,6 +119,12 @@ function releaseOOT(
});
echo(`Updating template and it's dependencies to ${reactNativeVersion}`);

echo('Building packages...\n');
execSync('node ./scripts/build/build.js', {
cwd: REPO_ROOT,
stdio: [process.stdin, process.stdout, process.stderr],
});

// Release visionOS packages only if OTP is passed
if (!oneTimePassword) {
return;
Expand Down

0 comments on commit 5135230

Please sign in to comment.