Best JavaScript code snippet using cypress
copyFiles.js
Source:copyFiles.js
...11 mkdirp(path.join(destRoot, self.templateDest, self.imgDirPath));12 mkdirp(path.join(destRoot, self.templateDest, self.cssDirPath));13 mkdirp(path.join(destRoot, self.templateDest, self.cssLibDirPath));14 mkdirp(path.join(destRoot, self.templateDest, self.fontDirPath));15 self.fs.copy(16 path.join(sourceRoot, 'project/_editorconfig'),17 path.join(destRoot, '.editorconfig')18 );19 self.fs.copy(20 path.join(sourceRoot, 'project/_gitignore'),21 path.join(destRoot, '.gitignore')22 );23 self.fs.copy(24 path.join(sourceRoot, 'project/_gitattributes'),25 path.join(destRoot, '.gitattributes')26 );27 // self.fs.copyTpl(28 // path.join(sourceRoot, 'project/README.md'),29 // path.join(destRoot, 'README.md'),30 // templateContext31 // );32 cb();33}34function copyExpressFiles(self, destRoot, sourceRoot, cb){35 if(self.environmentOption === 'express'){36 self.fs.copy(37 path.join(sourceRoot, 'bin'),38 path.join(destRoot, self.mainDir, 'bin')39 );40 self.fs.copy(41 path.join(sourceRoot, 'routes'),42 path.join(destRoot, self.mainDir, 'routes')43 );44 self.fs.copy(45 path.join(sourceRoot, 'views'),46 path.join(destRoot, self.mainDir, 'views')47 );48 self.fs.copy(49 path.join(sourceRoot, 'app.js'),50 path.join(destRoot, self.mainDir, 'app.js')51 );52 self.fs.copy(53 path.join(sourceRoot, 'package.json'),54 path.join(destRoot, self.mainDir, 'package.json')55 );56 }57 cb();58}59function copyWordpressFiles(self, destRoot, sourceRoot, cb) {60 var wpRoot = path.join(sourceRoot, 'wordpress/blank-theme'),61 wpDest = path.join(destRoot, self.templateDest),62 templateContext = {63 themeAuthor: self.themeAuthor,64 themeAuthorEmail: self.themeAuthorEmail,65 themeName: self.themeName,66 themeNameSpace: self.themeNameSpace,67 jsDirPath: self.jsDirPath,68 jsLibDirPath: self.jsLibDirPath,69 cssDirPath: self.cssDirPath,70 cssLibDirPath: self.cssLibDirPath71 }72 if(self.environmentOption === 'wordpress' && self.wpBlankTheme === true) {73 self.fs.copy(74 path.join(wpRoot, '_inc'),75 path.join(wpDest, '_inc')76 );77 self.fs.copy(78 path.join(wpRoot, 'screenshot.png'),79 path.join(wpDest, 'screenshot.png')80 );81 self.fs.copyTpl(82 path.join(wpRoot, '404.php'),83 path.join(wpDest, '404.php'),84 templateContext85 );86 self.fs.copyTpl(87 path.join(wpRoot, 'archive.php'),88 path.join(wpDest, 'archive.php'),89 templateContext90 );91 self.fs.copyTpl(92 path.join(wpRoot, 'comments.php'),93 path.join(wpDest, 'comments.php'),94 templateContext95 );96 self.fs.copyTpl(97 path.join(wpRoot, 'footer.php'),98 path.join(wpDest, 'footer.php'),99 templateContext100 );101 self.fs.copyTpl(102 path.join(wpRoot, 'functions.php'),103 path.join(wpDest, 'functions.php'),104 templateContext105 );106 self.fs.copyTpl(107 path.join(wpRoot, 'header.php'),108 path.join(wpDest, 'header.php'),109 templateContext110 );111 self.fs.copyTpl(112 path.join(wpRoot, 'index.php'),113 path.join(wpDest, 'index.php'),114 templateContext115 );116 self.fs.copyTpl(117 path.join(wpRoot, 'options.php'),118 path.join(wpDest, 'options.php'),119 templateContext120 );121 self.fs.copyTpl(122 path.join(wpRoot, 'page.php'),123 path.join(wpDest, 'page.php'),124 templateContext125 );126 self.fs.copyTpl(127 path.join(wpRoot, 'search.php'),128 path.join(wpDest, 'search.php'),129 templateContext130 );131 self.fs.copyTpl(132 path.join(wpRoot, 'searchform.php'),133 path.join(wpDest, 'searchform.php'),134 templateContext135 );136 self.fs.copyTpl(137 path.join(wpRoot, 'sidebar.php'),138 path.join(wpDest, 'sidebar.php'),139 templateContext140 );141 self.fs.copyTpl(142 path.join(wpRoot, 'single.php'),143 path.join(wpDest, 'single.php'),144 templateContext145 );146 self.fs.copyTpl(147 path.join(wpRoot, 'style.css'),148 path.join(wpDest, 'style.css'),149 templateContext150 );151 }152 cb();153}154function copyH5bpFiles(self, destRoot, sourceRoot, cb) {155 var templateContext = {156 imgDirPath: self.imgDirPath157 }158 if(self.environmentOption === 'static') {159 self.fs.copyTpl(160 path.join(sourceRoot, 'website/browserconfig.xml'),161 path.join(destRoot, self.mainDir, 'browserconfig.xml'),162 templateContext163 );164 self.fs.copy(165 path.join(sourceRoot, 'website/htaccess.txt'),166 path.join(destRoot, self.mainDir, '.htaccess')167 );168 self.fs.copy(169 path.join(sourceRoot, 'website/crossdomain.xml'),170 path.join(destRoot, self.mainDir, 'crossdomain.xml')171 );172 self.fs.copy(173 path.join(sourceRoot, 'website/robots.txt'),174 path.join(destRoot, self.mainDir, 'robots.txt')175 );176 }177 cb();178}179function copyHtmlFiles(self, destRoot, sourceRoot, cb) {180 var templateContext = {181 environmentOption: self.environmentOption,182 imgDirPath: self.imgDirPath,183 cssDirPath: self.cssDirPath,184 jsDirPath: self.jsDirPath,185 jsLibDirPath: self.jsLibDirPath,186 modernizrOption: self.modernizrOption,187 analyticsOption: self.analyticsOption,188 jsScripts: self.jsScripts189 }190 if(self.environmentOption === 'static' || self.environmentOption === 'express') {191 switch (self.templateOption){192 case 'jade':193 if(self.environmentOption === 'express') {194 destRoot = path.join(destRoot, self.mainDir, 'views');195 } else {196 destRoot = path.join(destRoot, 'src/jade');197 }198 self.fs.copy(199 path.join(sourceRoot, 'jade'),200 destRoot201 );202 self.fs.copyTpl(203 path.join(sourceRoot, 'tpl/jade/index.jade'),204 path.join(destRoot, 'index.jade'),205 templateContext206 );207 self.fs.copyTpl(208 path.join(sourceRoot, 'tpl/jade/templates/layout.jade'),209 path.join(destRoot,'templates/layout.jade'),210 templateContext211 );212 break;213 case 'pug':214 if(self.environmentOption === 'express') {215 destRoot = path.join(destRoot, self.mainDir, 'views');216 } else {217 destRoot = path.join(destRoot, 'src/pug');218 }219 self.fs.copy(220 path.join(sourceRoot, 'pug'),221 destRoot);222 self.fs.copyTpl(223 path.join(sourceRoot, 'tpl/pug/index.pug'),224 path.join(destRoot, 'index.pug'),225 templateContext226 );227 self.fs.copyTpl(228 path.join(sourceRoot, 'tpl/pug/templates/layout.pug'),229 path.join(destRoot,'templates/layout.pug'),230 templateContext231 );232 break;233 case 'nunjucks':234 if(self.environmentOption === 'express') {235 destRoot = path.join(destRoot, self.mainDir, 'views');236 } else {237 destRoot = path.join(destRoot, 'src/nunjucks');238 }239 self.fs.copy(240 path.join(sourceRoot, 'nunjucks'),241 destRoot242 );243 self.fs.copyTpl(244 path.join(sourceRoot, 'tpl/nunjucks/base/layout.html'),245 path.join(destRoot,'base/layout.html'),246 templateContext247 );248 self.fs.copy(249 path.join(sourceRoot, 'nunjucks'),250 destRoot251 );252 break;253 default:254 self.fs.copyTpl(255 path.join(sourceRoot, 'website/index.html'),256 path.join(destRoot, self.mainDir, 'index.html'),257 templateContext258 );259 }260 }261 cb();262}263function copyJsFiles(self, destRoot, gulpRoot, sourceRoot, cb){264 var templateContext = {265 requireOption: self.requireOption,266 jqueryOption: self.jqueryOption,267 jsLibDirPath: self.jsLibDirPath,268 jsScriptsBower: self.jsScriptsBower,269 rootFolder: self.rootFolder,270 javascriptOption: self.javascriptOption,271 modernizrOption: self.modernizrOption,272 scriptsOption: self.scriptsOption273 }274 var ext = '.js';275 if(self.gulpTypeOption === 'coffee') ext = '.coffee';276 self.fs.copyTpl(277 path.join(sourceRoot, 'gulp-tasks/bower' + ext),278 path.join(gulpRoot, 'gulp-tasks/bower' + ext),279 templateContext280 );281 self.fs.copyTpl(282 path.join(sourceRoot, 'gulp-tasks/scripts' + ext),283 path.join(gulpRoot, 'gulp-tasks/scripts' + ext),284 templateContext285 );286 switch (self.javascriptOption){287 case 'coffee':288 self.fs.copyTpl(289 path.join(sourceRoot, 'coffee/main.coffee'),290 path.join(destRoot, 'src/coffee/main.coffee'),291 templateContext292 );293 break;294 default:295 self.fs.copyTpl(296 path.join(sourceRoot, 'js/main.js'),297 path.join(destRoot, 'src/js/main.js'),298 templateContext299 );300 }301 if(self.modernizrOption) {302 self.fs.copy(303 path.join(sourceRoot, 'modernizr'),304 path.join(destRoot, 'src/modernizr')305 );306 var ext = '.js';307 if(self.gulpTypeOption === 'coffee') {308 ext = '.coffee';309 }310 self.fs.copy(311 path.join(sourceRoot, 'gulp-tasks/modernizr' + ext),312 path.join(gulpRoot, 'gulp-tasks/modernizr' + ext),313 templateContext314 );315 }316 cb();317}318function copyImageFiles(self, destRoot, sourceRoot, cb) {319 self.fs.copy(320 path.join(sourceRoot, 'img'),321 path.join(destRoot, 'src/img')322 );323 cb();324};325function copyGulpFiles(self, destRoot, gulpRoot, sourceRoot, cb) {326 var templateContext = {327 environmentOption: self.environmentOption,328 templateOption: self.templateOption,329 jsDirPath: self.jsDirPath,330 cssDirPath: self.cssDirPath,331 mainDir: self.mainDir332 }333 var ext = '.js';334 if(self.gulpTypeOption === 'coffee') {335 ext = '.coffee';336 self.fs.copyTpl(337 path.join(sourceRoot, 'gulp/coffee_gulpfile.js'),338 path.join(gulpRoot, 'gulpfile.js'),339 templateContext340 );341 }342 self.fs.copy(343 path.join(sourceRoot, 'gulp/gulp-tasks/clean' + ext),344 path.join(gulpRoot, 'gulp-tasks/clean' + ext)345 );346 self.fs.copy(347 path.join(sourceRoot, 'gulp/gulp-tasks/images' + ext),348 path.join(gulpRoot, 'gulp-tasks/images' + ext)349 );350 self.fs.copyTpl(351 path.join(sourceRoot, 'gulp/gulpfile' + ext),352 path.join(gulpRoot, 'gulpfile' + ext),353 templateContext354 );355 self.fs.copyTpl(356 path.join(sourceRoot, 'gulp/gulp-tasks/browsersync' + ext),357 path.join(gulpRoot, 'gulp-tasks/browsersync' + ext),358 templateContext359 );360 switch (self.templateOption){361 case 'html':362 self.fs.copyTpl(363 path.join(sourceRoot, 'gulp/gulp-tasks/html' + ext),364 path.join(gulpRoot, 'gulp-tasks/html' + ext),365 templateContext366 );367 break;368 case 'jade':369 self.fs.copyTpl(370 path.join(sourceRoot, 'gulp/gulp-tasks/jade' + ext),371 path.join(gulpRoot, 'gulp-tasks/html' + ext),372 templateContext373 );374 break;375 case 'pug':376 self.fs.copyTpl(377 path.join(sourceRoot, 'gulp/gulp-tasks/pug' + ext),378 path.join(gulpRoot, 'gulp-tasks/html' + ext),379 templateContext380 );381 break;382 case 'nunjucks':383 self.fs.copyTpl(384 path.join(sourceRoot, 'gulp/gulp-tasks/nunjucks' + ext),385 path.join(gulpRoot, 'gulp-tasks/html' + ext),386 templateContext387 );388 break;389 }390 cb();391};392function copySvgIconsFiles(self, destRoot, gulpRoot, sourceRoot, cb) {393 if(self.svgiconsOption){394 self.fs.copy(395 path.join(sourceRoot, 'illustrator'),396 path.join(destRoot, 'src/icons/illustrator')397 );398 self.fs.copy(399 path.join(sourceRoot, 'svg'),400 path.join(destRoot, 'src/icons', self.svgIconSpriteName)401 );402 var ext = '.js';403 if(self.gulpTypeOption === 'coffee') {404 ext = '.coffee';405 }406 self.fs.copy(407 path.join(sourceRoot, 'gulp-tasks/svg' + ext),408 path.join(gulpRoot, 'gulp-tasks/svg' + ext)409 );410 }411 cb();412}413function copyIconFontFiles(self, destRoot, gulpRoot, sourceRoot, cb) {414 var templateContext = {415 customIconfontName: self.customIconfontName416 }417 if(self.customIconfontOption){418 self.fs.copy(419 path.join(sourceRoot, 'illustrator'),420 path.join(destRoot, 'src/iconfont/illustrator')421 );422 self.fs.copy(423 path.join(sourceRoot, 'svg'),424 path.join(destRoot, 'src/iconfont/svg')425 );426 // Template file427 switch(self.preproOption) {428 case 'scss':429 self.fs.copy(430 path.join(sourceRoot, 'template/_icons.scss'),431 path.join(destRoot, 'src/iconfont/template/_icons.scss')432 );433 self.fs.copy(434 path.join(sourceRoot, 'scss/_icons.scss'),435 path.join(destRoot, 'src/scss/modules/_icons.scss')436 );437 self.fs.copyTpl(438 path.join(sourceRoot, 'scss/_font-icn.scss'),439 path.join(destRoot, 'src/scss/base/fonts/_font-icn.scss'),440 templateContext441 );442 break;443 case 'stylus':444 self.fs.copy(445 path.join(sourceRoot, 'template/icons.styl'),446 path.join(destRoot, 'src/iconfont/template/icons.styl')447 );448 self.fs.copy(449 path.join(sourceRoot, 'stylus/icons.styl'),450 path.join(destRoot, 'src/stylus/modules/icons.styl')451 );452 self.fs.copyTpl(453 path.join(sourceRoot, 'stylus/font-icn.styl'),454 path.join(destRoot, 'src/stylus/base/fonts/font-icn.styl'),455 templateContext456 );457 break;458 case 'less':459 self.fs.copy(460 path.join(sourceRoot, 'template/icons.less'),461 path.join(destRoot, 'src/iconfont/template/icons.less')462 );463 self.fs.copy(464 path.join(sourceRoot, 'less/icons.less'),465 path.join(destRoot, 'src/less/modules/icons.less')466 );467 self.fs.copyTpl(468 path.join(sourceRoot, 'less/font-icn.less'),469 path.join(destRoot, 'src/less/base/fonts/font-icn.less'),470 templateContext471 );472 break;473 }474 var ext = '.js';475 if(self.gulpTypeOption === 'coffee') {476 ext = '.coffee';477 }478 self.fs.copy(479 path.join(sourceRoot, 'gulp-tasks/iconfont' + ext),480 path.join(gulpRoot, 'gulp-tasks/iconfont' + ext)481 );482 }483 cb();484}485function copyStyleFiles(self, destRoot, gulpRoot, sourceRoot, cb) {486 var wpRoot = path.join(sourceRoot, 'wordpress/blank-theme'),487 templateContext = {488 preproOption: self.preproOption,489 baseStyleOption: self.baseStyleOption,490 mqOption: self.mqOption,491 gridOption: self.gridOption,492 mixinOption: self.mixinOption,493 nodeModules: self.nodeModules,494 imgDir: self.imgDir,495 fontDir: self.fontDir,496 assetsDir: self.assetsDir,497 wpBlankTheme: self.wpBlankTheme,498 postcssOption: self.postcssOption,499 postcssPlugins: self.postcssPlugins,500 postcssCssNanoOption: self.postcssCssNanoOption501 }502 var ext = '.js';503 if(self.gulpTypeOption === 'coffee') {504 ext = '.coffee';505 }506 self.fs.copyTpl(507 path.join(sourceRoot, 'gulp-tasks/styles' + ext),508 path.join(gulpRoot, 'gulp-tasks/styles' + ext),509 templateContext510 );511 if(self.preproOption === 'scss') {512 self.fs.copy(513 path.join(sourceRoot, 'scss/base'),514 path.join(destRoot, 'src/scss/base')515 );516 self.fs.copy(517 path.join(sourceRoot, 'scss/modules'),518 path.join(destRoot, 'src/scss/modules')519 );520 self.fs.copy(521 path.join(sourceRoot, 'scss/pages'),522 path.join(destRoot, 'src/scss/pages')523 );524 self.fs.copy(525 path.join(sourceRoot, 'scss/playground'),526 path.join(destRoot, 'src/scss/playground')527 );528 self.fs.copy(529 path.join(sourceRoot, 'scss/themes'),530 path.join(destRoot, 'src/scss/themes')531 );532 self.fs.copy(533 path.join(sourceRoot, 'scss/views'),534 path.join(destRoot, 'src/scss/views')535 );536 self.fs.copy(537 path.join(sourceRoot, 'scss/tpl/base/_variables.scss'),538 path.join(destRoot, 'src/scss/base/_variables.scss')539 );540 self.fs.copyTpl(541 path.join(sourceRoot, 'scss/tpl/style.scss'),542 path.join(destRoot, 'src/scss/style.scss'),543 templateContext544 );545 switch (self.gridOption){546 case 'semantic':547 self.fs.copy(548 path.join(sourceRoot, 'scss/tpl/base/_semantic-grid.scss'),549 path.join(destRoot, 'src/scss/base/_grid.scss')550 );551 break;552 case 'jeet':553 self.fs.copy(554 path.join(sourceRoot, 'scss/tpl/base/jeet/'),555 path.join(destRoot, 'src/scss/base/jeet/')556 );557 self.fs.copyTpl(558 path.join(sourceRoot, 'scss/tpl/base/_grid.scss'),559 path.join(destRoot, 'src/scss/base/_grid.scss'),560 templateContext561 );562 break;563 default:564 self.fs.copyTpl(565 path.join(sourceRoot, 'scss/tpl/base/_grid.scss'),566 path.join(destRoot, 'src/scss/base/_grid.scss'),567 templateContext568 );569 }570 switch (self.baseStyleOption){571 case 'reset':572 self.fs.copy(573 path.join(sourceRoot, 'scss/tpl/reset/_reset.scss'),574 path.join(destRoot, 'src/scss/base/_reset.scss')575 );576 break;577 case 'normalize':578 self.fs.copy(579 path.join(sourceRoot, 'scss/tpl/reset/_normalize.scss'),580 path.join(destRoot, 'src/scss/base/_normalize.scss')581 );582 break;583 case 'sanitize':584 self.fs.copy(585 path.join(sourceRoot, 'scss/tpl/reset/_sanitize.scss'),586 path.join(destRoot, 'src/scss/base/_sanitize.scss')587 );588 break;589 }590 }591 if(self.preproOption === 'stylus') {592 self.fs.copy(593 path.join(sourceRoot, 'stylus/base'),594 path.join(destRoot, 'src/stylus/base')595 );596 self.fs.copy(597 path.join(sourceRoot, 'stylus/modules'),598 path.join(destRoot, 'src/stylus/modules')599 );600 self.fs.copy(601 path.join(sourceRoot, 'stylus/pages'),602 path.join(destRoot, 'src/stylus/pages')603 );604 self.fs.copy(605 path.join(sourceRoot, 'stylus/playground'),606 path.join(destRoot, 'src/stylus/playground')607 );608 self.fs.copy(609 path.join(sourceRoot, 'stylus/themes'),610 path.join(destRoot, 'src/stylus/themes')611 );612 self.fs.copy(613 path.join(sourceRoot, 'stylus/views'),614 path.join(destRoot, 'src/stylus/views')615 );616 self.fs.copy(617 path.join(sourceRoot, 'stylus/tpl/base/variables.styl'),618 path.join(destRoot, 'src/stylus/base/variables.styl')619 );620 self.fs.copyTpl(621 path.join(sourceRoot, 'stylus/tpl/style.styl'),622 path.join(destRoot, 'src/stylus/style.styl'),623 templateContext624 );625 switch (self.gridOption){626 case 'semantic':627 self.fs.copy(628 path.join(sourceRoot, 'stylus/tpl/base/semantic-grid.styl'),629 path.join(destRoot, 'src/stylus/base/grid.styl')630 );631 break;632 case 'jeet':633 self.fs.copy(634 path.join(sourceRoot, 'stylus/tpl/base/jeet/'),635 path.join(destRoot, 'src/stylus/base/jeet/')636 );637 break;638 default:639 self.fs.copyTpl(640 path.join(sourceRoot, 'stylus/tpl/base/grid.styl'),641 path.join(destRoot, 'src/stylus/base/grid.styl'),642 templateContext643 );644 }645 switch (self.baseStyleOption){646 case 'reset':647 self.fs.copy(648 path.join(sourceRoot, 'stylus/tpl/reset/reset.styl'),649 path.join(destRoot, 'src/stylus/base/reset.styl')650 );651 break;652 case 'normalize':653 self.fs.copy(654 path.join(sourceRoot, 'stylus/tpl/reset/normalize.styl'),655 path.join(destRoot, 'src/stylus/base/normalize.styl')656 );657 break;658 case 'sanitize':659 self.fs.copy(660 path.join(sourceRoot, 'stylus/tpl/reset/sanitize.styl'),661 path.join(destRoot, 'src/stylus/base/sanitize.styl')662 );663 break;664 }665 }666 if(self.preproOption === 'less') {667 self.fs.copy(668 path.join(sourceRoot, 'less/base'),669 path.join(destRoot, 'src/less/base')670 );671 self.fs.copy(672 path.join(sourceRoot, 'less/modules'),673 path.join(destRoot, 'src/less/modules')674 );675 self.fs.copy(676 path.join(sourceRoot, 'less/pages'),677 path.join(destRoot, 'src/less/pages')678 );679 self.fs.copy(680 path.join(sourceRoot, 'less/playground'),681 path.join(destRoot, 'src/less/playground')682 );683 self.fs.copy(684 path.join(sourceRoot, 'less/themes'),685 path.join(destRoot, 'src/less/themes')686 );687 self.fs.copy(688 path.join(sourceRoot, 'less/views'),689 path.join(destRoot, 'src/less/views')690 );691 self.fs.copy(692 path.join(sourceRoot, 'less/tpl/base/variables.less'),693 path.join(destRoot, 'src/less/base/variables.less')694 );695 self.fs.copyTpl(696 path.join(sourceRoot, 'less/tpl/style.less'),697 path.join(destRoot, 'src/less/style.less'),698 templateContext699 );700 switch (self.gridOption){701 case 'semantic':702 self.fs.copy(703 path.join(sourceRoot, 'less/tpl/base/semantic-grid.less'),704 path.join(destRoot, 'src/less/base/grid.less')705 );706 break;707 default:708 self.fs.copyTpl(709 path.join(sourceRoot, 'less/tpl/base/grid.less'),710 path.join(destRoot, 'src/less/base/grid.less'),711 templateContext712 );713 }714 switch (self.mixinOption){715 case 'lesshat':716 self.fs.copy(717 path.join(sourceRoot, 'less/tpl/mixins/lesshat.less'),718 path.join(destRoot, 'src/less/base/mixins/lesshat.less')719 );720 self.fs.copy(721 path.join(sourceRoot, 'less/tpl/mixins/lesshat-prefixed.less'),722 path.join(destRoot, 'src/less/base/mixins/lesshat-prefixed.less')723 );724 break;725 }726 switch (self.mqOption){727 case 'lessmq':728 self.fs.copy(729 path.join(sourceRoot, 'less/tpl/mixins/mq.less'),730 path.join(destRoot, 'src/less/base/mixins/mq.less')731 );732 self.fs.copy(733 path.join(sourceRoot, 'less/tpl/mixins/mq-prefixed.less'),734 path.join(destRoot, 'src/less/base/mixins/mq-prefixed.less')735 );736 break;737 }738 switch (self.baseStyleOption){739 case 'reset':740 self.fs.copy(741 path.join(sourceRoot, 'less/tpl/reset/reset.less'),742 path.join(destRoot, 'src/less/base/reset.less')743 );744 break;745 case 'normalize':746 self.fs.copy(747 path.join(sourceRoot, 'less/tpl/reset/normalize.less'),748 path.join(destRoot, 'src/less/base/normalize.less')749 );750 break;751 case 'sanitize':752 self.fs.copy(753 path.join(sourceRoot, 'less/tpl/reset/sanitize.less'),754 path.join(destRoot, 'src/less/base/sanitize.less')755 );756 break;757 }758 }759 if(self.wpBlankTheme){760 switch(self.preproOption) {761 case 'scss':762 self.fs.copy(763 path.join(wpRoot, 'wp-core.css'),764 path.join(destRoot, 'src/scss/base/_wp-core.scss')765 );766 break;767 case 'stylus':768 self.fs.copy(769 path.join(wpRoot, 'wp-core.css'),770 path.join(destRoot, 'src/stylus/base/wp-core.styl')771 );772 break;773 case 'less':774 self.fs.copy(775 path.join(wpRoot, 'wp-core.css'),776 path.join(destRoot, 'src/less/base/wp-core.less')777 );778 break;779 }780 }781 cb();782}783module.exports = {784 copyProjectFiles: copyProjectFiles,785 copyWordpressFiles: copyWordpressFiles,786 copyExpressFiles: copyExpressFiles,787 copyH5bpFiles: copyH5bpFiles,788 copyHtmlFiles: copyHtmlFiles,...
writing.js
Source:writing.js
...13 // create directories14 mkdirp(path.join(destPath, 'src/fonts'));15 mkdirp(path.join(destPath, 'src/img'));16 // dotfiles17 this.fs.copy(this.templatePath('gitignore'), '.gitignore');18 this.fs.copy(this.templatePath('editorconfig'), '.editorconfig');19 this.fs.copy(this.templatePath('eslintrc'), '.eslintrc');20 this.fs.copy(this.templatePath('eslintignore'), '.eslintignore');21 this.fs.copy(this.templatePath('htmlhintrc'), '.htmlhintrc');22 this.fs.copy(this.templatePath('sass-lint.yml'), '.sass-lint.yml');23 this.fs.copy(this.templatePath('stylelintrc'), '.stylelintrc');24 this.fs.copyTpl(this.templatePath('gulpfile.babel.js'), 'gulpfile.babel.js', props);25 this.fs.copy(this.templatePath('README.md'),'README.md');26 this.fs.copyTpl(this.templatePath('package.json'),'package.json', props);27 // gulp configs28 this.fs.copy(this.templatePath('gulp/config.js'),'gulp/config.js');29 this.fs.copy(this.templatePath('gulp/util/handle-errors.js'),'gulp/util/handle-errors.js');30 31 // common tasks32 // this.fs.copyTpl(this.templatePath('gulp/tasks/default.js'),'gulp/tasks/default.js');33 // this.fs.copyTpl(this.templatePath('gulp/tasks/build.js'),'gulp/tasks/build.js', props);34 // this.fs.copyTpl(this.templatePath('gulp/tasks/watch.js'),'gulp/tasks/watch.js', props);35 this.fs.copyTpl(this.templatePath('gulp/tasks/copy.js'),'gulp/tasks/copy.js', props);36 this.fs.copy(this.templatePath('gulp/tasks/clean.js'),'gulp/tasks/clean.js');37 this.fs.copy(this.templatePath('gulp/tasks/server.js'),'gulp/tasks/server.js');38 39 if(props.preview){40 this.fs.copy(this.templatePath('gulp/tasks/index/index.html'),'gulp/tasks/index/index.html');41 this.fs.copy(this.templatePath('gulp/tasks/list-pages.js'),'gulp/tasks/list-pages.js');42 }43 this.sprites = props.sprites; // or in /templates/src/sass/app.sass use options.sprites44 // compile templates tasks45 switch (props.templates) {46 case 'nunjucks':47 this.fs.copy(this.templatePath('gulp/tasks/nunjucks.js'),'gulp/tasks/nunjucks.js');48 break;49 // case 'swig':50 // this.fs.copy(this.templatePath('gulp/tasks/swig.js'),'gulp/tasks/swig.js');51 // break;52 // case 'jade':53 // this.fs.copy(this.templatePath('gulp/tasks/jade.js'),'gulp/tasks/jade.js');54 // break;55 case 'pug':56 this.fs.copy(this.templatePath('gulp/tasks/pug.js'),'gulp/tasks/pug.js');57 break;58 }59 switch (props.css) {60 case 'sass':61 this.fs.copy(this.templatePath('gulp/tasks/sass.js'),'gulp/tasks/sass.js');62 break;63 case 'postcss':64 this.fs.copy(this.templatePath('gulp/tasks/postcss.js'),'gulp/tasks/postcss.js');65 break;66 }67 // image optimization task68 if (props.imagemin) {69 this.fs.copy(this.templatePath('gulp/tasks/imagemin.js'),'gulp/tasks/imagemin.js');70 }71 this.fs.copy(this.templatePath('gulp/tasks/svgo.js'),'gulp/tasks/svgo.js');72 if (props.svgo) {73 this.fs.copy(this.templatePath('src/img/svgo/facebook.svg'),'src/img/svgo/facebook.svg');74 this.fs.copy(this.templatePath('src/img/svgo'), 'src/img/svgo');75 }76 if (props.sprites.length) {77 this.fs.copy(this.templatePath('src/icons/facebook.png'), 'src/icons/facebook.png');78 this.fs.copy(this.templatePath('src/icons/facebook.svg'), 'src/icons/facebook.svg');79 this.fs.copy(this.templatePath('src/icons/facebook@2x.png'), 'src/icons/facebook@2x.png');80 }81 // iconfont task82 if (props.sprites.indexOf('iconfont') !== -1) {83 this.fs.copy(this.templatePath('gulp/tasks/iconfont/iconfont.js'),'gulp/tasks/iconfont/iconfont.js');84 this.fs.copy(this.templatePath('gulp/tasks/iconfont/iconfont.html'),'gulp/tasks/iconfont/iconfont.html');85 switch (props.css) {86 case 'sass':87 this.fs.copy(this.templatePath('gulp/tasks/iconfont/_iconfont.scss'),'gulp/tasks/iconfont/_iconfont.scss');88 break;89 case 'postcss':90 this.fs.copy(this.templatePath('gulp/tasks/iconfont/_iconfont.sss'),'gulp/tasks/iconfont/_iconfont.sss');91 break;92 }93 }94 // svg sprites task95 this.fs.copyTpl(this.templatePath('gulp/tasks/sprite-svg.js'),'gulp/tasks/sprite-svg.js',props);96 switch (props.css) {97 case 'sass':98 this.fs.copy(this.templatePath('gulp/tasks/sprite-svg/_sprite-svg.scss'),'gulp/tasks/sprite-svg/_sprite-svg.scss');99 break;100 case 'postcss':101 this.fs.copy(this.templatePath('gulp/tasks/sprite-svg/_sprite-svg.sss'),'gulp/tasks/sprite-svg/_sprite-svg.sss');102 break;103 }104 105 // png sprites task106 if (props.sprites.indexOf('png') !== -1) {107 this.fs.copyTpl(this.templatePath('gulp/tasks/sprite-png/sprite-png.js'),'gulp/tasks/sprite-png/sprite-png.js',props);108 switch (props.css) {109 case 'sass':110 this.fs.copyTpl(this.templatePath('gulp/tasks/sprite-png/sprite.template.mustache'),'gulp/tasks/sprite-png/sprite.template.mustache',props);111 break;112 case 'postcss':113 this.fs.copyTpl(this.templatePath('gulp/tasks/sprite-png/sprite.sss.template.mustache'),'gulp/tasks/sprite-png/sprite.sss.template.mustache',props);114 break;115 }116 }117 if(props.preview){118 this.fs.copyTpl(this.templatePath('src/index.yaml'),'src/index.yaml', props);119 }120 121 // copy directories122 // if (props.bundler === 'webpack') {123 this.fs.copy(this.templatePath('src/js/app-webpack.js'), 'src/js/app.js');124 // } else {125 // this.fs.copy(this.templatePath('src/js/app.js'), 'src/js/app.js');126 // this.fs.copy(this.templatePath('src/js/lib'), 'src/js/lib')127 // }128 // if (props.bundler === 'webpack') {129 this.fs.copy(this.templatePath('gulp/tasks/webpack.js'), 'gulp/tasks/webpack.js');130 this.fs.copy(this.templatePath('src/js/lib/sayHello-webpack.js'), 'src/js/lib/sayHello.js');131 this.fs.copy(this.templatePath('src/js/lib/detectTouch-webpack.js'), 'src/js/lib/detectTouch.js');132 this.fs.copy(this.templatePath('webpack.config.js'),'webpack.config.js');133 // }134 // else{135 // this.fs.copy(this.templatePath('gulp/tasks/js.js'), 'gulp/tasks/js.js');136 // this.fs.copy(this.templatePath('src/js/lib/sayHello.js'), 'src/js/lib/sayHello.js');137 // this.fs.copy(this.templatePath('src/js/lib/detectTouch.js'), 'src/js/lib/detectTouch.js');138 // }139 this.fs.copy(this.templatePath('babelrc'), '.babelrc');140 if (props.css === 'sass') {141 // this.directory('src/sass', 'src/sass');142 this.fs.copy(this.templatePath('src/sass'), 'src/sass');143 this.fs.copyTpl(this.templatePath('src/sass/app.sass'), 'src/sass/app.sass',props);144 } else{145 this.fs.copy(this.templatePath('src/postcss'), 'src/sass');146 this.fs.copyTpl(this.templatePath('src/sass/app.sss'), 'src/sass/app.sss',props);147 }148 switch (props.templates) {149 case 'nunjucks':150 this.fs.copy(this.templatePath('src/templates-nunjucks'), 'src/templates');151 if(!props.preview){152 this.fs.delete('src/templates/page.html');153 this.fs.copy(this.templatePath('src/templates-nunjucks/page.html'), 'src/templates/index.html');154 }155 break;156 case 'pug':157 this.fs.copy(this.templatePath('src/templates-pug'), 'src/templates');158 if(!props.preview){159 this.fs.delete('src/templates/page.pug');160 this.fs.copy(this.templatePath('src/templates-pug/page.pug'), 'src/templates/index.pug');161 }162 break;163 case 'swig':164 this.fs.copy(this.templatePath('src/templates-swig'), 'src/templates');165 break;166 case 'jade':167 this.fs.copy(this.templatePath('src/templates-jade'), 'src/templates');168 break;169 case 'html':170 this.fs.copy(this.templatePath('src/templates-html'), 'src');171 break;172 }...
project.js
Source:project.js
...77 'CHANGELOG.md',78 'src/main/resources/liquibase/master.xml',79 ]80 for (const file of files) {81 this.generator.fs.copy(this.generator.templatePath(file), this.generator.destinationPath(file))82 }83 const baseTplPath = 'src/main/java/package'84 const baseDestPath = `src/main/java/${data.groupCases.splitBySlash}/${data.nameCases.splitBySlash}`85 // this.generator.fs.copyTpl(this.generator.templatePath(`${baseTplPath}/exception/_package-info.java`), this.generator.destinationPath(`${baseDestPath}/exception/package-info.java`), data)86 // this.generator.fs.copyTpl(this.generator.templatePath(`${baseTplPath}/model/_package-info.java`), this.generator.destinationPath(`${baseDestPath}/model/package-info.java`), data)87 // this.generator.fs.copyTpl(this.generator.templatePath(`${baseTplPath}/enums/_package-info.java`), this.generator.destinationPath(`${baseDestPath}/enums/package-info.java`), data)88 // this.generator.fs.copyTpl(this.generator.templatePath(`${baseTplPath}/mapper/_package-info.java`), this.generator.destinationPath(`${baseDestPath}/mapper/package-info.java`), data)89 // this.generator.fs.copyTpl(this.generator.templatePath(`${baseTplPath}/service/_package-info.java`), this.generator.destinationPath(`${baseDestPath}/service/package-info.java`), data)90 // this.generator.fs.copyTpl(this.generator.templatePath(`${baseTplPath}/web/rest/_package-info.java`), this.generator.destinationPath(`${baseDestPath}/web/rest/package-info.java`), data)91 // this.generator.fs.copyTpl(this.generator.templatePath(`${baseTplPath}/web/rest/vo/_package-info.java`), this.generator.destinationPath(`${baseDestPath}/web/rest/vo/package-info.java`), data)92 this.generator.fs.copyTpl(this.generator.templatePath('_build.gradle'), this.generator.destinationPath(`build.gradle`), data)93 this.generator.fs.copyTpl(this.generator.templatePath(`_README.md`), this.generator.destinationPath(`README.md`), data)94 this.generator.fs.copyTpl(this.generator.templatePath(`_.gitignore`), this.generator.destinationPath(`.gitignore`), data)95 // this.generator.fs.copyTpl(this.generator.templatePath(`src/main/resources/_logback-spring.xml`), this.generator.destinationPath(`src/main/resources/logback-spring.xml`), data)...
index.js
Source:index.js
...128 }129 // templates130 switch (this.answers.htmlFramework) {131 case 'pug':132 this.fs.copy(133 this.templatePath('email_templates/pug/layouts'),134 this.destinationPath('app/template/layouts')135 );136 this.fs.copy(137 this.templatePath('email_templates/pug/components'),138 this.destinationPath('app/template/components')139 );140 this.fs.copy(141 this.templatePath('email_templates/pug/' + this.answers.emailTemplate + '.pug'),142 this.destinationPath('app/template/index.pug')143 );144 break;145 case 'inky':146 this.fs.copy(147 this.templatePath('email_templates/inky/layouts'),148 this.destinationPath('app/template/layouts')149 );150 this.fs.copy(151 this.templatePath('email_templates/inky/' + this.answers.emailTemplate + '.html'),152 this.destinationPath('app/template/index.html')153 );154 break;155 case 'heml':156 this.fs.copy(157 this.templatePath('email_templates/heml/' + this.answers.emailTemplate + '.heml'),158 this.destinationPath('app/index.heml')159 );160 break;161 default:162 this.fs.copy(163 this.templatePath('email_templates/' + this.answers.emailTemplate + '.html'),164 this.destinationPath('app/index.html')165 );166 }167 // styles168 if (this.answers.htmlFramework !== 'heml') {169 if (this.answers.sass) {170 this.fs.copy(171 this.templatePath('scss'),172 this.destinationPath('app/styles/scss')173 );174 } else {175 this.fs.copy(176 this.templatePath('css/foundation.css'),177 this.destinationPath('app/styles/css/foundation.css')178 );179 this.fs.copy(180 this.templatePath('css/main.css'),181 this.destinationPath('app/styles/css/main.css')182 );183 }184 }185 // extras186 this.fs.copy(187 this.templatePath('gitignore'),188 this.destinationPath('.gitignore')189 );190 this.fs.copy(191 this.templatePath('editorconfig'),192 this.destinationPath('.editorconfig')193 );194 }195 install() {196 this.installDependencies({197 npm: true,198 bower: false,199 yarn: false200 });201 }...
files.js
Source:files.js
...21 this.templatePath('_postcss.config.js'),22 this.destinationPath('postcss.config.js'),23 this24 );25 this.fs.copy(26 this.templatePath('_.gitignore'),27 this.destinationPath('.gitignore')28 );29 this.fs.copy(30 this.templatePath('_.babelrc'),31 this.destinationPath('.babelrc')32 );33 this.fs.copy(34 this.templatePath('_.eslintrc.json'),35 this.destinationPath('.eslintrc.json')36 );37 this.fs.copy(38 this.templatePath('_karma.conf.js'),39 this.destinationPath('karma.conf.js')40 );41 this.fs.copyTpl(42 this.templatePath('_spec.bundle.js'),43 this.destinationPath('spec.bundle.js'),44 this45 );46 this.fs.copy(47 this.templatePath('_protractor.conf.js'),48 this.destinationPath('protractor.conf.js')49 );50 this.fs.copyTpl(51 this.templatePath('_config/**/*'),52 this.destinationPath('config/'),53 this54 );55 this.fs.copy(56 this.templatePath('_src/_favicon.ico'),57 this.destinationPath('src/favicon.ico')58 );59 this.fs.copy(60 this.templatePath('_src/_tpl-index.ejs'),61 this.destinationPath('src/tpl-index.ejs')62 );63 this.fs.copyTpl(64 this.templatePath('_src/_assets/_styles/_sass/_index.scss'),65 this.destinationPath('src/assets/styles/sass/index.scss'),66 this67 );68 this.fs.copy(69 this.templatePath('_src/_assets/_images/**/*'),70 this.destinationPath('src/assets/images')71 );72 this.fs.copyTpl(73 this.templatePath('_src/_app/_index.bootstrap.js'),74 this.destinationPath('src/app/index.bootstrap.js'),75 this76 );77 this.fs.copyTpl(78 this.templatePath('_src/_app/_index.module.js'),79 this.destinationPath('src/app/index.module.js'),80 this81 );82 this.fs.copy(83 this.templatePath('_src/_app/_index.components.js'),84 this.destinationPath('src/app/index.components.js')85 );86 this.fs.copy(87 this.templatePath('_src/_app/_index.config.js'),88 this.destinationPath('src/app/index.config.js')89 );90 this.fs.copyTpl(91 this.templatePath('_src/_app/_index.routes.js'),92 this.destinationPath('src/app/index.routes.js'),93 this94 );95 this.fs.copy(96 this.templatePath('_src/_app/_index.run.js'),97 this.destinationPath('src/app/index.run.js')98 );99 this.fs.copyTpl(100 this.templatePath('_src/_app/_index.vendor.js'),101 this.destinationPath('src/app/index.vendor.js'),102 this103 );104 this.fs.copy(105 this.templatePath('_src/_app/_components/_footer/**/*'),106 this.destinationPath('src/app/components/footer')107 );108 this.fs.copy(109 this.templatePath('_src/_app/_core/core.module.js'),110 this.destinationPath('src/app/core/core.module.js')111 );112 this.fs.copy(113 this.templatePath('_src/_app/_core/_directives/**/*'),114 this.destinationPath('src/app/core/directives')115 );116 this.fs.copyTpl(117 this.templatePath('_src/_app/_core/_services/**/*'),118 this.destinationPath('src/app/core/services'),119 this120 );121 this.fs.copyTpl(122 this.templatePath('_src/_app/_pages/main/**/*'),123 this.destinationPath('src/app/pages/main'),124 this125 );126 this.fs.copyTpl(127 this.templatePath('_e2e/**/*'),128 this.destinationPath('e2e'),129 this130 );131 if (this.props.ocLazyLoad) {132 this.fs.copy(133 this.templatePath('_src/_app/_pages/async-page-example/**/*'),134 this.destinationPath('src/app/pages/async-page-example')135 );136 }137 };...
build.js
Source:build.js
...23 if (result_es8.emitSkipped) {24 throw new Error(result_es8.diagnostics[0].messageText);25 }26 // Copy non-ts resources27 await fs.copy('src/aes/aes.asm.js', 'dist_es5/aes/aes.asm.js');28 await fs.copy('src/aes/aes.asm.d.ts', 'dist_es5/aes/aes.asm.d.ts');29 await fs.copy('src/aes/aes.asm.js', 'dist_es8/aes/aes.asm.js');30 await fs.copy('src/aes/aes.asm.d.ts', 'dist_es8/aes/aes.asm.d.ts');31 await fs.copy('src/bignum/bigint.asm.js', 'dist_es5/bignum/bigint.asm.js');32 await fs.copy('src/bignum/bigint.asm.d.ts', 'dist_es5/bignum/bigint.asm.d.ts');33 await fs.copy('src/bignum/bigint.asm.js', 'dist_es8/bignum/bigint.asm.js');34 await fs.copy('src/bignum/bigint.asm.d.ts', 'dist_es8/bignum/bigint.asm.d.ts');35 await fs.copy('src/hash/sha1/sha1.asm.js', 'dist_es5/hash/sha1/sha1.asm.js');36 await fs.copy('src/hash/sha1/sha1.asm.d.ts', 'dist_es5/hash/sha1/sha1.asm.d.ts');37 await fs.copy('src/hash/sha1/sha1.asm.js', 'dist_es8/hash/sha1/sha1.asm.js');38 await fs.copy('src/hash/sha1/sha1.asm.d.ts', 'dist_es8/hash/sha1/sha1.asm.d.ts');39 await fs.copy('src/hash/sha256/sha256.asm.js', 'dist_es5/hash/sha256/sha256.asm.js');40 await fs.copy('src/hash/sha256/sha256.asm.d.ts', 'dist_es5/hash/sha256/sha256.asm.d.ts');41 await fs.copy('src/hash/sha256/sha256.asm.js', 'dist_es8/hash/sha256/sha256.asm.js');42 await fs.copy('src/hash/sha256/sha256.asm.d.ts', 'dist_es8/hash/sha256/sha256.asm.d.ts');43 await fs.copy('src/hash/sha512/sha512.asm.js', 'dist_es5/hash/sha512/sha512.asm.js');44 await fs.copy('src/hash/sha512/sha512.asm.d.ts', 'dist_es5/hash/sha512/sha512.asm.d.ts');45 await fs.copy('src/hash/sha512/sha512.asm.js', 'dist_es8/hash/sha512/sha512.asm.js');46 await fs.copy('src/hash/sha512/sha512.asm.d.ts', 'dist_es8/hash/sha512/sha512.asm.d.ts');47 const es5bundle = await rollup.rollup({48 input: 'dist_es5/entry-export_all.js',49 onwarn(warning, warn) {50 if (warning.code === 'THIS_IS_UNDEFINED') return;51 warn(warning); // this requires Rollup 0.4652 },53 });54 // Legacy browser export, as a bundle55 await es5bundle.write({56 file: 'asmcrypto.all.es5.js',57 format: 'iife',58 name: 'asmCrypto',59 });60 // Legacy browser export, as a bundle...
Using AI Code Generation
1describe('File Upload', () => {2 it('Upload file', () => {3 cy.get('input[type="file"]').attachFile('test.js')4 cy.get('input[type="submit"]').click()5 })6})
Using AI Code Generation
1Cypress.Commands.add('copyFile', (source, destination) => {2 return cy.task('copyFile', {3 })4})5Cypress.Commands.add('moveFile', (source, destination) => {6 return cy.task('moveFile', {7 })8})9Cypress.Commands.add('removeFile', (destination) => {10 return cy.task('removeFile', {11 })12})13Cypress.Commands.add('removeFolder', (destination) => {14 return cy.task('removeFolder', {15 })16})17Cypress.Commands.add('readJson', (destination) => {18 return cy.task('readJson', {19 })20})21Cypress.Commands.add('writeJson', (destination, data) => {22 return cy.task('writeJson', {23 })24})25Cypress.Commands.add('readYaml', (destination) => {26 return cy.task('readYaml', {27 })28})29Cypress.Commands.add('writeYaml', (destination, data) => {30 return cy.task('writeYaml', {
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!