-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
wrapper.js
24 lines (20 loc) · 787 Bytes
/
wrapper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import fs from 'node:fs';
import path from 'node:path';
import getClient from 'chrome-webstore-upload';
import zipdir from './zipdir.js';
const isZip = filepath => path.extname(filepath) === '.zip';
export async function upload({ apiConfig, zipPath, token }) {
const client = getClient(apiConfig);
const zipStream = isZip(zipPath)
? fs.createReadStream(zipPath)
: await zipdir(zipPath);
return client.uploadExisting(zipStream, token);
}
export async function publish({ apiConfig, token }, publishTarget, deployPercentage) {
const client = getClient(apiConfig);
return client.publish(publishTarget, token, deployPercentage);
}
export async function fetchToken(apiConfig) {
const client = getClient(apiConfig);
return client.fetchToken();
}