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.
npm install --save-dev chrome-webstore-upload
You will need a Google API clientId
, clientSecret
and refreshToken
. Read the guide.
All methods return a promise.
import chromeWebstoreUpload from 'chrome-webstore-upload';
const store = chromeWebstoreUpload({
extensionId: 'ecnglinljpjkbgmdpeiglonddahpbkeb',
clientId: 'xxxxxxxxxx',
clientSecret: 'xxxxxxxxxx',
refreshToken: 'xxxxxxxxxx',
});
import fs from 'fs';
const myZipFile = fs.createReadStream('./mypackage.zip');
const token = 'xxxx'; // optional. One will be fetched if not provided
store.uploadExisting(myZipFile, token).then(res => {
// Response is a Resource Representation
// https://developer.chrome.com/webstore/webstore_api/items#resource
});
const target = 'default'; // optional. Can also be 'trustedTesters'
const token = 'xxxx'; // optional. One will be fetched if not provided
store.publish(target, token).then(res => {
// Response is documented here:
// https://developer.chrome.com/webstore/webstore_api/items/publish
});
const projection = "DRAFT"; // optional. Can also be 'PUBLISHED' but only "DRAFT" is supported at this time.
const token = "xxxx"; // optional. One will be fetched if not provided
store.get(projection, token).then((res) => {
// Response is documented here:
// https://developer.chrome.com/docs/webstore/webstore_api/items/get
});
store.fetchToken().then(token => {
// Token is a string
});
- If you plan to upload and publish at the same time, use the
fetchToken
method, and pass it to bothuploadExisting
andpublish
as the optional second parameter. This will avoid those methods making duplicate calls for new tokens.
- webext-storage-cache - Map-like promised cache storage with expiration. Chrome and Firefox
- webext-dynamic-content-scripts - Automatically registers your content_scripts on domains added via permission.request
- Awesome-WebExtensions - A curated list of awesome resources for WebExtensions development.
- More…