{"id":13462997,"url":"https://microsoft.github.io/code-push/","last_synced_at":"2025-03-25T06:31:24.009Z","repository":{"id":1779753,"uuid":"43459513","full_name":"microsoft/code-push","owner":"microsoft","description":"A cloud service that enables Cordova and React Native developers to deploy mobile app updates directly to their users’ devices.","archived":false,"fork":false,"pushed_at":"2025-02-19T10:41:04.000Z","size":12411,"stargazers_count":4406,"open_issues_count":0,"forks_count":515,"subscribers_count":124,"default_branch":"master","last_synced_at":"2025-03-18T05:07:57.384Z","etag":null,"topics":["codepush","cordova","react","react-native","reactnative"],"latest_commit_sha":null,"homepage":"https://microsoft.github.io/code-push/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-30T21:12:55.000Z","updated_at":"2025-03-14T02:29:40.000Z","dependencies_parsed_at":"2023-11-08T12:29:35.094Z","dependency_job_id":"2be561cc-6379-4312-844d-7af519274c28","html_url":"https://github.com/microsoft/code-push","commit_stats":{"total_commits":833,"total_committers":69,"mean_commits":"12.072463768115941","dds":0.822328931572629,"last_synced_commit":"5d08c1cd12548b3331b622457c959601b1271e2b"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcode-push","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcode-push/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcode-push/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fcode-push/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/code-push/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245407810,"owners_count":20610237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codepush","cordova","react","react-native","reactnative"],"created_at":"2024-07-31T13:00:43.656Z","updated_at":"2025-03-25T06:31:23.986Z","avatar_url":"https://github.com/microsoft.png","language":"TypeScript","readme":"[![appcenterbanner](https://user-images.githubusercontent.com/31293287/32969262-3cc5d48a-cb99-11e7-91bf-fa57c67a371c.png)](http://microsoft.github.io/code-push/)\n\n#### [Sign up With App Center](https://appcenter.ms/signup?utm_source=CodePush\u0026utm_medium=Azure) to use CodePush\n\n# CodePush SDK\n\nCodePush SDK enables seamless in-app updates and serves as a core component of the [CodePush React Native SDK](https://github.com/Microsoft/react-native-code-push).\n\nTo start integrating CodePush into your project, visit our [documentation](https://docs.microsoft.com/en-us/appcenter/distribution/codepush/). If you're interested in contributing or building the SDK from source, follow the steps below.\n\n## Visual Studio App Center CodePush Standalone Version\n\nFor teams or organizations looking to self-host CodePush, we now offer the [CodePush Standalone Version](https://github.com/microsoft/code-push-server) which is compatible with this SDK. It allows you to set up and manage CodePush as a self-hosted service, giving you more control over your infrastructure and data. Visit the repository for installation instructions, usage guides, and more.\n\n## Dev Setup\n\n* Install [Node.js](https://nodejs.org/)\n* Install [Git](http://www.git-scm.com/)\n* Clone the Repository: `git clone https://github.com/Microsoft/code-push.git`\n\n### Building\n\n* Run `npm run setup` to install the NPM dependencies of management SDK.\n* Run `npm run build` to build the management SDK for testing.\n* Run `npm run build:release` to build the release version of management SDK.\n\n### Running Tests\n\n* To run tests, run `npm run test` from the root of the project.\n* You can use debug mode for tests with `.vscode/launch.json` file.\n\n### Coding Conventions\n\n* Use double quotes for strings\n* Use four space tabs\n* Use `camelCase` for local variables and imported modules, `PascalCase` for types, and `dash-case` for file names\n\nThis 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.\n\n# CodePush Management SDK (Node.js)\n\nA 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).\n\n## Getting Started\n\n1. Create a token to authenticate with the CodePush server using the following [App Center CLI](https://github.com/microsoft/appcenter-cli) command:\n\n    ```shell\n    appcenter tokens create -d \"DESCRIPTION_OF_THE_TOKEN\"\n    ```\n\n    Please copy your `API Token` and keep it secret. You won't be able to see it again.\n\n2. Install the management SDK by running `npm install code-push --save`\n\n3. Import it using one of the following statement: (using ES6 syntax as applicable):\n   * On commonjs environments:\n\n    ```javascript\n    const CodePush = require(\"code-push\");\n    ```\n\n    * Using ES6 syntax with tsconfig.json:\n\n    ```javascript\n    import CodePush from \"code-push\";\n    ```\n\n4. Create an instance of the `CodePush` class, passing it the `API Token` you created or retrieved in step #1:\n\n    ```javascript\n    const codePush = new CodePush(\"YOUR_API_TOKEN\");\n    ```\n\n5. 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.\n\n## API Reference\n\nThe `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.\n\n### Constructors\n\n* __CodePush(accessKey: string)__ - Creates a new instance of the CodePush management SDK, using the specified access key to authenticated with the server.\n\n### Methods\n\n*Note: `access key` here refers to an AppCenter API Token.*\n\n* __addAccessKey(description: string): Promise\u0026lt;AccessKey\u0026gt;__ - Creates a new access key with the specified description (e.g. \"VSTS CI\").\n\n* __addApp(name: string, os: string, platform: string, manuallyProvisionDeployments: boolean = false): Promise\u0026lt;App\u0026gt;__ - 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.\n\n* __addCollaborator(appName: string, email: string): Promise\u0026lt;void\u0026gt;__ - Adds the specified CodePush user as a collaborator to the specified CodePush app.\n\n* __addDeployment(appName: string, deploymentName: string): Promise\u0026lt;Deployment\u0026gt;__ - Creates a new deployment with the specified name, and associated with the specified app.\n\n* __clearDeploymentHistory(appName: string, deploymentName: string): Promise\u0026lt;void\u0026gt;__ - Clears the release history associated with the specified app deployment.\n\n* __getAccessKey(accessKey: string): Promise\u0026lt;AccessKey\u0026gt;__ - Retrieves the metadata about the specific access key.\n\n* __getAccessKeys(): Promise\u0026lt;AccessKey[]\u0026gt;__ - Retrieves the list of access keys associated with your CodePush account.\n\n* __getApp(appName: string): Promise\u0026lt;App\u0026gt;__ - Retrieves the metadata about the specified app.\n\n* __getApps(): Promise\u0026lt;App[]\u0026gt;__ - Retrieves the list of apps associated with your CodePush account.\n\n* __getCollaborators(appName: string): Promise\u0026lt;CollaboratorMap\u0026gt;__ - Retrieves the list of collaborators associated with the specified app.\n\n* __getDeployment(appName: string, deploymentName: string): Promise\u0026lt;Deployment\u0026gt;__ - Retrieves the metadata for the specified app deployment.\n\n* __getDeploymentHistory(appName: string, deploymentName: string): Promise\u0026lt;Package[]\u0026gt;__ - Retrieves the list of releases that have been made to the specified app deployment.\n\n* __getDeploymentMetrics(appName: string, deploymentName: string): Promise\u0026lt;DeploymentMetrics\u0026gt;__ - Retrieves the installation metrics for the specified app deployment.\n\n* __getDeployments(appName: string): Promise\u0026lt;Deployment[]\u0026gt;__ - Retrieves the list of deployments associated with the specified app.\n\n* __patchRelease(appName: string, deploymentName: string, label: string, updateMetadata: PackageInfo): Promise\u0026lt;void\u0026gt;__ - Updates the specified release's metadata with the given information.\n\n* __promote(appName: string, sourceDeploymentName: string, destinationDeploymentName: string, updateMetadata: PackageInfo): Promise\u0026lt;Package\u0026gt;__ - Promotes the latest release from one deployment to another for the specified app and updates the release with the given metadata.\n\n* __release(appName: string, deploymentName: string, updateContentsPath: string, targetBinaryVersion: string, updateMetadata: PackageInfo): Promise\u0026lt;Package\u0026gt;__ - Releases a new update to the specified deployment with the given metadata.\n\n* __removeAccessKey(accessKey: string): Promise\u0026lt;void\u0026gt;__ - Removes the specified access key from your CodePush account.\n\n* __removeApp(appName: string): Promise\u0026lt;void\u0026gt;__ - Deletes the specified CodePush app from your account.\n\n* __removeCollaborator(appName: string, email: string): Promise\u0026lt;void\u0026gt;__ - Removes the specified account as a collaborator from the specified app.\n\n* __removeDeployment(appName: string, deploymentName: string): Promise\u0026lt;void\u0026gt;__ - Removes the specified deployment from the specified app.\n\n* __renameApp(oldAppName: string, newAppName: string): Promise\u0026lt;void\u0026gt;__ - Renames an existing app.\n\n* __renameDeployment(appName: string, oldDeploymentName: string, newDeploymentName: string): Promise\u0026lt;void\u0026gt;__ - Renames an existing deployment within the specified app.\n\n* __rollback(appName: string, deploymentName: string, targetRelease?: string): Promise\u0026lt;void\u0026gt;__ - Rolls back the latest release within the specified deployment. Optionally allows you to target a specific release in the deployment's history, as opposed to rolling to the previous release.\n\n* __transferApp(appName: string, email: string): Promise\u0026lt;void\u0026gt;__ - Transfers the ownership of the specified app to the specified account.\n\n### Error Handling\n\nWhen an error occurs in any of the methods, the promise will be rejected with a CodePushError object with the following properties:\n\n* __message__: A user-friendly message that describes the error.\n* __statusCode__: An HTTP response code that identifies the category of error:\n  * __CodePush.ERROR_GATEWAY_TIMEOUT__: A network error prevented you from connecting to the CodePush server.\n  * __CodePush.ERROR_INTERNAL_SERVER__: An error occurred internally on the CodePush server.\n  * __CodePush.ERROR_NOT_FOUND__: The resource you are attempting to retrieve does not exist.\n  * __CodePush.ERROR_CONFLICT__: The resource you are attempting to create already exists.\n  * __CodePush.ERROR_UNAUTHORIZED__: The access key you configured is invalid or expired.\n","funding_links":[],"categories":["Utilities","工具","三、构建、调试与部署"],"sub_categories":["Other Platforms","其他","2. 热更新与 CI/CD"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/microsoft.github.io%2Fcode-push%2F","html_url":"https://awesome.ecosyste.ms/projects/microsoft.github.io%2Fcode-push%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/microsoft.github.io%2Fcode-push%2F/lists"}