@@ -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