Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit ebbedb1

Browse files
Update docs (#688)
Co-authored-by: Alexander Goncharov <v-algonc@microsoft.com>
1 parent aa7d774 commit ebbedb1

File tree

1 file changed

+63
-14
lines changed

1 file changed

+63
-14
lines changed

sdk/README.md

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,96 @@
1+
UPDATE: Over the next few months, we will be working on a new version of CodePush that will address some of the most common performance issues our customers are facing. This updated version will allow a better experience, our team to better support CodePush moving forward and have a faster development cycle for new features.
2+
We are prioritizing this work because we believe this to be the most valuable thing we can do for our CodePush customers in the long run. Starting June 11th 2019, support will slow down, bug fixes will be limited to critical bugs, and new feature development will pause until we finish this core update.
3+
4+
---
5+
6+
[![appcenterbanner](https://user-images.githubusercontent.com/31293287/32969262-3cc5d48a-cb99-11e7-91bf-fa57c67a371c.png)](http://microsoft.github.io/code-push/)
7+
8+
#### [Sign up With App Center](https://appcenter.ms/signup?utm_source=CodePush&utm_medium=Azure) to use CodePush
9+
10+
# CodePush
11+
12+
[CodePush](https://microsoft.github.io/code-push) is a cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users' devices. It works by acting as a central repository that developers can publish updates to (JS, HTML, CSS and images), and that apps can query for updates from (using provided client SDK for [Cordova](https://github.com/Microsoft/cordova-plugin-code-push) and [React Native](https://github.com/Microsoft/react-native-code-push)). 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.
13+
14+
To get started using CodePush, refer to our [documentation](https://docs.microsoft.com/en-us/appcenter/distribution/codepush/), otherwise, read the following steps if you'd like to build/contribute to the project from source.
15+
16+
*NOTE: If you need information about [code-push management CLI](https://github.com/microsoft/code-push/tree/v3.0.1/cli), you can find it in v3.0.1.*
17+
18+
## Dev Setup
19+
20+
* Install [Node.js](https://nodejs.org/)
21+
* Install [Git](http://www.git-scm.com/)
22+
* Clone the Repository: `git clone https://github.com/Microsoft/code-push.git`
23+
24+
### Building
25+
26+
* Run `npm setup` to install the NPM dependencies of management SDK.
27+
* Run `npm run build` to build the management SDK for testing.
28+
* Run `npm run build:release` to build the release version of management SDK.
29+
30+
### Running Tests
31+
32+
* To run tests, run `npm run test` from the root of the project.
33+
* You can use debug mode for tests with `.vscode/launch.json` file.
34+
35+
### Coding Conventions
36+
37+
* Use double quotes for strings
38+
* Use four space tabs
39+
* Use `camelCase` for local variables and imported modules, `PascalCase` for types, and `dash-case` for file names
40+
41+
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 [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
42+
143
# CodePush Management SDK (Node.js)
244

3-
A JavaScript library for programmatically managing your CodePush account (e.g. creating apps, promoting releases), which allows authoring Node.js-based build and/or deployment scripts, without needing to shell out to the [CLI](https://github.com/Microsoft/code-push/blob/master/cli/README.md).
45+
A JavaScript library for programmatically managing your CodePush account (e.g. creating apps, promoting releases), which allows authoring Node.js-based build and/or deployment scripts, without needing to shell out to the [App Center CLI](https://github.com/microsoft/appcenter-cli).
446

547

648
## Getting Started
749

8-
1. Create an access key to authenticate with the CodePush server using the following CodePush CLI command:
50+
1. Create a token to authenticate with the CodePush server using the following [App Center CLI](https://github.com/microsoft/appcenter-cli) command:
951

1052
```shell
11-
code-push access-key add "DESCRIPTION_OF_THE_KEY"
53+
appcenter tokens create -d "DESCRIPTION_OF_THE_TOKEN"
1254
```
13-
14-
If you already created a key that you want to use here, then you can retrieve it by running `code-push access-key ls` and using the value of the `Key` column for the key you wish to use.
15-
55+
Please copy your `API Token` and keep it secret. You won't be able to see it again.
56+
1657
2. Install the management SDK by running `npm install code-push --save`
1758
18-
3. Import it using the following statement (using ES6 syntax as applicable):
59+
3. Import it using one of the following statement: (using ES6 syntax as applicable):
60+
* On commonjs environments:
61+
62+
```javascript
63+
const CodePush = require("code-push");
64+
```
65+
* Using ES6 syntax with tsconfig.json:
1966
2067
```javascript
21-
var CodePush = require("code-push");
68+
import CodePush from "code-push";
2269
```
2370
24-
4. Create an instance of the `CodePush` class, passing it the access key you created or retrieved in step #1:
71+
4. Create an instance of the `CodePush` class, passing it the `API Token` you created or retrieved in step #1:
2572
2673
```javascript
27-
var codePush = new CodePush("YOUR_ACCESS_KEY");
74+
const codePush = new CodePush("YOUR_API_TOKEN");
2875
```
2976
3077
5. Begin automating the management of your account! For more details on what you can do with this `codePush` object, refer to the API reference section below.
3178
3279
## API Reference
3380
34-
The `code-push` module exports a single class (typically referred to as `CodePush`), which represents a proxy to the CodePush account management REST API. This class has a single constructor for authenticating with the CodePush service, and a collection of instance methods that correspond to the commands in the management [CLI](https://github.com/Microsoft/code-push/blob/master/cli/README.md), which allow you to programmatically control every aspect of your CodePush account.
81+
The `code-push` module exports a single class (typically referred to as `CodePush`), which represents a proxy to the CodePush account management REST API. This class has a single constructor for authenticating with the CodePush service, and a collection of instance methods that correspond to the commands in the [App Center CLI](https://github.com/microsoft/appcenter-cli), which allow you to programmatically control every aspect of your CodePush account.
3582
3683
### Constructors
3784
3885
- __CodePush(accessKey: string)__ - Creates a new instance of the CodePush management SDK, using the specified access key to authenticated with the server.
3986
4087
### Methods
4188
89+
*Note: `access key` here refers to an AppCenter API Token.*
90+
4291
- __addAccessKey(description: string): Promise&lt;AccessKey&gt;__ - Creates a new access key with the specified description (e.g. "VSTS CI").
4392
44-
- __addApp(name: string, os: string, platform: string, manuallyProvisionDeployments: boolean = false): Promise&lt;App&gt;__ - Creates a new CodePush app with the specified name, os, and platform. If the default deployments of "Staging" and "Production" are not desired, pass a value of true for the manuallyProvisionDesployments parameter.
93+
- __addApp(name: string, os: string, platform: string, manuallyProvisionDeployments: boolean = false): Promise&lt;App&gt;__ - Creates a new CodePush app with the specified name, os, and platform. If the default deployments of "Staging" and "Production" are not desired, pass a value of true for the manuallyProvisionDeployments parameter.
4594
4695
- __addCollaborator(appName: string, email: string): Promise&lt;void&gt;__ - Adds the specified CodePush user as a collaborator to the specified CodePush app.
4796
@@ -65,7 +114,7 @@ The `code-push` module exports a single class (typically referred to as `CodePus
65114
66115
- __getDeploymentMetrics(appName: string, deploymentName: string): Promise&lt;DeploymentMetrics&gt;__ - Retrieves the installation metrics for the specified app deployment.
67116
68-
- __getDeployments(appName: string): Promose&lt;Deployment[]&gt;__ - Retrieves the list of deployments associated with the specified app.
117+
- __getDeployments(appName: string): Promise&lt;Deployment[]&gt;__ - Retrieves the list of deployments associated with the specified app.
69118
70119
- __patchRelease(appName: string, deploymentName: string, label: string, updateMetadata: PackageInfo): Promise&lt;void&gt;__ - Updates the specified release's metadata with the given information.
71120

@@ -99,4 +148,4 @@ When an error occurs in any of the methods, the promise will be rejected with a
99148
- __CodePush.ERROR_INTERNAL_SERVER__: An error occurred internally on the CodePush server.
100149
- __CodePush.ERROR_NOT_FOUND__: The resource you are attempting to retrieve does not exist.
101150
- __CodePush.ERROR_CONFLICT__: The resource you are attempting to create already exists.
102-
- __CodePush.ERROR_UNAUTHORIZED__: The access key you configured is invalid or expired.
151+
- __CodePush.ERROR_UNAUTHORIZED__: The access key you configured is invalid or expired.

0 commit comments

Comments
 (0)