Skip to content

Commit af4e567

Browse files
chore(all): new build, contrib and lint
1 parent 33cd77d commit af4e567

13 files changed

+161
-136
lines changed

.jshintrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"esnext": true
3+
}

CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributing
2+
3+
We'd love for you to contribute and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accept a Pull Request from you. More information on the process is included in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md).

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,3 @@ To run the unit tests, first ensure that you have followed the steps above in or
7373
```shell
7474
karma start
7575
```
76-
77-
## Contributing
78-
79-
We'd love for you to contribute to our source code and to make this project even better than it is today! If this interests you, please begin by reading [our contributing guidelines](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md). The contributing document will provide you with all the information you need to get started. Once you have read that, you will need to also [sign our CLA](http://goo.gl/forms/dI8QDDSyKR) before we can accepts a Pull Request from you. More information on the process is including in the [contributor's guide](https://github.com/DurandalProject/about/blob/master/CONTRIBUTING.md).

build/6to5-options.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
filename: '',
3+
filenameRelative: '',
4+
blacklist: [],
5+
whitelist: [],
6+
modules: '',
7+
sourceMap: true,
8+
sourceMapName: '',
9+
sourceRoot: '',
10+
moduleRoot: '',
11+
moduleIds: false,
12+
experimental: false,
13+
format: {
14+
comments: false,
15+
compact: false,
16+
indent: {
17+
parentheses: true,
18+
adjustMultilineComment: true,
19+
style: " ",
20+
base: 0
21+
}
22+
}
23+
};

build/paths.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var path = require('path');
2+
3+
var appRoot = 'src/';
4+
5+
module.exports = {
6+
root: appRoot,
7+
source: appRoot + '**/*.js',
8+
html: appRoot + '**/*.html',
9+
style: 'styles/**/*.css',
10+
output: 'dist/',
11+
doc:'./doc',
12+
e2eSpecsSrc: 'test/e2e/src/*.js',
13+
e2eSpecsDist: 'test/e2e/dist/'
14+
};

build/tasks/build.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
var to5 = require('gulp-6to5');
4+
var paths = require('../paths');
5+
var compilerOptions = require('../6to5-options');
6+
var assign = Object.assign || require('object.assign');
7+
8+
gulp.task('build-es6', function () {
9+
return gulp.src(paths.source)
10+
.pipe(gulp.dest(paths.output + 'es6'));
11+
});
12+
13+
gulp.task('build-commonjs', function () {
14+
return gulp.src(paths.source)
15+
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
16+
.pipe(gulp.dest(paths.output + 'commonjs'));
17+
});
18+
19+
gulp.task('build-amd', function () {
20+
return gulp.src(paths.source)
21+
.pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
22+
.pipe(gulp.dest(paths.output + 'amd'));
23+
});
24+
25+
gulp.task('build-system', function () {
26+
return gulp.src(paths.source)
27+
.pipe(to5(assign({}, compilerOptions, {modules:'system'})))
28+
.pipe(gulp.dest(paths.output + 'system'));
29+
});
30+
31+
gulp.task('build', function(callback) {
32+
return runSequence(
33+
'clean',
34+
['build-es6', 'build-commonjs', 'build-amd', 'build-system'],
35+
callback
36+
);
37+
});

build/tasks/clean.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var gulp = require('gulp');
2+
var paths = require('../paths');
3+
var del = require('del');
4+
var vinylPaths = require('vinyl-paths');
5+
6+
gulp.task('clean', function() {
7+
return gulp.src([paths.output])
8+
.pipe(vinylPaths(del));
9+
});

build/tasks/dev.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var gulp = require('gulp');
2+
var tools = require('aurelia-tools');
3+
4+
gulp.task('update-own-deps', function(){
5+
tools.updateOwnDependenciesFromLocalRepositories();
6+
});
7+
8+
gulp.task('build-dev-env', function () {
9+
tools.buildDevEnv();
10+
});

build/tasks/doc.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var gulp = require('gulp');
2+
var tools = require('aurelia-tools');
3+
var paths = require('../paths');
4+
var yuidoc = require('gulp-yuidoc');
5+
6+
gulp.task('doc-generate', function(){
7+
return gulp.src(paths.source)
8+
.pipe(yuidoc.parser(null, 'api.json'))
9+
.pipe(gulp.dest(paths.doc));
10+
});
11+
12+
gulp.task('doc', ['doc-generate'], function(){
13+
tools.transformAPIModel(paths.doc);
14+
});

build/tasks/lint.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var gulp = require('gulp');
2+
var paths = require('../paths');
3+
var jshint = require('gulp-jshint');
4+
var stylish = require('jshint-stylish');
5+
6+
gulp.task('lint', function() {
7+
return gulp.src(paths.source)
8+
.pipe(jshint())
9+
.pipe(jshint.reporter(stylish));
10+
});

build/tasks/prepare-release.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var gulp = require('gulp');
2+
var runSequence = require('run-sequence');
3+
var paths = require('../paths');
4+
var changelog = require('conventional-changelog');
5+
var fs = require('fs');
6+
var bump = require('gulp-bump');
7+
8+
gulp.task('bump-version', function(){
9+
return gulp.src(['./package.json'])
10+
.pipe(bump({type:'patch'})) //major|minor|patch|prerelease
11+
.pipe(gulp.dest('./'));
12+
});
13+
14+
gulp.task('changelog', function(callback) {
15+
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
16+
17+
return changelog({
18+
repository: pkg.repository.url,
19+
version: pkg.version,
20+
file: paths.doc + '/CHANGELOG.md'
21+
}, function(err, log) {
22+
fs.writeFileSync(paths.doc + '/CHANGELOG.md', log);
23+
});
24+
});
25+
26+
gulp.task('prepare-release', function(callback){
27+
return runSequence(
28+
'build',
29+
'lint',
30+
'bump-version',
31+
'doc',
32+
'changelog',
33+
callback
34+
);
35+
});

