gulpfile.js 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546
  1. var gulp = require('gulp'),
  2. del = require('del'),
  3. // uglify = require('gulp-uglify-es').default,
  4. uglify = require('gulp-terser'),
  5. rename = require('gulp-rename'),
  6. changed = require('gulp-changed'),
  7. gulpif = require('gulp-if'),
  8. minimist = require('minimist'),
  9. ftp = require('gulp-ftp'),
  10. sftp = require('gulp-sftp-up4'),
  11. JSFtp = require('jsftp'),
  12. gutil = require('gulp-util'),
  13. fs = require("fs"),
  14. concat = require('gulp-concat'),
  15. shell = require('gulp-shell');
  16. var through2 = require('through2');
  17. var path = require('path');
  18. var nodePath = path;
  19. var git = require('gulp-git');
  20. var assetRev = require('gulp-o2oa-asset-rev');
  21. var apps = require('./gulpapps.js');
  22. const sourcemaps = require('gulp-sourcemaps');
  23. var {generate} = require('@o2oa/language-tools');
  24. var ftpconfig;
  25. try{
  26. ftpconfig = require('./gulpconfig.js');
  27. }catch(e){
  28. ftpconfig = {
  29. "dev": {
  30. 'upload': '',
  31. 'location': 'E:/o2server/servers/webServer/',
  32. 'host': '',
  33. 'user': '',
  34. 'pass': '',
  35. "port": 22,
  36. "remotePath": "/data/o2server/servers/webServer/",
  37. "dest": "dest"
  38. }
  39. };
  40. }
  41. var supportedLanguage = ["zh-cn", "en", "es"];
  42. var o_options = minimist(process.argv.slice(2), {//upload: local ftp or sftp
  43. string: ["ev", "upload", "location", "host", "user", "pass", "port", "remotePath", "dest", "src", "lp"]
  44. });
  45. function getEvOptions(ev){
  46. options.ev = ev;
  47. return (ftpconfig[ev]) || {
  48. 'location': '',
  49. 'host': '',
  50. 'user': '',
  51. 'pass': '',
  52. "port": null,
  53. "remotePath": "",
  54. "dest": "dest",
  55. "upload": ""
  56. }
  57. }
  58. function setOptions(op1, op2){
  59. if (!op2) op2 = {};
  60. options.upload = op1.upload || op2.upload || "";
  61. options.location = op1.location || op2.location || "";
  62. options.host = op1.host || op2.host || "";
  63. options.user = op1.user || op2.user || "";
  64. options.pass = op1.pass || op2.pass || "";
  65. options.port = op1.port || op2.port || "";
  66. options.remotePath = op1.remotePath || op2.remotePath || "";
  67. options.dest = op1.dest || op2.dest || "dest";
  68. options.lp = op1.lp || op2.lp || "zh-cn";
  69. options.src = op1.src || op2.src || "";
  70. }
  71. var options = {};
  72. setOptions(o_options, getEvOptions(o_options.ev));
  73. var appTasks = [];
  74. function setTaskName(task, name){
  75. Object.defineProperty(task, 'name', {
  76. value: name
  77. });
  78. return task;
  79. }
  80. function createLanguagePackTask(path){
  81. let component;
  82. if (ftpconfig && ftpconfig.languagePack && ftpconfig.languagePack.accessKeys){
  83. const lps = ftpconfig.languagePack.lps, keys = ftpconfig.languagePack.accessKeys["baidu-translate"];
  84. const name = path+" : LanguagePack";
  85. const task = function(cb){
  86. if (path.startsWith('x_component_')){
  87. component = path.substring('x_component_'.length).replace('_', '.');
  88. generate(component, lps, keys).then(()=>{
  89. cb();
  90. });
  91. }else if(path==='o2_core') {
  92. component = 'o2_core';
  93. generate(component, lps, keys).then(()=>{
  94. cb();
  95. });
  96. }else{
  97. cb();
  98. }
  99. }
  100. return setTaskName(task, name);
  101. }else{
  102. return function nothing(cb){cb();};
  103. }
  104. }
  105. function createDefaultTask(path, isMin, thisOptions) {
  106. var pkgPath = nodePath.resolve('source', path, 'package.json');
  107. if (fs.existsSync(pkgPath)){
  108. var pkg = require(pkgPath);
  109. if (pkg.scripts['o2-deploy']){
  110. const shellTask = shell.task('npm run o2-deploy', {cwd: nodePath.resolve('source', path), verbose:true});
  111. const task = function(){
  112. var option = thisOptions || options;
  113. var dest = ['dest/' + path + '/**/*'];
  114. return gulp.src(dest)
  115. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  116. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  117. host: option.host,
  118. user: option.user || 'anonymous',
  119. pass: option.pass || '@anonymous',
  120. port: option.port || 21,
  121. remotePath: (option.remotePath || '/') + path
  122. })))
  123. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  124. host: option.host,
  125. user: option.user || 'anonymous',
  126. pass: option.pass || null,
  127. port: option.port || 22,
  128. remotePath: (option.remotePath || '/') + path
  129. })))
  130. .pipe(gutil.noop());
  131. }
  132. return gulp.series(
  133. setTaskName(shellTask, path+' : build'),
  134. setTaskName(task, path+' : deploy'),
  135. )
  136. }
  137. }
  138. const task = function (){
  139. var option = thisOptions || options;
  140. var src;
  141. var dest = option.dest+'/' + path + '/';
  142. let ev = option.ev
  143. var evList = Object.keys(ftpconfig).map((i)=>{ return (i==ev) ? "*"+i : i; });
  144. if (isMin){
  145. var src_min = ['source/' + path + '/**/*.js', '!**/*.spec.js', '!**/test/**'];
  146. var src_move = ['source/' + path + '/**/*', '!**/*.spec.js', '!**/test/**'];
  147. gutil.log("Move-Uglify", ":", gutil.colors.green(gutil.colors.blue(path), gutil.colors.white('->'), dest));
  148. return gulp.src(src_min)
  149. .pipe(changed(dest))
  150. .pipe(uglify())
  151. .pipe(rename({ extname: '.min.js' }))
  152. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  153. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  154. host: option.host,
  155. user: option.user || 'anonymous',
  156. pass: option.pass || '@anonymous',
  157. port: option.port || 21,
  158. remotePath: (option.remotePath || '/') + path
  159. })))
  160. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  161. host: option.host,
  162. user: option.user || 'anonymous',
  163. pass: option.pass || null,
  164. port: option.port || 22,
  165. remotePath: (option.remotePath || '/') + path
  166. })))
  167. .pipe(gulpif((option.ev == "dev" || option.ev == "pro") ,gulp.dest(dest)))
  168. .pipe(gulp.src(src_move))
  169. .pipe(changed(dest))
  170. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  171. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  172. host: option.host,
  173. user: option.user || 'anonymous',
  174. pass: option.pass || '@anonymous',
  175. port: option.port || 21,
  176. remotePath: (option.remotePath || '/') + path
  177. })))
  178. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  179. host: option.host,
  180. user: option.user || 'anonymous',
  181. pass: option.pass || null,
  182. port: option.port || 22,
  183. remotePath: (option.remotePath || '/') + path
  184. })))
  185. .pipe(gulp.dest(dest))
  186. .pipe(gutil.noop());
  187. }else{
  188. src = ['source/' + path + '/**/*', '!**/*.spec.js', '!**/test/**'];
  189. gutil.log("Move", ":", gutil.colors.green(gutil.colors.blue(path), gutil.colors.white('->'), dest));
  190. return gulp.src(src)
  191. .pipe(changed(dest))
  192. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  193. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  194. host: option.host,
  195. user: option.user || 'anonymous',
  196. pass: option.pass || '@anonymous',
  197. port: option.port || 21,
  198. remotePath: (option.remotePath || '/') + path
  199. })))
  200. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  201. host: option.host,
  202. user: option.user || 'anonymous',
  203. pass: option.pass || null,
  204. port: option.port || 22,
  205. remotePath: (option.remotePath || '/') + path
  206. })))
  207. .pipe(gulp.dest(dest))
  208. .pipe(gutil.noop());
  209. }
  210. }
  211. return setTaskName(task, path+' : task');
  212. }
  213. function createXFormConcatTask(path, isMin, thisOptions) {
  214. return function process_Xform_concat(){
  215. var option = thisOptions || options;
  216. var src = [
  217. 'source/o2_core/o2/widget/AttachmentController.js',
  218. 'source/o2_core/o2/xScript/Macro.js',
  219. 'source/o2_core/o2/widget/Tab.js',
  220. 'source/o2_core/o2/widget/O2Identity.js',
  221. 'source/' + path + '/Form.js',
  222. 'source/' + path + '/$Module.js',
  223. 'source/' + path + '/$Input.js',
  224. 'source/' + path + '/$Selector.js',
  225. 'source/' + path + '/Div.js',
  226. 'source/' + path + '/Combox.js',
  227. 'source/' + path + '/DatagridMobile.js',
  228. 'source/' + path + '/DatagridPC.js',
  229. 'source/' + path + '/DatatablePC.js',
  230. 'source/' + path + '/DatatableMobile.js',
  231. 'source/' + path + '/Textfield.js',
  232. 'source/' + path + '/Personfield.js',
  233. 'source/' + path + '/Button.js',
  234. 'source/' + path + '/ViewSelector.js',
  235. 'source/' + path + '/*.js',
  236. 'source/x_component_process_Work/Processor.js',
  237. //'source/x_component_process_Work/Flow.js',
  238. '!source/' + path + '/Documenteditor.js ',
  239. '!source/' + path + '/Office.js',
  240. '!source/' + path + '/WpsOffice.js',
  241. '!source/' + path + '/WpsOffice2.js',
  242. '!source/' + path + '/YozoOffice.js',
  243. '!source/' + path + '/OnlyOffice.js',
  244. '!source/' + path + '/OfficeOnline.js',
  245. '!source/' + path + '/TinyMCEEditor.js'
  246. ];
  247. var dest = option.dest+'/' + path + '/';
  248. return gulp.src(src)
  249. .pipe(concat('$all.js'))
  250. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  251. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  252. host: option.host,
  253. user: option.user || 'anonymous',
  254. pass: option.pass || '@anonymous',
  255. port: option.port || 21,
  256. remotePath: (option.remotePath || '/') + path
  257. })))
  258. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  259. host: option.host,
  260. user: option.user || 'anonymous',
  261. pass: option.pass || null,
  262. port: option.port || 22,
  263. remotePath: (option.remotePath || '/') + path
  264. })))
  265. .pipe(gulp.dest(dest))
  266. .pipe(sourcemaps.init())
  267. .pipe(concat('$all.min.js'))
  268. .pipe(uglify())
  269. .pipe(sourcemaps.write("./"))
  270. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  271. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  272. host: option.host,
  273. user: option.user || 'anonymous',
  274. pass: option.pass || '@anonymous',
  275. port: option.port || 21,
  276. remotePath: (option.remotePath || '/') + path
  277. })))
  278. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  279. host: option.host,
  280. user: option.user || 'anonymous',
  281. pass: option.pass || null,
  282. port: option.port || 22,
  283. remotePath: (option.remotePath || '/') + path
  284. })))
  285. .pipe(gulp.dest(dest))
  286. };
  287. }
  288. function createCMSXFormConcatTask(path, isMin, thisOptions) {
  289. return function cms_xform_concat(){
  290. var processPath = "x_component_process_Xform";
  291. var option = thisOptions || options;
  292. var src = [
  293. 'source/o2_core/o2/widget/AttachmentController.js',
  294. // 'source/o2_core/o2/xScript/CMSEnvironment.js',
  295. 'source/o2_core/o2/xScript/CMSMacro.js',
  296. 'source/o2_core/o2/widget/Tab.js',
  297. 'source/o2_core/o2/widget/O2Identity.js',
  298. 'source/o2_core/o2/widget/ImageLazyLoader.js',
  299. 'source/o2_core/o2/widget/ImageViewer.js',
  300. 'source/' + processPath + '/Form.js',
  301. 'source/' + processPath + '/$Module.js',
  302. 'source/' + processPath + '/$Input.js',
  303. 'source/' + processPath + '/$Selector.js',
  304. 'source/' + processPath + '/Div.js',
  305. //'source/' + processPath + '/Combox.js',
  306. 'source/' + processPath + '/DatagridMobile.js',
  307. 'source/' + processPath + '/DatagridPC.js',
  308. 'source/' + processPath + '/DatatablePC.js',
  309. 'source/' + processPath + '/DatatableMobile.js',
  310. 'source/' + processPath + '/Textfield.js',
  311. //'source/' + processPath + '/Personfield.js',
  312. 'source/' + processPath + '/Button.js',
  313. //'source/' + processPath + '/ViewSelector.js',
  314. 'source/' + processPath + '/Org.js',
  315. // 'source/' + processPath + '/*.js',
  316. 'source/' + processPath + '/Actionbar.js',
  317. //'source/' + processPath + '/Address.js',
  318. 'source/' + processPath + '/Attachment.js',
  319. 'source/' + processPath + '/Calendar.js',
  320. 'source/' + processPath + '/Checkbox.js',
  321. 'source/' + processPath + '/Datagrid.js',
  322. 'source/' + processPath + '/Datatable.js',
  323. 'source/' + processPath + '/Datatemplate.js',
  324. 'source/' + processPath + '/Htmleditor.js',
  325. //'source/' + processPath + '/Iframe.js',
  326. 'source/' + processPath + '/Label.js',
  327. 'source/' + processPath + '/Number.js',
  328. 'source/' + processPath + '/Currency.js',
  329. 'source/' + processPath + '/Common.js',
  330. 'source/' + processPath + '/Image.js',
  331. 'source/' + processPath + '/ImageClipper.js',
  332. 'source/' + processPath + '/WritingBoard.js',
  333. 'source/' + processPath + '/Html.js',
  334. 'source/' + processPath + '/Radio.js',
  335. 'source/' + processPath + '/Select.js',
  336. //'source/' + processPath + '/Stat.js',
  337. //'source/' + processPath + '/Statement.js',
  338. //'source/' + processPath + '/StatementSelector.js',
  339. //'source/' + processPath + '/Subform.js',
  340. 'source/' + processPath + '/Tab.js',
  341. 'source/' + processPath + '/Table.js',
  342. 'source/' + processPath + '/Textarea.js',
  343. 'source/' + processPath + '/$ElModule.js',
  344. 'source/' + processPath + '/$Elinput.js',
  345. 'source/' + processPath + '/Elcascader.js',
  346. 'source/' + processPath + '/Elradio.js',
  347. 'source/' + processPath + '/Elcheckbox.js',
  348. 'source/' + processPath + '/Elcommon.js',
  349. 'source/' + processPath + '/Elcontainer.js',
  350. 'source/' + processPath + '/Elicon.js',
  351. 'source/' + processPath + '/Elinput.js',
  352. 'source/' + processPath + '/Elnumber.js',
  353. 'source/' + processPath + '/Elselect.js',
  354. 'source/' + processPath + '/Elslider.js',
  355. 'source/' + processPath + '/Elswitch.js',
  356. 'source/' + processPath + '/Elautocomplete.js',
  357. 'source/' + processPath + '/Elbutton.js',
  358. 'source/' + processPath + '/Eltime.js',
  359. 'source/' + processPath + '/Eldate.js',
  360. 'source/' + processPath + '/Eldatetime.js',
  361. 'source/' + processPath + '/Elrate.js',
  362. 'source/' + processPath + '/Elcolorpicker.js',
  363. 'source/' + processPath + '/Eltree.js',
  364. 'source/' + processPath + '/Eldropdown.js',
  365. 'source/' + processPath + '/Elcarousel.js',
  366. //'source/' + processPath + '/Tree.js',
  367. //'source/' + processPath + '/View.js',
  368. // 'source/x_component_process_Work/Processor.js',
  369. // '!source/' + processPath + '/Office.js'
  370. 'source/o2_core/o2/widget/SimpleToolbar.js',
  371. 'source/' + path + '/ModuleImplements.js',
  372. 'source/' + path + '/Package.js',
  373. 'source/' + path + '/Form.js',
  374. //'source/' + path + '/widget/Comment.js',
  375. 'source/' + path + '/widget/Log.js',
  376. 'source/' + path + '/Org.js',
  377. 'source/' + path + '/Author.js',
  378. 'source/' + path + '/Reader.js',
  379. 'source/' + path + '/Textfield.js',
  380. 'source/' + path + '/Actionbar.js',
  381. 'source/' + path + '/Attachment.js',
  382. 'source/' + path + '/Button.js',
  383. 'source/' + path + '/Calendar.js',
  384. 'source/' + path + '/Checkbox.js',
  385. 'source/' + path + '/Datagrid.js',
  386. 'source/' + path + '/Datatable.js',
  387. 'source/' + path + '/Datatemplate.js',
  388. 'source/' + path + '/Htmleditor.js',
  389. 'source/' + path + '/ImageClipper.js',
  390. 'source/' + path + '/WritingBoard.js',
  391. 'source/' + path + '/Label.js',
  392. 'source/' + path + '/Number.js',
  393. 'source/' + path + '/Currency.js',
  394. 'source/' + path + '/Radio.js',
  395. 'source/' + path + '/Select.js',
  396. 'source/' + path + '/Tab.js',
  397. 'source/' + path + '/Table.js',
  398. 'source/' + path + '/Textarea.js',
  399. 'source/' + path + '/Elcascader.js',
  400. 'source/' + path + '/Elradio.js',
  401. 'source/' + path + '/Elcheckbox.js',
  402. 'source/' + path + '/Elcommon.js',
  403. 'source/' + path + '/Elcontainer.js',
  404. 'source/' + path + '/Elicon.js',
  405. 'source/' + path + '/Elinput.js',
  406. 'source/' + path + '/Elnumber.js',
  407. 'source/' + path + '/Elselect.js',
  408. 'source/' + path + '/Elslider.js',
  409. 'source/' + path + '/Elswitch.js',
  410. 'source/' + path + '/Elautocomplete.js',
  411. 'source/' + path + '/Elbutton.js',
  412. 'source/' + path + '/Eltime.js',
  413. 'source/' + path + '/Eldate.js',
  414. 'source/' + path + '/Eldatetime.js',
  415. 'source/' + path + '/Elrate.js',
  416. 'source/' + path + '/Elcolorpicker.js',
  417. 'source/' + path + '/Eltree.js',
  418. 'source/' + path + '/Eldropdown.js',
  419. 'source/' + path + '/Elcarousel.js',
  420. //'source/' + path + '/Personfield.js',
  421. //'source/' + path + '/Readerfield.js',
  422. //'source/' + path + '/Authorfield.js',
  423. //'source/' + path + '/Orgfield.js',
  424. // 'source/' + path + '/*.js',
  425. // '!source/' + path + '/Office.js'
  426. ];
  427. var dest = option.dest+'/' + path + '/';
  428. return gulp.src(src)
  429. .pipe(concat('$all.js'))
  430. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  431. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  432. host: option.host,
  433. user: option.user || 'anonymous',
  434. pass: option.pass || '@anonymous',
  435. port: option.port || 21,
  436. remotePath: (option.remotePath || '/') + path
  437. })))
  438. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  439. host: option.host,
  440. user: option.user || 'anonymous',
  441. pass: option.pass || null,
  442. port: option.port || 22,
  443. remotePath: (option.remotePath || '/') + path
  444. })))
  445. .pipe(gulp.dest(dest))
  446. .pipe(sourcemaps.init())
  447. .pipe(concat('$all.min.js'))
  448. .pipe(uglify())
  449. .pipe(sourcemaps.write("./"))
  450. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  451. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  452. host: option.host,
  453. user: option.user || 'anonymous',
  454. pass: option.pass || '@anonymous',
  455. port: option.port || 21,
  456. remotePath: (option.remotePath || '/') + path
  457. })))
  458. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  459. host: option.host,
  460. user: option.user || 'anonymous',
  461. pass: option.pass || null,
  462. port: option.port || 22,
  463. remotePath: (option.remotePath || '/') + path
  464. })))
  465. .pipe(gulp.dest(dest))
  466. }
  467. }
  468. function createO2ConcatTask(path, isMin, thisOptions) {
  469. function o2_core_concat(){
  470. var option = thisOptions || options;
  471. var src = [
  472. 'source/' + path + '/polyfill.js',
  473. 'source/o2_lib/mootools/mootools-1.6.0_all.js',
  474. 'source/o2_lib/mootools/plugin/mBox.js',
  475. 'source/' + path + '/o2.js'
  476. ];
  477. var dest = option.dest+'/' + path + '/';
  478. return gulp.src(src)
  479. .pipe(concat('o2.js'))
  480. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  481. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  482. host: option.host,
  483. user: option.user || 'anonymous',
  484. pass: option.pass || '@anonymous',
  485. port: option.port || 21,
  486. remotePath: (option.remotePath || '/') + path
  487. })))
  488. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  489. host: option.host,
  490. user: option.user || 'anonymous',
  491. pass: option.pass || null,
  492. port: option.port || 22,
  493. remotePath: (option.remotePath || '/') + path
  494. })))
  495. .pipe(gulp.dest(dest))
  496. .pipe(sourcemaps.init())
  497. .pipe(concat('o2.min.js'))
  498. .pipe(uglify())
  499. .pipe(sourcemaps.write("./"))
  500. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  501. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  502. host: option.host,
  503. user: option.user || 'anonymous',
  504. pass: option.pass || '@anonymous',
  505. port: option.port || 21,
  506. remotePath: (option.remotePath || '/') + path
  507. })))
  508. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  509. host: option.host,
  510. user: option.user || 'anonymous',
  511. pass: option.pass || null,
  512. port: option.port || 22,
  513. remotePath: (option.remotePath || '/') + path
  514. })))
  515. .pipe(gulp.dest(dest))
  516. }
  517. function o2_core_xDesktop_concat(){
  518. var option = thisOptions || options;
  519. var src = [
  520. 'source/'+path+'/o2/widget/Common.js',
  521. 'source/'+path+'/o2/widget/Dialog.js',
  522. 'source/'+path+'/o2/widget/UUID.js',
  523. 'source/'+path+'/o2/xDesktop/Common.js',
  524. 'source/'+path+'/o2/xDesktop/Actions/RestActions.js',
  525. 'source/'+path+'/o2/xAction/RestActions.js',
  526. 'source/'+path+'/o2/xDesktop/Access.js',
  527. 'source/'+path+'/o2/xDesktop/Dialog.js',
  528. 'source/'+path+'/o2/xDesktop/Menu.js',
  529. 'source/'+path+'/o2/xDesktop/UserData.js',
  530. 'source/x_component_Template/MPopupForm.js',
  531. 'source/'+path+'/o2/xDesktop/Authentication.js',
  532. 'source/'+path+'/o2/xDesktop/Dialog.js',
  533. 'source/'+path+'/o2/xDesktop/Window.js',
  534. 'source/x_component_Common/Main.js'
  535. ];
  536. var dest = option.dest+'/' + path + '/o2/xDesktop/';
  537. return gulp.src(src)
  538. .pipe(concat('$all.js'))
  539. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/o2/xDesktop/')))
  540. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  541. host: option.host,
  542. user: option.user || 'anonymous',
  543. pass: option.pass || '@anonymous',
  544. port: option.port || 21,
  545. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  546. })))
  547. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  548. host: option.host,
  549. user: option.user || 'anonymous',
  550. pass: option.pass || null,
  551. port: option.port || 22,
  552. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  553. })))
  554. .pipe(gulp.dest(dest))
  555. .pipe(sourcemaps.init())
  556. .pipe(concat('$all.min.js'))
  557. .pipe(uglify())
  558. .pipe(sourcemaps.write("./"))
  559. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/o2/xDesktop/')))
  560. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  561. host: option.host,
  562. user: option.user || 'anonymous',
  563. pass: option.pass || '@anonymous',
  564. port: option.port || 21,
  565. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  566. })))
  567. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  568. host: option.host,
  569. user: option.user || 'anonymous',
  570. pass: option.pass || null,
  571. port: option.port || 22,
  572. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  573. })))
  574. .pipe(gulp.dest(dest));
  575. }
  576. function o2_core_bundle(){
  577. var option = thisOptions || options;
  578. var src = [
  579. 'source/' + path + '/polyfill.js',
  580. 'source/o2_lib/mootools/mootools-1.6.0_all.js',
  581. 'source/o2_lib/mootools/plugin/mBox.js',
  582. 'source/' + path + '/o2.js',
  583. 'source/x_desktop/js/base.js',
  584. 'source/x_desktop/js/base_loader.js',
  585. 'source/o2_core/o2/xScript/PageEnvironment.js',
  586. "source/o2_core/o2/framework.js"
  587. ];
  588. var dest = option.dest+'/' + path + '/';
  589. return gulp.src(src)
  590. .pipe(concat('bundle.js'))
  591. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  592. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  593. host: option.host,
  594. user: option.user || 'anonymous',
  595. pass: option.pass || '@anonymous',
  596. port: option.port || 21,
  597. remotePath: (option.remotePath || '/') + path
  598. })))
  599. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  600. host: option.host,
  601. user: option.user || 'anonymous',
  602. pass: option.pass || null,
  603. port: option.port || 22,
  604. remotePath: (option.remotePath || '/') + path
  605. })))
  606. .pipe(gulp.dest(dest))
  607. .pipe(sourcemaps.init())
  608. .pipe(concat('bundle.min.js'))
  609. .pipe(uglify())
  610. .pipe(sourcemaps.write("./"))
  611. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  612. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  613. host: option.host,
  614. user: option.user || 'anonymous',
  615. pass: option.pass || '@anonymous',
  616. port: option.port || 21,
  617. remotePath: (option.remotePath || '/') + path
  618. })))
  619. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  620. host: option.host,
  621. user: option.user || 'anonymous',
  622. pass: option.pass || null,
  623. port: option.port || 22,
  624. remotePath: (option.remotePath || '/') + path
  625. })))
  626. .pipe(gulp.dest(dest))
  627. }
  628. return [o2_core_concat, o2_core_xDesktop_concat, o2_core_bundle];
  629. }
  630. function concat_Actions(){
  631. return through2.obj(function (file, enc, cb) {
  632. debugger;
  633. if (file.isNull()) {
  634. this.push(file);
  635. return cb();
  636. }
  637. if (file.isStream()) {
  638. this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
  639. return cb();
  640. }
  641. var content = file.contents.toString();
  642. var o = path.parse(file.path);
  643. var name = o.name;
  644. content = "var actionJson = "+content;
  645. content = content+"\nif (!o2.xAction.RestActions.Action[\""+name+"\"]) o2.xAction.RestActions.Action[\""+name+"\"] = new Class({Extends: o2.xAction.RestActions.Action});";
  646. content = content+"\no2.Actions.actions[\""+name+"\"] = new o2.xAction.RestActions.Action[\""+name+"\"](\""+name+"\", actionJson);";
  647. file.contents = new Buffer.from(content);
  648. this.push(file);
  649. cb();
  650. });
  651. }
  652. function concat_Style(){
  653. return through2.obj(function (file, enc, cb) {
  654. if (file.isNull()) {
  655. this.push(file);
  656. return cb();
  657. }
  658. if (file.isStream()) {
  659. this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
  660. return cb();
  661. }
  662. var content = file.contents.toString();
  663. var name = file.path.replace(process.cwd(), "").replace(/\\/g, "/")
  664. name = ".."+name.substring(name.indexOf("/source")+7);
  665. content = "var csskey = encodeURIComponent(\""+name+"\");\no2.widget.css[csskey]="+content;
  666. file.contents = new Buffer.from(content);
  667. this.push(file);
  668. cb();
  669. });
  670. }
  671. function createBaseWorkConcatStyleTask(path){
  672. const task = function(){
  673. return gulp.src([
  674. "source/x_component_process_Work/$Main/default/css.wcss",
  675. "source/x_component_process_Xform/$Form/default/css.wcss",
  676. "source/o2_core/o2/widget/$Tab/mobileForm/css.wcss",
  677. "source/o2_core/o2/widget/$Menu/tab/css.wcss",
  678. "source/o2_core/o2/widget/$Tab/form/css.wcss",
  679. "source/x_component_process_Xform/$Form/default/doc.wcss",
  680. "source/o2_core/o2/widget/$Toolbar/documentEdit/css.wcss",
  681. "source/o2_core/o2/widget/$Toolbar/documentEdit_side/css.wcss"
  682. ])
  683. .pipe(concat_Style())
  684. .pipe(concat('js/base_work_style_temp.js'))
  685. .pipe(gulp.dest('source/x_desktop/'));
  686. }
  687. return setTaskName(task, path+".base_work : style");
  688. }
  689. function createBaseWorkConcatActionTask(path){
  690. const task = function(){
  691. return gulp.src([
  692. "source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
  693. "source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json",
  694. "source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
  695. "source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
  696. "source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
  697. "source/o2_core/o2/xAction/services/x_program_center.json",
  698. "source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
  699. ])
  700. .pipe(concat_Actions())
  701. .pipe(concat('js/base_work_actions_temp.js'))
  702. .pipe(gulp.dest('source/x_desktop/'))
  703. }
  704. return setTaskName(task, path+".base_work : action")
  705. }
  706. function createBaseWorkConcatDelTempTask(path) {
  707. const task = function(cb){
  708. var dest = [
  709. 'source/'+path+'/js/base_work_actions_temp.js',
  710. 'source/'+path+'/js/base_work_style_temp.js'
  711. ];
  712. return del(dest, cb);
  713. }
  714. return setTaskName(task, path+".base_work : clean");
  715. }
  716. function createBaseWorkConcatBodyTask(path, isMin, thisOptions) {
  717. const task = function(){
  718. var option = thisOptions || options;
  719. var src = [
  720. 'source/' + path + '/js/base_concat_head.js',
  721. // 'source/o2_core/o2/lp/'+(option.lp || 'zh-cn')+'.js',
  722. // 'source/x_component_process_Work/lp/'+(option.lp || 'zh-cn')+'.js',
  723. // 'source/x_component_process_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
  724. // 'source/x_component_Selector/lp/'+(option.lp || 'zh-cn')+'.js',
  725. 'source/' + path + '/js/base_work_style_temp.js',
  726. 'source/o2_core/o2/widget/Common.js',
  727. 'source/o2_core/o2/widget/Dialog.js',
  728. 'source/o2_core/o2/widget/UUID.js',
  729. 'source/o2_core/o2/widget/Menu.js',
  730. 'source/o2_core/o2/widget/Toolbar.js',
  731. 'source/o2_core/o2/xDesktop/Common.js',
  732. 'source/o2_core/o2/xDesktop/Actions/RestActions.js',
  733. 'source/o2_core/o2/xAction/RestActions.js',
  734. 'source/o2_core/o2/xDesktop/Access.js',
  735. 'source/o2_core/o2/xDesktop/Dialog.js',
  736. 'source/o2_core/o2/xDesktop/Menu.js',
  737. 'source/o2_core/o2/xDesktop/UserData.js',
  738. 'source/x_component_Template/MPopupForm.js',
  739. 'source/o2_core/o2/xDesktop/Authentication.js',
  740. 'source/o2_core/o2/xDesktop/Window.js',
  741. 'source/x_component_Common/Main.js',
  742. 'source/x_component_process_Work/Main.js',
  743. 'source/x_component_Selector/package.js',
  744. 'source/x_component_Selector/Person.js',
  745. 'source/x_component_Selector/Identity.js',
  746. 'source/x_component_Selector/Unit.js',
  747. 'source/x_component_Selector/IdentityWidthDuty.js',
  748. 'source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js',
  749. 'source/x_component_Selector/UnitWithType.js',
  750. 'source/o2_core/o2/xScript/Actions/UnitActions.js',
  751. 'source/o2_core/o2/xScript/Actions/ScriptActions.js',
  752. 'source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
  753. 'source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
  754. 'source/o2_core/o2/xScript/Environment.js',
  755. 'source/x_component_Template/MTooltips.js',
  756. 'source/x_component_Template/MSelector.js',
  757. 'source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
  758. 'source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js',
  759. 'source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
  760. 'source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
  761. 'source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
  762. 'source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
  763. 'source/' + path + '/js/base_work_actions_temp.js',
  764. 'source/' + path + '/js/base.js',
  765. 'source/' + path + '/js/base_loader.js'
  766. ];
  767. var dest = option.dest+'/' + path + '/';
  768. return gulp.src(src)
  769. .pipe(concat('js/base_work.js'))
  770. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  771. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  772. host: option.host,
  773. user: option.user || 'anonymous',
  774. pass: option.pass || '@anonymous',
  775. port: option.port || 21,
  776. remotePath: (option.remotePath || '/') + path
  777. })))
  778. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  779. host: option.host,
  780. user: option.user || 'anonymous',
  781. pass: option.pass || null,
  782. port: option.port || 22,
  783. remotePath: (option.remotePath || '/') + path
  784. })))
  785. .pipe(gulp.dest(dest))
  786. .pipe(sourcemaps.init())
  787. .pipe(concat('js/base_work.min.js'))
  788. .pipe(uglify())
  789. .pipe(sourcemaps.write("./"))
  790. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  791. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  792. host: option.host,
  793. user: option.user || 'anonymous',
  794. pass: option.pass || '@anonymous',
  795. port: option.port || 21,
  796. remotePath: (option.remotePath || '/') + path
  797. })))
  798. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  799. host: option.host,
  800. user: option.user || 'anonymous',
  801. pass: option.pass || null,
  802. port: option.port || 22,
  803. remotePath: (option.remotePath || '/') + path
  804. })))
  805. .pipe(gulp.dest(dest))
  806. }
  807. return setTaskName(task, path+".base_work : concat");
  808. }
  809. function createBaseWorkConcatLanguageTask(path, thisOptions, language){
  810. const task = function(){
  811. var option = thisOptions || options;
  812. var src = [
  813. 'source/o2_core/o2/lp/'+(language)+'.js',
  814. 'source/x_component_process_Work/lp/'+(language)+'.js',
  815. 'source/x_component_process_Xform/lp/'+(language)+'.js',
  816. 'source/x_component_Selector/lp/'+(language)+'.js',
  817. 'source/x_component_Template/lp/'+(language)+'.js',
  818. 'source/x_component_portal_Portal/lp/'+(language)+'.js',
  819. 'source/x_component_cms_Document/lp/'+(language)+'.js',
  820. 'source/x_component_cms_Xform/lp/'+(language)+'.js',
  821. ];
  822. var dest = option.dest+'/' + path + '/';
  823. return gulp.src(src, {allowEmpty: true})
  824. .pipe(concat('js/base_lp_'+language+'.js'))
  825. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  826. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  827. host: option.host,
  828. user: option.user || 'anonymous',
  829. pass: option.pass || '@anonymous',
  830. port: option.port || 21,
  831. remotePath: (option.remotePath || '/') + path
  832. })))
  833. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  834. host: option.host,
  835. user: option.user || 'anonymous',
  836. pass: option.pass || null,
  837. port: option.port || 22,
  838. remotePath: (option.remotePath || '/') + path
  839. })))
  840. .pipe(gulp.dest(dest))
  841. .pipe(uglify())
  842. .pipe(concat('js/base_lp_'+language+'.min.js'))
  843. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  844. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  845. host: option.host,
  846. user: option.user || 'anonymous',
  847. pass: option.pass || '@anonymous',
  848. port: option.port || 21,
  849. remotePath: (option.remotePath || '/') + path
  850. })))
  851. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  852. host: option.host,
  853. user: option.user || 'anonymous',
  854. pass: option.pass || null,
  855. port: option.port || 22,
  856. remotePath: (option.remotePath || '/') + path
  857. })))
  858. .pipe(gulp.dest(dest))
  859. }
  860. return setTaskName(task, path+".base_lp : "+language);
  861. }
  862. function createBaseWorkConcatTask(path, isMin, thisOptions){
  863. return gulp.series(
  864. createBaseWorkConcatActionTask(path),
  865. createBaseWorkConcatStyleTask(path),
  866. createBaseWorkConcatBodyTask(path, isMin, thisOptions),
  867. createBaseWorkConcatDelTempTask(path)
  868. );
  869. }
  870. function createBasePortalConcatStyleTask(path){
  871. const task = function(){
  872. return gulp.src([
  873. "source/x_component_process_Work/$Main/default/css.wcss",
  874. "source/x_component_portal_Portal/$Main/default/css.wcss",
  875. "source/x_component_process_Xform/$Form/default/css.wcss",
  876. "source/o2_core/o2/widget/$Tab/mobileForm/css.wcss",
  877. "source/o2_core/o2/widget/$Menu/tab/css.wcss"
  878. ])
  879. .pipe(concat_Style())
  880. .pipe(concat('js/base_portal_style_temp.js'))
  881. .pipe(gulp.dest('source/x_desktop/'))
  882. }
  883. return setTaskName(task, path+".base_portal : style");
  884. }
  885. function createBasePortalConcatActionTask(path){
  886. const task = function(){
  887. return gulp.src([
  888. "source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
  889. "source/o2_core/o2/xAction/services/x_portal_assemble_surface.json",
  890. "source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json",
  891. "source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
  892. "source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
  893. "source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
  894. "source/o2_core/o2/xAction/services/x_program_center.json",
  895. "source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
  896. ])
  897. .pipe(concat_Actions())
  898. .pipe(concat('js/base_portal_actions_temp.js'))
  899. .pipe(gulp.dest('source/x_desktop/'))
  900. }
  901. return setTaskName(task, path+".base_portal : action");
  902. }
  903. function createBasePortalConcatDelTempTask(path) {
  904. const task = function(cb){
  905. var dest = [
  906. 'source/'+path+'/js/base_portal_actions_temp.js',
  907. 'source/'+path+'/js/base_portal_style_temp.js'
  908. ];
  909. return del(dest, cb);
  910. }
  911. return setTaskName(task, path+".base_portal : clean");
  912. }
  913. function createBasePortalConcatBodyTask(path, isMin, thisOptions) {
  914. const task = function(){
  915. var option = thisOptions || options;
  916. var src = [
  917. 'source/' + path + '/js/base_concat_head.js',
  918. //'source/o2_core/o2/lp/'+(option.lp || 'zh-cn')+'.js',
  919. 'source/' + path + '/js/base_portal_style_temp.js',
  920. 'source/o2_core/o2/widget/Common.js',
  921. 'source/o2_core/o2/widget/Dialog.js',
  922. 'source/o2_core/o2/widget/UUID.js',
  923. 'source/o2_core/o2/widget/Menu.js',
  924. 'source/o2_core/o2/widget/Toolbar.js',
  925. 'source/o2_core/o2/xDesktop/Common.js',
  926. 'source/o2_core/o2/xDesktop/Actions/RestActions.js',
  927. 'source/o2_core/o2/xAction/RestActions.js',
  928. 'source/o2_core/o2/xDesktop/Access.js',
  929. 'source/o2_core/o2/xDesktop/Dialog.js',
  930. 'source/o2_core/o2/xDesktop/Menu.js',
  931. 'source/o2_core/o2/xDesktop/UserData.js',
  932. 'source/x_component_Template/MPopupForm.js',
  933. 'source/o2_core/o2/xDesktop/Authentication.js',
  934. 'source/o2_core/o2/xDesktop/Window.js',
  935. 'source/x_component_Common/Main.js',
  936. // 'source/x_component_process_Work/lp/'+(option.lp || 'zh-cn')+'.js',
  937. // 'source/x_component_portal_Portal/lp/'+(option.lp || 'zh-cn')+'.js',
  938. // 'source/x_component_process_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
  939. // 'source/x_component_Selector/lp/'+(option.lp || 'zh-cn')+'.js',
  940. 'source/x_component_portal_Portal/Main.js',
  941. 'source/x_component_Selector/package.js',
  942. 'source/x_component_Selector/Person.js',
  943. 'source/x_component_Selector/Identity.js',
  944. 'source/x_component_Selector/Unit.js',
  945. 'source/x_component_Selector/IdentityWidthDuty.js',
  946. 'source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js',
  947. 'source/x_component_Selector/UnitWithType.js',
  948. 'source/o2_core/o2/xScript/Actions/UnitActions.js',
  949. 'source/o2_core/o2/xScript/Actions/ScriptActions.js',
  950. 'source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
  951. 'source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
  952. 'source/o2_core/o2/xScript/PageEnvironment.js',
  953. 'source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
  954. 'source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js',
  955. 'source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
  956. 'source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
  957. 'source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
  958. 'source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
  959. 'source/' + path + '/js/base_portal_actions_temp.js',
  960. 'source/' + path + '/js/base.js',
  961. 'source/' + path + '/js/base_loader.js'
  962. ];
  963. var dest = option.dest+'/' + path + '/';
  964. return gulp.src(src)
  965. .pipe(concat('js/base_portal.js'))
  966. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  967. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  968. host: option.host,
  969. user: option.user || 'anonymous',
  970. pass: option.pass || '@anonymous',
  971. port: option.port || 21,
  972. remotePath: (option.remotePath || '/') + path
  973. })))
  974. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  975. host: option.host,
  976. user: option.user || 'anonymous',
  977. pass: option.pass || null,
  978. port: option.port || 22,
  979. remotePath: (option.remotePath || '/') + path
  980. })))
  981. .pipe(gulp.dest(dest))
  982. .pipe(sourcemaps.init())
  983. .pipe(concat('js/base_portal.min.js'))
  984. .pipe(uglify())
  985. .pipe(sourcemaps.write("./"))
  986. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  987. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  988. host: option.host,
  989. user: option.user || 'anonymous',
  990. pass: option.pass || '@anonymous',
  991. port: option.port || 21,
  992. remotePath: (option.remotePath || '/') + path
  993. })))
  994. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  995. host: option.host,
  996. user: option.user || 'anonymous',
  997. pass: option.pass || null,
  998. port: option.port || 22,
  999. remotePath: (option.remotePath || '/') + path
  1000. })))
  1001. .pipe(gulp.dest(dest))
  1002. }
  1003. return setTaskName(task, path+".base_portal : concat");
  1004. }
  1005. function createBasePortalConcatTask(path, isMin, thisOptions){
  1006. return gulp.series(
  1007. createBasePortalConcatActionTask(path),
  1008. createBasePortalConcatStyleTask(path),
  1009. createBasePortalConcatBodyTask(path, isMin, thisOptions),
  1010. createBasePortalConcatDelTempTask(path)
  1011. );
  1012. }
  1013. function createBaseDocumentConcatActionTask(path){
  1014. const task = function(){
  1015. return gulp.src([
  1016. "source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
  1017. "source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
  1018. "source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
  1019. "source/o2_core/o2/xAction/services/x_program_center.json",
  1020. "source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
  1021. ])
  1022. .pipe(concat_Actions())
  1023. .pipe(concat('js/base_document_actions_temp.js'))
  1024. .pipe(gulp.dest('source/x_desktop/'))
  1025. }
  1026. return setTaskName(task, path+".base_document : action");
  1027. }
  1028. function createBaseDocumentConcatStyleTask(path){
  1029. const task = function(){
  1030. return gulp.src([
  1031. "source/x_component_cms_Document/$Main/default/css.wcss",
  1032. "source/x_component_cms_Xform/$Form/default/css.wcss",
  1033. "source/o2_core/o2/widget/$AttachmentController/default/css.wcss"
  1034. ])
  1035. .pipe(concat_Style())
  1036. .pipe(concat('js/base_document_style_temp.js'))
  1037. .pipe(gulp.dest('source/x_desktop/'))
  1038. }
  1039. return setTaskName(task, path+".base_document : style");
  1040. }
  1041. function createBaseDocumentConcatBodyTask(path, isMin, thisOptions) {
  1042. const task = function(){
  1043. var option = thisOptions || options;
  1044. var src = [
  1045. 'source/' + path + '/js/base_concat_head.js',
  1046. //'source/o2_core/o2/lp/'+(option.lp || 'zh-cn')+'.js',
  1047. 'source/' + path + '/js/base_document_style_temp.js',
  1048. 'source/o2_core/o2/widget/Common.js',
  1049. 'source/o2_core/o2/widget/Dialog.js',
  1050. 'source/o2_core/o2/widget/UUID.js',
  1051. 'source/o2_core/o2/widget/Menu.js',
  1052. 'source/o2_core/o2/widget/Mask.js',
  1053. 'source/o2_core/o2/xDesktop/Common.js',
  1054. 'source/o2_core/o2/xDesktop/Actions/RestActions.js',
  1055. 'source/o2_core/o2/xAction/RestActions.js',
  1056. 'source/o2_core/o2/xDesktop/Access.js',
  1057. 'source/o2_core/o2/xDesktop/Dialog.js',
  1058. 'source/o2_core/o2/xDesktop/Menu.js',
  1059. 'source/o2_core/o2/xDesktop/UserData.js',
  1060. 'source/x_component_Template/MPopupForm.js',
  1061. 'source/o2_core/o2/xDesktop/Authentication.js',
  1062. 'source/o2_core/o2/xDesktop/Window.js',
  1063. 'source/x_component_Common/Main.js',
  1064. // 'source/x_component_cms_Document/lp/'+(option.lp || 'zh-cn')+'.js',
  1065. // 'source/x_component_process_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
  1066. // 'source/x_component_Selector/lp/'+(option.lp || 'zh-cn')+'.js',
  1067. // 'source/x_component_cms_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
  1068. 'source/x_component_cms_Document/Main.js',
  1069. 'source/x_component_Selector/package.js',
  1070. 'source/o2_core/o2/xScript/Actions/UnitActions.js',
  1071. 'source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
  1072. 'source/o2_core/o2/xScript/CMSEnvironment.js',
  1073. 'source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
  1074. 'source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
  1075. 'source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
  1076. 'source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
  1077. 'source/' + path + '/js/base_document_actions_temp.js',
  1078. 'source/' + path + '/js/base.js',
  1079. 'source/' + path + '/js/base_loader.js'
  1080. ];
  1081. var dest = option.dest+'/' + path + '/';
  1082. return gulp.src(src)
  1083. .pipe(concat('js/base_document.js'))
  1084. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  1085. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  1086. host: option.host,
  1087. user: option.user || 'anonymous',
  1088. pass: option.pass || '@anonymous',
  1089. port: option.port || 21,
  1090. remotePath: (option.remotePath || '/') + path
  1091. })))
  1092. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  1093. host: option.host,
  1094. user: option.user || 'anonymous',
  1095. pass: option.pass || null,
  1096. port: option.port || 22,
  1097. remotePath: (option.remotePath || '/') + path
  1098. })))
  1099. .pipe(gulp.dest(dest))
  1100. .pipe(sourcemaps.init())
  1101. .pipe(concat('js/base_document.min.js'))
  1102. .pipe(uglify())
  1103. .pipe(sourcemaps.write("./"))
  1104. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  1105. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  1106. host: option.host,
  1107. user: option.user || 'anonymous',
  1108. pass: option.pass || '@anonymous',
  1109. port: option.port || 21,
  1110. remotePath: (option.remotePath || '/') + path
  1111. })))
  1112. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  1113. host: option.host,
  1114. user: option.user || 'anonymous',
  1115. pass: option.pass || null,
  1116. port: option.port || 22,
  1117. remotePath: (option.remotePath || '/') + path
  1118. })))
  1119. .pipe(gulp.dest(dest))
  1120. }
  1121. return setTaskName(task, path+".base_document : concat");
  1122. }
  1123. function createBaseDocumentConcatDelTempTask(path) {
  1124. const task = function(cb){
  1125. var dest = [
  1126. 'source/'+path+'/js/base_document_actions_temp.js',
  1127. 'source/'+path+'/js/base_document_style_temp.js'
  1128. ];
  1129. return del(dest, cb);
  1130. }
  1131. return setTaskName(task, path+".base_document : clean")
  1132. }
  1133. function createBaseDocumentConcatTask(path, isMin, thisOptions){
  1134. return gulp.series(
  1135. createBaseDocumentConcatActionTask(path),
  1136. createBaseDocumentConcatStyleTask(path),
  1137. createBaseDocumentConcatBodyTask(path, isMin, thisOptions),
  1138. createBaseDocumentConcatDelTempTask(path)
  1139. )
  1140. }
  1141. function createBaseConcatTask(path, isMin, thisOptions){
  1142. const task = function(){
  1143. var option = thisOptions || options;
  1144. var src = [
  1145. 'source/' + path + '/js/base.js',
  1146. 'source/o2_core/o2/xScript/PageEnvironment.js',
  1147. 'source/o2_core/o2/framework.js',
  1148. 'source/' + path + '/js/base_loader.js'
  1149. ];
  1150. var dest = option.dest+'/' + path + '/';
  1151. return gulp.src(src)
  1152. .pipe(concat('js/base.js'))
  1153. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  1154. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  1155. host: option.host,
  1156. user: option.user || 'anonymous',
  1157. pass: option.pass || '@anonymous',
  1158. port: option.port || 21,
  1159. remotePath: (option.remotePath || '/') + path
  1160. })))
  1161. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  1162. host: option.host,
  1163. user: option.user || 'anonymous',
  1164. pass: option.pass || null,
  1165. port: option.port || 22,
  1166. remotePath: (option.remotePath || '/') + path
  1167. })))
  1168. .pipe(gulp.dest(dest))
  1169. .pipe(sourcemaps.init())
  1170. .pipe(concat('js/base.min.js'))
  1171. .pipe(uglify())
  1172. .pipe(sourcemaps.write("./"))
  1173. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  1174. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  1175. host: option.host,
  1176. user: option.user || 'anonymous',
  1177. pass: option.pass || '@anonymous',
  1178. port: option.port || 21,
  1179. remotePath: (option.remotePath || '/') + path
  1180. })))
  1181. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  1182. host: option.host,
  1183. user: option.user || 'anonymous',
  1184. pass: option.pass || null,
  1185. port: option.port || 22,
  1186. remotePath: (option.remotePath || '/') + path
  1187. })))
  1188. .pipe(gulp.dest(dest))
  1189. }
  1190. return setTaskName(task, path+".base")
  1191. }
  1192. var lpTasks = [];
  1193. function getAppTask(path, isMin, thisOptions) {
  1194. switch (path){
  1195. case 'x_component_process_Xform':
  1196. return gulp.series(
  1197. createLanguagePackTask(path),
  1198. createDefaultTask(path, isMin, thisOptions),
  1199. createXFormConcatTask(path, isMin, thisOptions)
  1200. );
  1201. case 'x_component_cms_Xform':
  1202. return gulp.series(
  1203. createLanguagePackTask(path),
  1204. createDefaultTask(path, isMin, thisOptions),
  1205. createCMSXFormConcatTask(path, isMin, thisOptions)
  1206. );
  1207. case 'o2_core':
  1208. return gulp.series(
  1209. createLanguagePackTask(path),
  1210. createDefaultTask(path, isMin, thisOptions),
  1211. createO2ConcatTask(path, isMin, thisOptions)
  1212. );
  1213. case 'x_desktop':
  1214. const tasks = supportedLanguage.map(function(lp){
  1215. return createBaseWorkConcatLanguageTask(path, thisOptions, lp);
  1216. });
  1217. return gulp.series(
  1218. createDefaultTask(path, isMin, thisOptions),
  1219. ...tasks,
  1220. createBaseWorkConcatTask(path, isMin, thisOptions),
  1221. createBasePortalConcatTask(path, isMin, thisOptions),
  1222. createBaseDocumentConcatTask(path, isMin, thisOptions),
  1223. createBaseConcatTask(path, isMin, thisOptions)
  1224. );
  1225. default:
  1226. return gulp.series(
  1227. createLanguagePackTask(path),
  1228. createDefaultTask(path, isMin, thisOptions)
  1229. );
  1230. }
  1231. }
  1232. apps.map(function (app) {
  1233. var taskName;
  1234. var isMin = (app.tasks.indexOf("min")!==-1);
  1235. taskName = app.folder;
  1236. appTasks.push(taskName);
  1237. gulp.task(taskName, getAppTask(app.folder, isMin));
  1238. });
  1239. function getCleanTask(path) {
  1240. return function (cb) {
  1241. const p = path || '/';
  1242. if (p){
  1243. var dest = (path=="/") ? options.dest+"/" : options.dest+'/' + path + '/';
  1244. gutil.log("Clean", ":", gutil.colors.red(dest));
  1245. del.sync(dest, cb);
  1246. cb();
  1247. }else{
  1248. cb();
  1249. }
  1250. }
  1251. }
  1252. function cleanRemoteFtp(f, cb) {
  1253. var file = options.remotePath + f;
  1254. var ftp = new JSFtp({
  1255. host: options.host,
  1256. user: options.user || 'anonymous',
  1257. pass: options.pass || null,
  1258. port: options.port || 21
  1259. });
  1260. ftp.raw('dele ' + file, function (err) {
  1261. if (err) { cb(); return; }
  1262. if (file.substring(file.length - 3).toLowerCase() == ".js") {
  1263. file = file.replace('.js', ".min.js");
  1264. ftp.raw('dele ' + file, function (err) {
  1265. if (err) { cb(); return; }
  1266. if (file.indexOf("/") != -1) {
  1267. var p = file.substring(0, file.lastIndexOf("/"));
  1268. ftp.raw('rmd ' + p, function (err) {
  1269. if (err) { cb(); return; }
  1270. ftp.raw.quit();
  1271. cb();
  1272. });
  1273. }
  1274. });
  1275. } else {
  1276. if (file.indexOf("/") != -1) {
  1277. var pPath = file.substring(0, file.lastIndexOf("/"));
  1278. ftp.raw('rmd ' + pPath, function (err) {
  1279. if (err) { cb(); return; }
  1280. ftp.raw.quit();
  1281. cb();
  1282. });
  1283. }
  1284. }
  1285. });
  1286. }
  1287. function cleanRemoteLocal(f, cb) {
  1288. var file = options.location + f;
  1289. del(file, { force: true, dryRun: true }, function () {
  1290. if (file.substring(file.length - 3).toLowerCase() == ".js") {
  1291. var minfile = file.replace('.js', ".min.js");
  1292. del(minfile, { force: true, dryRun: true }, function () {
  1293. var p = file.substring(0, file.lastIndexOf("/"));
  1294. fs.rmdir(p, function (err) {
  1295. if (err) { }
  1296. cb();
  1297. })
  1298. });
  1299. } else {
  1300. var p = file.substring(0, file.lastIndexOf("/"));
  1301. fs.rmdir(p, function (err) {
  1302. if (err) { }
  1303. cb();
  1304. })
  1305. }
  1306. });
  1307. }
  1308. function getCleanRemoteTask(path) {
  1309. return function (cb) {
  1310. if (options.upload) {
  1311. var file = path.replace(/\\/g, "/");
  1312. file = file.substring(file.indexOf("source/") + 7);
  1313. if (options.upload == 'local' && options.location != '') cleanRemoteLocal(file, cb);
  1314. if (options.upload == 'ftp' && options.host != '') cleanRemoteFtp(file, cb);
  1315. } else {
  1316. if (cb) cb();
  1317. }
  1318. }
  1319. }
  1320. function getWatchTask(path) {
  1321. var lpFiles = supportedLanguage.filter(function(l){
  1322. return l !== "zh-cn";
  1323. }).join("|");
  1324. return (path) ? function (cb) {
  1325. gutil.log("watch", ":", gutil.colors.green(path, "is watching ..."));
  1326. gulp.watch(['source/' + path + '/**/*', "!./**/test/**", '!**/lp/('+lpFiles+').js'], { "events": ['addDir', 'add', 'change'] }, gulp.parallel([path]));
  1327. } : function(cb){cb();};
  1328. }
  1329. gulp.task("clean", getCleanTask(options.src))
  1330. gulp.task("watch", getWatchTask(options.src));
  1331. function index() {
  1332. var src = ['source/favicon.ico', 'source/index.html'];
  1333. var dest = options.dest;
  1334. return gulp.src(src)
  1335. .pipe(changed(dest))
  1336. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + '/')))
  1337. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  1338. host: options.host,
  1339. user: options.user || 'anonymous',
  1340. pass: options.pass || '@anonymous',
  1341. port: options.port || 21,
  1342. remotePath: (options.remotePath || '/')
  1343. })))
  1344. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), ftp({
  1345. host: options.host,
  1346. user: options.user || 'anonymous',
  1347. pass: options.pass || null,
  1348. port: options.port || 22,
  1349. remotePath: (options.remotePath || '/')
  1350. })))
  1351. .pipe(gulp.dest(dest))
  1352. .pipe(gutil.noop());
  1353. }
  1354. function getGitV(){
  1355. var tagPromise = new Promise(function(s){
  1356. git.exec({args : 'describe --tag'}, function (err, stdout) {
  1357. var v = stdout.substring(0, stdout.lastIndexOf("-"));
  1358. s(v);
  1359. });
  1360. });
  1361. var revPromise = new Promise(function(s){
  1362. git.exec({args : 'rev-parse --short HEAD'}, function (err, hash) {
  1363. s(hash.trim());
  1364. });
  1365. });
  1366. return Promise.all([tagPromise,revPromise])
  1367. }
  1368. function o2_version_html(){
  1369. var path = "x_desktop";
  1370. var src = 'source/x_desktop/*.html';
  1371. var dest = options.dest + '/x_desktop/';
  1372. return getGitV().then(function(arr) {
  1373. return gulp.src(src)
  1374. .pipe(assetRev({"verConnecter": arr[0], "md5": arr[1]}))
  1375. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + path + '/')))
  1376. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  1377. host: options.host,
  1378. user: options.user || 'anonymous',
  1379. pass: options.pass || '@anonymous',
  1380. port: options.port || 21,
  1381. remotePath: (options.remotePath || '/') + path
  1382. })))
  1383. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), sftp({
  1384. host: options.host,
  1385. user: options.user || 'anonymous',
  1386. pass: options.pass || null,
  1387. port: options.port || 22,
  1388. remotePath: (options.remotePath || '/') + path
  1389. })))
  1390. .pipe(gulp.dest(dest))
  1391. .pipe(gutil.noop());
  1392. });
  1393. }
  1394. function o2_version_o2(){
  1395. var path = "o2_core";
  1396. var src = options.dest +'/o2_core/o2.js';
  1397. var dest = options.dest +'/o2_core/';
  1398. return getGitV().then(function(arr){
  1399. var v = arr[0]+"-"+arr[1];
  1400. return gulp.src(src)
  1401. .pipe(assetRev({"verConnecter": arr[0], "md5": arr[1], "replace": true}))
  1402. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + path + '/')))
  1403. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  1404. host: options.host,
  1405. user: options.user || 'anonymous',
  1406. pass: options.pass || '@anonymous',
  1407. port: options.port || 21,
  1408. remotePath: (options.remotePath || '/') + path
  1409. })))
  1410. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), sftp({
  1411. host: options.host,
  1412. user: options.user || 'anonymous',
  1413. pass: options.pass || null,
  1414. port: options.port || 22,
  1415. remotePath: (options.remotePath || '/') + path
  1416. })))
  1417. .pipe(gulp.dest(dest))
  1418. .pipe(uglify())
  1419. .pipe(rename({ extname: '.min.js' }))
  1420. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + path + '/')))
  1421. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  1422. host: options.host,
  1423. user: options.user || 'anonymous',
  1424. pass: options.pass || '@anonymous',
  1425. port: options.port || 21,
  1426. remotePath: (options.remotePath || '/') + path
  1427. })))
  1428. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), sftp({
  1429. host: options.host,
  1430. user: options.user || 'anonymous',
  1431. pass: options.pass || null,
  1432. port: options.port || 22,
  1433. remotePath: (options.remotePath || '/') + path
  1434. })))
  1435. .pipe(gulp.dest(dest))
  1436. .pipe(gutil.noop());
  1437. });
  1438. }
  1439. const version = gulp.parallel(o2_version_o2, o2_version_html);
  1440. exports.o2_version = version;
  1441. function build(){
  1442. options.ev = "p";
  1443. options.upload = o_options.upload || "";
  1444. options.location = o_options.location || uploadOptions.location;
  1445. options.host = o_options.host || uploadOptions.host;
  1446. options.user = o_options.user || uploadOptions.user;
  1447. options.pass = o_options.pass || uploadOptions.pass;
  1448. options.port = o_options.port || uploadOptions.port;
  1449. options.remotePath = o_options.remotePath || uploadOptions.remotePath;
  1450. options.dest = o_options.dest || uploadOptions.dest || "dest";
  1451. };
  1452. exports.default = gulp.series("clean", gulp.parallel(appTasks, index), version);