Skip to content

Commit

Permalink
Merge pull request #37 from j2rong4cn/main
Browse files Browse the repository at this point in the history
自动编译
  • Loading branch information
traceless committed Aug 29, 2023
2 parents ad14dde + 09673cf commit 50ded4a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: build
on:
workflow_dispatch:
push:
branches: [ 'main' ]
paths:
- 'node-proxy/**'
pull_request:
branches: [ 'main' ]
paths:
- 'node-proxy/**'

jobs:
release:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
cd node-proxy
npm install && npm run build
- name: Upload artifact
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: alist-encrypt-dev
path: |
node-proxy/build/*
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ jobs:
run: |
cd node-proxy
npm install && npm run build
- name: Compress
if: ${{ success() }}
run: |
cd node-proxy/build
ls -1 | xargs -I {} zip {}.zip {} && \
ls -1 *.zip | xargs -I {} shasum -a 256 {} >> sha256.txt
- name: Upload assets
if: ${{ success() }}
uses: softprops/action-gh-release@v1
with:
files: node-proxy/build/*
files: |
node-proxy/build/*.zip
node-proxy/build/sha256.txt
prerelease: false
token: ${{ secrets.REPO_TOKEN }}
5 changes: 2 additions & 3 deletions node-proxy/src/utils/levelDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import Datastore from 'nedb-promises'

// let datastore = Datastore.create('/path/to/db.db')
/**
* 继承接口,定义新方法
* 封装新方法
*/
class Nedb extends Datastore {
class Nedb {
constructor(dbFile) {
// this.super()
this.datastore = Datastore.create(dbFile)
}

Expand Down
9 changes: 4 additions & 5 deletions node-proxy/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default () => {
new PkgConfig(),
],
target: 'node',
// externals: [nodeExternals()],
mode: 'production',
optimization: {
minimize: true,
Expand Down Expand Up @@ -80,14 +79,14 @@ export default () => {

class PkgConfig {
apply(compiler: webpack.Compiler) {
compiler.hooks.afterEmit.tap('DistConfig', () => {
compiler.hooks.afterEmit.tap('PkgConfig', () => {
const conf = JSON.parse(fs.readFileSync(path.resolve('./package.json'), 'utf-8'))
const pkg_conf = JSON.parse(fs.readFileSync(path.resolve('./pkgconfig.dist.json'), 'utf-8'))
pkg_conf['name'] = conf['name']
pkg_conf['version'] = conf['version']
const dist_conf_path = path.join(output.path, 'package.json')
fs.writeFileSync(dist_conf_path, JSON.stringify(pkg_conf), { encoding: 'utf-8' })
console.log(dist_conf_path, pkg_conf)
const pkg_conf_path = path.join(output.path, 'package.json')
fs.writeFileSync(pkg_conf_path, JSON.stringify(pkg_conf), { encoding: 'utf-8' })
console.log(pkg_conf_path, pkg_conf)
})
}
}

0 comments on commit 50ded4a

Please sign in to comment.