gulpfile.js

+1-131
Original file line numberDiff line numberDiff line change
@@ -1,131 +1 @@
1-
var gulp = require('gulp');
2-
var runSequence = require('run-sequence');
3-
var del = require('del');
4-
var vinylPaths = require('vinyl-paths');
5-
var to5 = require('gulp-6to5');
6-
var jshint = require('gulp-jshint');
7-
var stylish = require('jshint-stylish');
8-
var yuidoc = require("gulp-yuidoc");
9-
var changelog = require('conventional-changelog');
10-
var assign = Object.assign || require('object.assign');
11-
var fs = require('fs');
12-
var bump = require('gulp-bump');
13-
var tools = require('aurelia-tools');
14-
15-
var path = {
16-
source:'src/**/*.js',
17-
output:'dist/',
18-
doc:'./doc'
19-
};
20-
21-
var compilerOptions = {
22-
filename: '',
23-
filenameRelative: '',
24-
blacklist: [],
25-
whitelist: [],
26-
modules: '',
27-
sourceMap: true,
28-
sourceMapName: '',
29-
sourceFileName: '',
30-
sourceRoot: '',
31-
moduleRoot: '',
32-
moduleIds: false,
33-
experimental: false,
34-
format: {
35-
comments: false,
36-
compact: false,
37-
indent: {
38-
parentheses: true,
39-
adjustMultilineComment: true,
40-
style: " ",
41-
base: 0
42-
}
43-
}
44-
};
45-
46-
var jshintConfig = {esnext:true};
47-
48-
gulp.task('clean', function() {
49-
return gulp.src([path.output])
50-
.pipe(vinylPaths(del));
51-
});
52-
53-
gulp.task('build-es6', function () {
54-
return gulp.src(path.source)
55-
.pipe(gulp.dest(path.output + 'es6'));
56-
});
57-
58-
gulp.task('build-commonjs', function () {
59-
return gulp.src(path.source)
60-
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
61-
.pipe(gulp.dest(path.output + 'commonjs'));
62-
});
63-
64-
gulp.task('build-amd', function () {
65-
return gulp.src(path.source)
66-
.pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
67-
.pipe(gulp.dest(path.output + 'amd'));
68-
});
69-
70-
gulp.task('build-system', function () {
71-
return gulp.src(path.source)
72-
.pipe(to5(assign({}, compilerOptions, {modules:'system'})))
73-
.pipe(gulp.dest(path.output + 'system'));
74-
});
75-
76-
gulp.task('lint', function() {
77-
return gulp.src(path.source)
78-
.pipe(jshint(jshintConfig))
79-
.pipe(jshint.reporter(stylish));
80-
});
81-
82-
gulp.task('doc-generate', function(){
83-
return gulp.src(path.source)
84-
.pipe(yuidoc.parser(null, 'api.json'))
85-
.pipe(gulp.dest(path.doc));
86-
});
87-
88-
gulp.task('doc', ['doc-generate'], function(){
89-
tools.transformAPIModel(path.doc);
90-
});
91-
92-
gulp.task('bump-version', function(){
93-
return gulp.src(['./bower.json', './package.json'])
94-
.pipe(bump({type:'patch'})) //major|minor|patch|prerelease
95-
.pipe(gulp.dest('./'));
96-
});
97-
98-
gulp.task('changelog', function(callback) {
99-
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
100-
101-
return changelog({
102-
repository: pkg.repository.url,
103-
version: pkg.version,
104-
file: path.doc + '/CHANGELOG.md'
105-
}, function(err, log) {
106-
fs.writeFileSync(path.doc + '/CHANGELOG.md', log);
107-
});
108-
});
109-
110-
gulp.task('build', function(callback) {
111-
return runSequence(
112-
'clean',
113-
['build-es6', 'build-commonjs', 'build-amd', 'build-system'],
114-
callback
115-
);
116-
});
117-
118-
gulp.task('update-own-deps', function(){
119-
tools.updateOwnDependenciesFromLocalRepositories();
120-
});
121-
122-
gulp.task('prepare-release', function(callback){
123-
return runSequence(
124-
'build',
125-
'lint',
126-
'bump-version',
127-
'doc',
128-
'changelog',
129-
callback
130-
);
131-
});
1+
require('require-dir')('build/tasks');

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333
},
3434
"devDependencies": {
35-
"aurelia-tools": "git://github.com/aurelia/tools.git",
35+
"aurelia-tools": "^0.1.0",
3636
"conventional-changelog": "0.0.11",
3737
"del": "^1.1.0",
3838
"gulp": "^3.8.10",
@@ -48,6 +48,7 @@
4848
"karma-jasmine": "^0.3.2",
4949
"karma-jspm": "^1.0.1",
5050
"object.assign": "^1.0.3",
51+
"require-dir": "^0.1.0",
5152
"run-sequence": "^1.0.2",
5253
"vinyl-paths": "^1.0.0"
5354
},

0 commit comments

Comments
 (0)