mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
refactor(infra): remove old plugin system (#5411)
plugin system need redesign
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { openHomePage, openPluginPage } from '@affine-test/kit/utils/load-page';
|
||||
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
test('plugin map should valid', async ({ page }) => {
|
||||
await openPluginPage(page);
|
||||
await page.waitForSelector('[data-plugins-load-status="success"]');
|
||||
});
|
||||
|
||||
test('plugin should exist', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitForEditorLoad(page);
|
||||
await page.route('**/plugins/**/package.json', route => route.fetch(), {
|
||||
times: 5,
|
||||
});
|
||||
await page.waitForTimeout(50);
|
||||
const packageJson = await page.evaluate(() => {
|
||||
// @ts-expect-error
|
||||
return window.__pluginPackageJson__.sort((a, b) =>
|
||||
a.name.localeCompare(b.name)
|
||||
);
|
||||
});
|
||||
const plugins = [
|
||||
'@affine/copilot-plugin',
|
||||
'@affine/hello-world-plugin',
|
||||
'@affine/image-preview-plugin',
|
||||
'@affine/vue-hello-world-plugin',
|
||||
];
|
||||
expect(packageJson).toEqual(
|
||||
plugins
|
||||
.map(name => ({
|
||||
name,
|
||||
version: expect.any(String),
|
||||
description: expect.any(String),
|
||||
affinePlugin: expect.anything(),
|
||||
}))
|
||||
.sort((a, b) => a.name.localeCompare(b.name))
|
||||
);
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "@affine-test/affine-plugin",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"e2e": "yarn playwright test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@affine-test/fixtures": "workspace:*",
|
||||
"@affine-test/kit": "workspace:*",
|
||||
"@playwright/test": "^1.39.0"
|
||||
},
|
||||
"version": "0.11.0"
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
import type {
|
||||
PlaywrightTestConfig,
|
||||
PlaywrightWorkerOptions,
|
||||
} from '@playwright/test';
|
||||
// import { devices } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
* https://github.com/motdotla/dotenv
|
||||
*/
|
||||
// require('dotenv').config();
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
const config: PlaywrightTestConfig = {
|
||||
testDir: './e2e',
|
||||
fullyParallel: true,
|
||||
timeout: process.env.CI ? 50_000 : 30_000,
|
||||
use: {
|
||||
baseURL: 'http://localhost:8080/',
|
||||
browserName:
|
||||
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ??
|
||||
'chromium',
|
||||
permissions: ['clipboard-read', 'clipboard-write'],
|
||||
viewport: { width: 1440, height: 800 },
|
||||
actionTimeout: 5 * 1000,
|
||||
locale: 'en-US',
|
||||
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer
|
||||
// You can open traces locally(`npx playwright show-trace trace.zip`)
|
||||
// or in your browser on [Playwright Trace Viewer](https://trace.playwright.dev/).
|
||||
trace: 'on-first-retry',
|
||||
// Record video only when retrying a test for the first time.
|
||||
video: 'on-first-retry',
|
||||
},
|
||||
forbidOnly: !!process.env.CI,
|
||||
workers: 4,
|
||||
retries: 1,
|
||||
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot'
|
||||
// default 'list' when running locally
|
||||
// See https://playwright.dev/docs/test-reporters#github-actions-annotations
|
||||
reporter: process.env.CI ? 'github' : 'list',
|
||||
|
||||
webServer: [
|
||||
// Intentionally not building the web, reminds you to run it by yourself.
|
||||
{
|
||||
command: 'yarn run start:web-static',
|
||||
port: 8080,
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: !process.env.CI,
|
||||
env: {
|
||||
COVERAGE: process.env.COVERAGE || 'false',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
if (process.env.CI) {
|
||||
config.retries = 3;
|
||||
config.workers = '50%';
|
||||
}
|
||||
|
||||
export default config;
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["e2e"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../tests/kit"
|
||||
},
|
||||
{
|
||||
"path": "../../tests/fixtures"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6,10 +6,6 @@ export async function openHomePage(page: Page) {
|
||||
await page.goto(coreUrl);
|
||||
}
|
||||
|
||||
export async function openPluginPage(page: Page) {
|
||||
await page.goto(`${coreUrl}/_plugin/index.html`);
|
||||
}
|
||||
|
||||
export async function open404Page(page: Page) {
|
||||
await page.goto(`${coreUrl}/404`);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'ses';
|
||||
import '@affine/component/theme/global.css';
|
||||
import '@affine/component/theme/theme.css';
|
||||
import { createI18n } from '@affine/i18n';
|
||||
@@ -19,7 +18,6 @@ import { setupGlobal, type Environment } from '@affine/env/global';
|
||||
import type { Preview } from '@storybook/react';
|
||||
import { useLayoutEffect, useRef } from 'react';
|
||||
import { setup } from '@affine/core/bootstrap/setup';
|
||||
import { bootstrapPluginSystem } from '@affine/core/bootstrap/register-plugins';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { currentWorkspaceAtom } from '@affine/workspace/atom';
|
||||
|
||||
@@ -117,9 +115,6 @@ window.localStorage.setItem(
|
||||
const store = createStore();
|
||||
_setCurrentStore(store);
|
||||
setup();
|
||||
bootstrapPluginSystem(store).catch(err => {
|
||||
console.error('Failed to bootstrap plugin system', err);
|
||||
});
|
||||
workspaceManager
|
||||
.createWorkspace(WorkspaceFlavour.LOCAL, async w => {
|
||||
w.meta.setName('test-workspace');
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"{projectRoot}/.storybook/**/*",
|
||||
"{workspaceRoot}/packages/frontend/core/src/**/*",
|
||||
"{workspaceRoot}/packages/common/infra/**/*",
|
||||
"{workspaceRoot}/packages/common/sdk/**/*",
|
||||
{
|
||||
"runtime": "node -v"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { BlockSuiteEditor } from '@affine/component/block-suite-editor';
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||
import { ImagePreviewModal } from '@affine/image-preview-plugin/src/component';
|
||||
import { ImagePreviewModal } from '@affine/core/components/image-preview';
|
||||
import { waitForCurrentWorkspaceAtom } from '@affine/workspace/atom';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import type { Meta } from '@storybook/react';
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
{
|
||||
"path": "../../packages/frontend/workspace"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/plugins/image-preview"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user