Skip to content

Commit 56f8e64

Browse files
Cleanup the CLI commands and docs
1 parent 41f89c6 commit 56f8e64

File tree

7 files changed

+28
-1964
lines changed

7 files changed

+28
-1964
lines changed

README.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# CodePush
2-
3-
> This "fork" is compatible with NativeScript
4-
5-
CodePush is a cloud service that enables Cordova, React Native and NativeScript developers to deploy mobile app updates directly to their users' devices.
6-
It works by acting as a central repository that developers can publish updates to (JS, HTML, CSS and images),
7-
and that apps can query for updates from (using provided client SDKs for [Cordova](https://github.com/Microsoft/cordova-plugin-code-push), [React Native](https://github.com/Microsoft/react-native-code-push) and [NativeScript](https://github.com/EddyVerbruggen/nativescript-code-push)).
8-
9-
This allows you to have a more deterministic and direct engagement model with your userbase, when addressing bugs and/or adding small features that don't require you to re-build a binary and re-distribute it through the respective app stores.
1+
# NativeScript CodePush
102

113
This repo includes the [management CLI](/cli) and [Node.js management SDK](/sdk), which allows you to manage and automate the needs of your apps.
124
To get started using CodePush for NativeScript, refer to our [CodePush plugin docs](https://github.com/EddyVerbruggen/nativescript-code-push),
@@ -47,11 +39,3 @@ npm publish
4739
To run all tests, run `gulp test` script from the root of the project.
4840

4941
To test just one of the projects (e.g. cli or sdk), run `gulp test-cli` or `gulp test-sdk`
50-
51-
### Coding Conventions
52-
53-
* Use double quotes for strings
54-
* Use four space tabs
55-
* Use `camelCase` for local variables and imported modules, `PascalCase` for types, and `dash-case` for file names
56-
57-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

cli/README-cn.md

Lines changed: 0 additions & 732 deletions
This file was deleted.

cli/README.md

Lines changed: 2 additions & 1096 deletions
Large diffs are not rendered by default.

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-code-push-cli",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Management CLI for the CodePush service",
55
"main": "script/cli.js",
66
"scripts": {

cli/script/command-executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ export var releaseNativeScript = (command: cli.IReleaseNativeScriptCommand): Pro
14671467
try {
14681468
projectPackageJson = require(path.join(process.cwd(), "package.json"));
14691469
} catch (error) {
1470-
throw new Error("Unable to find or read \"package.json\" in the CWD. The \"release-nativescript\" command must be executed in a NativeScript project folder.");
1470+
throw new Error("Unable to find or read \"package.json\" in the CWD. The \"release\" command must be executed in a NativeScript project folder.");
14711471
}
14721472

14731473
if (!projectPackageJson.nativescript) {

cli/script/command-parser.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ export function showHelp(showRootDescription?: boolean): void {
2222
console.log(chalk.cyan(" / ___/__ ___/ /__" + chalk.green(" / _ \\__ _____ / / ")));
2323
console.log(chalk.cyan("/ /__/ _ \\/ _ / -_)" + chalk.green(" ___/ // (_-</ _ \\")));
2424
console.log(chalk.cyan("\\___/\\___/\\_,_/\\__/" + chalk.green("_/ \\_,_/___/_//_/")) + " CLI v" + packageJson.version);
25-
console.log(chalk.cyan("=========== NativeScript Edition ==========="));
25+
console.log(chalk.cyan("=============== NativeScript Edition ==============="));
2626
console.log("");
27-
console.log("Mobile Center CodePush is a service that enables you to deploy mobile app updates directly to your users' devices.\n");
2827
updateCheck();
2928
}
3029

@@ -313,25 +312,27 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
313312

314313
addCommonConfiguration(yargs);
315314
})
315+
/*
316316
.command("link", "Link an additional authentication provider (e.g. GitHub) to an existing Mobile Center account", (yargs: yargs.Argv) => {
317317
isValidCommandCategory = true;
318318
isValidCommand = true;
319319
yargs.usage(USAGE_PREFIX + " link")
320-
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
320+
.demand(0, 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
321321
.example("link", "Links an account on the Mobile Center server")
322322
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
323323
324324
addCommonConfiguration(yargs);
325325
})
326+
*/
326327
.command("login", "Authenticate in order to begin managing your apps", (yargs: yargs.Argv) => {
327328
isValidCommandCategory = true;
328329
isValidCommand = true;
329330
yargs.usage(USAGE_PREFIX + " login [options]")
330331
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
331-
.example("login", "Logs in to the Mobile Center server")
332+
.example("login", "Logs in to the server")
332333
.example("login --accessKey mykey", "Logs in on behalf of the user who owns and created the access key \"mykey\"")
333334
.example("login --proxy http://someproxy.com:455", "Logs in with the specified proxy url")
334-
.option("accessKey", { alias: "key", default: null, demand: false, description: "Access key to authenticate against the Mobile Center server with, instead of providing your username and password credentials", type: "string" })
335+
.option("accessKey", { alias: "key", default: null, demand: false, description: "Access key to authenticate against the server with, instead of providing your username and password credentials", type: "string" })
335336
.option("proxy", { default: null, demand: false, description: "URL of the proxy server to use", type: "string" })
336337
.option("noProxy", { default: false, demand: false, description: "Bypass the system-wide proxy settings", type: "boolean" })
337338
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
@@ -377,22 +378,23 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
377378

378379
addCommonConfiguration(yargs);
379380
})
380-
.command("register", "Register a new Mobile Center account", (yargs: yargs.Argv) => {
381+
.command("register", "Register a new account", (yargs: yargs.Argv) => {
381382
isValidCommandCategory = true;
382383
isValidCommand = true;
383384
yargs.usage(USAGE_PREFIX + " register")
384385
.demand(/*count*/ 0, /*max*/ 1) //set 'max' to one to allow usage of serverUrl undocument parameter for testing
385-
.example("register", "Registers a new Mobile Center account")
386+
.example("register", "Registers a new account")
386387
.example("register --proxy http://someproxy.com:455", "Registers with the specified proxy url")
387388
.option("proxy", { default: null, demand: false, description: "URL of the proxy server to use", type: "string" })
388389
.option("noProxy", { default: false, demand: false, description: "Bypass the system-wide proxy settings", type: "boolean" })
389390
.check((argv: any, aliases: { [aliases: string]: string }): any => isValidCommand); // Report unrecognized, non-hyphenated command category.
390391

391392
addCommonConfiguration(yargs);
392393
})
394+
/*
393395
.command("release", "Release an update to an app deployment", (yargs: yargs.Argv) => {
394396
yargs.usage(USAGE_PREFIX + " release <appName> <updateContentsPath> <targetBinaryVersion> [options]")
395-
.demand(/*count*/ 3, /*max*/ 3) // Require exactly three non-option arguments.
397+
.demand(3, 3) // Require exactly three non-option arguments.
396398
.example("release MyApp app.js \"*\"", "Releases the \"app.js\" file to the \"MyApp\" app's \"Staging\" deployment, targeting any binary version using the \"*\" wildcard range syntax.")
397399
.example("release MyApp ./platforms/ios/www 1.0.3 -d Production -k ~/.ssh/codepush_rsa", "Releases the \"./platforms/ios/www\" folder and all its contents to the \"MyApp\" app's \"Production\" deployment, targeting only the 1.0.3 binary version and signed with the \"codepush_rsa\" private key")
398400
.example("release MyApp ./platforms/ios/www 1.0.3 -d Production -r 20", "Releases the \"./platforms/ios/www\" folder and all its contents to the \"MyApp\" app's \"Production\" deployment, targeting the 1.0.3 binary version and rolling out to about 20% of the users")
@@ -409,7 +411,7 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
409411
})
410412
.command("release-cordova", "Release a Cordova update to an app deployment", (yargs: yargs.Argv) => {
411413
yargs.usage(USAGE_PREFIX + " release-cordova <appName> <platform> [options]")
412-
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
414+
.demand(2, 2) // Require exactly two non-option arguments
413415
.example("release-cordova MyApp ios", "Releases the Cordova iOS project in the current working directory to the \"MyApp\" app's \"Staging\" deployment")
414416
.example("release-cordova MyApp android -d Production", "Releases the Cordova Android project in the current working directory to the \"MyApp\" app's \"Production\" deployment")
415417
.option("build", { alias: "b", default: false, demand: false, description: "Invoke \"cordova build\" instead of \"cordova prepare\"", type: "boolean" })
@@ -428,7 +430,7 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
428430
})
429431
.command("release-react", "Release a React Native update to an app deployment", (yargs: yargs.Argv) => {
430432
yargs.usage(USAGE_PREFIX + " release-react <appName> <platform> [options]")
431-
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
433+
.demand(2, 2) // Require exactly two non-option arguments
432434
.example("release-react MyApp ios", "Releases the React Native iOS project in the current working directory to the \"MyApp\" app's \"Staging\" deployment")
433435
.example("release-react MyApp android -d Production -k ~/.ssh/codepush_rsa", "Releases the React Native Android project in the current working directory to the \"MyApp\" app's \"Production\" deployment, signed with the \"codepush_rsa\" private key")
434436
.example("release-react MyApp windows --dev", "Releases the development bundle of the React Native Windows project in the current working directory to the \"MyApp\" app's \"Staging\" deployment")
@@ -453,11 +455,12 @@ var argv = yargs.usage(USAGE_PREFIX + " <command>")
453455
454456
addCommonConfiguration(yargs);
455457
})
456-
.command("release-nativescript", "Release a NativeScript update to an app deployment", (yargs: yargs.Argv) => {
457-
yargs.usage(USAGE_PREFIX + " release-nativescript <appName> <platform> [options]")
458+
*/
459+
.command("release", "Release a NativeScript update to an app deployment", (yargs: yargs.Argv) => {
460+
yargs.usage(USAGE_PREFIX + " release <appName> <platform> [options]")
458461
.demand(/*count*/ 2, /*max*/ 2) // Require exactly two non-option arguments
459-
.example("release-nativescript MyApp ios", "Releases the NativeScript iOS project in the current working directory to the \"MyApp\" app's \"Staging\" deployment")
460-
.example("release-nativescript MyApp android -d Production", "Releases the NativeScript Android project in the current working directory to the \"MyApp\" app's \"Production\" deployment")
462+
.example("release MyApp ios", "Releases the NativeScript iOS project in the current working directory to the \"MyApp\" app's \"Staging\" deployment")
463+
.example("release MyApp android -d Production", "Releases the NativeScript Android project in the current working directory to the \"MyApp\" app's \"Production\" deployment")
461464
.option("build", { alias: "b", default: false, demand: false, description: "Invoke \"tns build\" instead of assuming there's aleady a build waiting to be pushed", type: "boolean" })
462465
.option("isReleaseBuildType", { alias: "rb", default: false, demand: false, description: "If \"build\" option is true specifies whether to perform a release build", type: "boolean" })
463466
.option("keystorePath", { alias: "kp", default: null, demand: false, description: "If \"isReleaseBuildType\" option is true and \"platform\" is \"android\" specifies the path to the .keystore file", type: "string" })
@@ -590,7 +593,7 @@ function createCommand(): cli.ICommand {
590593

591594
appAddCommand.appName = arg2;
592595
appAddCommand.os = arg3;
593-
appAddCommand.platform = arg4;
596+
appAddCommand.platform = arg4 || "nativescript"; // default to NativeScript, so no longer required to pass in
594597
}
595598
break;
596599

@@ -820,6 +823,7 @@ function createCommand(): cli.ICommand {
820823
registerCommand.noProxy = argv["noProxy"];
821824
break;
822825

826+
/*
823827
case "release":
824828
if (arg1 && arg2 && arg3) {
825829
cmd = { type: cli.CommandType.release };
@@ -889,8 +893,9 @@ function createCommand(): cli.ICommand {
889893
releaseReactCommand.config = argv["config"];
890894
}
891895
break;
896+
*/
892897

893-
case "release-nativescript":
898+
case "release":
894899
if (arg1 && arg2) {
895900
cmd = { type: cli.CommandType.releaseNativeScript };
896901

0 commit comments

Comments
 (0)