chrome webstore upload
v3.1.4
Un petit module Node.js pour télécharger / publier des extensions sur la boutique en ligne Chrome.
Si vous cherchez à télécharger / publier à partir de la CLI, utilisez Chrome-webstore-upload-CLI.
npm install --save-dev chrome-webstore-upload
Vous aurez besoin d'un Google API clientId , clientSecret et refreshToken . Utilisez le guide.
Toutes les méthodes renvoient une promesse.
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
const response = await store . uploadExisting ( myZipFile , token ) ;
// 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
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 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 const token = store . fetchToken ( ) ;
// token is astring fetchToken et transmettez-la à la fois uploadExisting et publish en tant que deuxième paramètre facultatif. Cela évitera que ces méthodes effectuent des appels en double pour de nouveaux jetons.