mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 09:52:49 +08:00
refactor: use yarn (#1619)
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
"@storybook/addon-interactions": "7.0.0-rc.1",
|
||||
"@storybook/addon-links": "7.0.0-rc.1",
|
||||
"@storybook/builder-vite": "7.0.0-rc.1",
|
||||
"@storybook/jest": "0.0.11-next.0",
|
||||
"@storybook/jest": "0.0.10",
|
||||
"@storybook/react": "7.0.0-rc.1",
|
||||
"@storybook/react-vite": "7.0.0-rc.1",
|
||||
"@storybook/test-runner": "0.10.0-next.11",
|
||||
@@ -47,7 +47,7 @@
|
||||
"@types/react": "^18.0.28",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"@vitejs/plugin-react": "^3.1.0",
|
||||
"jest-mock": "^28.1.3",
|
||||
"jest-mock": "^29.5.0",
|
||||
"storybook": "7.0.0-rc.1",
|
||||
"storybook-dark-mode-v7": "3.0.0-alpha.0",
|
||||
"typescript": "^5.0.2",
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
import type { GetBlob, PutBlob } from '../ipc/types/blob';
|
||||
import type {
|
||||
GetDocumentParameter,
|
||||
GetDocumentResponse,
|
||||
YDocumentUpdate,
|
||||
} from '../ipc/types/document';
|
||||
import type { CreateUser, GetUserParameters, User } from '../ipc/types/user';
|
||||
import type {
|
||||
CreateWorkspace,
|
||||
CreateWorkspaceResult,
|
||||
GetWorkspace,
|
||||
GetWorkspaceResult,
|
||||
GetWorkspaces,
|
||||
GetWorkspacesResult,
|
||||
} from '../ipc/types/workspace';
|
||||
|
||||
export const updateYDocument = async (parameters: YDocumentUpdate) =>
|
||||
await true;
|
||||
|
||||
export const getYDocument = async (
|
||||
parameters: GetDocumentParameter
|
||||
): Promise<GetDocumentResponse> =>
|
||||
await {
|
||||
updates: [],
|
||||
};
|
||||
|
||||
export const createWorkspace = async (
|
||||
parameters: CreateWorkspace
|
||||
): Promise<CreateWorkspaceResult> => await { id: 'xxx', name: 'xxx' };
|
||||
|
||||
export const getWorkspaces = async (
|
||||
parameters: GetWorkspaces
|
||||
): Promise<GetWorkspacesResult> =>
|
||||
await {
|
||||
workspaces: [],
|
||||
};
|
||||
|
||||
export const getWorkspace = async (
|
||||
parameters: GetWorkspace
|
||||
): Promise<GetWorkspaceResult> =>
|
||||
await {
|
||||
workspace: {
|
||||
created_at: 0,
|
||||
id: '',
|
||||
member_count: 1,
|
||||
public: true,
|
||||
type: 0,
|
||||
},
|
||||
};
|
||||
|
||||
export const putBlob = async (parameters: PutBlob): Promise<string> =>
|
||||
await 'path/xxx';
|
||||
|
||||
export const getBlob = async (parameters: GetBlob): Promise<number[]> =>
|
||||
await [];
|
||||
|
||||
/**
|
||||
* This will create a private workspace too.
|
||||
* @returns
|
||||
*/
|
||||
export const createUser = async (parameters: CreateUser): Promise<User> =>
|
||||
await {
|
||||
created_at: 0,
|
||||
id: '1',
|
||||
email: 'xxx@xxx.xxx',
|
||||
name: 'xxx',
|
||||
};
|
||||
|
||||
export const getUser = async (parameters: GetUserParameters): Promise<User> =>
|
||||
await {
|
||||
created_at: 0,
|
||||
id: '1',
|
||||
email: 'xxx@xxx.xxx',
|
||||
name: 'xxx',
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { MessageCenter } from '../../../message';
|
||||
import { WorkspaceUnitCollection } from '../../../workspace-unit-collection';
|
||||
import { TauriIPCProvider } from '..';
|
||||
import * as ipcMethods from './mock-apis';
|
||||
|
||||
describe('tauri-ipc provider', async () => {
|
||||
const workspaceMetaCollection = new WorkspaceUnitCollection();
|
||||
const provider = new TauriIPCProvider({
|
||||
workspaces: workspaceMetaCollection.createScope(),
|
||||
messageCenter: new MessageCenter(),
|
||||
});
|
||||
provider.init(ipcMethods);
|
||||
|
||||
const workspaceName = 'workspace-test';
|
||||
let workspaceId: string | undefined;
|
||||
|
||||
test('create workspace', async () => {
|
||||
const workspaceUnit = await provider.createWorkspace({
|
||||
name: workspaceName,
|
||||
});
|
||||
workspaceId = workspaceUnit?.id;
|
||||
|
||||
expect(workspaceMetaCollection.workspaces.length).toEqual(1);
|
||||
expect(workspaceMetaCollection.workspaces[0].name).toEqual(workspaceName);
|
||||
});
|
||||
|
||||
test('workspace list', async () => {
|
||||
const workspacesMetaCollection1 = new WorkspaceUnitCollection();
|
||||
const provider1 = new TauriIPCProvider({
|
||||
workspaces: workspacesMetaCollection1.createScope(),
|
||||
messageCenter: new MessageCenter(),
|
||||
});
|
||||
provider1.init(ipcMethods);
|
||||
|
||||
await provider1.getUserInfo();
|
||||
await provider1.loadWorkspaces();
|
||||
expect(workspacesMetaCollection1.workspaces.length).toEqual(0);
|
||||
await provider1.createWorkspace({
|
||||
name: workspaceName,
|
||||
});
|
||||
expect(workspacesMetaCollection1.workspaces[0].name).toEqual(workspaceName);
|
||||
expect(workspacesMetaCollection1.workspaces[0].id).toEqual(workspaceId);
|
||||
});
|
||||
|
||||
test('update workspace', async () => {
|
||||
await provider.updateWorkspaceMeta(workspaceId!, {
|
||||
name: '1111',
|
||||
});
|
||||
expect(workspaceMetaCollection.workspaces[0].name).toEqual('1111');
|
||||
});
|
||||
});
|
||||
2
packages/env/package.json
vendored
2
packages/env/package.json
vendored
@@ -6,7 +6,7 @@
|
||||
"next": "=13.2.3",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"zod": "^3.21.3"
|
||||
"zod": "^3.21.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blocksuite/global": "0.5.0-20230320034723-8dfc65e",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"scripts": {
|
||||
"build": "tsc --project ./tsconfig.json",
|
||||
"sync-languages": "NODE_OPTIONS=--experimental-fetch ts-node-esm src/scripts/sync.ts",
|
||||
"sync-languages:check": "pnpm run sync-languages --check",
|
||||
"sync-languages:check": "yarn run sync-languages --check",
|
||||
"download-resources": "NODE_OPTIONS=--experimental-fetch ts-node-esm src/scripts/download.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
@@ -35,7 +35,7 @@
|
||||
"@types/node": "^18.15.3",
|
||||
"@types/prettier": "^2.7.2",
|
||||
"next": "=13.2.3",
|
||||
"prettier": "^2.8.4",
|
||||
"prettier": "^2.8.5",
|
||||
"react-dom": "^18.2.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.2"
|
||||
|
||||
@@ -91,7 +91,7 @@ const main = async () => {
|
||||
|
||||
console.log('Generating meta data...');
|
||||
const code = `// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
// Run \`pnpm run download-resources\` to regenerate.
|
||||
// Run \`yarn run download-resources\` to regenerate.
|
||||
// To overwrite this, please overwrite download.ts script.
|
||||
${availableLanguages
|
||||
.map(
|
||||
|
||||
Reference in New Issue
Block a user