diff --git a/packages/out-of-tree-platforms/.gitignore b/packages/out-of-tree-platforms/.gitignore new file mode 100644 index 00000000000000..ac0720f94136cd --- /dev/null +++ b/packages/out-of-tree-platforms/.gitignore @@ -0,0 +1,2 @@ +# Build output +/dist \ No newline at end of file diff --git a/packages/out-of-tree-platforms/index.js.flow b/packages/out-of-tree-platforms/index.js.flow new file mode 100644 index 00000000000000..8420b1093fdb2f --- /dev/null +++ b/packages/out-of-tree-platforms/index.js.flow @@ -0,0 +1 @@ +export * from './src'; diff --git a/packages/out-of-tree-platforms/package.json b/packages/out-of-tree-platforms/package.json index 3a1d042fdcdafe..648226808be25f 100644 --- a/packages/out-of-tree-platforms/package.json +++ b/packages/out-of-tree-platforms/package.json @@ -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" } } diff --git a/packages/out-of-tree-platforms/index.js b/packages/out-of-tree-platforms/src/index.js similarity index 92% rename from packages/out-of-tree-platforms/index.js rename to packages/out-of-tree-platforms/src/index.js index d095bafc534da6..a88b678821283b 100644 --- a/packages/out-of-tree-platforms/index.js +++ b/packages/out-of-tree-platforms/src/index.js @@ -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 @@ -42,5 +42,3 @@ const getPlatformResolver = (config: ResolverConfig): CustomResolver => { return context.resolveRequest(context, modifiedModuleName, platform); }; }; - -module.exports = {getPlatformResolver}; diff --git a/scripts/build/config.js b/scripts/build/config.js index 676fffb5c74b46..37af67b22d50bf 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -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, diff --git a/scripts/e2e/verdaccio.yml b/scripts/e2e/verdaccio.yml index 46e6710856a977..615f7344a80564 100644 --- a/scripts/e2e/verdaccio.yml +++ b/scripts/e2e/verdaccio.yml @@ -19,6 +19,10 @@ packages: '@react-native/*': access: $all publish: $all + proxy: npmjs + '@callstack/*': + access: $all + publish: $all '@*/*': access: $all publish: $authenticated diff --git a/scripts/oot-release.js b/scripts/oot-release.js index 21e281e78b148e..febf91e07b35d3 100644 --- a/scripts/oot-release.js +++ b/scripts/oot-release.js @@ -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. @@ -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;