mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-04-18 11:49:32 +08:00
chore: 开发流程使用 esbuild
This commit is contained in:
parent
02d54208b0
commit
ae1c738f70
12
README.md
12
README.md
@ -84,15 +84,25 @@ Install `pnpm`
|
||||
Go to `backend` directories, install node dependencies:
|
||||
|
||||
```
|
||||
pnpm install
|
||||
pnpm i
|
||||
```
|
||||
|
||||
1. In `backend`, run the backend server on http://localhost:3000
|
||||
|
||||
babel(old school)
|
||||
|
||||
```
|
||||
pnpm start
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
esbuild(experimental)
|
||||
|
||||
```
|
||||
pnpm run --parallel "/^dev:.*/"
|
||||
```
|
||||
|
||||
## LICENSE
|
||||
|
||||
This project is under the GPL V3 LICENSE.
|
||||
|
24
backend/dev-esbuild.js
Normal file
24
backend/dev-esbuild.js
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env node
|
||||
const { build } = require('esbuild');
|
||||
|
||||
!(async () => {
|
||||
const artifacts = [{ src: 'src/main.js', dest: 'sub-store.min.js' }];
|
||||
|
||||
for await (const artifact of artifacts) {
|
||||
await build({
|
||||
entryPoints: [artifact.src],
|
||||
bundle: true,
|
||||
minify: false,
|
||||
sourcemap: false,
|
||||
platform: 'node',
|
||||
format: 'cjs',
|
||||
outfile: artifact.dest,
|
||||
});
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
})
|
||||
.finally(() => {
|
||||
console.log('done');
|
||||
});
|
@ -8,6 +8,8 @@
|
||||
"test": "gulp peggy && npx cross-env BABEL_ENV=test mocha src/test/**/*.spec.js --require @babel/register --recursive",
|
||||
"serve": "node sub-store.min.js",
|
||||
"start": "nodemon -w src -w package.json --exec babel-node src/main.js",
|
||||
"dev:esbuild": "nodemon -w src -w package.json dev-esbuild.js",
|
||||
"dev:run": "nodemon -w sub-store.json -w sub-store.min.js sub-store.min.js",
|
||||
"build": "gulp",
|
||||
"bundle": "node bundle.js"
|
||||
},
|
||||
|
@ -63,7 +63,7 @@ function parse(raw) {
|
||||
return proxies;
|
||||
}
|
||||
|
||||
async function process(proxies, operators = [], targetPlatform, source) {
|
||||
async function processFn(proxies, operators = [], targetPlatform, source) {
|
||||
for (const item of operators) {
|
||||
// process script
|
||||
let script;
|
||||
@ -188,7 +188,7 @@ function produce(proxies, targetPlatform, type, opts = {}) {
|
||||
|
||||
export const ProxyUtils = {
|
||||
parse,
|
||||
process,
|
||||
process: processFn,
|
||||
produce,
|
||||
isIPv4,
|
||||
isIPv6,
|
||||
|
Loading…
x
Reference in New Issue
Block a user