@rnx-kit/cli 0.16.26 → 0.16.28
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/lib/align-deps.js +6 -0
- package/lib/bundle/cliOptions.d.ts +4 -4
- package/lib/bundle/cliOptions.js +3 -3
- package/lib/bundle.d.ts +4 -4
- package/lib/bundle.js +1 -1
- package/lib/clean.d.ts +2 -1
- package/lib/clean.js +2 -1
- package/lib/index.d.ts +11 -13
- package/lib/index.js +3 -3
- package/lib/parsers.d.ts +4 -2
- package/lib/parsers.js +45 -12
- package/lib/ram-bundle.d.ts +3 -3
- package/lib/start.d.ts +4 -3
- package/lib/start.js +8 -7
- package/lib/write-third-party-notices.d.ts +0 -3
- package/lib/write-third-party-notices.js +0 -2
- package/package.json +2 -2
- package/src/align-deps.ts +5 -0
- package/src/bundle/cliOptions.ts +4 -4
- package/src/bundle.ts +2 -2
- package/src/clean.ts +2 -1
- package/src/index.ts +1 -1
- package/src/parsers.ts +21 -11
- package/src/start.ts +8 -8
- package/src/write-third-party-notices.ts +0 -2
package/lib/align-deps.js
CHANGED
|
@@ -12,8 +12,10 @@ const optionsMap = {
|
|
|
12
12
|
"set-version": "setVersion",
|
|
13
13
|
};
|
|
14
14
|
function rnxAlignDeps(argv, _config, args) {
|
|
15
|
+
var _a;
|
|
15
16
|
(0, align_deps_1.cli)({
|
|
16
17
|
...(0, properties_1.pickValues)(args, Object.values(optionsMap), Object.keys(optionsMap)),
|
|
18
|
+
"diff-mode": (_a = args.diffMode) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
17
19
|
loose: Boolean(args.loose),
|
|
18
20
|
"migrate-config": Boolean(args.migrateConfig),
|
|
19
21
|
"no-unmanaged": Boolean(args.noUnmanaged),
|
|
@@ -28,6 +30,10 @@ exports.rnxAlignDepsCommand = {
|
|
|
28
30
|
description: "Manage dependencies within a repository and across many repositories",
|
|
29
31
|
func: rnxAlignDeps,
|
|
30
32
|
options: [
|
|
33
|
+
{
|
|
34
|
+
name: `--diff-mode [${align_deps_1.cliOptions["diff-mode"].choices.join("|")}]`,
|
|
35
|
+
description: align_deps_1.cliOptions["diff-mode"].description,
|
|
36
|
+
},
|
|
31
37
|
{
|
|
32
38
|
name: "--exclude-packages [packages]",
|
|
33
39
|
description: align_deps_1.cliOptions["exclude-packages"].description,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parsePlatform } from "@rnx-kit/tools-react-native/platform";
|
|
2
|
-
import {
|
|
2
|
+
import { asBoolean, asNumber, parseTransformProfile } from "../parsers";
|
|
3
3
|
export declare const commonBundleCommandOptions: ({
|
|
4
4
|
name: string;
|
|
5
5
|
description: string;
|
|
@@ -14,11 +14,11 @@ export declare const commonBundleCommandOptions: ({
|
|
|
14
14
|
name: string;
|
|
15
15
|
description: string;
|
|
16
16
|
default: boolean;
|
|
17
|
-
parse: typeof
|
|
17
|
+
parse: typeof asBoolean;
|
|
18
18
|
} | {
|
|
19
19
|
name: string;
|
|
20
20
|
description: string;
|
|
21
|
-
parse: typeof
|
|
21
|
+
parse: typeof asBoolean;
|
|
22
22
|
default?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
name: string;
|
|
@@ -28,7 +28,7 @@ export declare const commonBundleCommandOptions: ({
|
|
|
28
28
|
} | {
|
|
29
29
|
name: string;
|
|
30
30
|
description: string;
|
|
31
|
-
parse: typeof
|
|
31
|
+
parse: typeof asNumber;
|
|
32
32
|
default?: undefined;
|
|
33
33
|
} | {
|
|
34
34
|
name: string;
|
package/lib/bundle/cliOptions.js
CHANGED
|
@@ -21,12 +21,12 @@ exports.commonBundleCommandOptions = [
|
|
|
21
21
|
name: "--dev [boolean]",
|
|
22
22
|
description: "If false, warnings are disabled and the bundle is minified.",
|
|
23
23
|
default: true,
|
|
24
|
-
parse: parsers_1.
|
|
24
|
+
parse: parsers_1.asBoolean,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: "--minify [boolean]",
|
|
28
28
|
description: "Controls whether or not the bundle is minified. Disabling minification is useful for test builds.",
|
|
29
|
-
parse: parsers_1.
|
|
29
|
+
parse: parsers_1.asBoolean,
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
name: "--bundle-output [string]",
|
|
@@ -40,7 +40,7 @@ exports.commonBundleCommandOptions = [
|
|
|
40
40
|
{
|
|
41
41
|
name: "--max-workers [number]",
|
|
42
42
|
description: "Specifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.",
|
|
43
|
-
parse:
|
|
43
|
+
parse: parsers_1.asNumber,
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
name: "--sourcemap-output [string]",
|
package/lib/bundle.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config as CLIConfig } from "@react-native-community/cli-types";
|
|
2
2
|
import type { CLICommonBundleOptions } from "./bundle/types";
|
|
3
|
-
import {
|
|
3
|
+
import { asBoolean } from "./parsers";
|
|
4
4
|
type CLIBundleOptions = CLICommonBundleOptions & {
|
|
5
5
|
treeShake?: boolean;
|
|
6
6
|
};
|
|
@@ -23,11 +23,11 @@ export declare const rnxBundleCommand: {
|
|
|
23
23
|
name: string;
|
|
24
24
|
description: string;
|
|
25
25
|
default: boolean;
|
|
26
|
-
parse: typeof
|
|
26
|
+
parse: typeof asBoolean;
|
|
27
27
|
} | {
|
|
28
28
|
name: string;
|
|
29
29
|
description: string;
|
|
30
|
-
parse: typeof
|
|
30
|
+
parse: typeof asBoolean;
|
|
31
31
|
default?: undefined;
|
|
32
32
|
} | {
|
|
33
33
|
name: string;
|
|
@@ -37,7 +37,7 @@ export declare const rnxBundleCommand: {
|
|
|
37
37
|
} | {
|
|
38
38
|
name: string;
|
|
39
39
|
description: string;
|
|
40
|
-
parse: typeof
|
|
40
|
+
parse: typeof import("./parsers").asNumber;
|
|
41
41
|
default?: undefined;
|
|
42
42
|
} | {
|
|
43
43
|
name: string;
|
package/lib/bundle.js
CHANGED
package/lib/clean.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Config as CLIConfig } from "@react-native-community/cli-types";
|
|
2
|
+
import { asResolvedPath } from "./parsers";
|
|
2
3
|
type Args = {
|
|
3
4
|
include?: string;
|
|
4
5
|
projectRoot?: string;
|
|
@@ -18,7 +19,7 @@ export declare const rnxCleanCommand: {
|
|
|
18
19
|
name: string;
|
|
19
20
|
description: string;
|
|
20
21
|
default: string;
|
|
21
|
-
parse:
|
|
22
|
+
parse: typeof asResolvedPath;
|
|
22
23
|
} | {
|
|
23
24
|
name: string;
|
|
24
25
|
description: string;
|
package/lib/clean.js
CHANGED
|
@@ -32,6 +32,7 @@ const fs = __importStar(require("fs-extra"));
|
|
|
32
32
|
const ora_1 = __importDefault(require("ora"));
|
|
33
33
|
const os = __importStar(require("os"));
|
|
34
34
|
const path = __importStar(require("path"));
|
|
35
|
+
const parsers_1 = require("./parsers");
|
|
35
36
|
const external_1 = require("./serve/external");
|
|
36
37
|
async function rnxClean(_argv, _config, cliOptions) {
|
|
37
38
|
var _a, _b, _c;
|
|
@@ -201,7 +202,7 @@ exports.rnxCleanCommand = {
|
|
|
201
202
|
name: "--project-root <path>",
|
|
202
203
|
description: "Root path to your React Native project",
|
|
203
204
|
default: process.cwd(),
|
|
204
|
-
parse:
|
|
205
|
+
parse: parsers_1.asResolvedPath,
|
|
205
206
|
},
|
|
206
207
|
{
|
|
207
208
|
name: "--verify",
|
package/lib/index.d.ts
CHANGED
|
@@ -25,11 +25,11 @@ export declare const reactNativeConfig: {
|
|
|
25
25
|
name: string;
|
|
26
26
|
description: string;
|
|
27
27
|
default: boolean;
|
|
28
|
-
parse: typeof import("./parsers").
|
|
28
|
+
parse: typeof import("./parsers").asBoolean;
|
|
29
29
|
} | {
|
|
30
30
|
name: string;
|
|
31
31
|
description: string;
|
|
32
|
-
parse: typeof import("./parsers").
|
|
32
|
+
parse: typeof import("./parsers").asBoolean;
|
|
33
33
|
default?: undefined;
|
|
34
34
|
} | {
|
|
35
35
|
name: string;
|
|
@@ -39,7 +39,7 @@ export declare const reactNativeConfig: {
|
|
|
39
39
|
} | {
|
|
40
40
|
name: string;
|
|
41
41
|
description: string;
|
|
42
|
-
parse: typeof
|
|
42
|
+
parse: typeof import("./parsers").asNumber;
|
|
43
43
|
default?: undefined;
|
|
44
44
|
} | {
|
|
45
45
|
name: string;
|
|
@@ -60,7 +60,7 @@ export declare const reactNativeConfig: {
|
|
|
60
60
|
name: string;
|
|
61
61
|
description: string;
|
|
62
62
|
default: string;
|
|
63
|
-
parse: (
|
|
63
|
+
parse: typeof import("./parsers").asResolvedPath;
|
|
64
64
|
} | {
|
|
65
65
|
name: string;
|
|
66
66
|
description: string;
|
|
@@ -105,11 +105,11 @@ export declare const reactNativeConfig: {
|
|
|
105
105
|
name: string;
|
|
106
106
|
description: string;
|
|
107
107
|
default: boolean;
|
|
108
|
-
parse: typeof import("./parsers").
|
|
108
|
+
parse: typeof import("./parsers").asBoolean;
|
|
109
109
|
} | {
|
|
110
110
|
name: string;
|
|
111
111
|
description: string;
|
|
112
|
-
parse: typeof import("./parsers").
|
|
112
|
+
parse: typeof import("./parsers").asBoolean;
|
|
113
113
|
default?: undefined;
|
|
114
114
|
} | {
|
|
115
115
|
name: string;
|
|
@@ -119,7 +119,7 @@ export declare const reactNativeConfig: {
|
|
|
119
119
|
} | {
|
|
120
120
|
name: string;
|
|
121
121
|
description: string;
|
|
122
|
-
parse: typeof
|
|
122
|
+
parse: typeof import("./parsers").asNumber;
|
|
123
123
|
default?: undefined;
|
|
124
124
|
} | {
|
|
125
125
|
name: string;
|
|
@@ -134,7 +134,7 @@ export declare const reactNativeConfig: {
|
|
|
134
134
|
options: ({
|
|
135
135
|
name: string;
|
|
136
136
|
description: string;
|
|
137
|
-
parse: typeof
|
|
137
|
+
parse: typeof import("./parsers").asNumber;
|
|
138
138
|
default: number;
|
|
139
139
|
} | {
|
|
140
140
|
name: string;
|
|
@@ -144,7 +144,7 @@ export declare const reactNativeConfig: {
|
|
|
144
144
|
} | {
|
|
145
145
|
name: string;
|
|
146
146
|
description: string;
|
|
147
|
-
parse: (
|
|
147
|
+
parse: typeof import("./parsers").asResolvedPath;
|
|
148
148
|
default?: undefined;
|
|
149
149
|
} | {
|
|
150
150
|
name: string;
|
|
@@ -154,7 +154,7 @@ export declare const reactNativeConfig: {
|
|
|
154
154
|
} | {
|
|
155
155
|
name: string;
|
|
156
156
|
description: string;
|
|
157
|
-
parse: typeof
|
|
157
|
+
parse: typeof import("./parsers").asNumber;
|
|
158
158
|
default?: undefined;
|
|
159
159
|
} | {
|
|
160
160
|
name: string;
|
|
@@ -180,12 +180,10 @@ export declare const reactNativeConfig: {
|
|
|
180
180
|
name: string;
|
|
181
181
|
description: string;
|
|
182
182
|
default?: undefined;
|
|
183
|
-
parse?: undefined;
|
|
184
183
|
} | {
|
|
185
184
|
name: string;
|
|
186
185
|
description: string;
|
|
187
186
|
default: boolean;
|
|
188
|
-
parse: typeof import("./parsers").parseBoolean;
|
|
189
187
|
})[];
|
|
190
188
|
})[];
|
|
191
189
|
};
|
|
@@ -193,7 +191,7 @@ export { rnxAlignDeps, rnxAlignDepsCommand } from "./align-deps";
|
|
|
193
191
|
export { rnxBundle, rnxBundleCommand } from "./bundle";
|
|
194
192
|
export { rnxClean, rnxCleanCommand } from "./clean";
|
|
195
193
|
export { copyProjectAssets, rnxCopyAssetsCommand } from "./copy-assets";
|
|
196
|
-
export {
|
|
194
|
+
export { asBoolean, asNumber, parseTransformProfile } from "./parsers";
|
|
197
195
|
export { rnxRamBundle, rnxRamBundleCommand } from "./ram-bundle";
|
|
198
196
|
export { rnxStart, rnxStartCommand } from "./start";
|
|
199
197
|
export { rnxTest, rnxTestCommand } from "./test";
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rnxWriteThirdPartyNoticesCommand = exports.rnxWriteThirdPartyNotices = exports.rnxTestCommand = exports.rnxTest = exports.rnxStartCommand = exports.rnxStart = exports.rnxRamBundleCommand = exports.rnxRamBundle = exports.parseTransformProfile = exports.
|
|
3
|
+
exports.rnxWriteThirdPartyNoticesCommand = exports.rnxWriteThirdPartyNotices = exports.rnxTestCommand = exports.rnxTest = exports.rnxStartCommand = exports.rnxStart = exports.rnxRamBundleCommand = exports.rnxRamBundle = exports.parseTransformProfile = exports.asNumber = exports.asBoolean = exports.rnxCopyAssetsCommand = exports.copyProjectAssets = exports.rnxCleanCommand = exports.rnxClean = exports.rnxBundleCommand = exports.rnxBundle = exports.rnxAlignDepsCommand = exports.rnxAlignDeps = exports.reactNativeConfig = void 0;
|
|
4
4
|
const align_deps_1 = require("./align-deps");
|
|
5
5
|
const bundle_1 = require("./bundle");
|
|
6
6
|
const clean_1 = require("./clean");
|
|
@@ -34,8 +34,8 @@ var copy_assets_2 = require("./copy-assets");
|
|
|
34
34
|
Object.defineProperty(exports, "copyProjectAssets", { enumerable: true, get: function () { return copy_assets_2.copyProjectAssets; } });
|
|
35
35
|
Object.defineProperty(exports, "rnxCopyAssetsCommand", { enumerable: true, get: function () { return copy_assets_2.rnxCopyAssetsCommand; } });
|
|
36
36
|
var parsers_1 = require("./parsers");
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
Object.defineProperty(exports, "
|
|
37
|
+
Object.defineProperty(exports, "asBoolean", { enumerable: true, get: function () { return parsers_1.asBoolean; } });
|
|
38
|
+
Object.defineProperty(exports, "asNumber", { enumerable: true, get: function () { return parsers_1.asNumber; } });
|
|
39
39
|
Object.defineProperty(exports, "parseTransformProfile", { enumerable: true, get: function () { return parsers_1.parseTransformProfile; } });
|
|
40
40
|
var ram_bundle_2 = require("./ram-bundle");
|
|
41
41
|
Object.defineProperty(exports, "rnxRamBundle", { enumerable: true, get: function () { return ram_bundle_2.rnxRamBundle; } });
|
package/lib/parsers.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TransformProfile } from "metro-babel-transformer";
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
2
|
+
export declare function asBoolean(value: string): boolean;
|
|
3
|
+
export declare function asNumber(value: string): number;
|
|
4
|
+
export declare function asResolvedPath(value: string): string;
|
|
5
|
+
export declare function asStringArray(value: string): string[];
|
|
4
6
|
export declare function parseTransformProfile(val: string): TransformProfile;
|
|
5
7
|
//# sourceMappingURL=parsers.d.ts.map
|
package/lib/parsers.js
CHANGED
|
@@ -1,20 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (
|
|
6
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.parseTransformProfile = exports.asStringArray = exports.asResolvedPath = exports.asNumber = exports.asBoolean = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
function asBoolean(value) {
|
|
29
|
+
switch (value) {
|
|
30
|
+
case "false":
|
|
31
|
+
return false;
|
|
32
|
+
case "true":
|
|
33
|
+
return true;
|
|
34
|
+
default:
|
|
35
|
+
throw new Error("Invalid boolean value '" + value + "' — must be true or false");
|
|
10
36
|
}
|
|
11
|
-
throw new Error("Invalid boolean value '" + val + "' -- must be true or false");
|
|
12
37
|
}
|
|
13
|
-
exports.
|
|
14
|
-
function
|
|
15
|
-
return
|
|
38
|
+
exports.asBoolean = asBoolean;
|
|
39
|
+
function asNumber(value) {
|
|
40
|
+
return Number(value);
|
|
41
|
+
}
|
|
42
|
+
exports.asNumber = asNumber;
|
|
43
|
+
function asResolvedPath(value) {
|
|
44
|
+
return path.resolve(value);
|
|
45
|
+
}
|
|
46
|
+
exports.asResolvedPath = asResolvedPath;
|
|
47
|
+
function asStringArray(value) {
|
|
48
|
+
return value.split(",");
|
|
16
49
|
}
|
|
17
|
-
exports.
|
|
50
|
+
exports.asStringArray = asStringArray;
|
|
18
51
|
function parseTransformProfile(val) {
|
|
19
52
|
const allowedProfiles = [
|
|
20
53
|
"hermes-stable",
|
package/lib/ram-bundle.d.ts
CHANGED
|
@@ -22,11 +22,11 @@ export declare const rnxRamBundleCommand: {
|
|
|
22
22
|
name: string;
|
|
23
23
|
description: string;
|
|
24
24
|
default: boolean;
|
|
25
|
-
parse: typeof import("./parsers").
|
|
25
|
+
parse: typeof import("./parsers").asBoolean;
|
|
26
26
|
} | {
|
|
27
27
|
name: string;
|
|
28
28
|
description: string;
|
|
29
|
-
parse: typeof import("./parsers").
|
|
29
|
+
parse: typeof import("./parsers").asBoolean;
|
|
30
30
|
default?: undefined;
|
|
31
31
|
} | {
|
|
32
32
|
name: string;
|
|
@@ -36,7 +36,7 @@ export declare const rnxRamBundleCommand: {
|
|
|
36
36
|
} | {
|
|
37
37
|
name: string;
|
|
38
38
|
description: string;
|
|
39
|
-
parse: typeof
|
|
39
|
+
parse: typeof import("./parsers").asNumber;
|
|
40
40
|
default?: undefined;
|
|
41
41
|
} | {
|
|
42
42
|
name: string;
|
package/lib/start.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Config } from "@react-native-community/cli-types";
|
|
2
|
+
import { asNumber, asResolvedPath } from "./parsers";
|
|
2
3
|
import type { StartCommandArgs } from "./serve/types";
|
|
3
4
|
export declare function rnxStart(_argv: string[], ctx: Config, args: StartCommandArgs): Promise<void>;
|
|
4
5
|
export declare const rnxStartCommand: {
|
|
@@ -8,7 +9,7 @@ export declare const rnxStartCommand: {
|
|
|
8
9
|
options: ({
|
|
9
10
|
name: string;
|
|
10
11
|
description: string;
|
|
11
|
-
parse: typeof
|
|
12
|
+
parse: typeof asNumber;
|
|
12
13
|
default: number;
|
|
13
14
|
} | {
|
|
14
15
|
name: string;
|
|
@@ -18,7 +19,7 @@ export declare const rnxStartCommand: {
|
|
|
18
19
|
} | {
|
|
19
20
|
name: string;
|
|
20
21
|
description: string;
|
|
21
|
-
parse:
|
|
22
|
+
parse: typeof asResolvedPath;
|
|
22
23
|
default?: undefined;
|
|
23
24
|
} | {
|
|
24
25
|
name: string;
|
|
@@ -28,7 +29,7 @@ export declare const rnxStartCommand: {
|
|
|
28
29
|
} | {
|
|
29
30
|
name: string;
|
|
30
31
|
description: string;
|
|
31
|
-
parse: typeof
|
|
32
|
+
parse: typeof asNumber;
|
|
32
33
|
default?: undefined;
|
|
33
34
|
} | {
|
|
34
35
|
name: string;
|
package/lib/start.js
CHANGED
|
@@ -28,6 +28,7 @@ const logger = __importStar(require("@rnx-kit/console"));
|
|
|
28
28
|
const metro_service_1 = require("@rnx-kit/metro-service");
|
|
29
29
|
const path = __importStar(require("path"));
|
|
30
30
|
const metro_config_1 = require("./metro-config");
|
|
31
|
+
const parsers_1 = require("./parsers");
|
|
31
32
|
const external_1 = require("./serve/external");
|
|
32
33
|
const help_1 = require("./serve/help");
|
|
33
34
|
const keyboard_1 = require("./serve/keyboard");
|
|
@@ -193,7 +194,7 @@ exports.rnxStartCommand = {
|
|
|
193
194
|
{
|
|
194
195
|
name: "--port [number]",
|
|
195
196
|
description: "Host port to use when listening for incoming server requests.",
|
|
196
|
-
parse:
|
|
197
|
+
parse: parsers_1.asNumber,
|
|
197
198
|
default: 8081,
|
|
198
199
|
},
|
|
199
200
|
{
|
|
@@ -204,27 +205,27 @@ exports.rnxStartCommand = {
|
|
|
204
205
|
{
|
|
205
206
|
name: "--projectRoot [path]",
|
|
206
207
|
description: "Path to the root of your react-native project. The bundle server uses this root path to resolve all web requests.",
|
|
207
|
-
parse:
|
|
208
|
+
parse: parsers_1.asResolvedPath,
|
|
208
209
|
},
|
|
209
210
|
{
|
|
210
211
|
name: "--watchFolders [paths]",
|
|
211
212
|
description: "Additional folders which will be added to the file-watch list. Comma-separated. By default, Metro watches all project files.",
|
|
212
|
-
parse: (val) =>
|
|
213
|
+
parse: (val) => (0, parsers_1.asStringArray)(val).map(parsers_1.asResolvedPath),
|
|
213
214
|
},
|
|
214
215
|
{
|
|
215
216
|
name: "--assetPlugins [list]",
|
|
216
217
|
description: "Additional asset plugins to be used by the Metro Babel transformer. Comma-separated list containing plugin module names or absolute paths to plugin packages.",
|
|
217
|
-
parse:
|
|
218
|
+
parse: parsers_1.asStringArray,
|
|
218
219
|
},
|
|
219
220
|
{
|
|
220
221
|
name: "--sourceExts [list]",
|
|
221
222
|
description: "Additional source-file extensions to include when generating bundles. Comma-separated list, excluding the leading dot.",
|
|
222
|
-
parse:
|
|
223
|
+
parse: parsers_1.asStringArray,
|
|
223
224
|
},
|
|
224
225
|
{
|
|
225
226
|
name: "--max-workers [number]",
|
|
226
227
|
description: "Specifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.",
|
|
227
|
-
parse:
|
|
228
|
+
parse: parsers_1.asNumber,
|
|
228
229
|
},
|
|
229
230
|
{
|
|
230
231
|
name: "--reset-cache",
|
|
@@ -249,7 +250,7 @@ exports.rnxStartCommand = {
|
|
|
249
250
|
{
|
|
250
251
|
name: "--config [string]",
|
|
251
252
|
description: "Path to the Metro configuration file.",
|
|
252
|
-
parse:
|
|
253
|
+
parse: parsers_1.asResolvedPath,
|
|
253
254
|
},
|
|
254
255
|
{
|
|
255
256
|
name: "--no-interactive",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Config as CLIConfig } from "@react-native-community/cli-types";
|
|
2
|
-
import { parseBoolean } from "./parsers";
|
|
3
2
|
type CliThirdPartyNoticesOptions = {
|
|
4
3
|
rootPath: string;
|
|
5
4
|
sourceMapFile: string;
|
|
@@ -19,12 +18,10 @@ export declare const rnxWriteThirdPartyNoticesCommand: {
|
|
|
19
18
|
name: string;
|
|
20
19
|
description: string;
|
|
21
20
|
default?: undefined;
|
|
22
|
-
parse?: undefined;
|
|
23
21
|
} | {
|
|
24
22
|
name: string;
|
|
25
23
|
description: string;
|
|
26
24
|
default: boolean;
|
|
27
|
-
parse: typeof parseBoolean;
|
|
28
25
|
})[];
|
|
29
26
|
};
|
|
30
27
|
export {};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rnxWriteThirdPartyNoticesCommand = exports.rnxWriteThirdPartyNotices = void 0;
|
|
4
4
|
const third_party_notices_1 = require("@rnx-kit/third-party-notices");
|
|
5
|
-
const parsers_1 = require("./parsers");
|
|
6
5
|
function rnxWriteThirdPartyNotices(_argv, _config, { additionalText, ignoreModules, ignoreScopes, json, outputFile, preambleText, rootPath, sourceMapFile, }) {
|
|
7
6
|
// react-native-cli is not as rich as yargs, so we have to perform a mapping.
|
|
8
7
|
(0, third_party_notices_1.writeThirdPartyNotices)({
|
|
@@ -34,7 +33,6 @@ exports.rnxWriteThirdPartyNoticesCommand = {
|
|
|
34
33
|
name: "--json",
|
|
35
34
|
description: "Format the 3rd-party notice file as JSON instead of text.",
|
|
36
35
|
default: false,
|
|
37
|
-
parse: parsers_1.parseBoolean,
|
|
38
36
|
},
|
|
39
37
|
{
|
|
40
38
|
name: "--output-file [file]",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnx-kit/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.28",
|
|
4
4
|
"description": "Command-line interface for working with kit packages in your repo",
|
|
5
5
|
"homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/cli#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"test": "rnx-kit-scripts test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@rnx-kit/align-deps": "^2.
|
|
40
|
+
"@rnx-kit/align-deps": "^2.5.0",
|
|
41
41
|
"@rnx-kit/config": "^0.6.6",
|
|
42
42
|
"@rnx-kit/console": "^1.1.0",
|
|
43
43
|
"@rnx-kit/metro-plugin-cyclic-dependencies-detector": "^1.1.1",
|
package/src/align-deps.ts
CHANGED
|
@@ -19,6 +19,7 @@ export function rnxAlignDeps(
|
|
|
19
19
|
): void {
|
|
20
20
|
cli({
|
|
21
21
|
...pickValues(args, Object.values(optionsMap), Object.keys(optionsMap)),
|
|
22
|
+
"diff-mode": args.diffMode?.toString(),
|
|
22
23
|
loose: Boolean(args.loose),
|
|
23
24
|
"migrate-config": Boolean(args.migrateConfig),
|
|
24
25
|
"no-unmanaged": Boolean(args.noUnmanaged),
|
|
@@ -34,6 +35,10 @@ export const rnxAlignDepsCommand = {
|
|
|
34
35
|
"Manage dependencies within a repository and across many repositories",
|
|
35
36
|
func: rnxAlignDeps,
|
|
36
37
|
options: [
|
|
38
|
+
{
|
|
39
|
+
name: `--diff-mode [${cliOptions["diff-mode"].choices.join("|")}]`,
|
|
40
|
+
description: cliOptions["diff-mode"].description,
|
|
41
|
+
},
|
|
37
42
|
{
|
|
38
43
|
name: "--exclude-packages [packages]",
|
|
39
44
|
description: cliOptions["exclude-packages"].description,
|
package/src/bundle/cliOptions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parsePlatform } from "@rnx-kit/tools-react-native/platform";
|
|
2
|
-
import {
|
|
2
|
+
import { asBoolean, asNumber, parseTransformProfile } from "../parsers";
|
|
3
3
|
|
|
4
4
|
export const commonBundleCommandOptions = [
|
|
5
5
|
{
|
|
@@ -22,13 +22,13 @@ export const commonBundleCommandOptions = [
|
|
|
22
22
|
name: "--dev [boolean]",
|
|
23
23
|
description: "If false, warnings are disabled and the bundle is minified.",
|
|
24
24
|
default: true,
|
|
25
|
-
parse:
|
|
25
|
+
parse: asBoolean,
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
name: "--minify [boolean]",
|
|
29
29
|
description:
|
|
30
30
|
"Controls whether or not the bundle is minified. Disabling minification is useful for test builds.",
|
|
31
|
-
parse:
|
|
31
|
+
parse: asBoolean,
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
name: "--bundle-output [string]",
|
|
@@ -44,7 +44,7 @@ export const commonBundleCommandOptions = [
|
|
|
44
44
|
name: "--max-workers [number]",
|
|
45
45
|
description:
|
|
46
46
|
"Specifies the maximum number of parallel worker threads to use for transforming files. This defaults to the number of cores available on your machine.",
|
|
47
|
-
parse:
|
|
47
|
+
parse: asNumber,
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
name: "--sourcemap-output [string]",
|
package/src/bundle.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
overridableCommonBundleOptions,
|
|
10
10
|
} from "./bundle/overrides";
|
|
11
11
|
import type { CLICommonBundleOptions } from "./bundle/types";
|
|
12
|
-
import {
|
|
12
|
+
import { asBoolean } from "./parsers";
|
|
13
13
|
|
|
14
14
|
type CLIBundleOptions = CLICommonBundleOptions & {
|
|
15
15
|
treeShake?: boolean;
|
|
@@ -63,7 +63,7 @@ export const rnxBundleCommand = {
|
|
|
63
63
|
name: "--tree-shake [boolean]",
|
|
64
64
|
description:
|
|
65
65
|
"Enable tree shaking to remove unused code and reduce the bundle size.",
|
|
66
|
-
parse:
|
|
66
|
+
parse: asBoolean,
|
|
67
67
|
},
|
|
68
68
|
],
|
|
69
69
|
};
|
package/src/clean.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as fs from "fs-extra";
|
|
|
4
4
|
import ora from "ora";
|
|
5
5
|
import * as os from "os";
|
|
6
6
|
import * as path from "path";
|
|
7
|
+
import { asResolvedPath } from "./parsers";
|
|
7
8
|
import { requireExternal } from "./serve/external";
|
|
8
9
|
|
|
9
10
|
type Args = {
|
|
@@ -211,7 +212,7 @@ export const rnxCleanCommand = {
|
|
|
211
212
|
name: "--project-root <path>",
|
|
212
213
|
description: "Root path to your React Native project",
|
|
213
214
|
default: process.cwd(),
|
|
214
|
-
parse:
|
|
215
|
+
parse: asResolvedPath,
|
|
215
216
|
},
|
|
216
217
|
{
|
|
217
218
|
name: "--verify",
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { rnxAlignDeps, rnxAlignDepsCommand } from "./align-deps";
|
|
|
24
24
|
export { rnxBundle, rnxBundleCommand } from "./bundle";
|
|
25
25
|
export { rnxClean, rnxCleanCommand } from "./clean";
|
|
26
26
|
export { copyProjectAssets, rnxCopyAssetsCommand } from "./copy-assets";
|
|
27
|
-
export {
|
|
27
|
+
export { asBoolean, asNumber, parseTransformProfile } from "./parsers";
|
|
28
28
|
export { rnxRamBundle, rnxRamBundleCommand } from "./ram-bundle";
|
|
29
29
|
export { rnxStart, rnxStartCommand } from "./start";
|
|
30
30
|
export { rnxTest, rnxTestCommand } from "./test";
|
package/src/parsers.ts
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import type { TransformProfile } from "metro-babel-transformer";
|
|
2
|
+
import * as path from "path";
|
|
2
3
|
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export function asBoolean(value: string): boolean {
|
|
5
|
+
switch (value) {
|
|
6
|
+
case "false":
|
|
7
|
+
return false;
|
|
8
|
+
case "true":
|
|
9
|
+
return true;
|
|
10
|
+
default:
|
|
11
|
+
throw new Error(
|
|
12
|
+
"Invalid boolean value '" + value + "' — must be true or false"
|
|
13
|
+
);
|
|
6
14
|
}
|
|
7
|
-
if (val === "true") {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
throw new Error(
|
|
11
|
-
"Invalid boolean value '" + val + "' -- must be true or false"
|
|
12
|
-
);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export function
|
|
16
|
-
return
|
|
17
|
+
export function asNumber(value: string): number {
|
|
18
|
+
return Number(value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function asResolvedPath(value: string): string {
|
|
22
|
+
return path.resolve(value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function asStringArray(value: string): string[] {
|
|
26
|
+
return value.split(",");
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
export function parseTransformProfile(val: string): TransformProfile {
|
package/src/start.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { Middleware } from "metro-config";
|
|
|
12
12
|
import type Server from "metro/src/Server";
|
|
13
13
|
import * as path from "path";
|
|
14
14
|
import { customizeMetroConfig } from "./metro-config";
|
|
15
|
+
import { asNumber, asResolvedPath, asStringArray } from "./parsers";
|
|
15
16
|
import { requireExternal } from "./serve/external";
|
|
16
17
|
import { makeHelp } from "./serve/help";
|
|
17
18
|
import { attachKeyHandlers } from "./serve/keyboard";
|
|
@@ -234,7 +235,7 @@ export const rnxStartCommand = {
|
|
|
234
235
|
name: "--port [number]",
|
|
235
236
|
description:
|
|
236
237
|
"Host port to use when listening for incoming server requests.",
|
|
237
|
-
parse:
|
|
238
|
+
parse: asNumber,
|
|
238
239
|
default: 8081,
|
|
239
240
|
},
|
|
240
241
|
{
|
|
@@ -247,32 +248,31 @@ export const rnxStartCommand = {
|
|
|
247
248
|
name: "--projectRoot [path]",
|
|
248
249
|
description:
|
|
249
250
|
"Path to the root of your react-native project. The bundle server uses this root path to resolve all web requests.",
|
|
250
|
-
parse:
|
|
251
|
+
parse: asResolvedPath,
|
|
251
252
|
},
|
|
252
253
|
{
|
|
253
254
|
name: "--watchFolders [paths]",
|
|
254
255
|
description:
|
|
255
256
|
"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)),
|
|
257
|
+
parse: (val: string) => asStringArray(val).map(asResolvedPath),
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
name: "--assetPlugins [list]",
|
|
261
261
|
description:
|
|
262
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:
|
|
263
|
+
parse: asStringArray,
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
name: "--sourceExts [list]",
|
|
267
267
|
description:
|
|
268
268
|
"Additional source-file extensions to include when generating bundles. Comma-separated list, excluding the leading dot.",
|
|
269
|
-
parse:
|
|
269
|
+
parse: asStringArray,
|
|
270
270
|
},
|
|
271
271
|
{
|
|
272
272
|
name: "--max-workers [number]",
|
|
273
273
|
description:
|
|
274
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:
|
|
275
|
+
parse: asNumber,
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
name: "--reset-cache",
|
|
@@ -301,7 +301,7 @@ export const rnxStartCommand = {
|
|
|
301
301
|
{
|
|
302
302
|
name: "--config [string]",
|
|
303
303
|
description: "Path to the Metro configuration file.",
|
|
304
|
-
parse:
|
|
304
|
+
parse: asResolvedPath,
|
|
305
305
|
},
|
|
306
306
|
{
|
|
307
307
|
name: "--no-interactive",
|
|
@@ -1,6 +1,5 @@
|
|
|
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";
|
|
4
3
|
|
|
5
4
|
type CliThirdPartyNoticesOptions = {
|
|
6
5
|
rootPath: string;
|
|
@@ -59,7 +58,6 @@ export const rnxWriteThirdPartyNoticesCommand = {
|
|
|
59
58
|
name: "--json",
|
|
60
59
|
description: "Format the 3rd-party notice file as JSON instead of text.",
|
|
61
60
|
default: false,
|
|
62
|
-
parse: parseBoolean,
|
|
63
61
|
},
|
|
64
62
|
{
|
|
65
63
|
name: "--output-file [file]",
|