@react-native/core-cli-utils 0.76.0-nightly-20240715-2eb7bcb8d → 0.76.0-nightly-20240720-3a5eb1973
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/dist/index.d.ts +22 -0
- package/dist/index.js +66 -0
- package/dist/index.js.flow +26 -0
- package/dist/private/android.d.ts +29 -0
- package/dist/private/android.js +74 -0
- package/dist/private/android.js.flow +42 -0
- package/dist/private/app.d.ts +37 -0
- package/dist/private/app.js +176 -0
- package/dist/private/app.js.flow +72 -0
- package/dist/private/apple.d.ts +54 -0
- package/dist/private/apple.js +148 -0
- package/dist/private/apple.js.flow +71 -0
- package/dist/private/clean.d.ts +59 -0
- package/dist/private/clean.js +141 -0
- package/dist/private/clean.js.flow +77 -0
- package/dist/private/types.d.ts +16 -0
- package/dist/private/types.js +1 -0
- package/dist/private/utils.d.ts +28 -0
- package/dist/private/utils.js +53 -0
- package/dist/private/utils.js.flow +38 -0
- package/dist/public/version.d.ts +27 -0
- package/dist/public/version.js +31 -0
- package/{src/public/version.flow.js → dist/public/version.js.flow} +12 -19
- package/package.json +2 -2
- package/src/index.flow.js +0 -26
- package/src/index.js +0 -20
- package/src/private/android.js +0 -121
- package/src/private/app.js +0 -250
- package/src/private/apple.js +0 -196
- package/src/private/clean.js +0 -203
- package/src/private/utils.js +0 -66
- package/src/public/version.js +0 -20
- /package/{src/private/types.js → dist/private/types.js.flow} +0 -0
package/src/private/clean.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
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 type {Task} from './types';
|
|
13
|
-
import type {ExecaPromise, Options as ExecaOptions} from 'execa';
|
|
14
|
-
|
|
15
|
-
import {assertDependencies, isMacOS, isOnPath, isWindows, task} from './utils';
|
|
16
|
-
import execa from 'execa';
|
|
17
|
-
import {existsSync, readdirSync, rm} from 'fs';
|
|
18
|
-
import os from 'os';
|
|
19
|
-
import path from 'path';
|
|
20
|
-
|
|
21
|
-
const FIRST = 1,
|
|
22
|
-
SECOND = 2;
|
|
23
|
-
|
|
24
|
-
const rmrf = (pathname: string) => {
|
|
25
|
-
if (!existsSync(pathname)) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
rm(pathname, {force: true, maxRetries: 3, recursive: true});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Removes the contents of a directory matching a given pattern, but keeps the directory.
|
|
33
|
-
* @private
|
|
34
|
-
*/
|
|
35
|
-
export function deleteDirectoryContents(
|
|
36
|
-
directory: string,
|
|
37
|
-
filePattern: RegExp,
|
|
38
|
-
): () => Promise<void> {
|
|
39
|
-
return async function deleteDirectoryContentsAction() {
|
|
40
|
-
const base = path.dirname(directory);
|
|
41
|
-
const files = readdirSync(base).filter((filename: string) =>
|
|
42
|
-
filePattern.test(filename),
|
|
43
|
-
);
|
|
44
|
-
for (const filename of files) {
|
|
45
|
-
rmrf(path.join(base, filename));
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Removes a directory recursively.
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
export function deleteDirectory(directory: string): () => Promise<void> {
|
|
55
|
-
return async function cleanDirectoryAction() {
|
|
56
|
-
rmrf(directory);
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Deletes the contents of the tmp directory matching a given pattern.
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
export function deleteTmpDirectoryContents(
|
|
65
|
-
filepattern: RegExp,
|
|
66
|
-
): () => Promise<void> {
|
|
67
|
-
return deleteDirectoryContents(os.tmpdir(), filepattern);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const platformGradlew = isWindows ? 'gradlew.bat' : 'gradlew';
|
|
71
|
-
|
|
72
|
-
type CocoaPodsClean = {
|
|
73
|
-
clean: Task<ExecaPromise>,
|
|
74
|
-
};
|
|
75
|
-
type AndroidClean = {
|
|
76
|
-
validate: Task<void>,
|
|
77
|
-
run: Task<ExecaPromise>,
|
|
78
|
-
};
|
|
79
|
-
type MetroClean = {
|
|
80
|
-
metro: Task<Promise<void>>,
|
|
81
|
-
haste: Task<Promise<void>>,
|
|
82
|
-
react_native: Task<Promise<void>>,
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
type NpmClean = {
|
|
86
|
-
node_modules: Task<Promise<void>>,
|
|
87
|
-
verify_cache: Task<ExecaPromise>,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
type WatchmanClean = {
|
|
91
|
-
stop: Task<ExecaPromise>,
|
|
92
|
-
cache: Task<ExecaPromise>,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
type YarnClean = {
|
|
96
|
-
clean: Task<ExecaPromise>,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
type CleanTasks = {
|
|
100
|
-
android: (andoirdSrcDir: ?string, opts?: ExecaOptions) => AndroidClean,
|
|
101
|
-
cocoapods: CocoaPodsClean,
|
|
102
|
-
metro: () => MetroClean,
|
|
103
|
-
npm: (projectRootDir: string) => NpmClean,
|
|
104
|
-
watchman: (projectRootDir: string) => WatchmanClean,
|
|
105
|
-
yarn: (projectRootDir: string) => YarnClean,
|
|
106
|
-
cocoapods?: (projectRootDir: string) => CocoaPodsClean,
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
// The tasks that cleanup various build artefacts.
|
|
110
|
-
/* eslint sort-keys: "off" */
|
|
111
|
-
export const tasks: CleanTasks = {
|
|
112
|
-
/**
|
|
113
|
-
* Cleans up the Android Gradle cache
|
|
114
|
-
*/
|
|
115
|
-
android: (androidSrcDir: ?string, opts?: ExecaOptions) => ({
|
|
116
|
-
validate: task(FIRST, 'Check gradlew is available', () => {
|
|
117
|
-
assertDependencies(isOnPath(platformGradlew, 'Gradle wrapper'));
|
|
118
|
-
}),
|
|
119
|
-
run: task(SECOND, '🧹 Clean Gradle cache', () => {
|
|
120
|
-
const gradlew = path.join(androidSrcDir ?? 'android', platformGradlew);
|
|
121
|
-
const script = path.basename(gradlew);
|
|
122
|
-
const cwd = path.dirname(gradlew);
|
|
123
|
-
return execa(isWindows ? script : './' + script, ['clean'], {
|
|
124
|
-
cwd,
|
|
125
|
-
...opts,
|
|
126
|
-
});
|
|
127
|
-
}),
|
|
128
|
-
}),
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Aggressively cleans up all Metro caches.
|
|
132
|
-
*/
|
|
133
|
-
metro: () => ({
|
|
134
|
-
metro: task(
|
|
135
|
-
FIRST,
|
|
136
|
-
'🧹 Clean Metro cache',
|
|
137
|
-
deleteTmpDirectoryContents(/^metro-.+/),
|
|
138
|
-
),
|
|
139
|
-
haste: task(
|
|
140
|
-
FIRST,
|
|
141
|
-
'🧹 Clean Haste cache',
|
|
142
|
-
deleteTmpDirectoryContents(/^haste-map-.+/),
|
|
143
|
-
),
|
|
144
|
-
react_native: task(
|
|
145
|
-
FIRST,
|
|
146
|
-
'🧹 Clean React Native cache',
|
|
147
|
-
deleteTmpDirectoryContents(/^react-.+/),
|
|
148
|
-
),
|
|
149
|
-
}),
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Cleans up the `node_modules` folder and optionally garbage collects the npm cache.
|
|
153
|
-
*/
|
|
154
|
-
npm: (projectRootDir: string) => ({
|
|
155
|
-
node_modules: task(
|
|
156
|
-
FIRST,
|
|
157
|
-
'🧹 Clean node_modules',
|
|
158
|
-
deleteDirectory(path.join(projectRootDir, 'node_modules')),
|
|
159
|
-
),
|
|
160
|
-
verify_cache: task(SECOND, '🔬 Verify npm cache', (opts?: ExecaOptions) =>
|
|
161
|
-
execa('npm', ['cache', 'verify'], {cwd: projectRootDir, ...opts}),
|
|
162
|
-
),
|
|
163
|
-
}),
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Stops Watchman and clears its cache
|
|
167
|
-
*/
|
|
168
|
-
watchman: (projectRootDir: string) => ({
|
|
169
|
-
stop: task(FIRST, '✋ Stop Watchman', (opts?: ExecaOptions) =>
|
|
170
|
-
execa(isWindows ? 'tskill' : 'killall', ['watchman'], {
|
|
171
|
-
cwd: projectRootDir,
|
|
172
|
-
...opts,
|
|
173
|
-
}),
|
|
174
|
-
),
|
|
175
|
-
cache: task(SECOND, '🧹 Delete Watchman cache', (opts?: ExecaOptions) =>
|
|
176
|
-
execa('watchman', ['watch-del-all'], {cwd: projectRootDir, ...opts}),
|
|
177
|
-
),
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Cleans up the Yarn cache
|
|
182
|
-
*/
|
|
183
|
-
yarn: (projectRootDir: string) => ({
|
|
184
|
-
clean: task(FIRST, '🧹 Clean Yarn cache', (opts?: ExecaOptions) =>
|
|
185
|
-
execa('yarn', ['cache', 'clean'], {cwd: projectRootDir, ...opts}),
|
|
186
|
-
),
|
|
187
|
-
}),
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
if (isMacOS) {
|
|
191
|
-
/**
|
|
192
|
-
* Cleans up the local and global CocoaPods cache
|
|
193
|
-
*/
|
|
194
|
-
tasks.cocoapods = (projectRootDir: string) => ({
|
|
195
|
-
// TODO: add project root
|
|
196
|
-
clean: task(FIRST, '🧹 Clean CocoaPods pod cache', (opts?: ExecaOptions) =>
|
|
197
|
-
execa('bundle', ['exec', 'pod', 'deintegrate'], {
|
|
198
|
-
cwd: projectRootDir,
|
|
199
|
-
...opts,
|
|
200
|
-
}),
|
|
201
|
-
),
|
|
202
|
-
});
|
|
203
|
-
}
|
package/src/private/utils.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
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 type {Task} from './types';
|
|
13
|
-
|
|
14
|
-
import execa from 'execa';
|
|
15
|
-
import os from 'os';
|
|
16
|
-
|
|
17
|
-
export function task<R>(
|
|
18
|
-
order: number,
|
|
19
|
-
label: string,
|
|
20
|
-
action: Task<R>['action'],
|
|
21
|
-
): Task<R> {
|
|
22
|
-
return {
|
|
23
|
-
action,
|
|
24
|
-
label,
|
|
25
|
-
order,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const isWindows = os.platform() === 'win32';
|
|
30
|
-
export const isMacOS = os.platform() === 'darwin';
|
|
31
|
-
|
|
32
|
-
export const toPascalCase = (label: string): string =>
|
|
33
|
-
label.length === 0 ? '' : label[0].toUpperCase() + label.slice(1);
|
|
34
|
-
|
|
35
|
-
type PathCheckResult = {
|
|
36
|
-
found: boolean,
|
|
37
|
-
dep: string,
|
|
38
|
-
description: string,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export function isOnPath(dep: string, description: string): PathCheckResult {
|
|
42
|
-
const cmd = isWindows ? ['where', [dep]] : ['command', ['-v', dep]];
|
|
43
|
-
try {
|
|
44
|
-
return {
|
|
45
|
-
dep,
|
|
46
|
-
description,
|
|
47
|
-
found: execa.sync(...cmd).exitCode === 0,
|
|
48
|
-
};
|
|
49
|
-
} catch {
|
|
50
|
-
return {
|
|
51
|
-
dep,
|
|
52
|
-
description,
|
|
53
|
-
found: false,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function assertDependencies(
|
|
59
|
-
...deps: $ReadOnlyArray<ReturnType<typeof isOnPath>>
|
|
60
|
-
) {
|
|
61
|
-
for (const {found, dep, description} of deps) {
|
|
62
|
-
if (!found) {
|
|
63
|
-
throw new Error(`"${dep}" not found, ${description}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
package/src/public/version.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
/*::
|
|
13
|
-
export type * from './version.flow';
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
if (process.env.BUILD_EXCLUDE_BABEL_REGISTER == null) {
|
|
17
|
-
require('../../../../scripts/build/babel-register').registerForMonorepo();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
module.exports = require('./version.flow');
|
|
File without changes
|