@rnx-kit/cli 0.17.4 → 0.17.6
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/build/android.d.ts +2 -1
- package/lib/build/android.js +7 -18
- package/lib/build/apple.js +4 -18
- package/lib/build/ios.js +5 -2
- package/lib/build/macos.js +3 -1
- package/lib/build/watcher.d.ts +4 -0
- package/lib/build/watcher.js +22 -0
- package/lib/build.d.ts +1 -1
- package/lib/build.js +1 -1
- package/lib/index.js +10 -6
- package/lib/run.js +1 -1
- package/package.json +2 -2
package/lib/build/android.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Config } from "@react-native-community/cli-types";
|
|
2
2
|
import ora from "ora";
|
|
3
3
|
import type { AndroidBuildParams } from "./types";
|
|
4
|
-
export
|
|
4
|
+
export type BuildResult = string | number | null;
|
|
5
|
+
export declare function buildAndroid(config: Config, buildParams: AndroidBuildParams, logger?: ora.Ora): Promise<BuildResult>;
|
|
5
6
|
//# sourceMappingURL=android.d.ts.map
|
package/lib/build/android.js
CHANGED
|
@@ -4,32 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.buildAndroid = buildAndroid;
|
|
7
|
+
const cache_1 = require("@rnx-kit/tools-react-native/cache");
|
|
7
8
|
const ora_1 = __importDefault(require("ora"));
|
|
8
|
-
|
|
9
|
+
const watcher_1 = require("./watcher");
|
|
10
|
+
function buildAndroid(config, buildParams, logger = (0, ora_1.default)()) {
|
|
9
11
|
const { sourceDir } = config.project.android ?? {};
|
|
10
12
|
if (!sourceDir) {
|
|
11
|
-
|
|
13
|
+
(0, cache_1.invalidateState)();
|
|
12
14
|
process.exitCode = 1;
|
|
13
|
-
|
|
15
|
+
logger.fail("No Android project was found");
|
|
16
|
+
return Promise.resolve(null);
|
|
14
17
|
}
|
|
15
18
|
return import("@rnx-kit/tools-android").then(({ assemble }) => {
|
|
16
19
|
return new Promise((resolve) => {
|
|
17
|
-
logger.start("Building");
|
|
18
|
-
const errors = [];
|
|
19
20
|
const gradle = assemble(sourceDir, buildParams);
|
|
20
|
-
|
|
21
|
-
gradle.stderr.on("data", (data) => errors.push(data));
|
|
22
|
-
gradle.on("close", (code) => {
|
|
23
|
-
if (code === 0) {
|
|
24
|
-
logger.succeed("Build succeeded");
|
|
25
|
-
resolve(sourceDir);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
logger.fail(Buffer.concat(errors).toString());
|
|
29
|
-
process.exitCode = code ?? 1;
|
|
30
|
-
resolve(code);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
21
|
+
(0, watcher_1.watch)(gradle, logger, () => resolve(sourceDir), resolve);
|
|
33
22
|
});
|
|
34
23
|
});
|
|
35
24
|
}
|
package/lib/build/apple.js
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runBuild = runBuild;
|
|
4
|
+
const watcher_1 = require("./watcher");
|
|
4
5
|
function runBuild(xcworkspace, buildParams, logger) {
|
|
5
6
|
return import("@rnx-kit/tools-apple").then(({ xcodebuild }) => {
|
|
6
7
|
return new Promise((resolve) => {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const proc = xcodebuild(xcworkspace, buildParams, (text) => {
|
|
10
|
-
const current = logger.text;
|
|
8
|
+
const onSuccess = () => resolve({ xcworkspace, args: build.spawnargs });
|
|
9
|
+
const build = xcodebuild(xcworkspace, buildParams, (text) => {
|
|
11
10
|
logger.info(text);
|
|
12
|
-
logger.start(current);
|
|
13
|
-
});
|
|
14
|
-
proc.stdout.on("data", () => (logger.text += "."));
|
|
15
|
-
proc.stderr.on("data", (data) => errors.push(data));
|
|
16
|
-
proc.on("close", (code) => {
|
|
17
|
-
if (code === 0) {
|
|
18
|
-
logger.succeed("Build succeeded");
|
|
19
|
-
resolve({ xcworkspace, args: proc.spawnargs });
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
logger.fail(Buffer.concat(errors).toString());
|
|
23
|
-
process.exitCode = code ?? 1;
|
|
24
|
-
resolve(code);
|
|
25
|
-
}
|
|
26
11
|
});
|
|
12
|
+
(0, watcher_1.watch)(build, logger, onSuccess, resolve);
|
|
27
13
|
});
|
|
28
14
|
});
|
|
29
15
|
}
|
package/lib/build/ios.js
CHANGED
|
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.buildIOS = buildIOS;
|
|
30
|
+
const cache_1 = require("@rnx-kit/tools-react-native/cache");
|
|
30
31
|
const path = __importStar(require("node:path"));
|
|
31
32
|
const ora_1 = __importDefault(require("ora"));
|
|
32
33
|
const apple_1 = require("./apple");
|
|
@@ -34,15 +35,17 @@ function buildIOS(config, buildParams, logger = (0, ora_1.default)()) {
|
|
|
34
35
|
const { platform } = buildParams;
|
|
35
36
|
const { sourceDir, xcodeProject } = config.project[platform] ?? {};
|
|
36
37
|
if (!sourceDir || !xcodeProject) {
|
|
38
|
+
(0, cache_1.invalidateState)();
|
|
39
|
+
process.exitCode = 1;
|
|
37
40
|
const root = platform.substring(0, platform.length - 2);
|
|
38
41
|
logger.fail(`No ${root}OS project was found; did you forget to run 'pod install'?`);
|
|
39
|
-
process.exitCode = 1;
|
|
40
42
|
return Promise.resolve(1);
|
|
41
43
|
}
|
|
42
44
|
const { name, path: projectDir } = xcodeProject;
|
|
43
45
|
if (!name?.endsWith(".xcworkspace")) {
|
|
44
|
-
|
|
46
|
+
(0, cache_1.invalidateState)();
|
|
45
47
|
process.exitCode = 1;
|
|
48
|
+
logger.fail("No Xcode workspaces were found; did you forget to run `pod install`?");
|
|
46
49
|
return Promise.resolve(1);
|
|
47
50
|
}
|
|
48
51
|
const xcworkspace = projectDir
|
package/lib/build/macos.js
CHANGED
|
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.buildMacOS = buildMacOS;
|
|
30
|
+
const cache_1 = require("@rnx-kit/tools-react-native/cache");
|
|
30
31
|
const fs = __importStar(require("node:fs"));
|
|
31
32
|
const path = __importStar(require("node:path"));
|
|
32
33
|
const ora_1 = __importDefault(require("ora"));
|
|
@@ -43,8 +44,9 @@ function buildMacOS(_config, { workspace, ...buildParams }, logger = (0, ora_1.d
|
|
|
43
44
|
const sourceDir = "macos";
|
|
44
45
|
const workspaces = findXcodeWorkspaces(sourceDir);
|
|
45
46
|
if (workspaces.length === 0) {
|
|
46
|
-
|
|
47
|
+
(0, cache_1.invalidateState)();
|
|
47
48
|
process.exitCode = 1;
|
|
49
|
+
logger.fail("No Xcode workspaces were found; specify an Xcode workspace with `--workspace`");
|
|
48
50
|
return Promise.resolve(1);
|
|
49
51
|
}
|
|
50
52
|
if (workspaces.length > 1) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
2
|
+
import type { Ora } from "ora";
|
|
3
|
+
export declare function watch(subproc: ChildProcessWithoutNullStreams, logger: Ora, onSuccess: () => void, onFail: (exitCode: number | null) => void): void;
|
|
4
|
+
//# sourceMappingURL=watcher.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.watch = watch;
|
|
4
|
+
function watch(subproc, logger, onSuccess, onFail) {
|
|
5
|
+
subproc.stdout.on("data", () => (logger.text += "."));
|
|
6
|
+
const errors = [];
|
|
7
|
+
subproc.stderr.on("data", (data) => errors.push(data));
|
|
8
|
+
subproc.on("close", (code) => {
|
|
9
|
+
if (code === 0) {
|
|
10
|
+
logger.succeed("Build succeeded");
|
|
11
|
+
onSuccess();
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
logger.fail(Buffer.concat(errors).toString());
|
|
15
|
+
process.exitCode = code ?? 1;
|
|
16
|
+
onFail(code);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
logger.info(`Command: ${subproc.spawnargs.join(" ")}`);
|
|
20
|
+
logger.start("Building");
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=watcher.js.map
|
package/lib/build.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { BuildConfiguration, DeviceType, InputParams } from "./build/types"
|
|
|
3
3
|
declare function asConfiguration(configuration: string): BuildConfiguration;
|
|
4
4
|
declare function asDestination(destination: string): DeviceType;
|
|
5
5
|
declare function asSupportedPlatform(platform: string): InputParams["platform"];
|
|
6
|
-
export declare function rnxBuild(_argv: string[], config: Config, buildParams: InputParams): Promise<
|
|
6
|
+
export declare function rnxBuild(_argv: string[], config: Config, buildParams: InputParams): Promise<import("./build/android").BuildResult> | Promise<import("./build/apple").BuildResult>;
|
|
7
7
|
export declare const rnxBuildCommand: {
|
|
8
8
|
name: string;
|
|
9
9
|
description: string;
|
package/lib/build.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rnxWriteThirdPartyNoticesCommand = exports.rnxWriteThirdPartyNotices = exports.rnxTestCommand = exports.rnxTest = exports.rnxStartCommand = exports.rnxStart = exports.rnxRunCommand = exports.rnxRun = exports.rnxRamBundleCommand = exports.rnxRamBundle = exports.rnxCopyAssetsCommand = exports.copyProjectAssets = exports.rnxCleanCommand = exports.rnxClean = exports.rnxBundleCommand = exports.rnxBundle = exports.rnxBuildCommand = exports.rnxBuild = exports.rnxAlignDepsCommand = exports.rnxAlignDeps = exports.reactNativeConfig = void 0;
|
|
4
4
|
const align_deps_1 = require("./align-deps");
|
|
5
|
+
const build_1 = require("./build");
|
|
5
6
|
const bundle_1 = require("./bundle");
|
|
6
7
|
const clean_1 = require("./clean");
|
|
7
8
|
const copy_assets_1 = require("./copy-assets");
|
|
8
9
|
const ram_bundle_1 = require("./ram-bundle");
|
|
10
|
+
const run_1 = require("./run");
|
|
9
11
|
const start_1 = require("./start");
|
|
10
12
|
const test_1 = require("./test");
|
|
11
13
|
const write_third_party_notices_1 = require("./write-third-party-notices");
|
|
@@ -14,6 +16,8 @@ exports.reactNativeConfig = {
|
|
|
14
16
|
bundle_1.rnxBundleCommand,
|
|
15
17
|
ram_bundle_1.rnxRamBundleCommand,
|
|
16
18
|
start_1.rnxStartCommand,
|
|
19
|
+
build_1.rnxBuildCommand,
|
|
20
|
+
run_1.rnxRunCommand,
|
|
17
21
|
copy_assets_1.rnxCopyAssetsCommand,
|
|
18
22
|
align_deps_1.rnxAlignDepsCommand,
|
|
19
23
|
test_1.rnxTestCommand,
|
|
@@ -24,9 +28,9 @@ exports.reactNativeConfig = {
|
|
|
24
28
|
var align_deps_2 = require("./align-deps");
|
|
25
29
|
Object.defineProperty(exports, "rnxAlignDeps", { enumerable: true, get: function () { return align_deps_2.rnxAlignDeps; } });
|
|
26
30
|
Object.defineProperty(exports, "rnxAlignDepsCommand", { enumerable: true, get: function () { return align_deps_2.rnxAlignDepsCommand; } });
|
|
27
|
-
var
|
|
28
|
-
Object.defineProperty(exports, "rnxBuild", { enumerable: true, get: function () { return
|
|
29
|
-
Object.defineProperty(exports, "rnxBuildCommand", { enumerable: true, get: function () { return
|
|
31
|
+
var build_2 = require("./build");
|
|
32
|
+
Object.defineProperty(exports, "rnxBuild", { enumerable: true, get: function () { return build_2.rnxBuild; } });
|
|
33
|
+
Object.defineProperty(exports, "rnxBuildCommand", { enumerable: true, get: function () { return build_2.rnxBuildCommand; } });
|
|
30
34
|
var bundle_2 = require("./bundle");
|
|
31
35
|
Object.defineProperty(exports, "rnxBundle", { enumerable: true, get: function () { return bundle_2.rnxBundle; } });
|
|
32
36
|
Object.defineProperty(exports, "rnxBundleCommand", { enumerable: true, get: function () { return bundle_2.rnxBundleCommand; } });
|
|
@@ -39,9 +43,9 @@ Object.defineProperty(exports, "rnxCopyAssetsCommand", { enumerable: true, get:
|
|
|
39
43
|
var ram_bundle_2 = require("./ram-bundle");
|
|
40
44
|
Object.defineProperty(exports, "rnxRamBundle", { enumerable: true, get: function () { return ram_bundle_2.rnxRamBundle; } });
|
|
41
45
|
Object.defineProperty(exports, "rnxRamBundleCommand", { enumerable: true, get: function () { return ram_bundle_2.rnxRamBundleCommand; } });
|
|
42
|
-
var
|
|
43
|
-
Object.defineProperty(exports, "rnxRun", { enumerable: true, get: function () { return
|
|
44
|
-
Object.defineProperty(exports, "rnxRunCommand", { enumerable: true, get: function () { return
|
|
46
|
+
var run_2 = require("./run");
|
|
47
|
+
Object.defineProperty(exports, "rnxRun", { enumerable: true, get: function () { return run_2.rnxRun; } });
|
|
48
|
+
Object.defineProperty(exports, "rnxRunCommand", { enumerable: true, get: function () { return run_2.rnxRunCommand; } });
|
|
45
49
|
var start_2 = require("./start");
|
|
46
50
|
Object.defineProperty(exports, "rnxStart", { enumerable: true, get: function () { return start_2.rnxStart; } });
|
|
47
51
|
Object.defineProperty(exports, "rnxStartCommand", { enumerable: true, get: function () { return start_2.rnxStartCommand; } });
|
package/lib/run.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnx-kit/cli",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.6",
|
|
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",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@rnx-kit/tools-apple": "^0.1.2",
|
|
55
55
|
"@rnx-kit/tools-language": "^2.0.0",
|
|
56
56
|
"@rnx-kit/tools-node": "^2.1.1",
|
|
57
|
-
"@rnx-kit/tools-react-native": "^1.4.
|
|
57
|
+
"@rnx-kit/tools-react-native": "^1.4.2",
|
|
58
58
|
"commander": "^11.1.0",
|
|
59
59
|
"ora": "^5.4.1",
|
|
60
60
|
"qrcode": "^1.5.0"
|