Skip to content

Commit 3b9ad93

Browse files
authored
Merge branch 'main' into wmaj/nanospinner
2 parents f615e11 + d20b58c commit 3b9ad93

67 files changed

Lines changed: 282 additions & 254 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ React Native CLI comes with following commands:
2626
Usage (with `npx`):
2727

2828
```sh
29-
npx react-native@latest init <projectName> [options]
29+
npx @react-native-community/cli@latest init <projectName> [options]
3030
```
3131

3232
Initialize a new React Native project named <projectName> in a directory of the same name. You can find out more use cases in [init docs](./init.md).

docs/init.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
There are couple of ways to initialize new React Native projects.
44

55
```sh
6-
npx react-native-community/cli@latest init ProjectName
6+
npx @react-native-community/cli@latest init ProjectName
77
```
88

99
> Note: If you have both `yarn` and `npm` installed on your machine, React Native CLI will always try to use `npm`. You can force usage of `yarn` by adding `--pm yarn` flag to the command.
@@ -20,7 +20,7 @@ yarn init && yarn add react-native && yarn react-native init ProjectName
2020

2121
```sh
2222
# This will use the latest init command but will install react-native@VERSION and use its template
23-
npx react-native-community/cli@latest init ProjectName --version ${VERSION}
23+
npx @react-native-community/cli@latest init ProjectName --version ${VERSION}
2424

2525
# This will use init command from react-native@VERSION through react-native-community/cli@${VERSION} (e.g. X.XX.X) automatically
2626
npx react-native-community/cli@${VERSION} init ProjectName
@@ -43,7 +43,7 @@ For all available options, please check [Yarn documentation](https://classic.yar
4343

4444
```sh
4545
# This will initialize new project using template from `react-native-template-typescript` package
46-
npx react-native-community/cli@latest init ProjectName --template ${TEMPLATE_NAME}
46+
npx @react-native-community/cli@latest init ProjectName --template ${TEMPLATE_NAME}
4747

