mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
wip
This commit is contained in:
74
gulpfile.js
74
gulpfile.js
@ -17,6 +17,10 @@ var through2 = require('through2');
|
||||
var runSequence = require('run-sequence');
|
||||
var watch = require('gulp-watch');
|
||||
var exec = require('child_process').exec;
|
||||
var babel = require('gulp-babel');
|
||||
var webpack = require('gulp-webpack');
|
||||
var lazypipe = require('lazypipe');
|
||||
|
||||
|
||||
|
||||
gulp.task('build', function() {
|
||||
@ -75,30 +79,79 @@ function doubleCheckDistFiles() {
|
||||
}
|
||||
|
||||
gulp.task('clean', function(done) {
|
||||
del(['../angular-ionic/modules/ionic, ./angular-ionic/modules/examples/src/ionic'], done);
|
||||
del(['../angular-ionic/modules/ionic, ./angular-ionic/modules/examples/src/ionic, dist/'], done);
|
||||
});
|
||||
|
||||
|
||||
gulp.task('ionic.copy.js', function(done) {
|
||||
gulp.task('ionic.transpile.js', function(done) {
|
||||
return gulp.src(['ionic/**/*.js', '!ionic/components/*/test/**/*'])
|
||||
.pipe(gulp.dest('../angular-ionic/modules/ionic'));
|
||||
.pipe(babel(babelOptions))
|
||||
//.pipe(concat('ionic.bundle.js'))
|
||||
.pipe(gulp.dest('dist/js/'));
|
||||
});
|
||||
|
||||
//gulp.task('ionic.copy.js', function(done) {
|
||||
// return gulp.src(['ionic/**/*.js', '!ionic/components/*/test/**/*'])
|
||||
// .pipe(gulp.dest('../angular-ionic/modules/ionic'));
|
||||
//});
|
||||
var babelOptions = {
|
||||
optional: ['es7.decorators'],
|
||||
plugins: [
|
||||
'./transformers/disable-define',
|
||||
'angular2-annotations',
|
||||
'type-assertion:after'
|
||||
]
|
||||
};
|
||||
|
||||
var webpackOptions = {
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.es6$/,
|
||||
loader: "babel-loader?" + JSON.stringify(babelOptions)
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: "babel-loader?" + JSON.stringify(babelOptions)
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'angular2': 'angular2/es6/dev',
|
||||
'rtts_assert': 'rtts_assert/es6'
|
||||
},
|
||||
modulesDirectories: [
|
||||
'ionic2',
|
||||
'node_modules'
|
||||
],
|
||||
extensions: ['', '.js', '.es6']
|
||||
},
|
||||
debug: true
|
||||
}
|
||||
|
||||
|
||||
gulp.task('ionic.examples', function() {
|
||||
var indexContents = _.template( fs.readFileSync('scripts/e2e/angular.template.html') )({
|
||||
buildConfig: buildConfig
|
||||
});
|
||||
var buildTest = lazypipe()
|
||||
//.pipe(babel, babelOptions)
|
||||
.pipe(webpack, webpackOptions)
|
||||
.pipe(createIndexHTML);
|
||||
|
||||
// Get each test folder with gulp.src
|
||||
return gulp.src('ionic/components/*/test/*/**/*')
|
||||
.pipe(gulpif(/index.js$/, buildTest()))
|
||||
.pipe(rename(function(file) {
|
||||
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
|
||||
}))
|
||||
.pipe(gulpif(/index.js$/, processMain()))
|
||||
.pipe(gulp.dest('../angular-ionic/modules/examples/src/ionic'))
|
||||
.pipe(gulp.dest('dist/examples/'))
|
||||
|
||||
function createIndexHTML() {
|
||||
var indexContents = _.template(
|
||||
fs.readFileSync('scripts/e2e/ionic.template.html')
|
||||
)({
|
||||
buildConfig: buildConfig
|
||||
});
|
||||
|
||||
function processMain() {
|
||||
return through2.obj(function(file, enc, next) {
|
||||
var self = this;
|
||||
self.push(new VinylFile({
|
||||
@ -109,7 +162,6 @@ gulp.task('ionic.examples', function() {
|
||||
next(null, file);
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
12
package.json
12
package.json
@ -2,6 +2,10 @@
|
||||
"name": "ionic2",
|
||||
"version": "0.0.0",
|
||||
"devDependencies": {
|
||||
"babel-core": "^5.0.0",
|
||||
"babel-loader": "^5.1.3",
|
||||
"babel-plugin-angular2-annotations": "^1.1.0",
|
||||
"babel-plugin-type-assertion": "^0.2.1",
|
||||
"canonical-path": "0.0.2",
|
||||
"connect": "^3.3.4",
|
||||
"del": "~1.1.1",
|
||||
@ -19,11 +23,14 @@
|
||||
"gulp-shell": "^0.4.0",
|
||||
"gulp-traceur": "^0.17.1",
|
||||
"gulp-watch": "^4.2.4",
|
||||
"gulp-webpack": "^1.4.0",
|
||||
"gulp-wrap": "^0.11.0",
|
||||
"karma": "^0.12.31",
|
||||
"karma-chrome-launcher": "^0.1.7",
|
||||
"karma-jasmine": "^0.3.5",
|
||||
"lazypipe": "^0.2.3",
|
||||
"lodash": "^2.4.1",
|
||||
"node-libs-browser": "^0.5.2",
|
||||
"node-uuid": "^1.4.1",
|
||||
"run-sequence": "^1.1.0",
|
||||
"serve-static": "^1.9.2",
|
||||
@ -33,13 +40,14 @@
|
||||
"through2": "^0.6.3",
|
||||
"traceur-runtime": "0.0.59",
|
||||
"vinyl": "^0.4.6",
|
||||
"webpack": "^1.9.10",
|
||||
"yargs": "^3.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"angular2": "2.0.0-alpha.21",
|
||||
"angular2": "2.0.0-alpha.25",
|
||||
"es6-module-loader": "^0.16.5",
|
||||
"hammerjs": "^2.0.4",
|
||||
"rtts_assert": "^2.0.0-alpha.20",
|
||||
"rtts_assert": "^2.0.0-alpha.25",
|
||||
"rx": "^2.4.6",
|
||||
"systemjs": "^0.16.8",
|
||||
"traceur": "0.0.87",
|
||||
|
39
scripts/e2e/ionic.template.html
Normal file
39
scripts/e2e/ionic.template.html
Normal file
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||
<link href="/css/ionic.css" rel="stylesheet">
|
||||
<!--
|
||||
<script src="/../../../node_modules/angular2/node_modules/zone.js/dist/zone.js"></script>
|
||||
<script src="/../../../node_modules/reflect-metadata/Reflect.js"></script>
|
||||
<script src="/../../../system.js"></script>
|
||||
<script src="/../../../angular2.js"></script>
|
||||
<script src="https://jspm.io/system@0.16.js"></script>
|
||||
-->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<ion-app>
|
||||
Loading...
|
||||
</ion-app>
|
||||
|
||||
<!-- web animations polyfill for non-chrome browsers
|
||||
<script src="/../../polyfills/web-animations.min.js"></script> -->
|
||||
<script src="zone-microtask.js" type="text/javascript"></script>
|
||||
<script src="long-stack-trace-zone.js" type="text/javascript"></script>
|
||||
<!-- <script src="traceur-runtime.js" type="text/javascript"></script>
|
||||
<script src="system.src.js" type="text/javascript"></script>
|
||||
<script src="extension-register.js" type="text/javascript"></script>
|
||||
<script src="extension-cjs.js" type="text/javascript"></script>
|
||||
<script src="runtime_paths.js" type="text/javascript"></script> -->
|
||||
<script src="traceur-runtime.js" type="text/javascript"></script>
|
||||
<script src="babel-external-helpers.js" type="text/javascript"></script>
|
||||
<!-- <script src="system.src.js"></script> -->
|
||||
<script src="Reflect.js" type="text/javascript"></script>
|
||||
<!-- <script src="../../../js/ionic.bundle.js"></script> -->
|
||||
<script src="../../../../bundle.js"></script>
|
||||
<!-- <script type="text/javascript">System.import('index').then(function(m) { m.main(); }, console.error.bind(console))</script>-->
|
||||
</body>
|
||||
</html>
|
13
transformers/disable-define.js
Normal file
13
transformers/disable-define.js
Normal file
@ -0,0 +1,13 @@
|
||||
var babel = require('babel-core');
|
||||
var t = babel.types;
|
||||
var Transformer = babel.Transformer;
|
||||
|
||||
module.exports = new Transformer('disable-define', {
|
||||
Identifier: function Identifier(node, parent, scope, file) {
|
||||
if (node.name === 'define') {
|
||||
// Advice from @t_wada. Not to change source map.
|
||||
// https://twitter.com/t_wada/status/582560881533304833
|
||||
node.name = '__def_';
|
||||
}
|
||||
}
|
||||
});
|
40
webpack.config.js
Normal file
40
webpack.config.js
Normal file
@ -0,0 +1,40 @@
|
||||
var babelOptions = {
|
||||
optional: ['es7.decorators'],
|
||||
plugins: [
|
||||
'./transformers/disable-define',
|
||||
'angular2-annotations',
|
||||
'type-assertion:after'
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
entry: "./ionic/ionic",
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename: "ionic.bundle.js"
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.es6$/,
|
||||
loader: "babel-loader?" + JSON.stringify(babelOptions)
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: "babel-loader?" + JSON.stringify(babelOptions)
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'angular2': 'angular2/es6/dev',
|
||||
'rtts_assert': 'rtts_assert/es6'
|
||||
},
|
||||
modulesDirectories: [
|
||||
'ionic2',
|
||||
'node_modules'
|
||||
],
|
||||
extensions: ['', '.js', '.es6']
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user