chrome-webstore-upload 3.0.3 → 3.1.0
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.
- package/index.js +13 -4
- package/package.json +1 -1
- package/readme.md +2 -1
package/index.js
CHANGED
|
@@ -6,8 +6,17 @@ const rootURI = 'https://www.googleapis.com';
|
|
|
6
6
|
export const refreshTokenURI = 'https://www.googleapis.com/oauth2/v4/token';
|
|
7
7
|
const uploadExistingURI = id =>
|
|
8
8
|
`${rootURI}/upload/chromewebstore/v1.1/items/${id}`;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
const publishURI = ({ extensionId, target = 'default', deployPercentage }) => {
|
|
11
|
+
const url = new URL(`${rootURI}/chromewebstore/v1.1/items/${extensionId}/publish`);
|
|
12
|
+
url.searchParams.set('publishTarget', target);
|
|
13
|
+
if (deployPercentage) {
|
|
14
|
+
url.searchParams.set('deployPercentage', deployPercentage);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return url.href;
|
|
18
|
+
};
|
|
19
|
+
|
|
11
20
|
const getURI = (id, projection) =>
|
|
12
21
|
`${rootURI}/chromewebstore/v1.1/items/${id}?projection=${projection}`;
|
|
13
22
|
|
|
@@ -61,10 +70,10 @@ class APIClient {
|
|
|
61
70
|
return response;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
async publish(target = 'default', token = this.fetchToken()) {
|
|
73
|
+
async publish(target = 'default', token = this.fetchToken(), deployPercentage) {
|
|
65
74
|
const { extensionId } = this;
|
|
66
75
|
|
|
67
|
-
const request = await fetch(publishURI(extensionId, target), {
|
|
76
|
+
const request = await fetch(publishURI({ extensionId, target, deployPercentage }), {
|
|
68
77
|
method: 'POST',
|
|
69
78
|
headers: this._headers(await token),
|
|
70
79
|
});
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -49,7 +49,8 @@ store.uploadExisting(myZipFile, token).then(res => {
|
|
|
49
49
|
```javascript
|
|
50
50
|
const target = 'default'; // optional. Can also be 'trustedTesters'
|
|
51
51
|
const token = 'xxxx'; // optional. One will be fetched if not provided
|
|
52
|
-
|
|
52
|
+
const deployPercentage = 25; // optional. Will default to 100%.
|
|
53
|
+
store.publish(target, token, deployPercentage).then(res => {
|
|
53
54
|
// Response is documented here:
|
|
54
55
|
// https://developer.chrome.com/webstore/webstore_api/items/publish
|
|
55
56
|
});
|