Skip to content

Commit

Permalink
✨ 尝试单独构建 asar 包 #300
Browse files Browse the repository at this point in the history
  • Loading branch information
muwoo committed Nov 14, 2023
1 parent 75e3111 commit dcea66e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"feature:dev": "cd feature & npm run serve",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",
"release": "vue-cli-service electron:build",
"release": "vue-cli-service electron:build && node ./release.js",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps"
},
Expand Down Expand Up @@ -46,6 +46,7 @@
"worker-loader": "^3.0.8"
},
"devDependencies": {
"@electron/asar": "^3.2.8",
"@ts-type/package-dts": "^1.0.53",
"@types/electron-devtools-installer": "^2.2.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
Expand All @@ -69,6 +70,7 @@
"less": "^3.0.4",
"less-loader": "^5.0.0",
"prettier": "^2.8.4",
"tar": "^6.2.0",
"typescript": "~4.1.5",
"vue-cli-plugin-electron-builder": "3.0.0-alpha.4",
"worker-plugin": "^5.0.1"
Expand Down
16 changes: 16 additions & 0 deletions release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const asar = require('@electron/asar');
const tar = require('tar');

const src = 'dist_electron/bundled';
const dest = 'build/app.asar';

(async () => {
await asar.createPackageWithOptions(src, dest, {});
await tar.c(
{
gzip: true,
file: 'app.asar.tgz',
},
[dest]
);
})();
21 changes: 21 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,15 @@
ajv "^6.12.0"
ajv-keywords "^3.4.1"

"@electron/asar@^3.2.8":
version "3.2.8"
resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.8.tgz#2ea722f3452583dbd4ffdcc4b4f5dc903f1d8178"
integrity sha512-cmskk5M06ewHMZAplSiF4AlME3IrnnZhKnWbtwKVLRkdJkKyUVjMLhDIiPIx/+6zQWVlKX/LtmK9xDme7540Sg==
dependencies:
commander "^5.0.0"
glob "^7.1.6"
minimatch "^3.0.4"

"@electron/get@^2.0.0":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@electron/get/-/get-2.0.2.tgz#ae2a967b22075e9c25aaf00d5941cd79c21efd7e"
Expand Down Expand Up @@ -12975,6 +12984,18 @@ tar@^6.1.11:
mkdirp "^1.0.3"
yallist "^4.0.0"

tar@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.0.tgz#b14ce49a79cb1cd23bc9b016302dea5474493f73"
integrity sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==
dependencies:
chownr "^2.0.0"
fs-minipass "^2.0.0"
minipass "^5.0.0"
minizlib "^2.1.1"
mkdirp "^1.0.3"
yallist "^4.0.0"

temp-file@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/temp-file/-/temp-file-3.4.0.tgz#766ea28911c683996c248ef1a20eea04d51652c7"
Expand Down

0 comments on commit dcea66e

Please sign in to comment.