4848
# This will initialize new project using init command from react-native@VERSION but will use a custom template
4949
npx react-native-community/cli@${VERSION} init ProjectName --template ${TEMPLATE_NAME}
@@ -52,7 +52,7 @@ npx react-native-community/cli@${VERSION} init ProjectName --template ${TEMPLATE
5252
You can force usage of `yarn` if you have both `yarn` and `npm` installed on your machine:
5353

5454
```sh
55-
npx react-native-community/cli@latest init ProjectName --pm yarn
55+
npx @react-native-community/cli@latest init ProjectName --pm yarn
5656
```
5757

5858
## Creating custom template

jest/helpers.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import os from 'os';
33
import path from 'path';
44
import {createDirectory} from 'jest-util';
55
import execa from 'execa';
6-
import chalk from 'chalk';
6+
import pico from 'picocolors';
77
import slash from 'slash';
88

99
const CLI_PATH = path.resolve(__dirname, '../packages/cli/build/bin.js');
@@ -121,7 +121,7 @@ function getExecaOptions(options: SpawnOptions) {
121121

122122
const cwd = isRelative ? path.resolve(__dirname, options.cwd) : options.cwd;
123123

124-
let env = Object.assign({}, process.env, {FORCE_COLOR: '0'}, options.env);
124+
let env = Object.assign({}, process.env, {NO_COLOR: 1}, options.env);
125125

126126
if (options.nodeOptions) {
127127
env.NODE_OPTIONS = options.nodeOptions;
@@ -147,12 +147,12 @@ function handleTestFailure(
147147
) {
148148
if (!options.expectedFailure && result.exitCode !== 0) {
149149
console.log(`Running ${cmd} command failed for unexpected reason. Here's more info:
150-
${chalk.bold('cmd:')} ${cmd}
151-
${chalk.bold('options:')} ${JSON.stringify(options)}
152-
${chalk.bold('args:')} ${(args || []).join(' ')}
153-
${chalk.bold('stderr:')} ${result.stderr}
154-
${chalk.bold('stdout:')} ${result.stdout}
155-
${chalk.bold('exitCode:')}${result.exitCode}`);
150+
${pico.bold('cmd:')} ${cmd}
151+
${pico.bold('options:')} ${JSON.stringify(options)}
152+
${pico.bold('args:')} ${(args || []).join(' ')}
153+
${pico.bold('stderr:')} ${result.stderr}
154+
${pico.bold('stdout:')} ${result.stdout}
155+
${pico.bold('exitCode:')}${result.exitCode}`);
156156
} else if (options.expectedFailure && result.exitCode === 0) {
157157
throw new Error("Expected command to fail, but it didn't");
158158
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"@types/node": "^20.0.0",
3434
"babel-jest": "^26.6.2",
3535
"babel-plugin-module-resolver": "^3.2.0",
36-
"chalk": "^4.1.2",
3736
"chokidar": "^3.3.1",
3837
"eslint": "^8.23.1",
3938
"eslint-import-resolver-alias": "^1.1.2",
@@ -50,6 +49,7 @@
5049
"lint-staged": "^13.1.0",
5150
"metro-memory-fs": "0.78.0",
5251
"micromatch": "^4.0.4",
52+
"picocolors": "^1.1.1",
5353
"prettier": "2.8.8",
5454
"slash": "^3.0.0",
5555
"string-length": "^2.0.0",

packages/cli-clean/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"types": "build/index.d.ts",
1010
"dependencies": {
1111
"@react-native-community/cli-tools": "20.0.2",
12-
"chalk": "^4.1.2",
1312
"execa": "^5.0.0",
14-
"fast-glob": "^3.3.2"
13+
"fast-glob": "^3.3.2",
14+
"picocolors": "^1.1.1"
1515
},
1616
"files": [
1717
"build",

packages/cli-clean/src/clean.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {getLoader, logger, prompt} from '@react-native-community/cli-tools';
22
import type {Config as CLIConfig} from '@react-native-community/cli-types';
3-
import chalk from 'chalk';
3+
import pico from 'picocolors';
44
import execa from 'execa';
55
import {existsSync as fileExists, rm} from 'fs';
66
import os from 'os';
@@ -62,7 +62,7 @@ async function promptForCaches(
6262
name: 'caches',
6363
message: 'Select all caches to clean',
6464
choices: Object.entries(groups).map(([cmd, group]) => ({
65-
title: `${cmd} ${chalk.dim(`(${group.description})`)}`,
65+
title: `${cmd} ${pico.dim(`(${group.description})`)}`,
6666
value: cmd,
6767
selected: DEFAULT_GROUPS.includes(cmd),
6868
})),

packages/cli-config-android/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
},
99
"dependencies": {
1010
"@react-native-community/cli-tools": "20.0.2",
11-
"chalk": "^4.1.2",
1211
"fast-glob": "^3.3.2",
13-
"fast-xml-parser": "^4.4.1"
12+
"fast-xml-parser": "^4.4.1",
13+
"picocolors": "^1.1.1"
1414
},
1515
"files": [
1616
"build",

packages/cli-config-android/src/config/findComponentDescriptors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export function findComponentDescriptors(packageRoot: string) {
1616
// no jsSrcsDir, continue with default glob pattern
1717
}
1818
const globPattern = jsSrcsDir
19-
? `${jsSrcsDir}/**/+(*.js|*.jsx|*.ts|*.tsx)`
20-
: '**/+(*.js|*.jsx|*.ts|*.tsx)';
19+
? `${jsSrcsDir}/**/*{.js,.jsx,.ts,.tsx}`
20+
: '**/*{.js,.jsx,.ts,.tsx}';
2121
const files = glob.sync(globPattern, {
2222
cwd: unixifyPaths(packageRoot),
2323
onlyFiles: true,

packages/cli-config-android/src/config/findPackageClassName.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ export function getMainActivityFiles(
1818
let patternArray = [];
1919

2020
if (includePackage) {
21-
patternArray.push('*Package.java', '*Package.kt');
21+
patternArray.push('Package.java', 'Package.kt');
2222
} else {
23-
patternArray.push('*.java', '*.kt');
23+
patternArray.push('.java', '.kt');
2424
}
2525

26-
return glob.sync(`**/+(${patternArray.join('|')})`, {
26+
return glob.sync(`**/*{${patternArray.join(',')}}`, {
2727
cwd: unixifyPaths(folder),
2828
onlyFiles: true,
2929
ignore: ['**/.cxx/**'],

packages/cli-config-android/src/config/getAndroidProject.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Config} from '@react-native-community/cli-types';
22
import {logger, CLIError} from '@react-native-community/cli-tools';
33
import fs from 'fs';
4-
import chalk from 'chalk';
4+
import pico from 'picocolors';
55

66
export function getAndroidProject(config: Config) {
77
const androidProject = config.project.android;
@@ -48,11 +48,11 @@ function discoverPackageName(
4848

4949
throw new CLIError(
5050
`Failed to build the app: No package name found.
51-
We couldn't parse the namespace from neither your build.gradle[.kts] file at ${chalk.underline.dim(
52-
`${buildGradlePath}`,
51+
We couldn't parse the namespace from neither your build.gradle[.kts] file at ${pico.underline(
52+
pico.dim(`${buildGradlePath}`),
5353
)}
54-
nor your package in the AndroidManifest at ${chalk.underline.dim(
55-
`${manifestPath}`,
54+
nor your package in the AndroidManifest at ${pico.underline(
55+
pico.dim(`${manifestPath}`),
5656
)}
5757
`,
5858
);
@@ -70,10 +70,10 @@ export function getPackageName(
7070
let packageName = discoverPackageName(manifestPath, buildGradlePath);
7171
if (!validatePackageName(packageName)) {
7272
logger.warn(
73-
`Invalid application's package name "${chalk.bgRed(
73+
`Invalid application's package name "${pico.bgRed(
7474
packageName,
75-
)}" in either 'AndroidManifest.xml' or 'build.gradle'. Read guidelines for setting the package name here: ${chalk.underline.dim(
76-
'https://developer.android.com/studio/build/application-id',
75+
)}" in either 'AndroidManifest.xml' or 'build.gradle'. Read guidelines for setting the package name here: ${pico.underline(
76+
pico.dim('https://developer.android.com/studio/build/application-id'),
7777
)}`,
7878
);
7979
}

0 commit comments

Comments
 (0)