chrome webstore upload
v3.1.4
โมดูล Node.js ขนาดเล็กเพื่ออัปโหลด/เผยแพร่ส่วนขยายไปยัง Chrome Web Store
หากคุณต้องการอัปโหลด/เผยแพร่จาก CLI ให้ใช้ Chrome-Webstore-Upload-cli
npm install --save-dev chrome-webstore-upload
คุณจะต้องใช้ Google API clientId , clientSecret และ refreshToken ใช้คู่มือ
วิธีการทั้งหมดส่งคืนสัญญา
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 และส่งผ่านไปยังทั้ง uploadExisting และ publish เป็นพารามิเตอร์ที่สองเสริม สิ่งนี้จะหลีกเลี่ยงวิธีการเหล่านั้นที่เรียกใช้ซ้ำสำหรับโทเค็นใหม่