microsoft / cordova-plugin-code-push

Cordova plugin for CodePush
http://appcenter.ms
Other
643 stars 333 forks source link

Get deployment name (e.g. Production) from deployment key #543

Open l3ender opened 5 years ago

l3ender commented 5 years ago

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Description

Given a deployment key, how can I get the deployment channel/branch name?

Additional Information

We use code push in our app and want to be able to display the deployment channel name. Our config.xml has our deployment keys which are used for syncing for changes, but how can I get the deployment name (e.g. Production, Staging, Beta)?

We have two places where we'd like this:

  1. If a code push update is installed, we have the LocalPackage update. This has the deploymentKey but no deployment name.
  2. If a code push update is not installed, how can the deployment name be retrieved from the deployment key our app has?

This would help us quite a bit as everywhere else we are using deployment name (e.g. when release code push updates).

Thanks!

alexandergoncharov-zz commented 5 years ago

Hi @l3ender Thank you for reporting!

For your needs you should use CodePush Management SDK. It's npm module which provides additional functionality for CodePush.

Here is documentation for CodePush Management SDK: https://docs.microsoft.com/en-us/appcenter/distribution/codepush/node

You should use getDeployments(appName: string) method.

Could you please let me know if it was helpful or you have any questions?

l3ender commented 5 years ago

Thanks @alexandergoncharov. Could you please advise on how this could be added in an Angular app?

When I try the following:

import { CodePush } from "code-push";

I get the following errors:

Could not find a declaration file for module 'code-push'. '~/workspace/node_modules/code-push/script/index.js' implicitly has an 'any' type. Try npm install @types/code-push if it exists or add a new declaration (.d.ts) file containing declare module 'code-push';ts(7016)

Could you please advise? Thanks!

Edit: I should mention that there are no types available (see search on npmjs and https://github.com/microsoft/code-push/issues/341).

l3ender commented 5 years ago

@alexandergoncharov Any ideas?

l3ender commented 5 years ago

@alexandergoncharov Any input on this issue?

alexandergoncharov-zz commented 5 years ago

Hi @l3ender, Sorry for delay.

Right now we are working on the new codepush version and support will be slow down during this process. Please check UPDATE section of README: https://github.com/microsoft/cordova-plugin-code-push/blob/master/README.md

l3ender commented 4 years ago

@alexandergoncharov Hi, it's been a few months and I'm wondering if you'd be able to assist on how to use CodePush Management SDK in Angular app. Thanks!

alexandergoncharov-zz commented 4 years ago

Hi @l3ender , I'm sorry for so long delay.

Right now we have types for CodePush SDK. Could you please try with the latest version of the CodePush SDK and let me know your results?

l3ender commented 4 years ago

Thanks for the update. I'm trying to utilize the codepush management SDK but am facing a different error, for which I raised https://github.com/microsoft/code-push/issues/727.