Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @format
*/
// @noflow
'use strict';

/**
* @typedef {{
Expand Down Expand Up @@ -35,11 +34,12 @@
* }} ProjectConfig
*/

const child_process = require('node:child_process');
const path = require('node:path');
import child_process from 'node:child_process';
import path from 'node:path';
import {createRequire} from 'node:module';
import {WriteStream} from 'node:tty';

const colors = (() => {
const {WriteStream} = require('node:tty');
if (WriteStream.prototype.hasColors() &&
!process.env.NODE_TEST_CONTEXT &&
process.env.NODE_ENV !== 'test'
Expand All @@ -54,11 +54,13 @@ const colors = (() => {
return { bold: passthrough, dim: passthrough };
})();

const {logger, CLIError, getDefaultUserTerminal} = ((projectRoot = process.cwd()) => {
const {logger, CLIError, getDefaultUserTerminal} = await (async (projectRoot = process.cwd()) => {
const require = createRequire(import.meta.url);
const cli = require.resolve('@react-native-community/cli/package.json', {paths: [projectRoot]});
const options = {paths: [path.dirname(cli)]};
const tools = require.resolve('@react-native-community/cli-tools', options);
return require(tools);
const module = await import(tools);
return module.default || module;
})();

/**
Expand Down Expand Up @@ -351,7 +353,7 @@ const commonOptions = [
},
];

module.exports = [
export const macosCommands = [
{
name: 'build-macos',
description: 'builds your app',
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ try {
}

// $FlowFixMe[untyped-import]
const macosCommands = require('./local-cli/runMacOS/runMacOS');
const {macosCommands} = require('./local-cli/runMacOS/runMacOS.mjs');
const {
bundleCommand,
startCommand,
Expand Down
Loading