Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chrome-webstore-upload

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-webstore-upload

Upload Chrome Extensions to the Chrome Web Store

  • 3.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

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'; // optional. One will be fetched if not provided
const response = await store.uploadExisting(myZipFile, token);
// response is a Resource Representation
// https://developer.chrome.com/webstore/webstore_api/items#resource

Publish extension

const target = 'default'; // optional. Can also be 'trustedTesters'
const token = 'xxxx'; // optional. One will be fetched if not provided
const deployPercentage = 25; // optional. Will default to 100%.
const response = await store.publish(target, token, deployPercentage);
// response is documented here:
// https://developer.chrome.com/webstore/webstore_api/items#publish

Get a Chrome Web Store item

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
const response = await store.get(projection, token);
// response is documented here:
// https://developer.chrome.com/docs/webstore/webstore_api/items#get

Fetch token

const token = store.fetchToken();
// token is  astring

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.

Keywords

FAQs

Package last updated on 01 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc