Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename react-native package to @callstack/react-native-visionos #35

Merged
merged 9 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ module.exports = {
platforms: ['ios', 'android'],
},
moduleNameMapper: {
// These mappers allow out-of-tree platforms tests to seamlessly resolve RN imports
'^react-native/(.*)': '<rootDir>/packages/react-native/$1',
'^react-native$': '<rootDir>/packages/react-native/index.js',
// This module is internal to Meta and used by their custom React renderer.
// In tests, we can just use a mock.
'^ReactNativeInternalFeatureFlags$':
Expand Down
6 changes: 3 additions & 3 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "react-native",
"name": "@callstack/react-native-visionos",
"version": "1000.0.0",
"description": "A framework for building native apps using React",
"description": "React Native for visionOS",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react-native.git",
"url": "https://github.com/callstack/react-native-visionos.git",
"directory": "packages/react-native"
},
"homepage": "https://reactnative.dev/",
Expand Down
5 changes: 5 additions & 0 deletions packages/react-native/react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ module.exports = {
startCommand,
],
platforms: {
visionos: {
npmPackageName: '@callstack/react-native-visionos',
projectConfig: ios.projectConfig,
dependencyConfig: ios.dependencyConfig,
},
ios: {
projectConfig: ios.projectConfig,
dependencyConfig: ios.dependencyConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"react": "18.2.0",
"react-native": "1000.0.0"
"@callstack/react-native-visionos": "1000.0.0"
thymikee marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
27 changes: 15 additions & 12 deletions packages/react-native/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"jsx": "react",
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {"react-native": ["."]}
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"jsx": "react",
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"react-native": ["."],
"react-native/*": ["../*"]
}
}
}
4 changes: 2 additions & 2 deletions scripts/__tests__/publish-npm-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('publish-npm', () => {
'nightly',
);
expect(execMock.mock.calls[0][0]).toBe(
`npm view react-native@next version`,
`npm view @callstack/react-native-visionos@next version`,
);
expect(execMock.mock.calls[1][0]).toBe('npm publish --tag nightly');
expect(echoMock).toHaveBeenCalledWith(
Expand All @@ -126,7 +126,7 @@ describe('publish-npm', () => {
expect(removeNewArchFlags).not.toHaveBeenCalled();
expect(publishAndroidArtifactsToMavenMock).not.toBeCalled();
expect(execMock.mock.calls[0][0]).toBe(
`npm view react-native@next version`,
`npm view @callstack/react-native-visionos@next version`,
);
expect(consoleErrorMock).toHaveBeenCalledWith(
`Failed to set version number to ${expectedVersion}`,
Expand Down
6 changes: 3 additions & 3 deletions scripts/__tests__/set-rn-version-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('set-rn-version', () => {

expect(updateTemplatePackageMock).toHaveBeenCalledWith({
'@react-native/package-a': '0.81.0-nightly-29282302-abcd1234',
'react-native': version,
'@callstack/react-native-visionos': version,
});
});

Expand Down Expand Up @@ -131,7 +131,7 @@ describe('set-rn-version', () => {
);

expect(updateTemplatePackageMock).toHaveBeenCalledWith({
'react-native': version,
'@callstack/react-native-visionos': version,
});
});

Expand Down Expand Up @@ -195,7 +195,7 @@ describe('set-rn-version', () => {

expect(updateTemplatePackageMock).toHaveBeenCalledWith({
'@react-native/package-a': '0.0.0-prealpha-2023100415',
'react-native': version,
'@callstack/react-native-visionos': version,
});
});
});
2 changes: 1 addition & 1 deletion scripts/circle-ci-artifacts-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async function artifactURLForReactNative() {
.slice(0, 9);
return _findUrlForJob(
'build_npm_package',
`react-native-1000.0.0-${shortCommit}.tgz`,
`callstack-react-native-visionos-1000.0.0-${shortCommit}.tgz`,
);
}

Expand Down
5 changes: 4 additions & 1 deletion scripts/npm-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const {exec} = require('shelljs');

// Get `next` version from npm and +1 on the minor for `main` version
function getMainVersion() {
const versionStr = getPackageVersionStrByTag('react-native', 'next');
const versionStr = getPackageVersionStrByTag(
'@callstack/react-native-visionos',
'next',
);
const {major, minor} = parseVersion(versionStr, 'release');
return `${major}.${parseInt(minor, 10) + 1}.0`;
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-ci-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ try {

const REACT_NATIVE_PACKAGE = path.join(
REACT_NATIVE_PACKAGE_DIR,
'react-native-*.tgz',
'callstack-react-native-visionos-*.tgz',
);

describe('Set up Verdaccio');
Expand Down Expand Up @@ -133,7 +133,7 @@ try {
exitCode = 1;
throw Error(exitCode);
}
exec('rm -rf ./node_modules/react-native/template');
exec('rm -rf ./node_modules/@callstack/react-native-visionos/template');

if (argv.android) {
describe('Install end-to-end framework');
Expand Down
2 changes: 1 addition & 1 deletion scripts/set-rn-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function setReactNativeVersion(argVersion, dependencyVersions, buildType) {
setPackage(version, dependencyVersions);

const templateDependencyVersions = {
'react-native': version.version,
'@callstack/react-native-visionos': version.version,
...(dependencyVersions != null ? dependencyVersions : {}),
};
updateTemplatePackage(templateDependencyVersions);
Expand Down
17 changes: 8 additions & 9 deletions scripts/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
* and to make it more accessible for other devs to play around with.
*/

const {exec, pushd, popd, pwd, cd, sed} = require('shelljs');
const updateTemplatePackage = require('./update-template-package');
const yargs = require('yargs');
const path = require('path');

const {
checkPackagerRunning,
maybeLaunchAndroidEmulator,
launchPackagerInSeparateWindow,
setupCircleCIArtifacts,
maybeLaunchAndroidEmulator,
prepareArtifacts,
setupCircleCIArtifacts,
} = require('./testing-utils');
const updateTemplatePackage = require('./update-template-package');
const path = require('path');
const {cd, exec, popd, pushd, pwd, sed} = require('shelljs');
const yargs = require('yargs');

const argv = yargs
.option('t', {
Expand Down Expand Up @@ -197,7 +196,7 @@ async function testRNTestProject(circleCIArtifacts) {
// Prepare some variables for later use
const repoRoot = pwd();
const reactNativePackagePath = `${repoRoot}/packages/react-native`;
const localNodeTGZPath = `${reactNativePackagePath}/react-native-${releaseVersion}.tgz`;
const localNodeTGZPath = `${reactNativePackagePath}/callstack-react-native-visionos-${releaseVersion}.tgz`;

const mavenLocalPath =
circleCIArtifacts != null
Expand All @@ -214,7 +213,7 @@ async function testRNTestProject(circleCIArtifacts) {
);

updateTemplatePackage({
'react-native': `file://${localNodeTGZPath}`,
'@callstack/react-native-visionos': `file://${localNodeTGZPath}`,
});

pushd('/tmp/');
Expand Down