@holajs/plugin-platform-gmuapp
Advanced tools
| /** */ | ||
| export interface GmuConfig { | ||
| extApi?: Array<ExtApiConfig>; | ||
| [key: string]: any; | ||
| } | ||
| export interface ExtApiConfig { | ||
| module: string; | ||
| name: string; | ||
| isSync?: boolean; | ||
| params?: { | ||
| [key: string]: any; | ||
| }; | ||
| } |
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("path"),t=require("fs-extra"),n=require("shelljs"),o=require("@tarojs/plugin-platform-weapp");function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=i(e),a=i(t),u=i(n);function p(e,t,n,o){return new(n||(n=Promise))((function(i,r){function a(e){try{p(o.next(e))}catch(e){r(e)}}function u(e){try{p(o.throw(e))}catch(e){r(e)}}function p(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}p((o=o.apply(e,t||[])).next())}))}let s=!1;exports.default=(e,t)=>{let n="gmu";"gmuapp"===e.runOpts.options.platform&&(a.emptyDirSync(e.paths.outputPath),e.initialConfig.outputRoot=r.join(e.initialConfig.outputRoot,"src"),e.paths.outputPath=r.join(e.paths.outputPath,"src"),e.initialConfig.gmuapp&&(n="gmuapp")),e.registerPlatform({name:"gmuapp",useConfigName:n,fn({config:n}){return p(this,void 0,void 0,(function*(){e.modifyBuildAssets((({miniPlugin:t})=>{var n,o;const i=[],u=(null===(o=null===(n=t.appConfig)||void 0===n?void 0:n.window)||void 0===o?void 0:o.pullDownRefreshIconPath)||"";u&&i.push(u),t.pages.forEach((e=>{const n=t.filesConfig[t.getConfigFilePath(e.name)].content.pullDownRefreshIconPath;n&&i.push(n)})),i.forEach((t=>{const n=r.join(e.paths.sourcePath,t),o=r.join(e.paths.outputPath,t);a.ensureDirSync(o.slice(0,o.lastIndexOf(r.sep))),a.copyFileSync(n,o)}))}));const i=r.join(e.paths.appPath,n.nativePath||"native"),u=r.join(e.paths.outputPath.replace(/(\/|\\)src(\/|\\)?$/,""),"native");a.ensureDir(i),a.copy(i,u),e.generateFrameworkInfo(),e.generateProjectConfig({srcConfigName:"project.gmuapp.json",distConfigName:"../project.json"});const p=new o.Weapp(e,n,t||{});yield p.start()}))}}),e.onBuildFinish((()=>{var t,n,o;const{options:i,config:r}=e.runOpts;if("gmuapp"===i.platform&&!s){s=!0;const a=e.paths.outputPath.replace(/(\/|\\)src(\/|\\)?$/,"");let p="";if(i.isWatch){const e=(null===(t=null==r?void 0:r.devServer)||void 0===t?void 0:t.port)||3e3;p=(null===(n=null==r?void 0:r.exec)||void 0===n?void 0:n.dev)?r.exec.dev:`light release -wb ${e} ${i.isMpDebug?"--debug":""}`}else p=(null===(o=null==r?void 0:r.exec)||void 0===o?void 0:o.prod)?r.exec.prod:"light release -p";u.exec(`cd ${a} && ${p}`,{async:!0})}}))}; | ||
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("path"),t=require("fs-extra"),n=require("shelljs"),o=require("@tarojs/plugin-platform-weapp");function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=i(e),a=i(t),u=i(n);function p(e,t,n,o){return new(n||(n=Promise))((function(i,r){function a(e){try{p(o.next(e))}catch(e){r(e)}}function u(e){try{p(o.throw(e))}catch(e){r(e)}}function p(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}p((o=o.apply(e,t||[])).next())}))}let s=!1;function c(e,t){if(e&&t)try{const n="gmuConf.js",o=`module.exports = ${JSON.stringify(e)}`;a.writeFileSync(r.join(t,n),o)}catch(e){console.warn(e)}}exports.default=(e,t)=>{let n="gmu";"gmuapp"===e.runOpts.options.platform&&(a.emptyDirSync(e.paths.outputPath),e.initialConfig.outputRoot=r.join(e.initialConfig.outputRoot,"src"),e.paths.outputPath=r.join(e.paths.outputPath,"src"),e.initialConfig.gmuapp&&(n="gmuapp")),e.registerPlatform({name:"gmuapp",useConfigName:n,fn({config:n}){return p(this,void 0,void 0,(function*(){e.modifyBuildAssets((({miniPlugin:t})=>{var n,o,i;const u=[],p=(null===(o=null===(n=t.appConfig)||void 0===n?void 0:n.window)||void 0===o?void 0:o.pullDownRefreshIconPath)||"";p&&u.push(p),t.pages.forEach((e=>{const n=t.filesConfig[t.getConfigFilePath(e.name)].content.pullDownRefreshIconPath;n&&u.push(n)})),u.forEach((t=>{const n=r.join(e.paths.sourcePath,t),o=r.join(e.paths.outputPath,t);a.ensureDirSync(o.slice(0,o.lastIndexOf(r.sep))),a.copyFileSync(n,o)})),c(null===(i=t.appConfig)||void 0===i?void 0:i.gmuConfig,e.paths.outputPath)}));const i=r.join(e.paths.appPath,n.nativePath||"native"),u=r.join(e.paths.outputPath.replace(/(\/|\\)src(\/|\\)?$/,""),"native");a.ensureDir(i),a.copy(i,u),e.generateFrameworkInfo(),e.generateProjectConfig({srcConfigName:"project.gmuapp.json",distConfigName:"../project.json"});const p=new o.Weapp(e,n,t||{});yield p.start()}))}}),e.onBuildFinish((()=>{var t,n,o;const{options:i,config:r}=e.runOpts;if("gmuapp"===i.platform&&!s){s=!0;const a=e.paths.outputPath.replace(/(\/|\\)src(\/|\\)?$/,"");let p="";if(i.isWatch){const e=(null===(t=null==r?void 0:r.devServer)||void 0===t?void 0:t.port)||3e3;p=(null===(n=null==r?void 0:r.exec)||void 0===n?void 0:n.dev)?r.exec.dev:`light release -wb ${e} ${i.isMpDebug?"--debug":""}`}else p=(null===(o=null==r?void 0:r.exec)||void 0===o?void 0:o.prod)?r.exec.prod:"light release -p";u.exec(`cd ${a} && ${p}`,{async:!0})}}))},exports.generateGmuConf=c; |
+1
-1
| { | ||
| "name": "@holajs/plugin-platform-gmuapp", | ||
| "version": "0.1.13", | ||
| "version": "0.1.14", | ||
| "description": "GMU APP平台插件", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,2 +1,9 @@ | ||
| import { GmuConfig } from './types'; | ||
| declare const _default: (ctx: any, options: any) => void; | ||
| export default _default; | ||
| /** | ||
| * 生成 gmuConf 配置文件 | ||
| * @param config 配置 | ||
| * @param filePath 文件路径 | ||
| */ | ||
| export declare function generateGmuConf(config: GmuConfig, filePath: string): void; |
5367
15.72%7
16.67%35
150%