mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 09:21:24 +08:00
Merge branch 'canary' into stable
This commit is contained in:
@@ -122,8 +122,10 @@ export default {
|
||||
schemes: [productName.toLowerCase()],
|
||||
},
|
||||
],
|
||||
asar: true,
|
||||
},
|
||||
makers,
|
||||
plugins: [{ name: '@electron-forge/plugin-auto-unpack-natives', config: {} }],
|
||||
hooks: {
|
||||
readPackageJson: async (_, packageJson) => {
|
||||
// we want different package name for canary build
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@affine/electron",
|
||||
"private": true,
|
||||
"version": "0.10.2",
|
||||
"version": "0.10.3-canary.2",
|
||||
"author": "toeverything",
|
||||
"repository": {
|
||||
"url": "https://github.com/toeverything/AFFiNE",
|
||||
@@ -32,38 +32,39 @@
|
||||
"@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/shared-types": "^6.4.2",
|
||||
"@electron/remote": "2.0.12",
|
||||
"@blocksuite/blocks": "0.0.0-20231122113751-6bf81eb3-nightly",
|
||||
"@blocksuite/editor": "0.0.0-20231122113751-6bf81eb3-nightly",
|
||||
"@blocksuite/lit": "0.0.0-20231122113751-6bf81eb3-nightly",
|
||||
"@blocksuite/store": "0.0.0-20231122113751-6bf81eb3-nightly",
|
||||
"@electron-forge/cli": "^7.1.0",
|
||||
"@electron-forge/core": "^7.1.0",
|
||||
"@electron-forge/core-utils": "^7.1.0",
|
||||
"@electron-forge/maker-deb": "^7.1.0",
|
||||
"@electron-forge/maker-dmg": "^7.1.0",
|
||||
"@electron-forge/maker-squirrel": "^7.1.0",
|
||||
"@electron-forge/maker-zip": "^7.1.0",
|
||||
"@electron-forge/plugin-auto-unpack-natives": "^7.1.0",
|
||||
"@electron-forge/shared-types": "^7.1.0",
|
||||
"@electron/remote": "2.1.0",
|
||||
"@reforged/maker-appimage": "^3.3.1",
|
||||
"@toeverything/infra": "workspace:*",
|
||||
"@types/uuid": "^9.0.5",
|
||||
"builder-util-runtime": "^9.2.1",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"builder-util-runtime": "^9.2.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "^27.0.0",
|
||||
"electron-log": "^5.0.0",
|
||||
"electron": "^27.1.0",
|
||||
"electron-log": "^5.0.1",
|
||||
"electron-squirrel-startup": "1.0.0",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"esbuild": "^0.19.4",
|
||||
"esbuild": "^0.19.7",
|
||||
"fs-extra": "^11.1.1",
|
||||
"glob": "^10.3.10",
|
||||
"jotai": "^2.4.3",
|
||||
"jotai": "^2.5.1",
|
||||
"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",
|
||||
"undici": "^5.27.2",
|
||||
"uuid": "^9.0.1",
|
||||
"vitest": "0.34.6",
|
||||
"which": "^4.0.0",
|
||||
@@ -73,8 +74,8 @@
|
||||
"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"
|
||||
"nanoid": "^5.0.3",
|
||||
"yjs": "^13.6.10"
|
||||
},
|
||||
"build": {
|
||||
"protocols": [
|
||||
|
||||
@@ -11,9 +11,8 @@ async function buildLayers() {
|
||||
};
|
||||
|
||||
if (process.env.BUILD_TYPE_OVERRIDE) {
|
||||
define[
|
||||
'process.env.BUILD_TYPE_OVERRIDE'
|
||||
] = `"${process.env.BUILD_TYPE_OVERRIDE}"`;
|
||||
define['process.env.BUILD_TYPE_OVERRIDE'] =
|
||||
`"${process.env.BUILD_TYPE_OVERRIDE}"`;
|
||||
}
|
||||
|
||||
await esbuild.build({
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
import { readdir } from 'node:fs/promises';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const outputRoot = fileURLToPath(
|
||||
new URL(
|
||||
'../out/canary/AFFiNE-canary-darwin-arm64/AFFiNE-canary.app/Contents/Resources/app',
|
||||
'../out/canary/AFFiNE-canary-darwin-arm64/AFFiNE-canary.app/Contents/Resources',
|
||||
import.meta.url
|
||||
)
|
||||
);
|
||||
|
||||
const outputList = [
|
||||
['dist', ['main.js', 'helper.js', 'preload.js', 'affine.darwin-arm64.node']],
|
||||
] as [entry: string, expected: string[]][];
|
||||
|
||||
await Promise.all(
|
||||
outputList.map(async ([entry, output]) => {
|
||||
const files = await readdir(`${outputRoot}/${entry}`);
|
||||
output.forEach(file => {
|
||||
if (!files.includes(file)) {
|
||||
throw new Error(`File ${entry}/${file} not found`);
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
// todo: use asar package to check contents
|
||||
fs.existsSync(path.resolve(outputRoot, 'app.asar'));
|
||||
|
||||
console.log('Output check passed');
|
||||
|
||||
@@ -77,10 +77,7 @@ export const migrateToLatest = async (
|
||||
);
|
||||
};
|
||||
await downloadBinary(rootDoc, true);
|
||||
const result = await forceUpgradePages({
|
||||
getSchema: () => schema,
|
||||
getCurrentRootDoc: () => Promise.resolve(rootDoc),
|
||||
});
|
||||
const result = await forceUpgradePages(rootDoc, schema);
|
||||
equal(result, true, 'migrateWorkspace should return boolean value');
|
||||
const uploadBinary = async (doc: YDoc, isRoot: boolean) => {
|
||||
await connection.replaceUpdates(doc.guid, [
|
||||
|
||||
@@ -8,7 +8,9 @@ import type { WorkspaceMeta } from '../type';
|
||||
import {
|
||||
getDeletedWorkspacesBasePath,
|
||||
getWorkspaceBasePath,
|
||||
getWorkspaceDBPath,
|
||||
getWorkspaceMeta,
|
||||
getWorkspaceMetaPath,
|
||||
getWorkspacesBasePath,
|
||||
} from './meta';
|
||||
import { workspaceSubjects } from './subjects';
|
||||
@@ -53,6 +55,34 @@ export async function deleteWorkspace(id: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function cloneWorkspace(id: string, newId: string) {
|
||||
const dbPath = await getWorkspaceDBPath(id);
|
||||
const newBasePath = await getWorkspaceBasePath(newId);
|
||||
const newDbPath = await getWorkspaceDBPath(newId);
|
||||
const metaPath = await getWorkspaceMetaPath(newId);
|
||||
// check if new workspace dir exists
|
||||
if (
|
||||
await fs
|
||||
.access(newBasePath)
|
||||
.then(() => true)
|
||||
.catch(() => false)
|
||||
) {
|
||||
throw new Error(`workspace ${newId} already exists`);
|
||||
}
|
||||
|
||||
try {
|
||||
await fs.ensureDir(newBasePath);
|
||||
const meta = {
|
||||
id: newId,
|
||||
mainDBPath: newDbPath,
|
||||
};
|
||||
await fs.writeJSON(metaPath, meta);
|
||||
await fs.copy(dbPath, newDbPath);
|
||||
} catch (error) {
|
||||
logger.error('cloneWorkspace', error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function storeWorkspaceMeta(
|
||||
workspaceId: string,
|
||||
meta: Partial<WorkspaceMeta>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MainEventRegister, WorkspaceMeta } from '../type';
|
||||
import { deleteWorkspace, listWorkspaces } from './handlers';
|
||||
import { cloneWorkspace, deleteWorkspace, listWorkspaces } from './handlers';
|
||||
import { getWorkspaceMeta } from './meta';
|
||||
import { workspaceSubjects } from './subjects';
|
||||
|
||||
@@ -23,4 +23,5 @@ export const workspaceHandlers = {
|
||||
getMeta: async (id: string) => {
|
||||
return getWorkspaceMeta(id);
|
||||
},
|
||||
clone: async (id: string, newId: string) => cloneWorkspace(id, newId),
|
||||
};
|
||||
|
||||
@@ -36,8 +36,8 @@ async function createWindow() {
|
||||
titleBarStyle: isMacOS()
|
||||
? 'hiddenInset'
|
||||
: isWindows()
|
||||
? 'hidden'
|
||||
: 'default',
|
||||
? 'hidden'
|
||||
: 'default',
|
||||
trafficLightPosition: { x: 20, y: 16 },
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
|
||||
Reference in New Issue
Block a user