@rnx-kit/cli 0.16.18 → 0.16.20
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/CHANGELOG.md +14 -0
- package/coverage/clover.xml +36 -31
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/src/bundle/defaultPlugins.ts.html +1 -1
- package/coverage/lcov-report/src/bundle/index.html +1 -1
- package/coverage/lcov-report/src/bundle/kit-config.ts.html +1 -1
- package/coverage/lcov-report/src/bundle/metro.ts.html +1 -1
- package/coverage/lcov-report/src/bundle/overrides.ts.html +1 -1
- package/coverage/lcov-report/src/copy-assets.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +15 -15
- package/coverage/lcov-report/src/metro-config.ts.html +1 -1
- package/coverage/lcov-report/src/test.ts.html +49 -22
- package/coverage/lcov.info +54 -47
- package/eslint.config.js +1 -0
- package/lib/clean.d.ts +21 -0
- package/lib/clean.d.ts.map +1 -1
- package/lib/clean.js +24 -1
- package/lib/clean.js.map +1 -1
- package/lib/index.d.ts +194 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +45 -22
- package/lib/index.js.map +1 -1
- package/lib/start.d.ts +36 -0
- package/lib/start.d.ts.map +1 -1
- package/lib/start.js +77 -1
- package/lib/start.js.map +1 -1
- package/lib/test.d.ts +1 -2
- package/lib/test.d.ts.map +1 -1
- package/lib/test.js +19 -36
- package/lib/test.js.map +1 -1
- package/lib/write-third-party-notices.d.ts +17 -0
- package/lib/write-third-party-notices.d.ts.map +1 -1
- package/lib/write-third-party-notices.js +43 -1
- package/lib/write-third-party-notices.js.map +1 -1
- package/package.json +20 -8
- package/react-native.config.js +1 -184
- package/src/clean.ts +25 -0
- package/src/index.ts +28 -3
- package/src/start.ts +91 -0
- package/src/test.ts +21 -12
- package/src/write-third-party-notices.ts +47 -0
- package/test/__mocks__/fs.js +1 -20
- package/test/test.test.ts +1 -7
package/react-native.config.js
CHANGED
|
@@ -1,184 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const {
|
|
3
|
-
parseBoolean,
|
|
4
|
-
parseInt,
|
|
5
|
-
rnxAlignDepsCommand,
|
|
6
|
-
rnxBundleCommand,
|
|
7
|
-
rnxClean,
|
|
8
|
-
rnxCopyAssetsCommand,
|
|
9
|
-
rnxRamBundleCommand,
|
|
10
|
-
rnxStart,
|
|
11
|
-
rnxTestCommand,
|
|
12
|
-
rnxWriteThirdPartyNotices,
|
|
13
|
-
} = require("./lib/index");
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
commands: [
|
|
17
|
-
rnxBundleCommand,
|
|
18
|
-
rnxRamBundleCommand,
|
|
19
|
-
{
|
|
20
|
-
name: "rnx-start",
|
|
21
|
-
func: rnxStart,
|
|
22
|
-
description:
|
|
23
|
-
"Start a bundle-server to host your react-native experience during development",
|
|
24
|
-
options: [
|
|
25
|
-
{
|
|
26
|
-
name: "--port [number]",
|
|
27
|
-
description:
|
|
28
|
-
"Host port to use when listening for incoming server requests.",
|
|
29
|
-
parse: parseInt,
|
|
30
|
-
default: 8081,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "--host [string]",
|
|
34
|
-
description:
|
|
35
|
-
"Host name or address to bind when listening for incoming server requests. When not given, requests from all addresses are accepted.",
|
|
36
|
-
default: "",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "--projectRoot [path]",
|
|
40
|
-
description:
|
|
41
|
-
"Path to the root of your react-native project. The bundle server uses this root path to resolve all web requests.",
|
|
42
|
-
parse: (val) => path.resolve(val),
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "--watchFolders [paths]",
|
|
46
|
-
description:
|
|
47
|
-
"Additional folders which will be added to the file-watch list. Comma-separated. By default, Metro watches all project files.",
|
|
48
|
-
parse: (val) => val.split(",").map((folder) => path.resolve(folder)),
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "--assetPlugins [list]",
|
|
52
|
-
description:
|
|
53
|
-
"Additional asset plugins to be used by the Metro Babel transformer. Comma-separated list containing plugin module names or absolute paths to plugin packages.",
|
|
54
|
-
parse: (val) => val.split(","),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "--sourceExts [list]",
|
|
58
|
-
description:
|
|
59
|
-
"Additional source-file extensions to include when generating bundles. Comma-separated list, excluding the leading dot.",
|
|
60
|
-
parse: (val) => val.split(","),
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "--max-workers [number]",
|
|
64
|
-
description:
|
|
65
|
-
"Specifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.",
|
|
66
|
-
parse: parseInt,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "--reset-cache",
|
|
70
|
-
description: "Reset the Metro cache.",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "--custom-log-reporter-path [string]",
|
|
74
|
-
description:
|
|
75
|
-
"Path to a JavaScript file which exports a Metro 'TerminalReporter' function. This replaces the default reporter, which writes all messages to the Metro console.",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "--https",
|
|
79
|
-
description:
|
|
80
|
-
"Use a secure (https) web server. When not specified, an insecure (http) web server is used.",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "--key [path]",
|
|
84
|
-
description:
|
|
85
|
-
"Path to a custom SSL private key file to use for secure (https) communication.",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: "--cert [path]",
|
|
89
|
-
description:
|
|
90
|
-
"Path to a custom SSL certificate file to use for secure (https) communication.",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "--config [string]",
|
|
94
|
-
description: "Path to the Metro configuration file.",
|
|
95
|
-
parse: (val) => path.resolve(val),
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: "--no-interactive",
|
|
99
|
-
description: "Disables interactive mode.",
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "--id [string]",
|
|
103
|
-
description:
|
|
104
|
-
"Specify which bundle configuration to use if server configuration is missing.",
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
rnxCopyAssetsCommand,
|
|
109
|
-
rnxAlignDepsCommand,
|
|
110
|
-
rnxTestCommand,
|
|
111
|
-
{
|
|
112
|
-
name: "rnx-write-third-party-notices",
|
|
113
|
-
description: "Writes third party notices based on the given bundle",
|
|
114
|
-
func: rnxWriteThirdPartyNotices,
|
|
115
|
-
options: [
|
|
116
|
-
{
|
|
117
|
-
name: "--root-path <path>",
|
|
118
|
-
description:
|
|
119
|
-
"The root of the repo. This is the starting point for finding each module in the source map dependency graph.",
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "--source-map-file <file>",
|
|
123
|
-
description:
|
|
124
|
-
"The source map file associated with the package's entry file. This source map eventually leads to all package dependencies and their licenses.",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: "--json",
|
|
128
|
-
description:
|
|
129
|
-
"Format the 3rd-party notice file as JSON instead of text.",
|
|
130
|
-
default: false,
|
|
131
|
-
parse: parseBoolean,
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: "--output-file [file]",
|
|
135
|
-
description:
|
|
136
|
-
"The path to use when writing the 3rd-party notice file.",
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: "--ignore-scopes [string]",
|
|
140
|
-
description:
|
|
141
|
-
"Comma-separated list of `npm` scopes to ignore when traversing the source map dependency graph.",
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
name: "--ignore-modules [string]",
|
|
145
|
-
description:
|
|
146
|
-
"Comma-separated list of modules to ignore when traversing the source map dependency graph.",
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
name: "--preamble-text [string]",
|
|
150
|
-
description:
|
|
151
|
-
"A string to prepend to the start of the 3rd-party notice.",
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: "--additional-text [path]",
|
|
155
|
-
description: "A string to append to the end of the 3rd-party notice.",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: "rnx-clean",
|
|
161
|
-
func: rnxClean,
|
|
162
|
-
description: "Clears React Native project related caches",
|
|
163
|
-
options: [
|
|
164
|
-
{
|
|
165
|
-
name: "--include [android,cocoapods,metro,npm,watchman,yarn]",
|
|
166
|
-
description:
|
|
167
|
-
"Comma-separated flag of caches to clear, e.g. `npm,yarn`. When not specified, only non-platform specific caches are cleared.",
|
|
168
|
-
default: "metro,npm,watchman,yarn",
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: "--project-root <path>",
|
|
172
|
-
description: "Root path to your React Native project",
|
|
173
|
-
default: process.cwd(),
|
|
174
|
-
parse: (val) => path.resolve(val),
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: "--verify",
|
|
178
|
-
description: "Whether to verify the integrity of the cache",
|
|
179
|
-
default: false,
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
};
|
|
1
|
+
module.exports = require("./lib/index").reactNativeConfig;
|
package/src/clean.ts
CHANGED
|
@@ -194,3 +194,28 @@ function execute(command: string, args: string[], cwd: string): Promise<void> {
|
|
|
194
194
|
});
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
+
|
|
198
|
+
export const rnxCleanCommand = {
|
|
199
|
+
name: "rnx-clean",
|
|
200
|
+
func: rnxClean,
|
|
201
|
+
description: "Clears React Native project related caches",
|
|
202
|
+
options: [
|
|
203
|
+
{
|
|
204
|
+
name: "--include [android,cocoapods,metro,npm,watchman,yarn]",
|
|
205
|
+
description:
|
|
206
|
+
"Comma-separated flag of caches to clear, e.g. `npm,yarn`. When not specified, only non-platform specific caches are cleared.",
|
|
207
|
+
default: "metro,npm,watchman,yarn",
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "--project-root <path>",
|
|
211
|
+
description: "Root path to your React Native project",
|
|
212
|
+
default: process.cwd(),
|
|
213
|
+
parse: (val: string) => path.resolve(val),
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "--verify",
|
|
217
|
+
description: "Whether to verify the integrity of the cache",
|
|
218
|
+
default: false,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
|
+
import { rnxAlignDepsCommand } from "./align-deps";
|
|
2
|
+
import { rnxBundleCommand } from "./bundle";
|
|
3
|
+
import { rnxCleanCommand } from "./clean";
|
|
4
|
+
import { rnxCopyAssetsCommand } from "./copy-assets";
|
|
5
|
+
import { rnxRamBundleCommand } from "./ram-bundle";
|
|
6
|
+
import { rnxStartCommand } from "./start";
|
|
7
|
+
import { rnxTestCommand } from "./test";
|
|
8
|
+
import { rnxWriteThirdPartyNoticesCommand } from "./write-third-party-notices";
|
|
9
|
+
|
|
10
|
+
export const reactNativeConfig = {
|
|
11
|
+
commands: [
|
|
12
|
+
rnxBundleCommand,
|
|
13
|
+
rnxRamBundleCommand,
|
|
14
|
+
rnxStartCommand,
|
|
15
|
+
rnxCopyAssetsCommand,
|
|
16
|
+
rnxAlignDepsCommand,
|
|
17
|
+
rnxTestCommand,
|
|
18
|
+
rnxWriteThirdPartyNoticesCommand,
|
|
19
|
+
rnxCleanCommand,
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
|
|
1
23
|
export { rnxAlignDeps, rnxAlignDepsCommand } from "./align-deps";
|
|
2
24
|
export { rnxBundle, rnxBundleCommand } from "./bundle";
|
|
3
|
-
export { rnxClean } from "./clean";
|
|
25
|
+
export { rnxClean, rnxCleanCommand } from "./clean";
|
|
4
26
|
export { copyProjectAssets, rnxCopyAssetsCommand } from "./copy-assets";
|
|
5
27
|
export { parseBoolean, parseInt, parseTransformProfile } from "./parsers";
|
|
6
28
|
export { rnxRamBundle, rnxRamBundleCommand } from "./ram-bundle";
|
|
7
|
-
export { rnxStart } from "./start";
|
|
29
|
+
export { rnxStart, rnxStartCommand } from "./start";
|
|
8
30
|
export { rnxTest, rnxTestCommand } from "./test";
|
|
9
|
-
export {
|
|
31
|
+
export {
|
|
32
|
+
rnxWriteThirdPartyNotices,
|
|
33
|
+
rnxWriteThirdPartyNoticesCommand,
|
|
34
|
+
} from "./write-third-party-notices";
|
package/src/start.ts
CHANGED
|
@@ -223,3 +223,94 @@ export async function rnxStart(
|
|
|
223
223
|
attachKeyHandlers({ devServerUrl, help, messageSocketEndpoint, terminal });
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
+
|
|
227
|
+
export const rnxStartCommand = {
|
|
228
|
+
name: "rnx-start",
|
|
229
|
+
func: rnxStart,
|
|
230
|
+
description:
|
|
231
|
+
"Start a bundle-server to host your react-native experience during development",
|
|
232
|
+
options: [
|
|
233
|
+
{
|
|
234
|
+
name: "--port [number]",
|
|
235
|
+
description:
|
|
236
|
+
"Host port to use when listening for incoming server requests.",
|
|
237
|
+
parse: parseInt,
|
|
238
|
+
default: 8081,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "--host [string]",
|
|
242
|
+
description:
|
|
243
|
+
"Host name or address to bind when listening for incoming server requests. When not given, requests from all addresses are accepted.",
|
|
244
|
+
default: "",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: "--projectRoot [path]",
|
|
248
|
+
description:
|
|
249
|
+
"Path to the root of your react-native project. The bundle server uses this root path to resolve all web requests.",
|
|
250
|
+
parse: (val: string) => path.resolve(val),
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
name: "--watchFolders [paths]",
|
|
254
|
+
description:
|
|
255
|
+
"Additional folders which will be added to the file-watch list. Comma-separated. By default, Metro watches all project files.",
|
|
256
|
+
parse: (val: string) =>
|
|
257
|
+
val.split(",").map((folder) => path.resolve(folder)),
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: "--assetPlugins [list]",
|
|
261
|
+
description:
|
|
262
|
+
"Additional asset plugins to be used by the Metro Babel transformer. Comma-separated list containing plugin module names or absolute paths to plugin packages.",
|
|
263
|
+
parse: (val: string) => val.split(","),
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: "--sourceExts [list]",
|
|
267
|
+
description:
|
|
268
|
+
"Additional source-file extensions to include when generating bundles. Comma-separated list, excluding the leading dot.",
|
|
269
|
+
parse: (val: string) => val.split(","),
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "--max-workers [number]",
|
|
273
|
+
description:
|
|
274
|
+
"Specifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.",
|
|
275
|
+
parse: parseInt,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "--reset-cache",
|
|
279
|
+
description: "Reset the Metro cache.",
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
name: "--custom-log-reporter-path [string]",
|
|
283
|
+
description:
|
|
284
|
+
"Path to a JavaScript file which exports a Metro 'TerminalReporter' function. This replaces the default reporter, which writes all messages to the Metro console.",
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: "--https",
|
|
288
|
+
description:
|
|
289
|
+
"Use a secure (https) web server. When not specified, an insecure (http) web server is used.",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: "--key [path]",
|
|
293
|
+
description:
|
|
294
|
+
"Path to a custom SSL private key file to use for secure (https) communication.",
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: "--cert [path]",
|
|
298
|
+
description:
|
|
299
|
+
"Path to a custom SSL certificate file to use for secure (https) communication.",
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "--config [string]",
|
|
303
|
+
description: "Path to the Metro configuration file.",
|
|
304
|
+
parse: (val: string) => path.resolve(val),
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: "--no-interactive",
|
|
308
|
+
description: "Disables interactive mode.",
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "--id [string]",
|
|
312
|
+
description:
|
|
313
|
+
"Specify which bundle configuration to use if server configuration is missing.",
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
};
|
package/src/test.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Config as CLIConfig } from "@react-native-community/cli-types";
|
|
2
2
|
import { error } from "@rnx-kit/console";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
findPackageDir,
|
|
5
|
+
resolveDependencyChain,
|
|
6
|
+
} from "@rnx-kit/tools-node/package";
|
|
4
7
|
import { parsePlatform } from "@rnx-kit/tools-react-native/platform";
|
|
5
|
-
import * as path from "path";
|
|
6
8
|
|
|
7
9
|
type Args = {
|
|
8
10
|
platform: "android" | "ios" | "macos" | "windows" | "win32";
|
|
@@ -20,23 +22,19 @@ type Options = {
|
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
const COMMAND_NAME = "rnx-test";
|
|
23
|
-
|
|
24
|
-
export function resolveJestCli(): string {
|
|
25
|
-
const jestPath = path.dirname(require.resolve("jest/package.json"));
|
|
26
|
-
return require.resolve("jest-cli", { paths: [jestPath] });
|
|
27
|
-
}
|
|
25
|
+
const JEST_CLI = ["jest", "jest-cli"];
|
|
28
26
|
|
|
29
27
|
export function rnxTest(
|
|
30
28
|
_argv: string[],
|
|
31
|
-
|
|
29
|
+
{ root }: CLIConfig,
|
|
32
30
|
{ platform }: Args
|
|
33
31
|
): void {
|
|
34
32
|
const runJest: (argv: string[]) => void = (() => {
|
|
35
33
|
try {
|
|
36
|
-
const { run } = require(
|
|
34
|
+
const { run } = require(resolveDependencyChain(JEST_CLI, root));
|
|
37
35
|
return run;
|
|
38
36
|
} catch (e) {
|
|
39
|
-
error("'rnx-test' is unavailable because 'jest
|
|
37
|
+
error("'rnx-test' is unavailable because 'jest' is not installed");
|
|
40
38
|
throw e;
|
|
41
39
|
}
|
|
42
40
|
})();
|
|
@@ -64,10 +62,21 @@ export function rnxTest(
|
|
|
64
62
|
|
|
65
63
|
export function jestOptions(): Options[] {
|
|
66
64
|
const options = (() => {
|
|
65
|
+
const jestCliPath = (() => {
|
|
66
|
+
try {
|
|
67
|
+
return resolveDependencyChain(JEST_CLI);
|
|
68
|
+
} catch (_) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
})();
|
|
72
|
+
if (!jestCliPath) {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
75
|
+
|
|
67
76
|
try {
|
|
68
77
|
// `yargsOptions` is exported as of 29.5.0
|
|
69
78
|
// https://github.com/jestjs/jest/commit/0e8ed24a527b951efe11ed49da46e0bd8c0ebef9
|
|
70
|
-
const { yargsOptions } = require(
|
|
79
|
+
const { yargsOptions } = require(jestCliPath);
|
|
71
80
|
if (yargsOptions) {
|
|
72
81
|
return yargsOptions;
|
|
73
82
|
}
|
|
@@ -82,7 +91,7 @@ export function jestOptions(): Options[] {
|
|
|
82
91
|
//
|
|
83
92
|
// To work around this, resolve `jest-cli` first, then use the resolved
|
|
84
93
|
// path to import `./build/cli/args`.
|
|
85
|
-
const jestPath = findPackageDir(
|
|
94
|
+
const jestPath = findPackageDir(jestCliPath) || "jest-cli";
|
|
86
95
|
|
|
87
96
|
try {
|
|
88
97
|
// `args.js` was moved in 29.2.0
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Config as CLIConfig } from "@react-native-community/cli-types";
|
|
2
2
|
import { writeThirdPartyNotices } from "@rnx-kit/third-party-notices";
|
|
3
|
+
import { parseBoolean } from "./parsers";
|
|
3
4
|
|
|
4
5
|
type CliThirdPartyNoticesOptions = {
|
|
5
6
|
rootPath: string;
|
|
@@ -38,3 +39,49 @@ export function rnxWriteThirdPartyNotices(
|
|
|
38
39
|
additionalText: additionalText ? [additionalText] : undefined,
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
|
|
43
|
+
export const rnxWriteThirdPartyNoticesCommand = {
|
|
44
|
+
name: "rnx-write-third-party-notices",
|
|
45
|
+
description: "Writes third party notices based on the given bundle",
|
|
46
|
+
func: rnxWriteThirdPartyNotices,
|
|
47
|
+
options: [
|
|
48
|
+
{
|
|
49
|
+
name: "--root-path <path>",
|
|
50
|
+
description:
|
|
51
|
+
"The root of the repo. This is the starting point for finding each module in the source map dependency graph.",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "--source-map-file <file>",
|
|
55
|
+
description:
|
|
56
|
+
"The source map file associated with the package's entry file. This source map eventually leads to all package dependencies and their licenses.",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "--json",
|
|
60
|
+
description: "Format the 3rd-party notice file as JSON instead of text.",
|
|
61
|
+
default: false,
|
|
62
|
+
parse: parseBoolean,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "--output-file [file]",
|
|
66
|
+
description: "The path to use when writing the 3rd-party notice file.",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "--ignore-scopes [string]",
|
|
70
|
+
description:
|
|
71
|
+
"Comma-separated list of `npm` scopes to ignore when traversing the source map dependency graph.",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "--ignore-modules [string]",
|
|
75
|
+
description:
|
|
76
|
+
"Comma-separated list of modules to ignore when traversing the source map dependency graph.",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "--preamble-text [string]",
|
|
80
|
+
description: "A string to prepend to the start of the 3rd-party notice.",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "--additional-text [path]",
|
|
84
|
+
description: "A string to append to the end of the 3rd-party notice.",
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
package/test/__mocks__/fs.js
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { vol } = require("memfs");
|
|
4
|
-
|
|
5
|
-
/** @type {(newMockFiles: { [filename: string]: string }) => void} */
|
|
6
|
-
fs.__setMockFiles = (files) => {
|
|
7
|
-
vol.reset();
|
|
8
|
-
vol.fromJSON(files);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
fs.__toJSON = () => vol.toJSON();
|
|
12
|
-
|
|
13
|
-
fs.lstat = (...args) => Promise.resolve(vol.lstat(...args));
|
|
14
|
-
fs.lstatSync = (...args) => vol.lstatSync(...args);
|
|
15
|
-
fs.mkdirSync = (...args) => vol.mkdirSync(...args);
|
|
16
|
-
fs.readFileSync = (...args) => vol.readFileSync(...args);
|
|
17
|
-
fs.stat = (...args) => Promise.resolve(vol.stat(...args));
|
|
18
|
-
fs.statSync = (...args) => vol.statSync(...args);
|
|
19
|
-
|
|
20
|
-
module.exports = fs;
|
|
1
|
+
module.exports = require("@rnx-kit/metro-plugin-duplicates-checker/test/__mocks__/fs");
|
package/test/test.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jestOptions
|
|
1
|
+
import { jestOptions } from "../src/test";
|
|
2
2
|
|
|
3
3
|
describe("rnx-test", () => {
|
|
4
4
|
test("retrieves options from 'jest-cli'", () => {
|
|
@@ -8,10 +8,4 @@ describe("rnx-test", () => {
|
|
|
8
8
|
const updateSnapshot = options.find(({ name }) => name.startsWith("-u,"));
|
|
9
9
|
expect(updateSnapshot).toBeDefined();
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
test("resolves 'jest-cli' starting from 'jest'", () => {
|
|
13
|
-
expect(resolveJestCli()).toMatch(
|
|
14
|
-
/node_modules[/\\]jest-cli[/\\]build[/\\]index.js$/
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
11
|
});
|