mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
snapshat
This commit is contained in:
64
gulpfile.js
64
gulpfile.js
@ -78,6 +78,7 @@ gulp.task('watch', function() {
|
|||||||
|
|
||||||
gulp.task('serve', function() {
|
gulp.task('serve', function() {
|
||||||
connect.server({
|
connect.server({
|
||||||
|
root: 'dist',
|
||||||
port: 8000,
|
port: 8000,
|
||||||
livereload: false
|
livereload: false
|
||||||
});
|
});
|
||||||
@ -95,11 +96,6 @@ var traceurOptions = {
|
|||||||
|
|
||||||
var babelOptions = {
|
var babelOptions = {
|
||||||
optional: ['es7.decorators'],
|
optional: ['es7.decorators'],
|
||||||
/*plugins: [
|
|
||||||
'./transformers/disable-define',
|
|
||||||
'angular2-annotations',
|
|
||||||
'type-assertion:after'
|
|
||||||
],*/
|
|
||||||
modules: "system",
|
modules: "system",
|
||||||
moduleIds: true,
|
moduleIds: true,
|
||||||
getModuleId: function(name) {
|
getModuleId: function(name) {
|
||||||
@ -109,29 +105,19 @@ var babelOptions = {
|
|||||||
|
|
||||||
var exampleBabelOptions = {
|
var exampleBabelOptions = {
|
||||||
optional: ['es7.decorators'],
|
optional: ['es7.decorators'],
|
||||||
/*plugins: [
|
|
||||||
'./transformers/disable-define',
|
|
||||||
'angular2-annotations',
|
|
||||||
'type-assertion:after'
|
|
||||||
],*/
|
|
||||||
modules: "system",
|
modules: "system",
|
||||||
moduleIds: true,
|
moduleIds: true,
|
||||||
getModuleId: function(name) {
|
getModuleId: function(name) {
|
||||||
return "dist/examples/" + name.split('/test').join('');
|
return "examples/" + name.split('/test').join('');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var testBabelOptions = {
|
var testBabelOptions = {
|
||||||
optional: ['es7.decorators'],
|
optional: ['es7.decorators'],
|
||||||
/*plugins: [
|
|
||||||
'./transformers/disable-define',
|
|
||||||
'angular2-annotations',
|
|
||||||
'type-assertion:after'
|
|
||||||
],*/
|
|
||||||
modules: "system",
|
modules: "system",
|
||||||
moduleIds: true,
|
moduleIds: true,
|
||||||
getModuleId: function(name) {
|
getModuleId: function(name) {
|
||||||
return "dist/tests/" + name.split('/test').join('');
|
return "tests/" + name.split('/test').join('');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,11 +147,6 @@ gulp.task('transpile', function() {
|
|||||||
.on('error', function(error) {
|
.on('error', function(error) {
|
||||||
stream.emit('end');
|
stream.emit('end');
|
||||||
})
|
})
|
||||||
// .pipe(traceur(traceurOptions))
|
|
||||||
// .on('error', function (err) {
|
|
||||||
// console.log("ERROR: " + err.message);
|
|
||||||
// this.emit('end');
|
|
||||||
// })
|
|
||||||
.pipe(gulp.dest('dist/js/es6/ionic'))
|
.pipe(gulp.dest('dist/js/es6/ionic'))
|
||||||
.pipe(babel(babelOptions))
|
.pipe(babel(babelOptions))
|
||||||
.on('error', function (err) {
|
.on('error', function (err) {
|
||||||
@ -183,24 +164,6 @@ gulp.task('bundle.js', function() {
|
|||||||
.pipe(gulp.dest('dist/js/'));
|
.pipe(gulp.dest('dist/js/'));
|
||||||
});
|
});
|
||||||
|
|
||||||
//gulp.task('bundle.deps', function() {
|
|
||||||
// var Builder = require('systemjs-builder')
|
|
||||||
// var builder = new Builder();
|
|
||||||
// return builder.loadConfig('config.js').then(function(){
|
|
||||||
// // add ionic and angular2 build paths, since config.js is loaded at runtime from
|
|
||||||
// // tests we don't want to put them there
|
|
||||||
// builder.config({
|
|
||||||
// baseURL: 'file:' + process.cwd(),
|
|
||||||
// paths : {
|
|
||||||
// "ionic/*": "dist/js/es6/ionic/*.js"
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// return builder.build('dist/js/es6/ionic/**/* - [dist/js/es6/ionic/**/*]', 'dist/js/dependencies.js');
|
|
||||||
// }, function(error){
|
|
||||||
// console.log("Error building dependency bundle, have you transpiled Ionic and/or built Angular2 yet?");
|
|
||||||
// throw new Error(error);
|
|
||||||
// })
|
|
||||||
//});
|
|
||||||
gulp.task('tests', function() {
|
gulp.task('tests', function() {
|
||||||
return gulp.src('ionic/components/*/test/*/**/*.spec.ts')
|
return gulp.src('ionic/components/*/test/*/**/*.spec.ts')
|
||||||
.pipe(tsc(tscOptions, null, tscReporter))
|
.pipe(tsc(tscOptions, null, tscReporter))
|
||||||
@ -214,7 +177,6 @@ gulp.task('tests', function() {
|
|||||||
|
|
||||||
gulp.task('examples', function() {
|
gulp.task('examples', function() {
|
||||||
var buildTest = lazypipe()
|
var buildTest = lazypipe()
|
||||||
//.pipe(traceur, traceurOptions)
|
|
||||||
.pipe(tsc, tscOptions, null, tscReporter)
|
.pipe(tsc, tscOptions, null, tscReporter)
|
||||||
.pipe(babel, exampleBabelOptions)
|
.pipe(babel, exampleBabelOptions)
|
||||||
|
|
||||||
@ -234,7 +196,7 @@ gulp.task('examples', function() {
|
|||||||
|
|
||||||
function createIndexHTML() {
|
function createIndexHTML() {
|
||||||
var template = _.template(
|
var template = _.template(
|
||||||
fs.readFileSync('scripts/e2e/ionic.template.html')
|
fs.readFileSync('scripts/e2e/example.template.html')
|
||||||
)({
|
)({
|
||||||
buildConfig: buildConfig
|
buildConfig: buildConfig
|
||||||
});
|
});
|
||||||
@ -244,7 +206,7 @@ gulp.task('examples', function() {
|
|||||||
|
|
||||||
var module = path.dirname(file.path)
|
var module = path.dirname(file.path)
|
||||||
.replace(__dirname, '')
|
.replace(__dirname, '')
|
||||||
.replace('/ionic/components/', 'dist/examples/')
|
.replace('/ionic/components/', 'examples/')
|
||||||
.replace('/test/', '/') +
|
.replace('/test/', '/') +
|
||||||
'/index';
|
'/index';
|
||||||
|
|
||||||
@ -265,23 +227,29 @@ var e2eBabelOptions = {
|
|||||||
modules: "system",
|
modules: "system",
|
||||||
moduleIds: true,
|
moduleIds: true,
|
||||||
getModuleId: function(name) {
|
getModuleId: function(name) {
|
||||||
return "dist/e2e/" + name.split('/test').join('');
|
return "e2e/" + name.split('/test').join('');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('e2e', function() {
|
gulp.task('copy-scripts', function(){
|
||||||
|
gulp.src(['scripts/resources/*.js', 'config.js', 'dist/js/ionic.bundle.js',
|
||||||
|
'dist/vendor/web-animations-js/web-animations.min.js'])
|
||||||
|
.pipe(gulp.dest('dist/lib'));
|
||||||
|
})
|
||||||
|
|
||||||
|
gulp.task('e2e', ['copy-scripts'], function() {
|
||||||
var buildTest = lazypipe()
|
var buildTest = lazypipe()
|
||||||
//.pipe(traceur, traceurOptions)
|
//.pipe(traceur, traceurOptions)
|
||||||
.pipe(tsc, tscOptions, null, tscReporter)
|
.pipe(tsc, tscOptions, null, tscReporter)
|
||||||
.pipe(babel, e2eBabelOptions)
|
.pipe(babel, e2eBabelOptions)
|
||||||
|
|
||||||
var buildE2ETest = lazypipe()
|
var buildE2ETest = lazypipe()
|
||||||
//.pipe(traceur, traceurOptions)
|
//.pipe(traceur, traceurOptions)
|
||||||
.pipe(tsc, tscOptions, null, tscReporter)
|
.pipe(tsc, tscOptions, null, tscReporter)
|
||||||
.pipe(babel)
|
.pipe(babel)
|
||||||
|
|
||||||
var indexTemplate = _.template(
|
var indexTemplate = _.template(
|
||||||
fs.readFileSync('scripts/e2e/ionic.template.html')
|
fs.readFileSync('scripts/e2e/e2e.template.html')
|
||||||
)({
|
)({
|
||||||
buildConfig: buildConfig
|
buildConfig: buildConfig
|
||||||
|
|
||||||
@ -316,7 +284,7 @@ gulp.task('e2e', function() {
|
|||||||
|
|
||||||
var module = path.dirname(file.path)
|
var module = path.dirname(file.path)
|
||||||
.replace(__dirname, '')
|
.replace(__dirname, '')
|
||||||
.replace('/ionic/components/', 'dist/e2e/')
|
.replace('/ionic/components/', 'e2e/')
|
||||||
.replace('/test/', '/') +
|
.replace('/test/', '/') +
|
||||||
'/index';
|
'/index';
|
||||||
|
|
||||||
|
@ -79,4 +79,3 @@ module.exports = function(options) {
|
|||||||
console.log('Uploading e2e tests:', options.testId);
|
console.log('Uploading e2e tests:', options.testId);
|
||||||
uploadFiles(inputDir, '');
|
uploadFiles(inputDir, '');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
62
scripts/e2e/e2e.template.html
Normal file
62
scripts/e2e/e2e.template.html
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<!-- https://www.chromium.org/developers/design-documents/chromium-graphics/how-to-get-gpu-rasterization -->
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
|
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
|
||||||
|
|
||||||
|
<link href="../../../css/ionic.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* hack to create tall scrollable areas for testing using <f></f> */
|
||||||
|
f {
|
||||||
|
display: block;
|
||||||
|
margin: 15px auto;
|
||||||
|
max-width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
background: blue;
|
||||||
|
}
|
||||||
|
f:last-of-type {
|
||||||
|
background: red;
|
||||||
|
}
|
||||||
|
ion-tab:nth-of-type(2) f,
|
||||||
|
.green f {
|
||||||
|
background: green;
|
||||||
|
max-width: 250px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
ion-tab:nth-of-type(3) f,
|
||||||
|
.yellow f {
|
||||||
|
background: yellow;
|
||||||
|
width: 100px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<ion-app module="{{MODULE}}">
|
||||||
|
<ion-loading-icon></ion-loading-icon>
|
||||||
|
</ion-app>
|
||||||
|
|
||||||
|
<!-- SystemJS Loader -->
|
||||||
|
<script src="../../../lib/traceur-runtime.js"></script>
|
||||||
|
<script src="../../../lib/system.js"></script>
|
||||||
|
<script src="../../../lib/config.js"></script>
|
||||||
|
|
||||||
|
<!-- Angular bundle -->
|
||||||
|
<script src="../../../lib/angular2.dev.js"></script>
|
||||||
|
|
||||||
|
<!-- test module -->
|
||||||
|
<script src="index.js"></script>
|
||||||
|
|
||||||
|
<!-- ionic bundle -->
|
||||||
|
<script src="../../../lib/ionic.bundle.js"></script>
|
||||||
|
|
||||||
|
<!-- web animations polyfill for non-chrome browsers -->
|
||||||
|
<script src="../../../lib/web-animations.min.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -6,8 +6,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
|
||||||
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
|
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
|
||||||
|
|
||||||
<link href="/dist/css/ionic.css" rel="stylesheet">
|
<link href="/css/ionic.css" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* hack to create tall scrollable areas for testing using <f></f> */
|
/* hack to create tall scrollable areas for testing using <f></f> */
|
||||||
@ -42,18 +42,18 @@
|
|||||||
</ion-app>
|
</ion-app>
|
||||||
|
|
||||||
<!-- SystemJS Loader -->
|
<!-- SystemJS Loader -->
|
||||||
<script src="/scripts/resources/traceur-runtime.js"></script>
|
<script src="/lib/traceur-runtime.js"></script>
|
||||||
<script src="/scripts/resources/system.js"></script>
|
<script src="/lib/system.js"></script>
|
||||||
<script src="/config.js"></script>
|
<script src="/lib/config.js"></script>
|
||||||
|
|
||||||
<!-- Angular bundle -->
|
<!-- Angular bundle -->
|
||||||
<script src="/scripts/resources/angular2.dev.js"></script>
|
<script src="/lib/angular2.dev.js"></script>
|
||||||
|
|
||||||
<!-- ionic bundle -->
|
<!-- ionic bundle -->
|
||||||
<script src="/dist/js/ionic.bundle.js"></script>
|
<script src="/lib/ionic.bundle.js"></script>
|
||||||
|
|
||||||
<!-- web animations polyfill for non-chrome browsers -->
|
<!-- web animations polyfill for non-chrome browsers -->
|
||||||
<script src="/dist/vendor/web-animations-js/web-animations.min.js"></script>
|
<script src="/lib/web-animations.min.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -20,7 +20,7 @@ module.exports = function(gulp, argv, buildConfig) {
|
|||||||
console.log('Serving `dist` on http://localhost:' + buildConfig.protractorPort);
|
console.log('Serving `dist` on http://localhost:' + buildConfig.protractorPort);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('snapshot', ['build', 'protractor-server'], function(done) {
|
gulp.task('snapshot', [/*'build',*/ 'protractor-server'], function(done) {
|
||||||
var protractorConfigFile = path.resolve(projectRoot, 'scripts/snapshot/protractor.config.js');
|
var protractorConfigFile = path.resolve(projectRoot, 'scripts/snapshot/protractor.config.js');
|
||||||
snapshot(done, protractorConfigFile);
|
snapshot(done, protractorConfigFile);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user