mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
Due to restrictions on how Electron package works, the `node_modules` should not be hoisted and not to use s/h-links at all. This is why we need to have two separate installs for electron and non-electron packages in the build.
Tested via the following script
```bash
#!/bin/bash
echo "step 1: clean up"
find . -name "node_modules" -prune -exec rm -rf '{}' +
# git clean -dfX
build_type=canary
echo "step 2: install web dependencies"
# firstly, build web static
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 SENTRYCLI_SKIP_DOWNLOAD=1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=1 yarn
echo "step 3: generate assets"
BUILD_TYPE="$build_type" yarn workspace @affine/electron generate-assets
# cleanup node_modules
find . -name "node_modules" -prune -exec rm -rf '{}' +
echo "step 4: install electron dependencies"
# install electron deps
yarn config set nmHoistingLimits workspaces
yarn config set enableScripts false
yarn config set nmMode classic
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 HUSKY=0 yarn workspaces focus @affine/electron @affine/monorepo
echo "step 5: build native"
# build native
yarn workspace @affine/native build
yarn workspace @affine/storage build
echo "step 6: build electron"
# build electron
yarn workspace @affine/electron build
echo "step 7: package electron"
# package
SKIP_GENERATE_ASSETS=1 BUILD_TYPE="$build_type" HOIST_NODE_MODULES=1 yarn workspace @affine/electron package
```
94 lines
3.0 KiB
JSON
94 lines
3.0 KiB
JSON
{
|
|
"name": "@affine/electron",
|
|
"private": true,
|
|
"version": "0.10.3-canary.0",
|
|
"author": "toeverything",
|
|
"repository": {
|
|
"url": "https://github.com/toeverything/AFFiNE",
|
|
"type": "git"
|
|
},
|
|
"description": "AFFiNE Desktop App",
|
|
"homepage": "https://github.com/toeverything/AFFiNE",
|
|
"scripts": {
|
|
"start": "electron .",
|
|
"dev": "DEV_SERVER_URL=http://localhost:8080 yarn ts-node ./scripts/dev.ts",
|
|
"dev:prod": "yarn ts-node scripts/dev.ts",
|
|
"build": "NODE_ENV=production ts-node scripts/build-layers.ts",
|
|
"build:dev": "NODE_ENV=development ts-node scripts/build-layers.ts",
|
|
"generate-assets": "ts-node scripts/generate-assets.ts",
|
|
"package": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" electron-forge package",
|
|
"make": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" electron-forge make",
|
|
"make-squirrel": "yarn ts-node scripts/make-squirrel.ts"
|
|
},
|
|
"main": "./dist/main.js",
|
|
"devDependencies": {
|
|
"@affine-test/kit": "workspace:*",
|
|
"@affine/copilot-plugin": "workspace:*",
|
|
"@affine/env": "workspace:*",
|
|
"@affine/hello-world-plugin": "workspace:*",
|
|
"@affine/image-preview-plugin": "workspace:*",
|
|
"@affine/native": "workspace:*",
|
|
"@affine/outline-plugin": "workspace:*",
|
|
"@affine/sdk": "workspace:*",
|
|
"@affine/templates": "workspace:*",
|
|
"@affine/vue-hello-world-plugin": "workspace:*",
|
|
"@blocksuite/blocks": "0.0.0-20231116023037-31273bb7-nightly",
|
|
"@blocksuite/editor": "0.0.0-20231116023037-31273bb7-nightly",
|
|
"@blocksuite/lit": "0.0.0-20231116023037-31273bb7-nightly",
|
|
"@blocksuite/store": "0.0.0-20231116023037-31273bb7-nightly",
|
|
"@electron-forge/cli": "^6.4.2",
|
|
"@electron-forge/core": "^6.4.2",
|
|
"@electron-forge/core-utils": "^6.4.2",
|
|
"@electron-forge/maker-deb": "^6.4.2",
|
|
"@electron-forge/maker-dmg": "^6.4.2",
|
|
"@electron-forge/maker-squirrel": "^6.4.2",
|
|
"@electron-forge/maker-zip": "^6.4.2",
|
|
"@electron-forge/plugin-auto-unpack-natives": "^6.4.2",
|
|
"@electron-forge/shared-types": "^6.4.2",
|
|
"@electron/remote": "2.0.12",
|
|
"@reforged/maker-appimage": "^3.3.1",
|
|
"@toeverything/infra": "workspace:*",
|
|
"@types/uuid": "^9.0.5",
|
|
"builder-util-runtime": "^9.2.1",
|
|
"cross-env": "^7.0.3",
|
|
"electron": "^27.1.0",
|
|
"electron-log": "^5.0.0",
|
|
"electron-squirrel-startup": "1.0.0",
|
|
"electron-window-state": "^5.0.3",
|
|
"esbuild": "^0.19.4",
|
|
"fs-extra": "^11.1.1",
|
|
"glob": "^10.3.10",
|
|
"jotai": "^2.4.3",
|
|
"lodash-es": "^4.17.21",
|
|
"rxjs": "^7.8.1",
|
|
"semver": "^7.5.4",
|
|
"tinykeys": "^2.1.0",
|
|
"ts-node": "^10.9.1",
|
|
"undici": "^5.26.3",
|
|
"uuid": "^9.0.1",
|
|
"vitest": "0.34.6",
|
|
"which": "^4.0.0",
|
|
"zod": "^3.22.4"
|
|
},
|
|
"dependencies": {
|
|
"async-call-rpc": "^6.3.1",
|
|
"electron-updater": "^6.1.5",
|
|
"link-preview-js": "^3.0.5",
|
|
"nanoid": "^5.0.1",
|
|
"yjs": "^13.6.8"
|
|
},
|
|
"build": {
|
|
"protocols": [
|
|
{
|
|
"name": "affine",
|
|
"schemes": [
|
|
"affine"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"peerDependencies": {
|
|
"ts-node": "*"
|
|
}
|
|
}
|