mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
Merge branch 'master' into v4
# Conflicts: # README.md # package.json # src/components/action-sheet/action-sheet-component.ts # src/components/badge/badge.scss # src/components/card/card.ios.scss # src/components/card/card.md.scss # src/components/card/card.wp.scss # src/components/scroll/scroll.scss # src/components/scroll/scroll.ts # src/components/scroll/test/basic/main.html # src/components/slides/slides.scss # src/components/slides/swiper/swiper-effects.ts # src/components/slides/swiper/swiper-events.ts # src/components/slides/swiper/swiper-parallax.ts # src/components/slides/swiper/swiper.ts # src/components/toggle/test/toggle.spec.ts # src/components/toggle/toggle-gesture.ts # src/components/toggle/toggle.ios.scss # src/components/toggle/toggle.md.scss # src/components/toggle/toggle.ts # src/components/toggle/toggle.wp.scss # src/themes/ionic.mixins.scss
This commit is contained in:
@ -4,6 +4,7 @@ import * as glob from 'glob';
|
||||
import { task } from 'gulp';
|
||||
import * as del from 'del';
|
||||
import * as runSequence from 'run-sequence';
|
||||
import * as s3 from 's3';
|
||||
import { argv } from 'yargs';
|
||||
|
||||
|
||||
@ -12,6 +13,9 @@ import { createTempTsConfig, getFolderInfo, runAppScriptsBuild, writePolyfills }
|
||||
|
||||
import * as pAll from 'p-all';
|
||||
|
||||
import * as dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
|
||||
task('demos.prepare', (done: Function) => {
|
||||
runSequence('demos.clean', 'demos.polyfill', 'demos.sass', (err: any) => done(err));
|
||||
});
|
||||
@ -95,9 +99,19 @@ function buildDemo(filePath: string) {
|
||||
const appNgModulePath = join(dirname(filePath), 'app.module.ts');
|
||||
const distDir = join(distTestRoot, 'www');
|
||||
|
||||
return runAppScriptsBuild(appEntryPoint, appNgModulePath, ionicAngularDir, distDir, pathToWriteFile, ionicAngularDir, sassConfigPath, copyConfigPath).then(() => {
|
||||
return runAppScriptsBuild(
|
||||
appEntryPoint,
|
||||
appNgModulePath,
|
||||
ionicAngularDir,
|
||||
distDir,
|
||||
pathToWriteFile,
|
||||
ionicAngularDir,
|
||||
sassConfigPath,
|
||||
copyConfigPath
|
||||
).then(() => {
|
||||
const end = Date.now();
|
||||
console.log(`${filePath} took a total of ${(end - start) / 1000} seconds to build`);
|
||||
uploadToS3(pathToWriteFile);
|
||||
});
|
||||
}
|
||||
|
||||
@ -112,6 +126,78 @@ function chunkArrayInGroups(arr, size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function uploadToS3(path) {
|
||||
// fail silently if envars not present
|
||||
if (!process.env.AWS_KEY || !process.env.AWS_SECRET) {
|
||||
return new Promise((resolve) => {resolve();});
|
||||
}
|
||||
|
||||
let client = s3.createClient({
|
||||
s3Options: {
|
||||
accessKeyId: process.env.AWS_KEY,
|
||||
secretAccessKey: process.env.AWS_SECRET
|
||||
},
|
||||
});
|
||||
|
||||
// get demo name from path
|
||||
let demo = path.split('/')[path.split('/').length - 2];
|
||||
|
||||
let params = {
|
||||
localDir: path.replace('tsconfig.json',''),
|
||||
deleteRemoved: true,
|
||||
s3Params: {
|
||||
Bucket: "ionic-demos",
|
||||
Prefix: demo,
|
||||
},
|
||||
};
|
||||
|
||||
var uploader = client.uploadDir(params);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uploader.on('error', function(err) {
|
||||
console.error("s3 Upload Error:", err.stack);
|
||||
reject();
|
||||
});
|
||||
uploader.on('end', function() {
|
||||
console.log(demo, " demo uploaded to s3");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
task('demos.download', (done: Function) => {
|
||||
if (!process.env.AWS_KEY || !process.env.AWS_SECRET) {
|
||||
return new Promise((resolve) => {resolve();});
|
||||
}
|
||||
|
||||
let client = s3.createClient({
|
||||
s3Options: {
|
||||
accessKeyId: process.env.AWS_KEY,
|
||||
secretAccessKey: process.env.AWS_SECRET
|
||||
},
|
||||
});
|
||||
|
||||
let params = {
|
||||
localDir: join(process.cwd(), 'dist', 'demos', 'src'),
|
||||
s3Params: {
|
||||
Bucket: "ionic-demos",
|
||||
},
|
||||
};
|
||||
|
||||
let uploader = client.downloadDir(params);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uploader.on('error', function(err) {
|
||||
console.error("s3 Download Error:", err.stack);
|
||||
reject();
|
||||
});
|
||||
uploader.on('end', function() {
|
||||
console.log("Demos downloaded from s3");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
task('demos.clean', (done: Function) => {
|
||||
// this is a super hack, but it works for now
|
||||
if (argv.skipClean) {
|
||||
|
@ -17,7 +17,8 @@ task('lint.sass', function() {
|
||||
return src([
|
||||
'src/**/*.scss',
|
||||
'!src/components/*/test/**/*',
|
||||
'!src/util/test/*'
|
||||
'!src/util/test/*',
|
||||
'!src/themes/normalize.scss',
|
||||
])
|
||||
.pipe(scsslint())
|
||||
.pipe(scsslint.failReporter());
|
||||
|
Reference in New Issue
Block a user