@rnx-kit/cli 0.17.4 → 0.17.5

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.
@@ -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 declare function buildAndroid(config: Config, buildParams: AndroidBuildParams, logger?: ora.Ora): Promise<string | number | null>;
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
@@ -5,31 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildAndroid = buildAndroid;
7
7
  const ora_1 = __importDefault(require("ora"));
8
- async function buildAndroid(config, buildParams, logger = (0, ora_1.default)()) {
8
+ const watcher_1 = require("./watcher");
9
+ function buildAndroid(config, buildParams, logger = (0, ora_1.default)()) {
9
10
  const { sourceDir } = config.project.android ?? {};
10
11
  if (!sourceDir) {
11
12
  logger.fail("No Android project was found");
12
13
  process.exitCode = 1;
13
- return null;
14
+ return Promise.resolve(null);
14
15
  }
15
16
  return import("@rnx-kit/tools-android").then(({ assemble }) => {
16
17
  return new Promise((resolve) => {
17
- logger.start("Building");
18
- const errors = [];
19
18
  const gradle = assemble(sourceDir, buildParams);
20
- gradle.stdout.on("data", () => (logger.text += "."));
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
- });
19
+ (0, watcher_1.watch)(gradle, logger, () => resolve(sourceDir), resolve);
33
20
  });
34
21
  });
35
22
  }
@@ -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
- logger.start("Building");
8
- const errors = [];
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
  }
@@ -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<string | number | null> | Promise<import("./build/apple").BuildResult>;
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
@@ -53,7 +53,7 @@ exports.rnxBuildCommand = {
53
53
  func: rnxBuild,
54
54
  options: [
55
55
  {
56
- name: "--platform <string>",
56
+ name: "-p, --platform <string>",
57
57
  description: "Target platform",
58
58
  parse: asSupportedPlatform,
59
59
  },
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 build_1 = require("./build");
28
- Object.defineProperty(exports, "rnxBuild", { enumerable: true, get: function () { return build_1.rnxBuild; } });
29
- Object.defineProperty(exports, "rnxBuildCommand", { enumerable: true, get: function () { return build_1.rnxBuildCommand; } });
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 run_1 = require("./run");
43
- Object.defineProperty(exports, "rnxRun", { enumerable: true, get: function () { return run_1.rnxRun; } });
44
- Object.defineProperty(exports, "rnxRunCommand", { enumerable: true, get: function () { return run_1.rnxRunCommand; } });
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
@@ -24,7 +24,7 @@ exports.rnxRunCommand = {
24
24
  options: [
25
25
  ...build_1.rnxBuildCommand.options,
26
26
  {
27
- name: "--device <string>",
27
+ name: "-d, --device <string>",
28
28
  description: "The name of the device to launch the app in",
29
29
  },
30
30
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/cli",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
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",