Skip to content

Commit

Permalink
Switch from webpack to esbuild; upgrade devDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dansomething committed Feb 17, 2024
1 parent d138872 commit 0214ddd
Show file tree
Hide file tree
Showing 7 changed files with 3,087 additions and 3,406 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib/
!.eslintrc.js
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ module.exports = {
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
Expand Down
26 changes: 26 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as esbuild from 'esbuild';

const options = {
entryPoints: ['src/index.ts'],
bundle: true,
minify: process.env.NODE_ENV !== 'development',
sourcemap: process.env.NODE_ENV === 'development',
mainFields: ['module', 'main'],
external: ['coc.nvim'],
platform: 'node',
target: 'node16',
outfile: 'lib/index.js',
// https://esbuild.github.io/api/#log-level
logLevel: process.env.NODE_ENV === 'development' ? 'info' : 'error',
};

if (process.argv.length > 2 && process.argv[2] === '--watch') {
const ctx = await esbuild.context(options);
await ctx.watch();
console.log('watching...');
} else {
const result = await esbuild.build(options);
if (result.errors.length) {
console.error(result.errors);
}
}
19 changes: 6 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
const gulp = require("gulp");
const cp = require('child_process');
const gulp = require('gulp'); // eslint-disable-line @typescript-eslint/no-var-requires
const cp = require('child_process'); // eslint-disable-line @typescript-eslint/no-var-requires

const server_dir = '../java-debug';

gulp.task('build_server', () => {
cp.execSync(mvnw() + ' clean package', {
cwd: server_dir,
stdio: [0, 1, 2]
stdio: [0, 1, 2],
});
return gulp.src(server_dir + '/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.*.jar')
return gulp
.src(server_dir + '/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.*.jar')
.pipe(gulp.dest('./server'));
});

function isWin() {
return /^win/.test(process.platform);
}

function isMac() {
return /^darwin/.test(process.platform);
}

function isLinux() {
return /^linux/.test(process.platform);
}

function mvnw() {
return isWin() ? "mvnw.cmd" : "./mvnw";
return isWin() ? 'mvnw.cmd' : './mvnw';
}
Loading

0 comments on commit 0214ddd

Please sign in to comment.