From 59f97e780dc32b8fa68c4988f30cf515b71c48e2 Mon Sep 17 00:00:00 2001 From: Dan Bucholtz Date: Fri, 15 Sep 2017 15:41:41 -0500 Subject: [PATCH] chore(demos): remove unused gulp tasks (I hope) --- scripts/gulp/tasks/demos.prod.ts | 52 ++++++++++++++++---------------- scripts/gulp/tasks/demos.ts | 24 --------------- 2 files changed, 26 insertions(+), 50 deletions(-) diff --git a/scripts/gulp/tasks/demos.prod.ts b/scripts/gulp/tasks/demos.prod.ts index 308c5d0fea..19ce2622ea 100644 --- a/scripts/gulp/tasks/demos.prod.ts +++ b/scripts/gulp/tasks/demos.prod.ts @@ -59,9 +59,9 @@ function getDemosEntryPoints() { function buildDemos(filePaths: string[]) { - var batches = chunkArrayInGroups(filePaths, argv.batches || 1); - var batch = argv.batch || 0; - if(batch >= batches.length) { + const batches = chunkArrayInGroups(filePaths, argv.batches || 1); + const batch = argv.batch || 0; + if (batch >= batches.length) { throw new Error(`Batch number higher than total number of batches.`); } @@ -100,13 +100,13 @@ function buildDemo(filePath: string) { const distDir = join(distTestRoot, 'www'); return runAppScriptsBuild( - appEntryPoint, - appNgModulePath, - ionicAngularDir, - distDir, - pathToWriteFile, - ionicAngularDir, - sassConfigPath, + appEntryPoint, + appNgModulePath, + ionicAngularDir, + distDir, + pathToWriteFile, + ionicAngularDir, + sassConfigPath, copyConfigPath ).then(() => { const end = Date.now(); @@ -116,8 +116,8 @@ function buildDemo(filePath: string) { } function chunkArrayInGroups(arr, size) { - var result = []; - for(var i = 0; i < arr.length; i++) { + const result = []; + for (let i = 0; i < arr.length; i++) { if (!Array.isArray(result[i % size])) { result[i % size] = []; } @@ -129,7 +129,7 @@ function chunkArrayInGroups(arr, size) { function uploadToS3(path) { // fail silently if envars not present if (!process.env.AWS_KEY || !process.env.AWS_SECRET) { - return new Promise((resolve) => {resolve();}); + return Promise.resolve(); } let client = s3.createClient({ @@ -143,23 +143,23 @@ function uploadToS3(path) { let demo = path.split('/')[path.split('/').length - 2]; let params = { - localDir: path.replace('tsconfig.json',''), - deleteRemoved: true, + localDir: path.replace('tsconfig.json', ''), + deleteRemoved: true, s3Params: { - Bucket: "ionic-demos", + Bucket: 'ionic-demos', Prefix: demo, }, }; - var uploader = client.uploadDir(params); + const uploader = client.uploadDir(params); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { uploader.on('error', function(err) { - console.error("s3 Upload Error:", err.stack); + console.error('s3 Upload Error:', err.stack); reject(); }); uploader.on('end', function() { - console.log(demo, " demo uploaded to s3"); + console.log(demo, ' demo uploaded to s3'); resolve(); }); }); @@ -167,7 +167,7 @@ function uploadToS3(path) { task('demos.download', (done: Function) => { if (!process.env.AWS_KEY || !process.env.AWS_SECRET) { - return new Promise((resolve) => {resolve();}); + return Promise.resolve(); } let client = s3.createClient({ @@ -180,23 +180,23 @@ task('demos.download', (done: Function) => { let params = { localDir: join(process.cwd(), 'dist', 'demos', 'src'), s3Params: { - Bucket: "ionic-demos", + Bucket: 'ionic-demos', }, }; let uploader = client.downloadDir(params); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { uploader.on('error', function(err) { - console.error("s3 Download Error:", err.stack); + console.error('s3 Download Error:', err.stack); reject(); }); uploader.on('end', function() { - console.log("Demos downloaded from s3"); + console.log('Demos downloaded from s3'); resolve(); }); }); -}) +}); task('demos.clean', (done: Function) => { // this is a super hack, but it works for now diff --git a/scripts/gulp/tasks/demos.ts b/scripts/gulp/tasks/demos.ts index 3fd7fd93c0..b3ccbb3905 100644 --- a/scripts/gulp/tasks/demos.ts +++ b/scripts/gulp/tasks/demos.ts @@ -22,34 +22,10 @@ task('demos.polyfill', (done: Function) => { }); }); -task('demos.copyAndCompile', (done: (err: any) => void) => { - runSequence( - 'demos.copySource', - 'demos.compileTests', - 'demos.bundle', - done); -}); - -task('demos.copyExternalDependencies', () => { - src([`${SCRIPTS_ROOT}/${DEMOS_NAME}/*.css`]).pipe(dest(`${DIST_DEMOS_ROOT}/css`)); -}); - task('demos.sass', () => { // ensure there is a version.scss file setSassIonicVersion(`E2E-${createTimestamp()}`); return compileSass(`${DIST_DEMOS_ROOT}/css`); }); -task('demos.fonts', () => { - return copyFonts(`${DIST_DEMOS_ROOT}/fonts`); -}); -task('demos.serve', function() { - connect.server({ - root: './', - port: LOCAL_SERVER_PORT, - livereload: { - port: 35700 - } - }); -}); \ No newline at end of file