chrome-webstore-upload
A small node.js module to upload/publish extensions to the Chrome Web Store.
If you're looking to upload/publish from the CLI, then use chrome-webstore-upload-cli.
Install
npm install --save-dev chrome-webstore-upload
Setup
You will need a Google API clientId
, clientSecret
and refreshToken
. Use the guide.
Usage
All methods return a promise.
Create a new client
import chromeWebstoreUpload from 'chrome-webstore-upload';
const store = chromeWebstoreUpload({
extensionId: 'ecnglinljpjkbgmdpeiglonddahpbkeb',
clientId: 'xxxxxxxxxx',
clientSecret: 'xxxxxxxxxx',
refreshToken: 'xxxxxxxxxx',
});
Upload to existing extension
import fs from 'fs';
const myZipFile = fs.createReadStream('./mypackage.zip');
const token = 'xxxx';
const response = await store.uploadExisting(myZipFile, token);
Publish extension
const target = 'default';
const token = 'xxxx';
const deployPercentage = 25;
const response = await store.publish(target, token, deployPercentage);
Get a Chrome Web Store item
const projection = "DRAFT";
const token = "xxxx";
const response = await store.get(projection, token);
Fetch token
const token = store.fetchToken();
Tips
- If you plan to upload and publish at the same time, use the
fetchToken
method, and pass it to both uploadExisting
and publish
as the optional second parameter. This will avoid those methods making duplicate calls for new tokens.
Related