Skip to content
This repository was archived by the owner on Sep 14, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions custom_typings/fs-extra.d.ts

This file was deleted.

151 changes: 0 additions & 151 deletions custom_typings/node.d.ts

This file was deleted.

15 changes: 0 additions & 15 deletions custom_typings/vinyl-fs.d.ts

This file was deleted.

43 changes: 19 additions & 24 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,22 @@ const tslint = require('gulp-tslint');
const typescript = require('gulp-typescript');
const typings = require('gulp-typings');

const tsProject = typescript.createProject('tsconfig.json');

// WTF gulp-typescript
class Rebase extends stream.Transform {
constructor() {
super({objectMode: true});
}

_transform(file, enc, callback) {
let oldPath = file.path;
if (oldPath.startsWith('lib/src')) {
file.path = 'lib' + oldPath.substring('lib/src'.length);
}
callback(null, file);
}
}
const tsProject = typescript.createProject('tsconfig.json', {
typescript: require('typescript')
});

gulp.task('init', () => gulp.src("./typings.json").pipe(typings()));

gulp.task('lint', ['tslint', 'eslint', 'depcheck']);

gulp.task('build', () =>
tsProject.src()
.pipe(typescript(tsProject))
.pipe(new Rebase())
.pipe(gulp.dest('lib'))
);
gulp.task('build', () => {
const tsResult = tsProject.src().pipe(typescript(tsProject));

return mergeStream(
tsResult.dts.pipe(gulp.dest('lib')),
tsResult.js.pipe(gulp.dest('lib'))
);
});

gulp.task('clean', (done) => {
fs.remove(path.join(__dirname, 'lib'), done);
Expand All @@ -71,8 +60,9 @@ gulp.task('tslint', () =>
gulp.src('src/**/*.ts')
.pipe(tslint({
configuration: 'tslint.json',
formatter: 'verbose'
}))
.pipe(tslint.report('verbose')));
.pipe(tslint.report()));

gulp.task('eslint', () =>
gulp.src('test/**/*.js')
Expand All @@ -81,7 +71,12 @@ gulp.task('eslint', () =>
.pipe(eslint.failAfterError()));

gulp.task('depcheck', () =>
depcheck(__dirname, {})
depcheck(__dirname, {
// "@types/*" dependencies are type declarations that are automatically
// loaded by TypeScript during build. depcheck can't detect this
// so we ignore them here.
ignoreMatches: ['@types/*']
})
.then((result) => {
let invalidFiles = Object.keys(result.invalidFiles) || [];
let invalidJsFiles = invalidFiles.filter((f) => f.endsWith('.js'));
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
},
"homepage": "https://github.com/Polymer/polymer-build#readme",
"dependencies": {
"@types/fs-extra": "0.0.32",
"@types/vinyl-fs": "0.0.28",
"dom5": "^1.3.1",
"fs-extra": "^0.30.0",
"gulp": "^3.9.1",
Expand All @@ -42,12 +44,13 @@
"depcheck": "^0.6.3",
"gulp-eslint": "^2.0.0",
"gulp-mocha": "^2.2.0",
"gulp-tslint": "^5.0.0",
"gulp-tslint": "^6.1.1",
"gulp-typescript": "^2.13.4",
"gulp-typings": "^2.0.0",
"run-sequence": "^1.2.0",
"temp": "^0.8.3",
"tslint": "^3.10.2",
"tslint": "^3.15.1",
"typescript": "^2.0.2",
"vinyl-fs-fake": "^1.1.0"
}
}
Loading