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

refactor(breaking): remove deprecated link, unlink and associated code #1537

Merged
merged 40 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e151563
chore: initial commit - remove files
grabbou Jan 27, 2022
0ae9eea
chore: further removal
grabbou Jan 27, 2022
30103d3
chore: wip
grabbou Jan 27, 2022
6c53e48
continue work
grabbou Jan 28, 2022
596d849
chore: fix warnings and errors
grabbou Jan 28, 2022
8a24cd2
chore: move findXcodeProj to config and upgrade run-ios
grabbou Feb 2, 2022
a1fe895
chore: add todo
grabbou Feb 2, 2022
2f8baf8
chore: remove example
grabbou Feb 2, 2022
510a903
chore: update source dir and update dependnecy config for ios
grabbou Feb 2, 2022
2a43345
chore: remove logger
grabbou Feb 2, 2022
410ec1a
chore: fix type issues
grabbou Feb 2, 2022
b3e0730
chore: remove tests for missing properties, prefer snapshots instead …
grabbou Feb 2, 2022
16996b3
chore: update snapshots for iOS config (removed properties)
grabbou Feb 2, 2022
a67a5a6
chore: fix upgrade tests
grabbou Feb 2, 2022
65f4335
chore: remove extra tests
grabbou Feb 2, 2022
edf3175
chore: update config tests
grabbou Feb 2, 2022
3854ee3
chore: two tests tbd to support new resolution mechanism
grabbou Feb 2, 2022
f8a9ade
chore: fix ios tests and bring back configurable sourceDir
grabbou Feb 2, 2022
1c9508e
feat: align findPodfilePath with old findProject heuristics
grabbou Feb 2, 2022
be963e1
chore: fix lint
grabbou Feb 2, 2022
194ee75
chore: update snapshot
grabbou Feb 2, 2022
387f9ee
fix: filter invalid deps
grabbou Feb 2, 2022
299285f
chore: update tests
grabbou Feb 2, 2022
d665720
chore: add missing properties to Joi schema
grabbou Feb 2, 2022
020aa16
chore: another update
grabbou Feb 2, 2022
0153690
chore: fix Joi schema
grabbou Feb 2, 2022
f8fd19d
chore: update schema
grabbou Feb 2, 2022
de1a5d2
chore: fix snapshot
grabbou Feb 2, 2022
2c732a8
chore: note on the future development for this file
grabbou Feb 2, 2022
6051201
chore: update snapshot one more time - nitpick
grabbou Feb 2, 2022
361f0c9
one last time
grabbou Feb 2, 2022
64b4ef7
feat: print when multiple podfiles are found
grabbou Feb 3, 2022
00ccd36
update docs
grabbou Feb 3, 2022
59cb6e0
chore: fix
grabbou Feb 3, 2022
9e70eb3
Update autolinking.md
grabbou Feb 4, 2022
48686a9
chore: remove xmldoc dep
thymikee Feb 4, 2022
7326892
chore: remove xcode dep
thymikee Feb 4, 2022
794d9b3
chore: return type for dependencyConfig
thymikee Feb 4, 2022
ae7c66e
Merge branch 'master' into feat/remove-link
grabbou Feb 7, 2022
3e5cb0b
Update index.ts
grabbou Feb 7, 2022
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
28 changes: 6 additions & 22 deletions __e2e__/__snapshots__/config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ exports[`shows up current config without unnecessary output 1`] = `
]
}
],
"assets": [],
"healthChecks": [],
"platforms": {
"ios": {},
Expand All @@ -41,30 +40,15 @@ exports[`shows up current config without unnecessary output 1`] = `
"project": {
"ios": {
"sourceDir": "<<REPLACED_ROOT>>/TestProject/ios",
"folder": "<<REPLACED_ROOT>>/TestProject",
"pbxprojPath": "<<REPLACED_ROOT>>/TestProject/ios/TestProject.xcodeproj/project.pbxproj",
"podfile": "<<REPLACED_ROOT>>/TestProject/ios/Podfile",
"podspecPath": null,
"projectPath": "<<REPLACED_ROOT>>/TestProject/ios/TestProject.xcodeproj",
"projectName": "TestProject.xcodeproj",
"libraryFolder": "Libraries",
"sharedLibraries": [],
"plist": [],
"scriptPhases": []
"xcodeProject": {
"name": "TestProject.xcodeproj",
"isWorkspace": false
}
},
"android": {
"sourceDir": "<<REPLACED_ROOT>>/TestProject/android",
"isFlat": true,
"folder": "<<REPLACED_ROOT>>/TestProject",
"stringsPath": "<<REPLACED_ROOT>>/TestProject/android/app/src/main/res/values/strings.xml",
"manifestPath": "<<REPLACED_ROOT>>/TestProject/android/app/src/main/AndroidManifest.xml",
"buildGradlePath": "<<REPLACED_ROOT>>/TestProject/android/build.gradle",
"settingsGradlePath": "<<REPLACED_ROOT>>/TestProject/android/settings.gradle",
"assetsPath": "<<REPLACED_ROOT>>/TestProject/android/app/src/main/assets",
"mainFilePath": "<<REPLACED_ROOT>>/TestProject/android/app/src/main/java/com/testproject/MainApplication.java",
"packageName": "com.testproject",
"packageFolder": "com/testproject",
"appName": "app"
"appName": "app",
"packageName": "com.testproject"
}
}
}
Expand Down
38 changes: 0 additions & 38 deletions __e2e__/install.test.ts

