gulpfile.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. var gulp = require('gulp'),
  2. //var deleted = require('gulp-deleted');
  3. del = require('del'),
  4. //uglify = require('gulp-tm-uglify'),
  5. uglify = require('gulp-uglify-es').default,
  6. rename = require('gulp-rename'),
  7. changed = require('gulp-changed'),
  8. gulpif = require('gulp-if'),
  9. minimist = require('minimist'),
  10. ftp = require('gulp-ftp'),
  11. sftp = require('gulp-sftp-up4'),
  12. JSFtp = require('jsftp'),
  13. gutil = require('gulp-util'),
  14. fs = require("fs");
  15. concat = require('gulp-concat');
  16. //let uglify = require('gulp-uglify-es').default;
  17. var through2 = require('through2');
  18. var path = require('path');
  19. var sourceMap = require('gulp-sourcemaps');
  20. var git = require('gulp-git');
  21. var assetRev = require('gulp-tm-asset-rev');
  22. var apps = require('./gulpapps.js');
  23. var ftpconfig = require('./gulpconfig.js');
  24. var o_options = minimist(process.argv.slice(2), {//upload: local ftp or sftp
  25. string: ["ev", "upload", "location", "host", "user", "pass", "port", "remotePath", "dest", "src", "lp"]
  26. });
  27. function getEvOptions(ev){
  28. options.ev = ev;
  29. return (ftpconfig[ev]) || {
  30. 'location': '',
  31. 'host': '',
  32. 'user': '',
  33. 'pass': '',
  34. "port": null,
  35. "remotePath": "",
  36. "dest": "dest",
  37. "upload": ""
  38. }
  39. }
  40. function setOptions(op1, op2){
  41. if (!op2) op2 = {};
  42. options.upload = op1.upload || op2.upload || "";
  43. options.location = op1.location || op2.location || "";
  44. options.host = op1.host || op2.host || "";
  45. options.user = op1.user || op2.user || "";
  46. options.pass = op1.pass || op2.pass || "";
  47. options.port = op1.port || op2.port || "";
  48. options.remotePath = op1.remotePath || op2.remotePath || "";
  49. options.dest = op1.dest || op2.dest || "dest";
  50. options.lp = op1.lp || op2.lp || "zh-cn";
  51. options.src = op1.src || op2.src || "";
  52. }
  53. var options = {};
  54. setOptions(o_options, getEvOptions(o_options.ev));
  55. var appTasks = [];
  56. function createDefaultTask(path, isMin, thisOptions) {
  57. gulp.task(path, function (cb) {
  58. //var srcFile = 'source/' + path + '/**/*';
  59. var option = thisOptions || options;
  60. var src;
  61. var dest = option.dest+'/' + path + '/';
  62. let ev = option.ev
  63. var evList = Object.keys(ftpconfig).map((i)=>{ return (i==ev) ? "*"+i : i; });
  64. if (isMin){
  65. var src_min = ['source/' + path + '/**/*.js', '!**/*.spec.js', '!**/test/**'];
  66. var src_move = ['source/' + path + '/**/*', '!**/*.spec.js', '!**/test/**'];
  67. gutil.log("Move-Uglify", ":", gutil.colors.green(gutil.colors.blue(path), gutil.colors.white('->'), dest));
  68. return gulp.src(src_min)
  69. .pipe(changed(dest))
  70. .pipe(uglify())
  71. .pipe(rename({ extname: '.min.js' }))
  72. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  73. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  74. host: option.host,
  75. user: option.user || 'anonymous',
  76. pass: option.pass || '@anonymous',
  77. port: option.port || 21,
  78. remotePath: (option.remotePath || '/') + path
  79. })))
  80. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  81. host: option.host,
  82. user: option.user || 'anonymous',
  83. pass: option.pass || null,
  84. port: option.port || 22,
  85. remotePath: (option.remotePath || '/') + path
  86. })))
  87. .pipe(gulpif((option.ev == "dev" || option.ev == "pro") ,gulp.dest(dest)))
  88. .pipe(gulp.src(src_move))
  89. .pipe(changed(dest))
  90. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  91. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  92. host: option.host,
  93. user: option.user || 'anonymous',
  94. pass: option.pass || '@anonymous',
  95. port: option.port || 21,
  96. remotePath: (option.remotePath || '/') + path
  97. })))
  98. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  99. host: option.host,
  100. user: option.user || 'anonymous',
  101. pass: option.pass || null,
  102. port: option.port || 22,
  103. remotePath: (option.remotePath || '/') + path
  104. })))
  105. .pipe(gulp.dest(dest))
  106. .pipe(gutil.noop());
  107. }else{
  108. src = ['source/' + path + '/**/*', '!**/*.spec.js', '!**/test/**'];
  109. gutil.log("Move", ":", gutil.colors.green(gutil.colors.blue(path), gutil.colors.white('->'), dest));
  110. return gulp.src(src)
  111. .pipe(changed(dest))
  112. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  113. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  114. host: option.host,
  115. user: option.user || 'anonymous',
  116. pass: option.pass || '@anonymous',
  117. port: option.port || 21,
  118. remotePath: (option.remotePath || '/') + path
  119. })))
  120. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  121. host: option.host,
  122. user: option.user || 'anonymous',
  123. pass: option.pass || null,
  124. port: option.port || 22,
  125. remotePath: (option.remotePath || '/') + path
  126. })))
  127. .pipe(gulp.dest(dest))
  128. .pipe(gutil.noop());
  129. }
  130. });
  131. }
  132. function createXFormConcatTask(path, isMin, thisOptions) {
  133. gulp.task(path+" : concat", function(){
  134. var option = thisOptions || options;
  135. var src = [
  136. 'source/o2_core/o2/widget/AttachmentController.js',
  137. 'source/o2_core/o2/xScript/Macro.js',
  138. 'source/o2_core/o2/widget/Tab.js',
  139. 'source/o2_core/o2/widget/O2Identity.js',
  140. 'source/' + path + '/Form.js',
  141. 'source/' + path + '/$Module.js',
  142. 'source/' + path + '/$Input.js',
  143. 'source/' + path + '/Div.js',
  144. 'source/' + path + '/Combox.js',
  145. 'source/' + path + '/DatagridMobile.js',
  146. 'source/' + path + '/DatagridPC.js',
  147. 'source/' + path + '/Textfield.js',
  148. 'source/' + path + '/Personfield.js',
  149. 'source/' + path + '/Button.js',
  150. 'source/' + path + '/ViewSelector.js',
  151. 'source/' + path + '/*.js',
  152. 'source/x_component_process_Work/Processor.js',
  153. '!source/' + path + '/Office.js'
  154. ];
  155. var dest = option.dest+'/' + path + '/';
  156. return gulp.src(src)
  157. .pipe(sourceMap.init())
  158. .pipe(concat('$all.js'))
  159. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  160. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  161. host: option.host,
  162. user: option.user || 'anonymous',
  163. pass: option.pass || '@anonymous',
  164. port: option.port || 21,
  165. remotePath: (option.remotePath || '/') + path
  166. })))
  167. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  168. host: option.host,
  169. user: option.user || 'anonymous',
  170. pass: option.pass || null,
  171. port: option.port || 22,
  172. remotePath: (option.remotePath || '/') + path
  173. })))
  174. .pipe(gulp.dest(dest))
  175. .pipe(concat('$all.min.js'))
  176. .pipe(uglify())
  177. .pipe(sourceMap.write(""))
  178. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  179. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  180. host: option.host,
  181. user: option.user || 'anonymous',
  182. pass: option.pass || '@anonymous',
  183. port: option.port || 21,
  184. remotePath: (option.remotePath || '/') + path
  185. })))
  186. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  187. host: option.host,
  188. user: option.user || 'anonymous',
  189. pass: option.pass || null,
  190. port: option.port || 22,
  191. remotePath: (option.remotePath || '/') + path
  192. })))
  193. .pipe(gulp.dest(dest))
  194. });
  195. }
  196. function createO2ConcatTask(path, isMin, thisOptions) {
  197. gulp.task(path+" : concat", function(){
  198. var option = thisOptions || options;
  199. var src = [
  200. 'source/o2_lib/mootools/mootools-1.6.0_all.js',
  201. 'source/o2_lib/mootools/plugin/mBox.js',
  202. 'source/' + path + '/o2.js'
  203. ];
  204. var dest = option.dest+'/' + path + '/';
  205. return gulp.src(src)
  206. .pipe(sourceMap.init())
  207. .pipe(concat('o2.js'))
  208. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  209. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  210. host: option.host,
  211. user: option.user || 'anonymous',
  212. pass: option.pass || '@anonymous',
  213. port: option.port || 21,
  214. remotePath: (option.remotePath || '/') + path
  215. })))
  216. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  217. host: option.host,
  218. user: option.user || 'anonymous',
  219. pass: option.pass || null,
  220. port: option.port || 22,
  221. remotePath: (option.remotePath || '/') + path
  222. })))
  223. .pipe(gulp.dest(dest))
  224. .pipe(concat('o2.min.js'))
  225. .pipe(uglify())
  226. //.pipe(rename({ extname: '.min.js' }))
  227. .pipe(sourceMap.write(""))
  228. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  229. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  230. host: option.host,
  231. user: option.user || 'anonymous',
  232. pass: option.pass || '@anonymous',
  233. port: option.port || 21,
  234. remotePath: (option.remotePath || '/') + path
  235. })))
  236. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  237. host: option.host,
  238. user: option.user || 'anonymous',
  239. pass: option.pass || null,
  240. port: option.port || 22,
  241. remotePath: (option.remotePath || '/') + path
  242. })))
  243. .pipe(gulp.dest(dest))
  244. });
  245. gulp.task(path+".xDesktop : concat", function(){
  246. var option = thisOptions || options;
  247. var src = [
  248. 'source/'+path+'/o2/widget/Common.js',
  249. 'source/'+path+'/o2/widget/Dialog.js',
  250. 'source/'+path+'/o2/widget/UUID.js',
  251. 'source/'+path+'/o2/xDesktop/Common.js',
  252. 'source/'+path+'/o2/xDesktop/Actions/RestActions.js',
  253. 'source/'+path+'/o2/xAction/RestActions.js',
  254. 'source/'+path+'/o2/xDesktop/Access.js',
  255. 'source/'+path+'/o2/xDesktop/Dialog.js',
  256. 'source/'+path+'/o2/xDesktop/Menu.js',
  257. 'source/'+path+'/o2/xDesktop/UserData.js',
  258. 'source/x_component_Template/MPopupForm.js',
  259. 'source/'+path+'/o2/xDesktop/Authentication.js',
  260. 'source/'+path+'/o2/xDesktop/Dialog.js',
  261. 'source/'+path+'/o2/xDesktop/Window.js',
  262. 'source/x_component_Common/Main.js'
  263. ];
  264. var dest = option.dest+'/' + path + '/o2/xDesktop/';
  265. return gulp.src(src)
  266. .pipe(sourceMap.init())
  267. .pipe(concat('$all.js'))
  268. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/o2/xDesktop/')))
  269. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  270. host: option.host,
  271. user: option.user || 'anonymous',
  272. pass: option.pass || '@anonymous',
  273. port: option.port || 21,
  274. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  275. })))
  276. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  277. host: option.host,
  278. user: option.user || 'anonymous',
  279. pass: option.pass || null,
  280. port: option.port || 22,
  281. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  282. })))
  283. .pipe(gulp.dest(dest))
  284. .pipe(concat('$all.min.js'))
  285. .pipe(uglify())
  286. //.pipe(rename({ extname: '.min.js' }))
  287. .pipe(sourceMap.write(""))
  288. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/o2/xDesktop/')))
  289. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  290. host: option.host,
  291. user: option.user || 'anonymous',
  292. pass: option.pass || '@anonymous',
  293. port: option.port || 21,
  294. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  295. })))
  296. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  297. host: option.host,
  298. user: option.user || 'anonymous',
  299. pass: option.pass || null,
  300. port: option.port || 22,
  301. remotePath: (option.remotePath || '/') + path+"/o2/xDesktop/"
  302. })))
  303. .pipe(gulp.dest(dest))
  304. });
  305. gulp.task(path+" : bundle", function(){
  306. var option = thisOptions || options;
  307. var src = [
  308. 'source/o2_lib/mootools/mootools-1.6.0_all.js',
  309. 'source/o2_lib/mootools/plugin/mBox.js',
  310. 'source/' + path + '/o2.js',
  311. 'source/x_desktop/js/base.js',
  312. 'source/x_desktop/js/base_loader.js',
  313. "source/o2_core/o2/framework.js"
  314. ];
  315. var dest = option.dest+'/' + path + '/';
  316. return gulp.src(src)
  317. .pipe(sourceMap.init())
  318. .pipe(concat('bundle.js'))
  319. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  320. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  321. host: option.host,
  322. user: option.user || 'anonymous',
  323. pass: option.pass || '@anonymous',
  324. port: option.port || 21,
  325. remotePath: (option.remotePath || '/') + path
  326. })))
  327. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  328. host: option.host,
  329. user: option.user || 'anonymous',
  330. pass: option.pass || null,
  331. port: option.port || 22,
  332. remotePath: (option.remotePath || '/') + path
  333. })))
  334. .pipe(gulp.dest(dest))
  335. .pipe(concat('bundle.min.js'))
  336. .pipe(uglify())
  337. //.pipe(rename({ extname: '.min.js' }))
  338. .pipe(sourceMap.write(""))
  339. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  340. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  341. host: option.host,
  342. user: option.user || 'anonymous',
  343. pass: option.pass || '@anonymous',
  344. port: option.port || 21,
  345. remotePath: (option.remotePath || '/') + path
  346. })))
  347. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  348. host: option.host,
  349. user: option.user || 'anonymous',
  350. pass: option.pass || null,
  351. port: option.port || 22,
  352. remotePath: (option.remotePath || '/') + path
  353. })))
  354. .pipe(gulp.dest(dest))
  355. });
  356. }
  357. function concat_Actions(){
  358. return through2.obj(function (file, enc, cb) {
  359. debugger;
  360. if (file.isNull()) {
  361. this.push(file);
  362. return cb();
  363. }
  364. if (file.isStream()) {
  365. this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
  366. return cb();
  367. }
  368. var content = file.contents.toString();
  369. var o = path.parse(file.path);
  370. var name = o.name;
  371. content = "var actionJson = "+content;
  372. content = content+"\nif (!o2.xAction.RestActions.Action[\""+name+"\"]) o2.xAction.RestActions.Action[\""+name+"\"] = new Class({Extends: o2.xAction.RestActions.Action});";
  373. content = content+"\no2.Actions.actions[\""+name+"\"] = new o2.xAction.RestActions.Action[\""+name+"\"](\""+name+"\", actionJson);";
  374. file.contents = new Buffer.from(content);
  375. this.push(file);
  376. cb();
  377. });
  378. }
  379. function concat_Style(){
  380. return through2.obj(function (file, enc, cb) {
  381. if (file.isNull()) {
  382. this.push(file);
  383. return cb();
  384. }
  385. if (file.isStream()) {
  386. this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
  387. return cb();
  388. }
  389. var content = file.contents.toString();
  390. //name = ".."+file.path.replace(process.cwd(), "").replace(/\\/g, "/").substring("/source".length);
  391. var name = file.path.replace(process.cwd(), "").replace(/\\/g, "/")
  392. name = ".."+name.substring(name.indexOf("/source")+7);
  393. content = "var csskey = encodeURIComponent(\""+name+"\");\no2.widget.css[csskey]="+content;
  394. file.contents = new Buffer.from(content);
  395. this.push(file);
  396. cb();
  397. });
  398. }
  399. function createBaseWorkConcatStyleTask(path){
  400. gulp.task(path+".base_work : style", function(){
  401. return gulp.src([
  402. "source/x_component_process_Work/$Main/default/css.wcss",
  403. "source/x_component_process_Xform/$Form/default/css.wcss",
  404. "source/o2_core/o2/widget/$Tab/mobileForm/css.wcss",
  405. "source/o2_core/o2/widget/$Menu/tab/css.wcss",
  406. "source/o2_core/o2/widget/$Tab/form/css.wcss",
  407. "source/x_component_process_Xform/$Form/default/doc.wcss",
  408. "source/o2_core/o2/widget/$Toolbar/documentEdit/css.wcss",
  409. "source/o2_core/o2/widget/$Toolbar/documentEdit_side/css.wcss"
  410. ])
  411. .pipe(concat_Style())
  412. .pipe(concat('js/base_work_style_temp.js'))
  413. .pipe(gulp.dest('source/x_desktop/'))
  414. })
  415. }
  416. function createBaseWorkConcatActionTask(path){
  417. gulp.task(path+".base_work : action", function(){
  418. return gulp.src([
  419. "source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
  420. "source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json",
  421. "source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
  422. "source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
  423. "source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
  424. "source/o2_core/o2/xAction/services/x_program_center.json",
  425. "source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
  426. ])
  427. .pipe(concat_Actions())
  428. .pipe(concat('js/base_work_actions_temp.js'))
  429. .pipe(gulp.dest('source/x_desktop/'))
  430. })
  431. }
  432. function createBaseWorkConcatDelTempTask(path) {
  433. gulp.task(path+".base_work : clean", function(cb){
  434. var dest = [
  435. 'source/'+path+'/js/base_work_actions_temp.js',
  436. 'source/'+path+'/js/base_work_style_temp.js'
  437. ];
  438. return del(dest, cb);
  439. });
  440. }
  441. function createBaseWorkConcatBodyTask(path, isMin, thisOptions) {
  442. gulp.task(path+".base_work : concat", function(){
  443. var option = thisOptions || options;
  444. var src = [
  445. 'source/' + path + '/js/base_concat_head.js',
  446. 'source/o2_core/o2/lp/'+(option.lp || 'zh-cn')+'.js',
  447. 'source/x_component_process_Work/lp/'+(option.lp || 'zh-cn')+'.js',
  448. 'source/x_component_process_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
  449. 'source/x_component_Selector/lp/'+(option.lp || 'zh-cn')+'.js',
  450. 'source/' + path + '/js/base_work_style_temp.js',
  451. 'source/o2_core/o2/widget/Common.js',
  452. 'source/o2_core/o2/widget/Dialog.js',
  453. 'source/o2_core/o2/widget/UUID.js',
  454. 'source/o2_core/o2/widget/Menu.js',
  455. 'source/o2_core/o2/widget/Toolbar.js',
  456. 'source/o2_core/o2/xDesktop/Common.js',
  457. 'source/o2_core/o2/xDesktop/Actions/RestActions.js',
  458. 'source/o2_core/o2/xAction/RestActions.js',
  459. 'source/o2_core/o2/xDesktop/Access.js',
  460. 'source/o2_core/o2/xDesktop/Dialog.js',
  461. 'source/o2_core/o2/xDesktop/Menu.js',
  462. 'source/o2_core/o2/xDesktop/UserData.js',
  463. 'source/x_component_Template/MPopupForm.js',
  464. 'source/o2_core/o2/xDesktop/Authentication.js',
  465. 'source/o2_core/o2/xDesktop/Window.js',
  466. 'source/x_component_Common/Main.js',
  467. 'source/x_component_process_Work/Main.js',
  468. 'source/x_component_Selector/package.js',
  469. 'source/x_component_Selector/Person.js',
  470. 'source/x_component_Selector/Identity.js',
  471. 'source/x_component_Selector/Unit.js',
  472. 'source/x_component_Selector/IdentityWidthDuty.js',
  473. 'source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js',
  474. 'source/x_component_Selector/UnitWithType.js',
  475. 'source/o2_core/o2/xScript/Actions/UnitActions.js',
  476. 'source/o2_core/o2/xScript/Actions/ScriptActions.js',
  477. 'source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
  478. 'source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
  479. 'source/o2_core/o2/xScript/Environment.js',
  480. 'source/x_component_Template/MTooltips.js',
  481. 'source/x_component_Template/MSelector.js',
  482. 'source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
  483. 'source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js',
  484. 'source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
  485. 'source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
  486. 'source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
  487. 'source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
  488. 'source/' + path + '/js/base_work_actions_temp.js',
  489. 'source/' + path + '/js/base.js',
  490. 'source/' + path + '/js/base_loader.js'
  491. ];
  492. var dest = option.dest+'/' + path + '/';
  493. return gulp.src(src)
  494. .pipe(sourceMap.init())
  495. .pipe(concat('js/base_work.js'))
  496. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  497. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  498. host: option.host,
  499. user: option.user || 'anonymous',
  500. pass: option.pass || '@anonymous',
  501. port: option.port || 21,
  502. remotePath: (option.remotePath || '/') + path
  503. })))
  504. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  505. host: option.host,
  506. user: option.user || 'anonymous',
  507. pass: option.pass || null,
  508. port: option.port || 22,
  509. remotePath: (option.remotePath || '/') + path
  510. })))
  511. .pipe(gulp.dest(dest))
  512. .pipe(uglify())
  513. .pipe(concat('js/base_work.min.js'))
  514. .pipe( sourceMap.write("") )
  515. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  516. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  517. host: option.host,
  518. user: option.user || 'anonymous',
  519. pass: option.pass || '@anonymous',
  520. port: option.port || 21,
  521. remotePath: (option.remotePath || '/') + path
  522. })))
  523. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  524. host: option.host,
  525. user: option.user || 'anonymous',
  526. pass: option.pass || null,
  527. port: option.port || 22,
  528. remotePath: (option.remotePath || '/') + path
  529. })))
  530. .pipe(gulp.dest(dest))
  531. });
  532. }
  533. function createBaseWorkConcatTask(path, isMin, thisOptions){
  534. createBaseWorkConcatActionTask(path);
  535. createBaseWorkConcatStyleTask(path);
  536. createBaseWorkConcatBodyTask(path, isMin, thisOptions);
  537. createBaseWorkConcatDelTempTask(path);
  538. gulp.task( path+".base_work", gulp.series(path+".base_work : action", path+".base_work : style", path+".base_work : concat", path+".base_work : clean"));
  539. }
  540. function createBasePortalConcatStyleTask(path){
  541. gulp.task(path+".base_portal : style", function(){
  542. return gulp.src([
  543. "source/x_component_process_Work/$Main/default/css.wcss",
  544. "source/x_component_portal_Portal/$Main/default/css.wcss",
  545. "source/x_component_process_Xform/$Form/default/css.wcss",
  546. "source/o2_core/o2/widget/$Tab/mobileForm/css.wcss",
  547. "source/o2_core/o2/widget/$Menu/tab/css.wcss"
  548. ])
  549. .pipe(concat_Style())
  550. .pipe(concat('js/base_portal_style_temp.js'))
  551. .pipe(gulp.dest('source/x_desktop/'))
  552. })
  553. }
  554. function createBasePortalConcatActionTask(path){
  555. gulp.task(path+".base_portal : action", function(){
  556. return gulp.src([
  557. "source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
  558. "source/o2_core/o2/xAction/services/x_portal_assemble_surface.json",
  559. "source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
  560. "source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
  561. "source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
  562. "source/o2_core/o2/xAction/services/x_program_center.json",
  563. "source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
  564. ])
  565. .pipe(concat_Actions())
  566. .pipe(concat('js/base_portal_actions_temp.js'))
  567. .pipe(gulp.dest('source/x_desktop/'))
  568. })
  569. }
  570. function createBasePortalConcatDelTempTask(path) {
  571. gulp.task(path+".base_portal : clean", function(cb){
  572. var dest = [
  573. 'source/'+path+'/js/base_portal_actions_temp.js',
  574. 'source/'+path+'/js/base_portal_style_temp.js'
  575. ];
  576. return del(dest, cb);
  577. });
  578. }
  579. function createBasePortalConcatBodyTask(path, isMin, thisOptions) {
  580. gulp.task(path+".base_portal : concat", function(){
  581. var option = thisOptions || options;
  582. var src = [
  583. 'source/' + path + '/js/base_concat_head.js',
  584. 'source/o2_core/o2/lp/'+(option.lp || 'zh-cn')+'.js',
  585. 'source/' + path + '/js/base_portal_style_temp.js',
  586. 'source/o2_core/o2/widget/Common.js',
  587. 'source/o2_core/o2/widget/Dialog.js',
  588. 'source/o2_core/o2/widget/UUID.js',
  589. 'source/o2_core/o2/widget/Menu.js',
  590. 'source/o2_core/o2/widget/Toolbar.js',
  591. 'source/o2_core/o2/xDesktop/Common.js',
  592. 'source/o2_core/o2/xDesktop/Actions/RestActions.js',
  593. 'source/o2_core/o2/xAction/RestActions.js',
  594. 'source/o2_core/o2/xDesktop/Access.js',
  595. 'source/o2_core/o2/xDesktop/Dialog.js',
  596. 'source/o2_core/o2/xDesktop/Menu.js',
  597. 'source/o2_core/o2/xDesktop/UserData.js',
  598. 'source/x_component_Template/MPopupForm.js',
  599. 'source/o2_core/o2/xDesktop/Authentication.js',
  600. 'source/o2_core/o2/xDesktop/Window.js',
  601. 'source/x_component_Common/Main.js',
  602. 'source/x_component_process_Work/lp/'+(option.lp || 'zh-cn')+'.js',
  603. 'source/x_component_portal_Portal/lp/'+(option.lp || 'zh-cn')+'.js',
  604. 'source/x_component_process_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
  605. 'source/x_component_Selector/lp/'+(option.lp || 'zh-cn')+'.js',
  606. 'source/x_component_portal_Portal/Main.js',
  607. 'source/x_component_Selector/package.js',
  608. 'source/x_component_Selector/Person.js',
  609. 'source/x_component_Selector/Identity.js',
  610. 'source/x_component_Selector/Unit.js',
  611. 'source/x_component_Selector/IdentityWidthDuty.js',
  612. 'source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js',
  613. 'source/x_component_Selector/UnitWithType.js',
  614. 'source/o2_core/o2/xScript/Actions/UnitActions.js',
  615. 'source/o2_core/o2/xScript/Actions/ScriptActions.js',
  616. 'source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
  617. 'source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
  618. 'source/o2_core/o2/xScript/PageEnvironment.js',
  619. 'source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
  620. 'source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
  621. 'source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
  622. 'source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
  623. 'source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
  624. 'source/' + path + '/js/base_portal_actions_temp.js',
  625. 'source/' + path + '/js/base.js',
  626. 'source/' + path + '/js/base_loader.js'
  627. ];
  628. var dest = option.dest+'/' + path + '/';
  629. return gulp.src(src)
  630. .pipe(sourceMap.init())
  631. .pipe(concat('js/base_portal.js'))
  632. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  633. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  634. host: option.host,
  635. user: option.user || 'anonymous',
  636. pass: option.pass || '@anonymous',
  637. port: option.port || 21,
  638. remotePath: (option.remotePath || '/') + path
  639. })))
  640. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  641. host: option.host,
  642. user: option.user || 'anonymous',
  643. pass: option.pass || null,
  644. port: option.port || 22,
  645. remotePath: (option.remotePath || '/') + path
  646. })))
  647. .pipe(gulp.dest(dest))
  648. // .pipe(gulp.src(src))
  649. .pipe(concat('js/base_portal.min.js'))
  650. .pipe(uglify())
  651. .pipe( sourceMap.write("") )
  652. // .pipe(rename({ extname: '.min.js' }))
  653. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  654. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  655. host: option.host,
  656. user: option.user || 'anonymous',
  657. pass: option.pass || '@anonymous',
  658. port: option.port || 21,
  659. remotePath: (option.remotePath || '/') + path
  660. })))
  661. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  662. host: option.host,
  663. user: option.user || 'anonymous',
  664. pass: option.pass || null,
  665. port: option.port || 22,
  666. remotePath: (option.remotePath || '/') + path
  667. })))
  668. .pipe(gulp.dest(dest))
  669. });
  670. }
  671. function createBasePortalConcatTask(path, isMin, thisOptions){
  672. createBasePortalConcatActionTask(path);
  673. createBasePortalConcatStyleTask(path);
  674. createBasePortalConcatBodyTask(path, isMin, thisOptions);
  675. createBasePortalConcatDelTempTask(path);
  676. gulp.task( path+".base_portal", gulp.series(path+".base_portal : action", path+".base_portal : style", path+".base_portal : concat", path+".base_portal : clean"));
  677. }
  678. function createBaseConcatTask(path, isMin, thisOptions){
  679. gulp.task(path+".base", function(){
  680. var option = thisOptions || options;
  681. var src = [
  682. 'source/' + path + '/js/base.js',
  683. 'source/' + path + '/js/base_loader.js'
  684. ];
  685. var dest = option.dest+'/' + path + '/';
  686. return gulp.src(src)
  687. .pipe(sourceMap.init())
  688. .pipe(concat('js/base.js'))
  689. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  690. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  691. host: option.host,
  692. user: option.user || 'anonymous',
  693. pass: option.pass || '@anonymous',
  694. port: option.port || 21,
  695. remotePath: (option.remotePath || '/') + path
  696. })))
  697. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  698. host: option.host,
  699. user: option.user || 'anonymous',
  700. pass: option.pass || null,
  701. port: option.port || 22,
  702. remotePath: (option.remotePath || '/') + path
  703. })))
  704. .pipe(gulp.dest(dest))
  705. // .pipe(gulp.src(src))
  706. .pipe(concat('js/base.min.js'))
  707. .pipe(uglify())
  708. .pipe( sourceMap.write("") )
  709. // .pipe(rename({ extname: '.min.js' }))
  710. .pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
  711. .pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
  712. host: option.host,
  713. user: option.user || 'anonymous',
  714. pass: option.pass || '@anonymous',
  715. port: option.port || 21,
  716. remotePath: (option.remotePath || '/') + path
  717. })))
  718. .pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
  719. host: option.host,
  720. user: option.user || 'anonymous',
  721. pass: option.pass || null,
  722. port: option.port || 22,
  723. remotePath: (option.remotePath || '/') + path
  724. })))
  725. .pipe(gulp.dest(dest))
  726. });
  727. }
  728. function getAppTask(path, isMin, thisOptions) {
  729. if (path==="x_component_process_Xform"){
  730. createDefaultTask(path, isMin, thisOptions);
  731. createXFormConcatTask(path, isMin, thisOptions);
  732. return gulp.series(path, path+" : concat");
  733. }else if (path==="o2_core"){
  734. createDefaultTask(path, isMin, thisOptions);
  735. createO2ConcatTask(path, isMin, thisOptions);
  736. return gulp.series(path, path+" : concat", path+".xDesktop : concat", path+" : bundle");
  737. }else if (path==="x_desktop") {
  738. createDefaultTask(path, isMin, thisOptions);
  739. createBaseWorkConcatTask(path, isMin, thisOptions);
  740. createBasePortalConcatTask(path, isMin, thisOptions);
  741. createBaseConcatTask(path, isMin, thisOptions);
  742. return gulp.series(path, path+".base_work", path+".base_portal", path+".base");
  743. //return gulp.series(path, path+".base_work : concat");
  744. }else{
  745. createDefaultTask(path, isMin, thisOptions);
  746. return gulp.series(path);
  747. }
  748. }
  749. //var taskObj = {};
  750. apps.map(function (app) {
  751. var taskName;
  752. var isMin = (app.tasks.indexOf("min")!==-1);
  753. taskName = app.folder;
  754. appTasks.push(taskName);
  755. gulp.task(taskName, getAppTask(app.folder, isMin));
  756. // //var isMin = (app.tasks.indexOf("min")!==-1);
  757. // taskName = app.folder+"_release";
  758. // //appTasks.push(taskName);
  759. // gulp.task(taskName, getAppTask(app.folder, isMin, release_options));
  760. });
  761. // Object.keys(taskObj).map(function(k){
  762. // exports[k] = parallel(taskObj[k]);
  763. // });
  764. //exports[app.folder] = parallel(minTask, moveTask);
  765. function getCleanTask(path) {
  766. return function (cb) {
  767. if (path){
  768. var dest = (path=="/") ? options.dest+"/" : options.dest+'/' + path + '/';
  769. gutil.log("Clean", ":", gutil.colors.red(dest));
  770. del.sync(dest, cb);
  771. cb();
  772. }else{
  773. cb();
  774. }
  775. }
  776. }
  777. function cleanRemoteFtp(f, cb) {
  778. var file = options.remotePath + f;
  779. var ftp = new JSFtp({
  780. host: options.host,
  781. user: options.user || 'anonymous',
  782. pass: options.pass || null,
  783. port: options.port || 21
  784. });
  785. ftp.raw('dele ' + file, function (err) {
  786. if (err) { cb(); return; }
  787. if (file.substring(file.length - 3).toLowerCase() == ".js") {
  788. file = file.replace('.js', ".min.js");
  789. ftp.raw('dele ' + file, function (err) {
  790. if (err) { cb(); return; }
  791. if (file.indexOf("/") != -1) {
  792. var p = file.substring(0, file.lastIndexOf("/"));
  793. ftp.raw('rmd ' + p, function (err) {
  794. if (err) { cb(); return; }
  795. ftp.raw.quit();
  796. cb();
  797. });
  798. }
  799. });
  800. } else {
  801. if (file.indexOf("/") != -1) {
  802. var pPath = file.substring(0, file.lastIndexOf("/"));
  803. ftp.raw('rmd ' + pPath, function (err) {
  804. if (err) { cb(); return; }
  805. ftp.raw.quit();
  806. cb();
  807. });
  808. }
  809. }
  810. });
  811. }
  812. function cleanRemoteLocal(f, cb) {
  813. var file = options.location + f;
  814. del(file, { force: true, dryRun: true }, function () {
  815. if (file.substring(file.length - 3).toLowerCase() == ".js") {
  816. var minfile = file.replace('.js', ".min.js");
  817. del(minfile, { force: true, dryRun: true }, function () {
  818. var p = file.substring(0, file.lastIndexOf("/"));
  819. fs.rmdir(p, function (err) {
  820. if (err) { }
  821. cb();
  822. })
  823. });
  824. } else {
  825. var p = file.substring(0, file.lastIndexOf("/"));
  826. fs.rmdir(p, function (err) {
  827. if (err) { }
  828. cb();
  829. })
  830. }
  831. });
  832. }
  833. function getCleanRemoteTask(path) {
  834. return function (cb) {
  835. if (options.upload) {
  836. var file = path.replace(/\\/g, "/");
  837. file = file.substring(file.indexOf("source/") + 7);
  838. if (options.upload == 'local' && options.location != '') cleanRemoteLocal(file, cb);
  839. if (options.upload == 'ftp' && options.host != '') cleanRemoteFtp(file, cb);
  840. } else {
  841. if (cb) cb();
  842. }
  843. }
  844. }
  845. function getWatchTask(path) {
  846. return (path) ? function (cb) {
  847. gutil.log("watch", ":", gutil.colors.green(path, "is watching ..."));
  848. gulp.watch(['source/' + path + '/**/*', "!./**/test/**"], { "events": ['addDir', 'add', 'change'] }, gulp.parallel([path]));
  849. } : function(cb){cb();};
  850. }
  851. gulp.task("clean", getCleanTask(options.src))
  852. gulp.task("watch", getWatchTask(options.src));
  853. gulp.task("index", function () {
  854. var src = ['source/favicon.ico', 'source/index.html'];
  855. var dest = options.dest;
  856. return gulp.src(src)
  857. .pipe(changed(dest))
  858. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + '/')))
  859. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  860. host: options.host,
  861. user: options.user || 'anonymous',
  862. pass: options.pass || '@anonymous',
  863. port: options.port || 21,
  864. remotePath: (options.remotePath || '/')
  865. })))
  866. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), ftp({
  867. host: options.host,
  868. user: options.user || 'anonymous',
  869. pass: options.pass || null,
  870. port: options.port || 22,
  871. remotePath: (options.remotePath || '/')
  872. })))
  873. .pipe(gulp.dest(dest))
  874. .pipe(gutil.noop());
  875. });
  876. gulp.task("cleanAll", getCleanTask('/'));
  877. function getGitV(){
  878. var tagPromise = new Promise(function(s){
  879. git.exec({args : 'describe --tag'}, function (err, stdout) {
  880. var v = stdout.substring(0, stdout.indexOf("-"));
  881. s(v);
  882. });
  883. });
  884. var revPromise = new Promise(function(s){
  885. git.exec({args : 'rev-parse --short HEAD'}, function (err, hash) {
  886. s(hash.trim());
  887. });
  888. });
  889. return Promise.all([tagPromise,revPromise])
  890. }
  891. gulp.task("o2:new-v:html", function () {
  892. var path = "x_desktop";
  893. var src = 'source/x_desktop/*.html';
  894. var dest = options.dest + '/x_desktop/';
  895. return getGitV().then(function(arr) {
  896. return gulp.src(src)
  897. .pipe(assetRev({"verConnecter": arr[0], "md5": arr[1]}))
  898. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + path + '/')))
  899. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  900. host: options.host,
  901. user: options.user || 'anonymous',
  902. pass: options.pass || '@anonymous',
  903. port: options.port || 21,
  904. remotePath: (options.remotePath || '/') + path
  905. })))
  906. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), sftp({
  907. host: options.host,
  908. user: options.user || 'anonymous',
  909. pass: options.pass || null,
  910. port: options.port || 22,
  911. remotePath: (options.remotePath || '/') + path
  912. })))
  913. .pipe(gulp.dest(dest))
  914. .pipe(gutil.noop());
  915. });
  916. });
  917. gulp.task("o2:new-v:o2", function () {
  918. var path = "o2_core";
  919. var src = options.dest +'/o2_core/o2.js';
  920. var dest = options.dest +'/o2_core/';
  921. return getGitV().then(function(arr){
  922. var v = arr[0]+"-"+arr[1];
  923. return gulp.src(src)
  924. .pipe(assetRev({"verConnecter": arr[0], "md5": arr[1], "replace": true}))
  925. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + path + '/')))
  926. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  927. host: options.host,
  928. user: options.user || 'anonymous',
  929. pass: options.pass || '@anonymous',
  930. port: options.port || 21,
  931. remotePath: (options.remotePath || '/') + path
  932. })))
  933. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), sftp({
  934. host: options.host,
  935. user: options.user || 'anonymous',
  936. pass: options.pass || null,
  937. port: options.port || 22,
  938. remotePath: (options.remotePath || '/') + path
  939. })))
  940. .pipe(gulp.dest(dest))
  941. .pipe(uglify())
  942. .pipe(rename({ extname: '.min.js' }))
  943. .pipe(gulpif((options.upload == 'local' && options.location != ''), gulp.dest(options.location + path + '/')))
  944. .pipe(gulpif((options.upload == 'ftp' && options.host != ''), ftp({
  945. host: options.host,
  946. user: options.user || 'anonymous',
  947. pass: options.pass || '@anonymous',
  948. port: options.port || 21,
  949. remotePath: (options.remotePath || '/') + path
  950. })))
  951. .pipe(gulpif((options.upload == 'sftp' && options.host != ''), sftp({
  952. host: options.host,
  953. user: options.user || 'anonymous',
  954. pass: options.pass || null,
  955. port: options.port || 22,
  956. remotePath: (options.remotePath || '/') + path
  957. })))
  958. .pipe(gulp.dest(dest))
  959. .pipe(gutil.noop());
  960. });
  961. });
  962. gulp.task("o2:new-v", gulp.parallel("o2:new-v:o2", "o2:new-v:html"));
  963. gulp.task("git_clean", function (cb) {
  964. var dest = 'D:/O2/github/huqi1980/o2oa/o2web/source/';
  965. del(dest, { dryRun: true, force: true }, cb);
  966. });
  967. gulp.task("git_dest", function () {
  968. var dest = "D:/O2/github/huqi1980/o2oa/o2web/source";
  969. return gulp.src(["source/**/*", "!./**/test/**"])
  970. .pipe(changed(dest))
  971. .pipe(gulp.dest(dest))
  972. });
  973. gulp.task("git", gulp.series('git_clean', 'git_dest'));
  974. gulp.task("default", gulp.series(gulp.parallel(appTasks, 'index'), "o2:new-v"));
  975. function build(){
  976. options.ev = "p";
  977. options.upload = o_options.upload || "";
  978. options.location = o_options.location || uploadOptions.location;
  979. options.host = o_options.host || uploadOptions.host;
  980. options.user = o_options.user || uploadOptions.user;
  981. options.pass = o_options.pass || uploadOptions.pass;
  982. options.port = o_options.port || uploadOptions.port;
  983. options.remotePath = o_options.remotePath || uploadOptions.remotePath;
  984. options.dest = o_options.dest || uploadOptions.dest || "dest";
  985. };
  986. gulp.task("build", gulp.series("clean", gulp.parallel(appTasks, 'index'), "o2:new-v"))