@react-native/core-cli-utils 0.75.0-nightly-20240304-ec928d7a6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/index.js +16 -0
- package/package.json +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @react-native/core-cli-utils
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A collection of utilites to help Frameworks build their React Native CLI tooling. This is not intended to be used directly use users of React Native.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import { Command } from 'commander';
|
|
11
|
+
import cli from '@react-native/core-cli-utils';
|
|
12
|
+
import debug from 'debug';
|
|
13
|
+
|
|
14
|
+
const android = new Command('android');
|
|
15
|
+
|
|
16
|
+
const frameworkFindsAndroidSrcDir = "...";
|
|
17
|
+
const tasks = cli.clean.android(frameworkFindsAndroidSrcDir);
|
|
18
|
+
const log = debug('fancy-framework:android');
|
|
19
|
+
|
|
20
|
+
android
|
|
21
|
+
.command('clean')
|
|
22
|
+
.description(cli.clean.android)
|
|
23
|
+
.action(async () => {
|
|
24
|
+
const log = debug('fancy-framework:android:clean');
|
|
25
|
+
log(`🧹 let me clean your Android caches`);
|
|
26
|
+
// Add other caches your framework needs besides the normal React Native caches
|
|
27
|
+
// here.
|
|
28
|
+
for (const task of tasks) {
|
|
29
|
+
try {
|
|
30
|
+
log(`\t ${task.label}`);
|
|
31
|
+
// See: https://github.com/sindresorhus/execa#lines
|
|
32
|
+
const {stdout} = await task.action({ lines: true })
|
|
33
|
+
log(stdout.join('\n\tGradle: '));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
log(`\t ⚠️ whoops: ${e.message}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
And you'd be using it like this:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
$ ./fancy-framework android clean
|
|
45
|
+
🧹 let me clean your Android caches
|
|
46
|
+
Gradle: // a bunch of gradle output
|
|
47
|
+
Gradle: ....
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Contributing
|
|
51
|
+
|
|
52
|
+
Changes to this package can be made locally and linked against your app. Please see the [Contributing guide](https://reactnative.dev/contributing/overview#contributing-code).
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {tasks as clean} from './private/clean.js';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
clean,
|
|
16
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native/core-cli-utils",
|
|
3
|
+
"version": "0.75.0-nightly-20240304-ec928d7a6",
|
|
4
|
+
"description": "React Native CLI library for Frameworks to build on",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/facebook/react-native.git",
|
|
10
|
+
"directory": "packages/core-cli-utils"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./index.js",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/core-cli-utils#readme",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"cli-utils",
|
|
19
|
+
"react-native"
|
|
20
|
+
],
|
|
21
|
+
"bugs": "https://github.com/facebook/react-native/issues",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {},
|
|
29
|
+
"devDependencies": {}
|
|
30
|
+
}
|