mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-07-06 07:25:12 +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:
|
Go to `backend` directories, install node dependencies:
|
||||||
|
|
||||||
```
|
```
|
||||||
pnpm install
|
pnpm i
|
||||||
```
|
```
|
||||||
|
|
||||||
1. In `backend`, run the backend server on http://localhost:3000
|
1. In `backend`, run the backend server on http://localhost:3000
|
||||||
|
|
||||||
|
babel(old school)
|
||||||
|
|
||||||
```
|
```
|
||||||
pnpm start
|
pnpm start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
esbuild(experimental)
|
||||||
|
|
||||||
|
```
|
||||||
|
pnpm run --parallel "/^dev:.*/"
|
||||||
|
```
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
|
|
||||||
This project is under the GPL V3 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",
|
"test": "gulp peggy && npx cross-env BABEL_ENV=test mocha src/test/**/*.spec.js --require @babel/register --recursive",
|
||||||
"serve": "node sub-store.min.js",
|
"serve": "node sub-store.min.js",
|
||||||
"start": "nodemon -w src -w package.json --exec babel-node src/main.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",
|
"build": "gulp",
|
||||||
"bundle": "node bundle.js"
|
"bundle": "node bundle.js"
|
||||||
},
|
},
|
||||||
|
@ -63,7 +63,7 @@ function parse(raw) {
|
|||||||
return proxies;
|
return proxies;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function process(proxies, operators = [], targetPlatform, source) {
|
async function processFn(proxies, operators = [], targetPlatform, source) {
|
||||||
for (const item of operators) {
|
for (const item of operators) {
|
||||||
// process script
|
// process script
|
||||||
let script;
|
let script;
|
||||||
@ -188,7 +188,7 @@ function produce(proxies, targetPlatform, type, opts = {}) {
|
|||||||
|
|
||||||
export const ProxyUtils = {
|
export const ProxyUtils = {
|
||||||
parse,
|
parse,
|
||||||
process,
|
process: processFn,
|
||||||
produce,
|
produce,
|
||||||
isIPv4,
|
isIPv4,
|
||||||
isIPv6,
|
isIPv6,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user