-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(esbuild): replace webpack with esbuil
fix #27
- Loading branch information
1 parent
c0a9edb
commit e9637b5
Showing
13 changed files
with
1,287 additions
and
1,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ scripts | |
.dockerignore | ||
.editorconfig | ||
.gitignore | ||
.travis.yml | ||
Dockerfile | ||
LICENSE | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
dist | ||
node_modules | ||
scripts | ||
.vscode | ||
.eslintrc.js | ||
webpack.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,47 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
}, | ||
parser: "@typescript-eslint/parser", | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: "tsconfig.json", | ||
sourceType: "module", | ||
project: [ | ||
'tsconfig.json', | ||
'tsconfig.eslint.json', | ||
], | ||
sourceType: 'module', | ||
}, | ||
plugins: ["@typescript-eslint"], | ||
plugins: ['@typescript-eslint'], | ||
rules: { | ||
"@typescript-eslint/indent": ["error", 2], | ||
"@typescript-eslint/member-delimiter-style": [ | ||
"error", | ||
'@typescript-eslint/indent': ['error', 2], | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'error', | ||
{ | ||
multiline: { | ||
delimiter: "semi", | ||
delimiter: 'semi', | ||
requireLast: true, | ||
}, | ||
singleline: { | ||
delimiter: "semi", | ||
delimiter: 'semi', | ||
requireLast: false, | ||
}, | ||
}, | ||
], | ||
"@typescript-eslint/quotes": [ | ||
"error", | ||
"single", | ||
'@typescript-eslint/quotes': [ | ||
'error', | ||
'single', | ||
{ | ||
avoidEscape: true, | ||
}, | ||
], | ||
"@typescript-eslint/semi": ["error", "always"], | ||
"comma-dangle": ["error", "always-multiline"], | ||
"max-classes-per-file": "off", | ||
"no-console": "error", | ||
"no-multiple-empty-lines": ["error", { max: 1 }], | ||
"no-redeclare": "error", | ||
"no-return-await": "error", | ||
"prefer-const": "error", | ||
'@typescript-eslint/semi': ['error', 'always'], | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'max-classes-per-file': 'off', | ||
'no-console': 'error', | ||
'no-multiple-empty-lines': ['error', { max: 1 }], | ||
'no-redeclare': 'error', | ||
'no-return-await': 'error', | ||
'prefer-const': 'error', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
dist | ||
node_modules | ||
.vscode | ||
|
||
**/*.hidden.* | ||
**/secrets/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const argv = require('minimist')(process.argv.slice(2)); | ||
const esbuild = require('esbuild'); | ||
|
||
/** @type esbuild.BuildOptions */ | ||
const devConfig = { | ||
sourcemap: 'linked', | ||
}; | ||
|
||
/** @type esbuild.BuildOptions */ | ||
const prodConfig = { | ||
minify: true, | ||
}; | ||
|
||
/** @type esbuild.BuildOptions */ | ||
const config = { | ||
entryPoints: ['src/main.ts'], | ||
outfile: `dist/${process.env.npm_package_name}.js`, | ||
bundle: true, | ||
platform: 'node', | ||
logLevel: 'info', | ||
|
||
define: { | ||
VERSION: 'process.env.npm_package_version', | ||
DEVELOP: !!argv.dev, | ||
}, | ||
|
||
watch: argv.watch, | ||
|
||
metafile: argv.meta, | ||
...(argv.dev ? devConfig : prodConfig), | ||
}; | ||
|
||
if (argv.run) config.plugins = [require('@es-exec/esbuild-plugin-start').default({ script: `node dist/${process.env.npm_package_name}.js` })]; | ||
|
||
esbuild | ||
.build(config) | ||
.then(file => { | ||
if (argv.meta) require('fs').writeFileSync('dist/meta.json', JSON.stringify(file.metafile)); | ||
}); |
Oops, something went wrong.