build(electron): add nsis script for windows installer (#6674)

This pr only includes how to bundle the app into an installer after package step.

todo (not in this pr)
- [ ] make sure updater can work for both nsis & squirrel
- [ ] integrate nsis build into github action workflow

Advantage over Squirrel:
- allowing user to specify the installation location
- better uninstaller

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/b75f1076-62e7-445c-bbf9-d7be00dbfc59.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/c9ddc58c-512e-487e-80c8-7c4bd51482a8.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/cfc5c281-e044-4929-a261-b02a4619117b.png)
This commit is contained in:
pengx17
2024-04-25 03:30:04 +00:00
parent a697ebe340
commit 0b380f94c7
6 changed files with 105 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ const ReleaseTypeSchema = z.enum(['stable', 'beta', 'canary', 'internal']);
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const REPO_ROOT = path.resolve(__dirname, '..', '..', '..', '..');
const ROOT = path.resolve(__dirname, '..');
const envBuildType = (process.env.BUILD_TYPE || 'canary').trim().toLowerCase();
@@ -45,7 +46,15 @@ const platform =
? process.argv[process.argv.indexOf('--platform') + 1]
: process.platform;
const appIdMap = {
internal: 'pro.affine.internal',
canary: 'pro.affine.canary',
beta: 'pro.affine.beta',
stable: 'pro.affine.app',
};
export {
appIdMap,
arch,
buildType,
icnsPath,
@@ -55,6 +64,7 @@ export {
icoPath,
platform,
productName,
REPO_ROOT,
ROOT,
stableBuild,
};