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

Stop warning on every call to init #1

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
55bda44
feat: check npm and github for template (#2334)
blakef Apr 12, 2024
92d2862
fix: downgrade `ws` package (#2355)
szymonrybczak Apr 17, 2024
2514405
Fixed cannot start Android emulator version 34.1.20.0 (#2358)
hasunpark Apr 18, 2024
be880b8
v14.0.0-alpha.3
thymikee Apr 18, 2024
8efbf2c
fix(init): bump Yarn version on older Yarn versions (#2367)
szymonrybczak Apr 25, 2024
73f880c
v14.0.0-alpha.4
thymikee Apr 25, 2024
87881ef
fix(e2e): sync with React Native 0.74 (#2376)
szymonrybczak May 8, 2024
0b5f93d
chore: change `react-native` executable path key to `rnccli` (#2374)
szymonrybczak May 9, 2024
0bcdb73
v14.0.0-alpha.5
thymikee May 9, 2024
21a82d4
ci: skip windows e2e tests in specific scenario (#2386)
szymonrybczak May 12, 2024
1fbbbc8
chore: upgrade deasync to unblock CI (#2405)
szymonrybczak Jun 3, 2024
264d7dd
chore: remove `@react-native-community/cli` from `bin` entrypoints (#…
szymonrybczak Jun 3, 2024
b787c89
perf(autolinking): get platform's specific properties (#2379)
szymonrybczak Jun 3, 2024
5933018
build(deps): bump semver from 7.5.2 to 7.5.3 (#2399)
dependabot[bot] Jun 3, 2024
35ffa2e
chore: upgrade parcel to v2 (#2385)
jbroma Jun 4, 2024
af5858a
fix: correct derivation of fully specified android launch activities …
mikehardy Jun 4, 2024
bf24b50
build(deps): bump jsdom from 16.4.0 to 16.7.0 (#2408)
dependabot[bot] Jun 4, 2024
a492e01
build(deps): bump ansi-regex from 3.0.0 to 3.0.1 (#2407)
dependabot[bot] Jun 4, 2024
c500a51
Revert "ci: skip windows e2e tests in specific scenario (#2386)" (#2406)
szymonrybczak Jun 4, 2024
017a62b
build(deps): bump ejs from 3.1.9 to 3.1.10 (#2370)
dependabot[bot] Jun 4, 2024
efd6bd4
chore(run-android): deprecate `--deviceId` in favour of `--device` (#…
szymonrybczak Jun 5, 2024
7f2a028
The *diff link* at update check shows both the old and new versions (…
coder-xiaomo Jun 5, 2024
ad237ed
fix(ios): prioritize simulators over devices (#2364)
szymonrybczak Jun 5, 2024
9c813dc
fix: allow debugger to connect with custom hosts (#2404)
Jesse-Cameron Jun 5, 2024
1754348
perf(autolinking)!: prioritise files with `*Package.java|*Package.kt`…
szymonrybczak Jun 7, 2024
039f684
feat: use native fetch from node (#2381)
jbroma Jun 7, 2024
8944aba
feat(run-ios): allow passing UDID inside `--device` option (#2375)
szymonrybczak Jun 7, 2024
0db44d0
docs: Remove ram-bundle from README (#2411)
DrRefactor Jun 17, 2024
37ba363
fix(apple): parse `.xcworkspace` for schemes (#2415)
tido64 Jun 19, 2024
c98ddad
build(deps): bump ws from 6.2.2 to 6.2.3 (#2413)
dependabot[bot] Jun 19, 2024
33646ef
chore: remove specifying `-PreactNativeDebugArchitectures` in Android…
szymonrybczak Jun 19, 2024
45bc011
fix: update react-native version in the template for versions >= 0.75…
blakef Jun 20, 2024
3e22589
v14.0.0-alpha.6
thymikee Jun 20, 2024
e9473ef
fix: only show warning about --template & --version when necessary
blakef Jun 20, 2024
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
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ jobs:
distribution: 'zulu'
java-version: 17

- uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.0.1
- uses: gradle/actions/setup-gradle@v3

- uses: ruby/setup-ruby@v1
if: runner.os == 'macOS'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ build/
coverage
!packages/cli-platform-ios/src/config/__fixtures__/native_modules/node_modules
*.env
.parcel-cache
8 changes: 7 additions & 1 deletion __e2e__/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`shows up current config without unnecessary output 1`] = `
{
"root": "<<REPLACED_ROOT>>/TestProject",
"reactNativePath": "<<REPLACED_ROOT>>/TestProject/node_modules/react-native",
"reactNativeVersion": "0.73",
"reactNativeVersion": "0.74",
"dependencies": {},
"commands": [
{
Expand Down Expand Up @@ -72,6 +72,12 @@ exports[`shows up current config without unnecessary output 1`] = `
"options": [
"<<REPLACED>>"
]
},
{
"name": "codegen",
"options": [
"<<REPLACED>>"
]
}
],
"healthChecks": [],
Expand Down
13 changes: 1 addition & 12 deletions __e2e__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
writeFiles,
spawnScript,
replaceProjectRootInOutput,
getAllPackages,
addRNCPrefix,
} from '../jest/helpers';

const DIR = getTempDirectory('test_root');
Expand Down Expand Up @@ -38,15 +36,6 @@ function createCorruptedSetupEnvScript() {
}

beforeAll(() => {
const packages = getAllPackages();

// Register all packages to be linked
for (const pkg of packages) {
spawnScript('yarn', ['link'], {
cwd: path.join(__dirname, `../packages/${pkg}`),
});
}

// Clean up folder and re-create a new project
cleanup(DIR);
writeFiles(DIR, {});
Expand All @@ -55,7 +44,7 @@ beforeAll(() => {
runCLI(DIR, ['init', 'TestProject', '--install-pods']);

// Link CLI to the project
spawnScript('yarn', ['link', ...addRNCPrefix(packages)], {
spawnScript('yarn', ['link', __dirname, '--all'], {
cwd: path.join(DIR, 'TestProject'),
});
});
Expand Down
16 changes: 6 additions & 10 deletions __e2e__/init.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import fs from 'fs';
import path from 'path';
import {runCLI, getTempDirectory, cleanup, writeFiles} from '../jest/helpers';
import {execSync} from 'child_process';
import semver from 'semver';
import slash from 'slash';

const yarnVersion = semver.parse(execSync('yarn --version').toString().trim())!;

// .yarnrc -> .yarnrc.yml >= 2.0.0: yarnpkg/berry/issues/239
const yarnConfigFile = yarnVersion.major > 1 ? '.yarnrc.yml' : '.yarnrc';

const DIR = getTempDirectory('command-init');
const PROJECT_NAME = 'TestInit';

Expand All @@ -30,7 +23,7 @@ function createCustomTemplateFiles() {
const customTemplateCopiedFiles = [
'.git',
'.yarn',
yarnConfigFile,
'.yarnrc.yml', // .yarnrc.yml for Yarn versions >= 2.0.0
'dir',
'file',
'node_modules',
Expand Down Expand Up @@ -185,7 +178,7 @@ test('init uses npm as the package manager with --npm', () => {
// Remove yarn specific files and node_modules
const filteredFiles = customTemplateCopiedFiles.filter(
(file) =>
!['yarn.lock', 'node_modules', yarnConfigFile, '.yarn'].includes(file),
!['yarn.lock', 'node_modules', '.yarnrc.yml', '.yarn'].includes(file),
);

// Add package-lock.json
Expand Down Expand Up @@ -214,8 +207,11 @@ test('init --platform-name should work for out of tree platform', () => {
]);

expect(stdout).toContain('Run instructions');
// This will no longer contain react-native-macos@latest, but
// [email protected] or whatever the concrete version
// matching @latest at the time of execution.
expect(stdout).toContain(
`Installing template from ${outOfTreePlatformName}@latest`,
`Installing template from ${outOfTreePlatformName}@`,
);

// make sure we don't leave garbage
Expand Down
38 changes: 11 additions & 27 deletions __e2e__/root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,33 @@ import {
getTempDirectory,
cleanup,
writeFiles,
addRNCPrefix,
getAllPackages,
} from '../jest/helpers';

const cwd = getTempDirectory('test_different_roots');
const DIR = getTempDirectory('test_different_roots');

beforeAll(() => {
const packages = getAllPackages();

// Register all packages to be linked
for (const pkg of packages) {
spawnScript('yarn', ['link'], {
cwd: path.join(__dirname, `../packages/${pkg}`),
});
}

// Clean up folder and re-create a new project
cleanup(cwd);
writeFiles(cwd, {});
cleanup(DIR);
writeFiles(DIR, {});

// Initialise React Native project
runCLI(cwd, ['init', 'TestProject']);
runCLI(DIR, ['init', 'TestProject', '--install-pods']);

// Link CLI to the project

spawnScript('yarn', ['link', ...addRNCPrefix(packages)], {
cwd: path.join(cwd, 'TestProject'),
spawnScript('yarn', ['link', __dirname, '--all'], {
cwd: path.join(DIR, 'TestProject'),
});
});

afterAll(() => {
cleanup(cwd);
cleanup(DIR);
});

test('works when Gradle is run outside of the project hierarchy', async () => {
/**
* Location of Android project
*/
const androidProjectRoot = path.join(cwd, 'TestProject/android');
const androidProjectRoot = path.join(DIR, 'TestProject/android');

/*
* Grab absolute path to Gradle wrapper. The fact that we are using
Expand All @@ -54,13 +42,9 @@ test('works when Gradle is run outside of the project hierarchy', async () => {
const gradleWrapper = path.join(androidProjectRoot, 'gradlew');

// Make sure that we use `-bin` distribution of Gradle
await spawnScript(
gradleWrapper,
['wrapper', '--gradle-version=8.0.1', '--distribution-type', 'bin'],
{
cwd: androidProjectRoot,
},
);
await spawnScript(gradleWrapper, ['wrapper', '--distribution-type', 'bin'], {
cwd: androidProjectRoot,
});

// Execute `gradle` with `-p` flag and `cwd` outside of project hierarchy
const {stdout} = spawnScript(gradleWrapper, ['-p', androidProjectRoot], {
Expand Down
15 changes: 8 additions & 7 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ React Native CLI comes with following commands:
- [`info`](/packages/cli-doctor/README.md#info)
- [`log-android`](/packages/cli-platform-android/README.md#log-android)
- [`log-ios`](/packages/cli-platform-ios/README.md#log-ios)
- [`ram-bundle`](https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#ram-bundle)
- [`run-android`](/packages/cli-platform-android/README.md#run-android)
- [`build-android`](/packages/cli-platform-android/README.md#build-android)
- [`run-ios`](/packages/cli-platform-ios/README.md#run-ios)
Expand All @@ -22,7 +21,7 @@ React Native CLI comes with following commands:

> Available since 0.60.0

> **IMPORTANT**: Please note that this command is not available through `react-native-cli`, hence you need to either invoke it directly from `@react-native-community/cli` or `react-native` package which proxies binary to this CLI since 0.60.0, so it's possible to use it with e.g. `npx`.
> **IMPORTANT**: Please note that this command is not available through `react-native-cli`, hence you need to either invoke it directly from the `@react-native-community/cli` package which proxies binary to this CLI since 0.60.0, so it's possible to use it with e.g. `npx`.

Usage (with `npx`):

Expand All @@ -36,7 +35,7 @@ Initialize a new React Native project named <projectName> in a directory of the

#### `--version <string>`

Shortcut for `--template react-native@version`.
The version of React Native to use with the template.

#### `--directory <string>`

Expand All @@ -58,10 +57,12 @@ Uses a custom template. Accepts following template sources:
Example:

```sh
npx react-native@latest init MyApp --template react-native-custom-template
npx react-native@latest init MyApp --template file:///Users/name/template-path
npx react-native@latest init MyApp --template file:///Users/name/template-name-1.0.0.tgz
npx react-native@latest init MyApp --template Esemesek/react-native-new-template
npx react-native-community/cli@latest init MyApp --template react-native-community/cli-custom-template
npx react-native-community/cli@latest init MyApp --template file:///Users/name/template-path
npx react-native-community/cli@latest init MyApp --template file:///Users/name/template-name-1.0.0.tgz
npx react-native-community/cli@latest init MyApp --template Esemesek/react-native-community/cli-new-template
# Use a specific version of the community template with the nightly release of React Native
npx react-native-community/cli@latest init MyApp --template @react-native-community/template0.74.0 --version nightly
```

A template is any directory or npm package that contains a `template.config.js` file in the root with the following type:
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "14.0.0-alpha.2",
"version": "14.0.0-alpha.6",
"npmClient": "yarn",
"exact": true,
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@types/glob": "^7.1.1",
"@types/jest": "^26.0.15",
"@types/node": "^18.0.0",
"@types/node-fetch": "^2.3.7",
"babel-jest": "^26.6.2",
"babel-plugin-module-resolver": "^3.2.0",
"chalk": "^4.1.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli-clean/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@react-native-community/cli-clean",
"version": "14.0.0-alpha.2",
"version": "14.0.0-alpha.6",
"license": "MIT",
"main": "build/index.js",
"publishConfig": {
"access": "public"
},
"types": "build/index.d.ts",
"dependencies": {
"@react-native-community/cli-tools": "14.0.0-alpha.2",
"@react-native-community/cli-tools": "14.0.0-alpha.6",
"chalk": "^4.1.2",
"execa": "^5.0.0",
"fast-glob": "^3.3.2"
Expand All @@ -19,7 +19,7 @@
"!*.map"
],
"devDependencies": {
"@react-native-community/cli-types": "14.0.0-alpha.2",
"@react-native-community/cli-types": "14.0.0-alpha.6",
"@types/prompts": "^2.4.4"
},
"homepage": "https://github.com/react-native-community/cli/tree/main/packages/cli-clean",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli-config/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@react-native-community/cli-config",
"version": "14.0.0-alpha.2",
"version": "14.0.0-alpha.6",
"license": "MIT",
"main": "build/index.js",
"publishConfig": {
"access": "public"
},
"types": "build/index.d.ts",
"dependencies": {
"@react-native-community/cli-tools": "14.0.0-alpha.2",
"@react-native-community/cli-tools": "14.0.0-alpha.6",
"chalk": "^4.1.2",
"cosmiconfig": "^9.0.0",
"deepmerge": "^4.3.0",
Expand All @@ -21,7 +21,7 @@
"!*.map"
],
"devDependencies": {
"@react-native-community/cli-types": "14.0.0-alpha.2",
"@react-native-community/cli-types": "14.0.0-alpha.6",
"@types/cosmiconfig": "^5.0.3"
},
"homepage": "https://github.com/react-native-community/cli/tree/main/packages/cli-config",
Expand Down
Loading
Loading