Skip to content

Commit

Permalink
WebPack builds for improved loading times (VSCodeVim#3889)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianjfrosst authored and J-Fields committed Sep 7, 2019
1 parent 38c268a commit 1f80b2d
Show file tree
Hide file tree
Showing 7 changed files with 1,688 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ script:
echo "Prettier Failed. Run `gulp forceprettier` and commit changes to resolve.";
exit 1;
fi
- npm run build
- gulp build
- gulp prepare-test
- npm test

before_deploy:
Expand Down
7 changes: 6 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ typings/**
**/*.map
.github_changelog_generator
.gitignore
*.yml
*.yml
# Not needed, due to webpack
node_modules/
src/
tsconfig.json
webpack.config.js
21 changes: 18 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ var gulp = require('gulp'),
ts = require('gulp-typescript'),
PluginError = require('plugin-error'),
minimist = require('minimist'),
path = require('path');
path = require('path'),
webpack_stream = require('webpack-stream'),
webpack_config = require('./webpack.config.js');

const exec = require('child_process').exec;
const spawn = require('child_process').spawn;
Expand Down Expand Up @@ -126,6 +128,10 @@ function updateVersion(done) {
});
}

function copyPackageJson() {
return gulp.src('./package.json').pipe(gulp.dest('out'));
}

gulp.task('tsc', function() {
var isError = false;

Expand All @@ -146,6 +152,13 @@ gulp.task('tsc', function() {
.pipe(gulp.dest('out'));
});

gulp.task('webpack', function() {
return gulp
.src('./extension.ts')
.pipe(webpack_stream(webpack_config))
.pipe(gulp.dest('out'));
});

gulp.task('tslint', function() {
const program = require('tslint').Linter.createProgram('./tsconfig.json');
return gulp
Expand Down Expand Up @@ -177,7 +190,7 @@ gulp.task('commit-hash', function(done) {
});

// test
gulp.task('test', function(done) {
gulp.task('run-test', function(done) {
// the flag --grep takes js regex as a string and filters by test and test suite names
var knownOptions = {
string: 'grep',
Expand Down Expand Up @@ -228,7 +241,9 @@ gulp.task('test', function(done) {
});
});

gulp.task('build', gulp.series('prettier', gulp.parallel('tsc', 'tslint'), 'commit-hash'));
gulp.task('build', gulp.series('prettier', gulp.parallel('webpack', 'tslint'), 'commit-hash'));
gulp.task('prepare-test', gulp.parallel('tsc', copyPackageJson));
gulp.task('test', gulp.series('prepare-test', 'run-test'));
gulp.task('changelog', gulp.series(validateArgs, createChangelog));
gulp.task(
'release',
Expand Down
Loading

0 comments on commit 1f80b2d

Please sign in to comment.