diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 4a3b6d523e8bd..1f61364303b8a 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -29,6 +29,9 @@ inputs: description: 'Build plugins' required: false default: 'true' + nmHoistingLimits: + description: 'Set nmHoistingLimits in .yarnrc.yml' + required: false runs: using: 'composite' @@ -46,6 +49,11 @@ runs: shell: bash run: yarn config set nmMode hardlinks-local + - name: Set nmHoistingLimits + if: ${{ inputs.nmHoistingLimits }} + shell: bash + run: yarn config set nmHoistingLimits ${{ inputs.nmHoistingLimits }} + - name: yarn install if: ${{ inputs.package-install == 'true' }} continue-on-error: true diff --git a/.github/workflows/release-desktop-app.yml b/.github/workflows/release-desktop-app.yml index 85f7329bbbd6a..ba5e21db06441 100644 --- a/.github/workflows/release-desktop-app.yml +++ b/.github/workflows/release-desktop-app.yml @@ -67,6 +67,7 @@ jobs: SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} RELEASE_VERSION: ${{ github.event.inputs.version || steps.get-canary-version.outputs.RELEASE_VERSION }} + SKIP_PLUGIN_BUILD: 'true' - name: Upload core artifact uses: actions/upload-artifact@v3 @@ -105,6 +106,11 @@ jobs: - name: Setup Node.js timeout-minutes: 10 uses: ./.github/actions/setup-node + with: + extra-flags: workspaces focus @affine/electron @affine/monorepo + hard-link-nm: false + build-plugins: false + nmHoistingLimits: workspaces - name: Setup Maker timeout-minutes: 10 uses: ./.github/actions/setup-maker @@ -131,6 +137,10 @@ jobs: - name: make run: yarn workspace @affine/electron make --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }} + env: + SKIP_PLUGIN_BUILD: 1 + SKIP_WEB_BUILD: 1 + HOIST_NODE_MODULES: 1 - name: Save artifacts (mac) if: ${{ matrix.spec.platform == 'darwin' }} @@ -173,6 +183,11 @@ jobs: - name: Setup Node.js timeout-minutes: 10 uses: ./.github/actions/setup-node + with: + extra-flags: workspaces focus @affine/electron @affine/monorepo + hard-link-nm: false + build-plugins: false + nmHoistingLimits: workspaces - name: Setup Maker timeout-minutes: 10 uses: ./.github/actions/setup-maker @@ -195,6 +210,10 @@ jobs: - name: package run: yarn workspace @affine/electron package --platform=${{ matrix.spec.platform }} --arch=${{ matrix.spec.arch }} + env: + SKIP_PLUGIN_BUILD: 1 + SKIP_WEB_BUILD: 1 + HOIST_NODE_MODULES: 1 - name: get all files to be signed id: get_files_to_be_signed diff --git a/apps/electron/forge.config.js b/apps/electron/forge.config.js index a6aed6f90c563..68ec86d1b0d34 100644 --- a/apps/electron/forge.config.js +++ b/apps/electron/forge.config.js @@ -130,15 +130,17 @@ module.exports = { packageJson.productName = productName; }, prePackage: async () => { - await rm(path.join(__dirname, 'node_modules'), { - recursive: true, - force: true, - }); + if (!process.env.HOIST_NODE_MODULES) { + await rm(path.join(__dirname, 'node_modules'), { + recursive: true, + force: true, + }); - await symlink( - path.join(__dirname, '..', '..', 'node_modules'), - path.join(__dirname, 'node_modules') - ); + await symlink( + path.join(__dirname, '..', '..', 'node_modules'), + path.join(__dirname, 'node_modules') + ); + } }, generateAssets: async (_, platform, arch) => { if (process.env.SKIP_GENERATE_ASSETS) { diff --git a/apps/electron/package.json b/apps/electron/package.json index a8479132c4bf7..afb3d16e01cf7 100644 --- a/apps/electron/package.json +++ b/apps/electron/package.json @@ -52,7 +52,7 @@ "@types/uuid": "^9.0.5", "builder-util-runtime": "^9.2.1", "cross-env": "7.0.3", - "electron": "^26.4.0", + "electron": "^27.0.0", "electron-log": "^5.0.0-rc.1", "electron-squirrel-startup": "1.0.0", "electron-window-state": "^5.0.3", diff --git a/apps/electron/scripts/generate-assets.mjs b/apps/electron/scripts/generate-assets.mjs index 22e568cafcc50..ac2b86547460d 100755 --- a/apps/electron/scripts/generate-assets.mjs +++ b/apps/electron/scripts/generate-assets.mjs @@ -41,9 +41,12 @@ $.env.DISTRIBUTION = 'desktop'; cd(repoRootDir); +if (!process.env.SKIP_PLUGIN_BUILD) { + await $`yarn -T run build:plugins`; +} + // step 1: build web (nextjs) dist if (!process.env.SKIP_WEB_BUILD) { - await $`yarn -T run build:plugins`; await $`yarn nx build @affine/core`; await $`yarn workspace @affine/electron build`; diff --git a/package.json b/package.json index ebd95a577a7f7..18912eea3bac6 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,8 @@ "@vanilla-extract/webpack-plugin": "^2.3.1", "@vitejs/plugin-react-swc": "^3.4.0", "@vitest/coverage-istanbul": "0.34.6", - "@vitest/ui": "0.34.6", + "@vitest/ui": "0.34.7", + "electron": "^27.0.0", "eslint": "^8.51.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-i": "^2.28.1", diff --git a/packages/env/package.json b/packages/env/package.json index 5e48430dea0f3..a51acd18d8ac5 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -6,6 +6,7 @@ "module": "./src/index.ts", "devDependencies": { "@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly", + "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "react": "18.2.0", "react-dom": "18.2.0", "vitest": "0.34.6", diff --git a/packages/infra/package.json b/packages/infra/package.json index b33ff4b2523fc..2dcf023b37a64 100644 --- a/packages/infra/package.json +++ b/packages/infra/package.json @@ -64,6 +64,7 @@ }, "devDependencies": { "@affine-test/fixtures": "workspace:*", + "@affine/templates": "workspace:*", "@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/lit": "0.0.0-20230926212737-6d4b1569-nightly", "@testing-library/react": "^14.0.0", diff --git a/packages/plugin-cli/package.json b/packages/plugin-cli/package.json index 258a542b124af..2bf5c1443f5a0 100644 --- a/packages/plugin-cli/package.json +++ b/packages/plugin-cli/package.json @@ -18,6 +18,7 @@ "@vitejs/plugin-vue": "^4.4.0", "rollup": "^3.29.4", "rollup-plugin-swc3": "^0.10.2", - "ts-node": "^10.9.1" + "ts-node": "^10.9.1", + "vue": "^3.3.4" } } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index adf583ce1b01f..6d96739343c00 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -24,6 +24,7 @@ "dependencies": { "@blocksuite/block-std": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/blocks": "0.0.0-20230926212737-6d4b1569-nightly", + "@blocksuite/editor": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/global": "0.0.0-20230926212737-6d4b1569-nightly", "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "jotai": "^2.4.3", diff --git a/packages/storage/index.d.ts b/packages/storage/index.d.ts index 11051b6732f6d..636452036bb16 100644 --- a/packages/storage/index.d.ts +++ b/packages/storage/index.d.ts @@ -1,6 +1,19 @@ -/* auto-generated by NAPI-RS */ +/* tslint:disable */ /* eslint-disable */ +/* auto-generated by NAPI-RS */ + +export interface Blob { + contentType: string; + lastModified: string; + size: number; + data: Buffer; +} +/** + * Merge updates in form like `Y.applyUpdate(doc, update)` way and return the + * result binary. + */ +export function mergeUpdatesInApplyWay(updates: Array): Buffer; export class Storage { /** Create a storage instance and establish connection to persist store. */ static connect( @@ -18,16 +31,3 @@ export class Storage { /** Workspace size taken by blobs. */ blobsSize(workspaces: Array): Promise; } - -export interface Blob { - contentType: string; - lastModified: string; - size: number; - data: Buffer; -} - -/** - * Merge updates in form like `Y.applyUpdate(doc, update)` way and return the - * result binary. - */ -export function mergeUpdatesInApplyWay(updates: Array): Buffer; diff --git a/packages/y-indexeddb/package.json b/packages/y-indexeddb/package.json index 9ae1901e1b805..dc1f59196e104 100644 --- a/packages/y-indexeddb/package.json +++ b/packages/y-indexeddb/package.json @@ -43,7 +43,8 @@ "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", "vitest": "0.34.6", - "y-indexeddb": "^9.0.11" + "y-indexeddb": "^9.0.11", + "yjs": "^13.6.8" }, "peerDependencies": { "yjs": "^13" diff --git a/packages/y-provider/package.json b/packages/y-provider/package.json index 4739415dbc3c4..1bf0d1d85545b 100644 --- a/packages/y-provider/package.json +++ b/packages/y-provider/package.json @@ -27,7 +27,8 @@ "@blocksuite/store": "0.0.0-20230926212737-6d4b1569-nightly", "vite": "^4.4.11", "vite-plugin-dts": "3.6.0", - "vitest": "0.34.6" + "vitest": "0.34.6", + "yjs": "^13.6.8" }, "peerDependencies": { "yjs": "^13" diff --git a/yarn.lock b/yarn.lock index d5242d0106f08..7fe1b99a88ef8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -414,7 +414,7 @@ __metadata: async-call-rpc: ^6.3.1 builder-util-runtime: ^9.2.1 cross-env: 7.0.3 - electron: ^26.4.0 + electron: ^27.0.0 electron-log: ^5.0.0-rc.1 electron-squirrel-startup: 1.0.0 electron-updater: ^6.1.5 @@ -447,6 +447,7 @@ __metadata: resolution: "@affine/env@workspace:packages/env" dependencies: "@blocksuite/global": 0.0.0-20230926212737-6d4b1569-nightly + "@blocksuite/store": 0.0.0-20230926212737-6d4b1569-nightly lit: ^2.8.0 react: 18.2.0 react-dom: 18.2.0 @@ -547,7 +548,8 @@ __metadata: "@vanilla-extract/webpack-plugin": ^2.3.1 "@vitejs/plugin-react-swc": ^3.4.0 "@vitest/coverage-istanbul": 0.34.6 - "@vitest/ui": 0.34.6 + "@vitest/ui": 0.34.7 + electron: ^27.0.0 eslint: ^8.51.0 eslint-config-prettier: ^9.0.0 eslint-plugin-i: ^2.28.1 @@ -630,6 +632,7 @@ __metadata: rollup: ^3.29.4 rollup-plugin-swc3: ^0.10.2 ts-node: ^10.9.1 + vue: ^3.3.4 bin: af: ./src/af.mjs languageName: unknown @@ -641,6 +644,7 @@ __metadata: dependencies: "@blocksuite/block-std": 0.0.0-20230926212737-6d4b1569-nightly "@blocksuite/blocks": 0.0.0-20230926212737-6d4b1569-nightly + "@blocksuite/editor": 0.0.0-20230926212737-6d4b1569-nightly "@blocksuite/global": 0.0.0-20230926212737-6d4b1569-nightly "@blocksuite/store": 0.0.0-20230926212737-6d4b1569-nightly jotai: ^2.4.3 @@ -12410,6 +12414,7 @@ __metadata: dependencies: "@affine-test/fixtures": "workspace:*" "@affine/sdk": "workspace:*" + "@affine/templates": "workspace:*" "@blocksuite/blocks": 0.0.0-20230926212737-6d4b1569-nightly "@blocksuite/editor": 0.0.0-20230926212737-6d4b1569-nightly "@blocksuite/global": 0.0.0-20230926212737-6d4b1569-nightly @@ -12475,6 +12480,7 @@ __metadata: vitest: 0.34.6 y-indexeddb: ^9.0.11 y-provider: "workspace:*" + yjs: ^13.6.8 peerDependencies: yjs: ^13 languageName: unknown @@ -14024,11 +14030,11 @@ __metadata: languageName: node linkType: hard -"@vitest/ui@npm:0.34.6": - version: 0.34.6 - resolution: "@vitest/ui@npm:0.34.6" +"@vitest/ui@npm:0.34.7": + version: 0.34.7 + resolution: "@vitest/ui@npm:0.34.7" dependencies: - "@vitest/utils": 0.34.6 + "@vitest/utils": 0.34.7 fast-glob: ^3.3.0 fflate: ^0.8.0 flatted: ^3.2.7 @@ -14037,7 +14043,7 @@ __metadata: sirv: ^2.0.3 peerDependencies: vitest: ">=0.30.1 <1" - checksum: aaea587823d38bf5bb1961bbfdddacd42bbcedd7a6f771d8e26f5f597267655a19527434099b11013d00100ddb25a9550d55d1a275c08763dc67407ac7d3baa1 + checksum: 6d1c73ee3bb303645c62bdb4ffb87063631e1771c2dbee0a28537678d09ffc97fa9669e2de6d1cd7e469f2b48dfde88f46fb9686ee82591c24050b6723aa9758 languageName: node linkType: hard @@ -14052,6 +14058,17 @@ __metadata: languageName: node linkType: hard +"@vitest/utils@npm:0.34.7": + version: 0.34.7 + resolution: "@vitest/utils@npm:0.34.7" + dependencies: + diff-sequences: ^29.4.3 + loupe: ^2.3.6 + pretty-format: ^29.5.0 + checksum: d98b8809ada19c207ace43c88d452685adde6966b00e223ac2308b2ea7d0694bdd4d6ff9518ea505e2b5bd4d1b51f44bae430e22fa83ca32c77ad28b61209bc4 + languageName: node + linkType: hard + "@volar/language-core@npm:1.10.4, @volar/language-core@npm:~1.10.4": version: 1.10.4 resolution: "@volar/language-core@npm:1.10.4" @@ -18853,16 +18870,16 @@ __metadata: languageName: node linkType: soft -"electron@npm:^26.4.0": - version: 26.4.0 - resolution: "electron@npm:26.4.0" +"electron@npm:^27.0.0": + version: 27.0.0 + resolution: "electron@npm:27.0.0" dependencies: "@electron/get": ^2.0.0 "@types/node": ^18.11.18 extract-zip: ^2.0.1 bin: electron: cli.js - checksum: eb68e980220dee407af33e5662e53dcf9c40f2c29ff2beac76e227368377979b6d649a529b49503227b59cdb8986dd348588338710059ffa93509aa50027bbee + checksum: 4a84cb894d5f626fe7a2b5171693e903ce82a7673aabc419e5d3d0d2f9cc8441e5088524ecd86a046beab4ba7dd13820b7a94c361c3e7bc2f0959d1a1a860df5 languageName: node linkType: hard @@ -34485,6 +34502,7 @@ __metadata: vite: ^4.4.11 vite-plugin-dts: 3.6.0 vitest: 0.34.6 + yjs: ^13.6.8 peerDependencies: yjs: ^13 languageName: unknown