This file was deleted.

63 changes: 0 additions & 63 deletions __e2e__/uninstall.test.ts

This file was deleted.

68 changes: 0 additions & 68 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ React Native CLI comes with following commands:
- [`doctor`](#doctor)
- [`init`](#init)
- [`info`](#info)
- [`install`](#install)
- [`link`](#link)
- [`log-android`](#log-android)
- [`log-ios`](#log-ios)
- [`ram-bundle`](#ram-bundle)
- [`run-android`](#run-android)
- [`run-ios`](#run-ios)
- [`start`](#start)
- [`uninstall`](#uninstall)
- [`unlink`](#unlink)
- [`upgrade`](#upgrade)
- [`profile-hermes`](#profile-hermes)

Expand Down Expand Up @@ -239,38 +235,6 @@ react-native info

Get relevant version info about OS, toolchain and libraries. Useful when sending bug reports.

### `install`

Usage:

```sh
react-native install <packageName>
```

Installs single package from npm and then links native dependencies. If `install` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used.

### `link`

> Will be replaced by [autolinking](./autolinking.md) soon.

Usage:

```sh
react-native link [packageName]
```

Links assets and optionally native modules.

#### Options

#### `--all`

Link all native modules and assets.

#### `--platforms [list]`

Pass comma-separated list of platforms to scope `link` to.

### `log-android`

Usage:
Expand Down Expand Up @@ -425,10 +389,6 @@ Explicitly set the scheme configuration to use default: 'Debug'.

Explicitly set Xcode scheme to use.

#### `--project-path <string>`

Path relative to project root where the Xcode project (.xcodeproj) lives. default: 'ios'.

#### `--device [string]`

Explicitly set device to use by name. The value is not required if you have a single device connected.
Expand Down Expand Up @@ -519,34 +479,6 @@ Path to the CLI configuration file

Disables interactive mode

### `uninstall`

Usage:

```sh
react-native uninstall <packageName>
```

Unlinks single package native dependencies and then uninstalls it from `package.json`. If `uninstall` detects `yarn.lock` in your project, it will use Yarn as package manager. Otherwise `npm` will be used.

### `unlink`

> Will be replaced by [autolinking](./autolinking.md) soon.

Usage:

```
react-native unlink <packageName> [options]
```

Unlink native dependency linked with the `link` command.

#### Options

#### `--platforms [list]`

Scope unlinking to specified platforms

### `upgrade`

Usage:
Expand Down
106 changes: 0 additions & 106 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

React Native CLI has a configuration mechanism that allows changing its behavior and providing additional features.

> Note: Configuring CLI used to be possible via `rn-cli.config.js` (that has been renamed to `metro.config.js`) and never documented `rnpm` entry on the `package.json`. We have provided migration guides where possible.

React Native CLI can be configured by creating a `react-native.config.js` at the root of the project. Depending on the type of a package, the set of valid properties is different.

Check the documentation for
Expand All @@ -14,107 +12,3 @@ Check the documentation for
- [plugins](./plugins.md)

to learn more about different types of configuration and features available.

## Migration guide

`"rnpm"` is deprecated and support for it is removed since v4.x of the CLI.

> **Important**: Proceed further only if your project uses `"rnpm"` in `package.json`.

There are different kinds of React Native projects, including apps, libraries and platforms. For each we prepared a brief "before & after" of the configuration shape with legacy `"rnpm"` and current `react-native.config.js`. Please mind that all configuration entries are optional.

### Apps

`package.json` entry:

```json
{
"rnpm": {
"ios": {},
"android": {},
"assets": ["./path-to-assets"],
"plugin": "./path-to-commands.js"
}
}
```

becomes `react-native.config.js`

```js
module.exports = {
project: {
ios: {},
android: {}, // grouped into "project"
},
assets: ['./path-to-assets'], // stays the same
commands: require('./path-to-commands.js'), // formerly "plugin", returns an array of commands
};
```

### Libraries

`package.json` entry:

```json
{
"rnpm": {
"ios": {},
"android": {},
"assets": ["./path-to-assets"],
"hooks": {
"prelink": "./path-to-a-prelink-hook"
}
}
}
```

becomes `react-native.config.js`:

```js
module.exports = {
// config for a library is scoped under "dependency" key
dependency: {
platforms: {
ios: {},
android: {}, // projects are grouped into "platforms"
},
assets: ['./path-to-assets'], // stays the same
// hooks are considered anti-pattern, please avoid them
hooks: {
prelink: './path-to-a-prelink-hook',
},
},
};
```

You'll find more details in [dependencies](./dependencies.md) docs.

### Out-of-tree platforms

`package.json` entry:

```json
{
"rnpm": {
"haste": {
"platforms": ["windows"],
"providesModuleNodeModules": ["react-native-windows"]
},
"platform": "./local-cli/platform.js"
}
}
```

becomes `react-native.config.js`

```js
module.exports = {
platforms: {
// grouped under "platforms" entry
windows: require('./local-cli/platform.js').windows,
},
// "haste" is no longer needed
};
```

You'll find more details in [platforms](./platforms.md) docs.
Loading