Skip to content

Commit fd25ff5

Browse files
committed
chore: pack
1 parent fa6636c commit fd25ff5

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

extension.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"dist": "HeaderEditor-{VER}",
33
"auto": {
4-
"xpi": true,
54
"amo": true,
65
"cws": true,
76
"crx": true,
8-
"edge": true
7+
"edge": true,
8+
"xpi": true
99
},
1010
"crx": [
1111
{

scripts/pack.mjs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const packUtils = {
4444
* @param {*} extensionConfig 对应extension.json中的配置
4545
* @returns
4646
*/
47-
async function packOnePlatform(name, browserConfig, extensionConfig) {
47+
async function prepareOnePlatform(name, extensionConfig) {
4848
if (typeof packUtils[name] === 'undefined') {
4949
console.error(`pack-utils for ${name} not found`);
5050
return;
@@ -68,8 +68,19 @@ async function packOnePlatform(name, browserConfig, extensionConfig) {
6868
// 打包成zip
6969
console.log(`zip ${thisPack} -> ${zipPath}`);
7070
await createZip(thisPack, zipPath);
71-
// 执行上传等操作
72-
console.log(`Running ${name} pack...`);
71+
} catch (e) {
72+
console.error(`Prepare ${name} error`);
73+
console.error(e);
74+
}
75+
return { dirName, thisPack, zipPath };
76+
}
77+
async function packOnePlatform(name, prepare, browserConfig, extensionConfig) {
78+
const { thisPack, zipPath } = prepare;
79+
if (typeof packUtils[name] === 'undefined') {
80+
console.error(`pack-utils for ${name} not found`);
81+
return;
82+
}
83+
try {
7384
const res = await packUtils[name]({
7485
rootPath: _path.root,
7586
sourcePath: thisPack,
@@ -122,7 +133,8 @@ async function main() {
122133
const platformConfig = extension[name];
123134
for (const item of platformConfig) {
124135
const browser = browserConfig[item.browser];
125-
queue.push(packOnePlatform(name, browser, item));
136+
const prepare = await prepareOnePlatform(name, item);
137+
queue.push(packOnePlatform(name, { ...prepare }, browser, item));
126138
}
127139
}
128140

0 commit comments

Comments
 (0)