mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-04 11:13:59 +08:00
feat: bundle
This commit is contained in:
parent
bd510a9aa9
commit
f94a12bf6e
14
.github/workflows/main.yml
vendored
14
.github/workflows/main.yml
vendored
@ -1,15 +1,15 @@
|
|||||||
name: build
|
name: build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- 'backend/package.json'
|
- "backend/package.json"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- 'backend/package.json'
|
- "backend/package.json"
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: 'master'
|
ref: "master"
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@ -34,6 +34,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd backend
|
cd backend
|
||||||
pnpm run build
|
pnpm run build
|
||||||
|
- name: Bundle
|
||||||
|
run: |
|
||||||
|
cd backend
|
||||||
|
pnpm i -D estrella
|
||||||
|
pnpm run bundle
|
||||||
- id: tag
|
- id: tag
|
||||||
name: Generate release tag
|
name: Generate release tag
|
||||||
run: |
|
run: |
|
||||||
@ -52,3 +57,4 @@ jobs:
|
|||||||
./backend/dist/sub-store-1.min.js
|
./backend/dist/sub-store-1.min.js
|
||||||
./backend/dist/sub-store-parser.loon.min.js
|
./backend/dist/sub-store-parser.loon.min.js
|
||||||
./backend/dist/cron-sync-artifacts.min.js
|
./backend/dist/cron-sync-artifacts.min.js
|
||||||
|
./backend/dist/sub-store.bundle.js
|
||||||
|
23
backend/bundle.js
Normal file
23
backend/bundle.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
let content = fs.readFileSync(path.join(__dirname, 'sub-store.min.js'), {
|
||||||
|
encoding: 'utf8',
|
||||||
|
});
|
||||||
|
content = content.replace(
|
||||||
|
/eval\(('|")(require\(('|").*?('|")\))('|")\)/g,
|
||||||
|
'$2',
|
||||||
|
);
|
||||||
|
fs.writeFileSync(path.join(__dirname, 'dist/sub-store.no-bundle.js'), content, {
|
||||||
|
encoding: 'utf8',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { build } = require('estrella');
|
||||||
|
build({
|
||||||
|
entry: 'dist/sub-store.no-bundle.js',
|
||||||
|
outfile: 'dist/sub-store.bundle.js',
|
||||||
|
bundle: true,
|
||||||
|
platform: 'node',
|
||||||
|
});
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.37",
|
"version": "2.14.38",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -8,7 +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",
|
||||||
"build": "gulp"
|
"build": "gulp",
|
||||||
|
"bundle": "node bundle.js"
|
||||||
},
|
},
|
||||||
"author": "Peng-YM",
|
"author": "Peng-YM",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
@ -48,7 +48,7 @@ class ResourceCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set(id, value) {
|
set(id, value) {
|
||||||
this.resourceCache[id] = { time: new Date().getTime(), data: value }
|
this.resourceCache[id] = { time: new Date().getTime(), data: value };
|
||||||
this._persist();
|
this._persist();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user