Skip to content

Commit

Permalink
Another crack at bundling the extension with webpack (VSCodeVim#4690)
Browse files Browse the repository at this point in the history
This broke the extension last time we tried 🙂
The main benefit is shipping a smaller bundle, which leads to slightly faster startup times.
Fixes VSCodeVim#3127
  • Loading branch information
J-Fields authored May 2, 2020
1 parent 924688c commit 4dbdc78
Show file tree
Hide file tree
Showing 8 changed files with 2,336 additions and 144 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
23 changes: 18 additions & 5 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
.github/**

.vscode/**
.vscode-test/**

**/*.ts
**/*.map
*.yml

src/**
build/**
out/test/**
test/**
typings/**
**/*.ts
**/*.map
.github_changelog_generator
out/test/**
node_modules/**
images/design/**

.gitignore
*.yml

tsconfig.json
tslint.json
webpack.config.js
gulpfile.js
renovate.json
.github_changelog_generator
18 changes: 15 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 @@ -133,6 +135,10 @@ function updateVersion(done) {
});
}

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

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

Expand All @@ -153,6 +159,10 @@ 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 @@ -184,7 +194,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 @@ -235,7 +245,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 4dbdc78

Please sign in to comment.