@revopush/code-push-cli 0.0.3 → 0.0.4
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.
|
@@ -1082,7 +1082,7 @@ const releaseReact = (command) => {
|
|
|
1082
1082
|
// This is needed to clear the react native bundler cache:
|
|
1083
1083
|
// https://github.com/facebook/react-native/issues/4289
|
|
1084
1084
|
.then(() => deleteFolder(`${os.tmpdir()}/react-*`))
|
|
1085
|
-
.then(() => (0, exports.runReactNativeBundleCommand)(bundleName, command.development || false, entryFile, outputFolder, platform, command.sourcemapOutput))
|
|
1085
|
+
.then(() => (0, exports.runReactNativeBundleCommand)(bundleName, command.development || false, entryFile, outputFolder, platform, command.sourcemapOutput, command.extraBundlerOptions))
|
|
1086
1086
|
.then(async () => {
|
|
1087
1087
|
const isHermesEnabled = command.useHermes ||
|
|
1088
1088
|
(platform === "android" && (await (0, react_native_utils_1.getAndroidHermesEnabled)(command.gradleFile))) || // Check if we have to run hermes to compile JS to Byte Code if Hermes is enabled in build.gradle and we're releasing an Android build
|
|
@@ -1148,7 +1148,7 @@ function requestAccessKey() {
|
|
|
1148
1148
|
});
|
|
1149
1149
|
});
|
|
1150
1150
|
}
|
|
1151
|
-
const runReactNativeBundleCommand = (bundleName, development, entryFile, outputFolder, platform, sourcemapOutput) => {
|
|
1151
|
+
const runReactNativeBundleCommand = (bundleName, development, entryFile, outputFolder, platform, sourcemapOutput, extraBundlerOptions) => {
|
|
1152
1152
|
const reactNativeBundleArgs = [];
|
|
1153
1153
|
const envNodeArgs = process.env.CODE_PUSH_NODE_ARGS;
|
|
1154
1154
|
if (typeof envNodeArgs !== "undefined") {
|
|
@@ -1172,6 +1172,9 @@ const runReactNativeBundleCommand = (bundleName, development, entryFile, outputF
|
|
|
1172
1172
|
if (sourcemapOutput) {
|
|
1173
1173
|
reactNativeBundleArgs.push("--sourcemap-output", sourcemapOutput);
|
|
1174
1174
|
}
|
|
1175
|
+
if (extraBundlerOptions.length > 0) {
|
|
1176
|
+
reactNativeBundleArgs.push(...extraBundlerOptions);
|
|
1177
|
+
}
|
|
1175
1178
|
(0, exports.log)(chalk.cyan('Running "react-native bundle" command:\n'));
|
|
1176
1179
|
const reactNativeBundleProcess = (0, exports.spawn)("node", reactNativeBundleArgs);
|
|
1177
1180
|
(0, exports.log)(`node ${reactNativeBundleArgs.join(" ")}`);
|
|
@@ -718,6 +718,13 @@ yargs
|
|
|
718
718
|
demand: false,
|
|
719
719
|
description: "Name of build configuration which specifies the binary version you want to target this release at. For example, 'Debug' or 'Release' (iOS only)",
|
|
720
720
|
type: "string",
|
|
721
|
+
})
|
|
722
|
+
.option("extraBundlerOption", {
|
|
723
|
+
alias: "eo",
|
|
724
|
+
default: [],
|
|
725
|
+
demand: false,
|
|
726
|
+
description: "Option that gets passed to react-native bundler. Can be specified multiple times.",
|
|
727
|
+
type: "array",
|
|
721
728
|
})
|
|
722
729
|
.check((argv, aliases) => {
|
|
723
730
|
return checkValidReleaseOptions(argv);
|
|
@@ -1045,6 +1052,7 @@ function createCommand() {
|
|
|
1045
1052
|
releaseReactCommand.xcodeProjectFile = argv["xcodeProjectFile"];
|
|
1046
1053
|
releaseReactCommand.xcodeTargetName = argv["xcodeTargetName"];
|
|
1047
1054
|
releaseReactCommand.buildConfigurationName = argv["buildConfigurationName"];
|
|
1055
|
+
releaseReactCommand.extraBundlerOptions = argv["extraBundlerOption"];
|
|
1048
1056
|
}
|
|
1049
1057
|
break;
|
|
1050
1058
|
case "rollback":
|
package/bin/test/cli.js
CHANGED
|
@@ -1264,6 +1264,38 @@ describe("CLI", () => {
|
|
|
1264
1264
|
})
|
|
1265
1265
|
.done();
|
|
1266
1266
|
});
|
|
1267
|
+
it("release-react applies extraBundlerOptions to bundler command", (done) => {
|
|
1268
|
+
var bundleName = "bundle.js";
|
|
1269
|
+
var command = {
|
|
1270
|
+
type: cli.CommandType.releaseReact,
|
|
1271
|
+
appName: "a",
|
|
1272
|
+
appStoreVersion: null,
|
|
1273
|
+
bundleName: bundleName,
|
|
1274
|
+
deploymentName: "Staging",
|
|
1275
|
+
description: "Test default entry file",
|
|
1276
|
+
mandatory: false,
|
|
1277
|
+
rollout: null,
|
|
1278
|
+
platform: "ios",
|
|
1279
|
+
extraBundlerOptions: ["--foo=bar", "--baz"],
|
|
1280
|
+
};
|
|
1281
|
+
ensureInTestAppDirectory();
|
|
1282
|
+
var release = sandbox.stub(cmdexec, "release");
|
|
1283
|
+
cmdexec
|
|
1284
|
+
.execute(command)
|
|
1285
|
+
.then(() => {
|
|
1286
|
+
var releaseCommand = command;
|
|
1287
|
+
releaseCommand.package = path.join(os.tmpdir(), "CodePush");
|
|
1288
|
+
releaseCommand.appStoreVersion = "1.2.3";
|
|
1289
|
+
sinon.assert.calledOnce(spawn);
|
|
1290
|
+
var spawnCommand = spawn.args[0][0];
|
|
1291
|
+
var spawnCommandArgs = spawn.args[0][1].join(" ");
|
|
1292
|
+
assert.equal(spawnCommand, "node");
|
|
1293
|
+
assert.equal(spawnCommandArgs, `${path.join("node_modules", "react-native", "local-cli", "cli.js")} bundle --assets-dest ${path.join(os.tmpdir(), "CodePush")} --bundle-output ${path.join(os.tmpdir(), "CodePush", bundleName)} --dev false --entry-file index.ios.js --platform ios --foo=bar --baz`);
|
|
1294
|
+
assertJsonDescribesObject(JSON.stringify(release.args[0][0], /*replacer=*/ null, /*spacing=*/ 2), releaseCommand);
|
|
1295
|
+
done();
|
|
1296
|
+
})
|
|
1297
|
+
.done();
|
|
1298
|
+
});
|
|
1267
1299
|
it("sessionList lists session name and expires fields", (done) => {
|
|
1268
1300
|
var command = {
|
|
1269
1301
|
type: cli.CommandType.sessionList,
|
package/package.json
CHANGED
|
@@ -1340,7 +1340,8 @@ export const releaseReact = (command: cli.IReleaseReactCommand): Promise<void> =
|
|
|
1340
1340
|
entryFile,
|
|
1341
1341
|
outputFolder,
|
|
1342
1342
|
platform,
|
|
1343
|
-
command.sourcemapOutput
|
|
1343
|
+
command.sourcemapOutput,
|
|
1344
|
+
command.extraBundlerOptions
|
|
1344
1345
|
)
|
|
1345
1346
|
)
|
|
1346
1347
|
.then(async () => {
|
|
@@ -1431,7 +1432,8 @@ export const runReactNativeBundleCommand = (
|
|
|
1431
1432
|
entryFile: string,
|
|
1432
1433
|
outputFolder: string,
|
|
1433
1434
|
platform: string,
|
|
1434
|
-
sourcemapOutput: string
|
|
1435
|
+
sourcemapOutput: string,
|
|
1436
|
+
extraBundlerOptions: string[]
|
|
1435
1437
|
): Promise<void> => {
|
|
1436
1438
|
const reactNativeBundleArgs: string[] = [];
|
|
1437
1439
|
const envNodeArgs: string = process.env.CODE_PUSH_NODE_ARGS;
|
|
@@ -1461,6 +1463,10 @@ export const runReactNativeBundleCommand = (
|
|
|
1461
1463
|
reactNativeBundleArgs.push("--sourcemap-output", sourcemapOutput);
|
|
1462
1464
|
}
|
|
1463
1465
|
|
|
1466
|
+
if (extraBundlerOptions.length > 0) {
|
|
1467
|
+
reactNativeBundleArgs.push(...extraBundlerOptions);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1464
1470
|
log(chalk.cyan('Running "react-native bundle" command:\n'));
|
|
1465
1471
|
const reactNativeBundleProcess = spawn("node", reactNativeBundleArgs);
|
|
1466
1472
|
log(`node ${reactNativeBundleArgs.join(" ")}`);
|
package/script/command-parser.ts
CHANGED
|
@@ -840,6 +840,14 @@ yargs
|
|
|
840
840
|
"Name of build configuration which specifies the binary version you want to target this release at. For example, 'Debug' or 'Release' (iOS only)",
|
|
841
841
|
type: "string",
|
|
842
842
|
})
|
|
843
|
+
.option("extraBundlerOption", {
|
|
844
|
+
alias: "eo",
|
|
845
|
+
default: [],
|
|
846
|
+
demand: false,
|
|
847
|
+
description:
|
|
848
|
+
"Option that gets passed to react-native bundler. Can be specified multiple times.",
|
|
849
|
+
type: "array",
|
|
850
|
+
})
|
|
843
851
|
.check((argv: any, aliases: { [aliases: string]: string }): any => {
|
|
844
852
|
return checkValidReleaseOptions(argv);
|
|
845
853
|
});
|
|
@@ -1245,6 +1253,7 @@ export function createCommand(): cli.ICommand {
|
|
|
1245
1253
|
releaseReactCommand.xcodeProjectFile = argv["xcodeProjectFile"] as any;
|
|
1246
1254
|
releaseReactCommand.xcodeTargetName = argv["xcodeTargetName"] as any;
|
|
1247
1255
|
releaseReactCommand.buildConfigurationName = argv["buildConfigurationName"] as any;
|
|
1256
|
+
releaseReactCommand.extraBundlerOptions = argv["extraBundlerOption"] as any;
|
|
1248
1257
|
}
|
|
1249
1258
|
break;
|
|
1250
1259
|
|
package/script/types/cli.ts
CHANGED
|
@@ -206,6 +206,7 @@ export interface IReleaseReactCommand extends IReleaseBaseCommand {
|
|
|
206
206
|
xcodeProjectFile?: string;
|
|
207
207
|
xcodeTargetName?: string;
|
|
208
208
|
buildConfigurationName?: string;
|
|
209
|
+
extraBundlerOptions?: string[];
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
export interface IRollbackCommand extends ICommand {
|
package/test/cli.ts
CHANGED
|
@@ -1595,6 +1595,50 @@ describe("CLI", () => {
|
|
|
1595
1595
|
.done();
|
|
1596
1596
|
});
|
|
1597
1597
|
|
|
1598
|
+
it("release-react applies extraBundlerOptions to bundler command", (done: Mocha.Done): void => {
|
|
1599
|
+
var bundleName = "bundle.js";
|
|
1600
|
+
var command: cli.IReleaseReactCommand = {
|
|
1601
|
+
type: cli.CommandType.releaseReact,
|
|
1602
|
+
appName: "a",
|
|
1603
|
+
appStoreVersion: null,
|
|
1604
|
+
bundleName: bundleName,
|
|
1605
|
+
deploymentName: "Staging",
|
|
1606
|
+
description: "Test default entry file",
|
|
1607
|
+
mandatory: false,
|
|
1608
|
+
rollout: null,
|
|
1609
|
+
platform: "ios",
|
|
1610
|
+
extraBundlerOptions: ["--foo=bar", "--baz"],
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1613
|
+
ensureInTestAppDirectory();
|
|
1614
|
+
|
|
1615
|
+
var release: sinon.SinonSpy = sandbox.stub(cmdexec, "release");
|
|
1616
|
+
|
|
1617
|
+
cmdexec
|
|
1618
|
+
.execute(command)
|
|
1619
|
+
.then(() => {
|
|
1620
|
+
var releaseCommand: cli.IReleaseCommand = <any>command;
|
|
1621
|
+
releaseCommand.package = path.join(os.tmpdir(), "CodePush");
|
|
1622
|
+
releaseCommand.appStoreVersion = "1.2.3";
|
|
1623
|
+
|
|
1624
|
+
sinon.assert.calledOnce(spawn);
|
|
1625
|
+
var spawnCommand: string = spawn.args[0][0];
|
|
1626
|
+
var spawnCommandArgs: string = spawn.args[0][1].join(" ");
|
|
1627
|
+
assert.equal(spawnCommand, "node");
|
|
1628
|
+
assert.equal(
|
|
1629
|
+
spawnCommandArgs,
|
|
1630
|
+
`${path.join("node_modules", "react-native", "local-cli", "cli.js")} bundle --assets-dest ${path.join(
|
|
1631
|
+
os.tmpdir(),
|
|
1632
|
+
"CodePush"
|
|
1633
|
+
)} --bundle-output ${path.join(os.tmpdir(), "CodePush", bundleName)} --dev false --entry-file index.ios.js --platform ios --foo=bar --baz`
|
|
1634
|
+
);
|
|
1635
|
+
assertJsonDescribesObject(JSON.stringify(release.args[0][0], /*replacer=*/ null, /*spacing=*/ 2), releaseCommand);
|
|
1636
|
+
|
|
1637
|
+
done();
|
|
1638
|
+
})
|
|
1639
|
+
.done();
|
|
1640
|
+
});
|
|
1641
|
+
|
|
1598
1642
|
it("sessionList lists session name and expires fields", (done: Mocha.Done): void => {
|
|
1599
1643
|
var command: cli.IAccessKeyListCommand = {
|
|
1600
1644
|
type: cli.CommandType.sessionList,
|