mirror of
https://github.com/dream-num/univer.git
synced 2026-08-28 14:56:51 +08:00
chore: remove experimental packages from pnpm workspace and simplify vitest configuration (#6422)
This commit is contained in:
+1
-2
@@ -19,8 +19,7 @@
|
||||
"skipChecks": true,
|
||||
"workspaces": [
|
||||
"common/*",
|
||||
"packages/*",
|
||||
"packages-experimental/action-recorder"
|
||||
"packages/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -57,5 +57,7 @@
|
||||
|
||||
"editor.quickSuggestions": {
|
||||
"strings": "on"
|
||||
}
|
||||
},
|
||||
|
||||
"vitest.maximumConfigs": 80
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ The structure of the repository is as follows:
|
||||
├── examples/ demos running on the web
|
||||
├── mockdata/ mock data for development
|
||||
├── packages/ Univer core and plugins
|
||||
├── packages-experimental/ experimental plugins (not published on npm.com)
|
||||
```
|
||||
|
||||
The file structure of a plugin should be organized as follows:
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
"@univerjs/thread-comment": "workspace:*",
|
||||
"@univerjs/thread-comment-ui": "workspace:*",
|
||||
"@univerjs/ui": "workspace:*",
|
||||
"@univerjs/uni-formula-ui": "workspace:*",
|
||||
"@univerjs/uniscript": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -42,15 +42,11 @@ async function generateLocales() {
|
||||
|
||||
const pkgJsonFile = fs.readJsonSync(path.resolve(__dirname, '../package.json'));
|
||||
|
||||
const packages = fs.readdirSync(path.resolve(__dirname, '../../packages'))
|
||||
.filter((dir) => fs.statSync(path.join(__dirname, '../../packages', dir)).isDirectory())
|
||||
.map((dir) => path.join(__dirname, '../../packages', dir));
|
||||
const packages = fs.readdirSync(path.resolve(__dirname, '../../../packages'))
|
||||
.filter((dir) => fs.statSync(path.join(__dirname, '../../../packages', dir)).isDirectory())
|
||||
.map((dir) => path.join(__dirname, '../../../packages', dir));
|
||||
|
||||
const experimentalPackages = fs.readdirSync(path.resolve(__dirname, '../../packages-experimental'))
|
||||
.filter((dir) => fs.statSync(path.join(__dirname, '../../packages-experimental', dir)).isDirectory())
|
||||
.map((dir) => path.join(__dirname, '../../packages-experimental', dir));
|
||||
|
||||
const allPackages = [...packages, ...experimentalPackages];
|
||||
const allPackages = [...packages];
|
||||
for (const pkg of allPackages) {
|
||||
const localePath = path.join(pkg, 'src/locale');
|
||||
if (fs.existsSync(localePath)) {
|
||||
@@ -50,7 +50,6 @@ function createConfig(options) {
|
||||
'src/locale/**',
|
||||
'**/*.stories.tsx',
|
||||
'**/__testing__/**',
|
||||
'packages-experimental/**/*',
|
||||
'**/*/tailwind.config.ts',
|
||||
],
|
||||
},
|
||||
|
||||
@@ -24,7 +24,6 @@ import animate from 'tailwindcss-animate';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const packagesDir = fs.readdirSync(path.resolve(__dirname, '../../packages')).map((dir) => path.resolve(__dirname, `../../packages/${dir}`));
|
||||
const packagesExperimentalDir = fs.readdirSync(path.resolve(__dirname, '../../packages-experimental')).map((dir) => path.resolve(__dirname, `../../packages-experimental/${dir}`));
|
||||
|
||||
const tailwindProjects = packagesDir.concat(packagesExperimentalDir).reduce((acc, dir) => {
|
||||
const tailwindConfig = path.resolve(dir, 'tailwind.config.ts');
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// The type definition is copied from:
|
||||
// packages-experimental/debugger/src/controllers/e2e/e2e.controller.ts
|
||||
// common/debugger/src/controllers/e2e/e2e.controller.ts
|
||||
export interface IE2EControllerAPI {
|
||||
loadAndRelease(id: number, loadTimeout?: number, disposeTimeout?: number): Promise<void>;
|
||||
loadDefaultSheet(loadTimeout?: number): Promise<void>;
|
||||
|
||||
@@ -131,11 +131,6 @@ const entryPoints = [
|
||||
// slides
|
||||
'./src/slides/main.ts',
|
||||
|
||||
// uni
|
||||
'./src/uni/main.ts',
|
||||
'./src/uni/worker.ts',
|
||||
'./src/uni/lazy.ts',
|
||||
|
||||
// mobile sheet
|
||||
'./src/mobile-s/main.ts',
|
||||
'./src/mobile-s/worker.ts',
|
||||
|
||||
@@ -75,13 +75,7 @@
|
||||
"@univerjs/ui": "workspace:*",
|
||||
"@univerjs/ui-adapter-vue3": "workspace:*",
|
||||
"@univerjs/ui-adapter-web-component": "workspace:*",
|
||||
"@univerjs/uni-docs-ui": "workspace:*",
|
||||
"@univerjs/uni-formula": "workspace:*",
|
||||
"@univerjs/uni-formula-ui": "workspace:*",
|
||||
"@univerjs/uni-sheets-ui": "workspace:*",
|
||||
"@univerjs/uni-slides-ui": "workspace:*",
|
||||
"@univerjs/uniscript": "workspace:*",
|
||||
"@univerjs/uniui": "workspace:*",
|
||||
"@univerjs/watermark": "workspace:*",
|
||||
"lit": "^3.3.2",
|
||||
"monaco-editor": "0.55.1",
|
||||
|
||||
@@ -67,9 +67,6 @@ function Examples() {
|
||||
}, {
|
||||
title: '📚 Docs Uniscript',
|
||||
href: './docs-uniscript/',
|
||||
}, {
|
||||
title: '🌌 Uni Mode',
|
||||
href: './uni/',
|
||||
}, {
|
||||
title: '📱 Mobile',
|
||||
href: './mobile-s/',
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* Copyright 2023-present DreamNum Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
|
||||
import { UniverDocUniFormulaUIPlugin } from '@univerjs/uni-formula-ui';
|
||||
import type { Plugin, PluginCtor } from '@univerjs/core';
|
||||
// import { UniverUniscriptPlugin } from '@univerjs/uniscript';
|
||||
|
||||
export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {
|
||||
return [
|
||||
// [
|
||||
// UniverUniscriptPlugin,
|
||||
// {
|
||||
// getWorkerUrl(moduleID: string, label: string) {
|
||||
// if (label === 'typescript' || label === 'javascript') {
|
||||
// return './vs/language/typescript/ts.worker.js';
|
||||
// }
|
||||
|
||||
// return './vs/editor/editor.worker.js';
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
[UniverSheetsFilterUIPlugin],
|
||||
[UniverDocUniFormulaUIPlugin],
|
||||
];
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
/**
|
||||
* Copyright 2023-present DreamNum Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injector, LocaleType, LogLevel, Univer, UniverInstanceType } from '@univerjs/core';
|
||||
import { FUniver } from '@univerjs/core/facade';
|
||||
import { UniverDocsPlugin } from '@univerjs/docs';
|
||||
import { UniverDocsDrawingUIPlugin } from '@univerjs/docs-drawing-ui';
|
||||
import { DocUIController, UniverDocsUIPlugin } from '@univerjs/docs-ui';
|
||||
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
|
||||
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
|
||||
import { DEFAULT_DOCUMENT_DATA_CN, DEFAULT_DOCUMENT_DATA_EN, DEFAULT_SLIDE_DATA, DEFAULT_WORKBOOK_DATA_DEMO, DEFAULT_WORKBOOK_DATA_DEMO1 } from '@univerjs/mockdata';
|
||||
import zhCN from '@univerjs/mockdata/locales/zh-CN';
|
||||
import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
|
||||
import { UniverSheetsPlugin } from '@univerjs/sheets';
|
||||
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
|
||||
import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
|
||||
import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
|
||||
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
|
||||
import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';
|
||||
import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
|
||||
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
|
||||
import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui';
|
||||
import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
|
||||
import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
|
||||
import { SheetUIController, UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
|
||||
import { UniverSlidesPlugin } from '@univerjs/slides';
|
||||
import { SlidesUIController, UniverSlidesUIPlugin } from '@univerjs/slides-ui';
|
||||
import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
|
||||
import { UniDocsUIController } from '@univerjs/uni-docs-ui';
|
||||
import { UniverDocUniFormulaPlugin } from '@univerjs/uni-formula';
|
||||
import { UniSheetsUIController } from '@univerjs/uni-sheets-ui';
|
||||
import { UniSlidesUIController } from '@univerjs/uni-slides-ui';
|
||||
import { UniverUniUIPlugin } from '@univerjs/uniui';
|
||||
|
||||
import '../global.css';
|
||||
|
||||
const LOAD_LAZY_PLUGINS_TIMEOUT = 4_000;
|
||||
|
||||
// univer
|
||||
const univer = new Univer({
|
||||
locale: LocaleType.ZH_CN,
|
||||
locales: {
|
||||
[LocaleType.ZH_CN]: zhCN,
|
||||
},
|
||||
logLevel: LogLevel.VERBOSE,
|
||||
});
|
||||
|
||||
registerBasicPlugins(univer);
|
||||
registerSheetPlugins(univer);
|
||||
registerSlidePlugins(univer);
|
||||
registerUniPlugins(univer);
|
||||
|
||||
// create univer instances
|
||||
univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);
|
||||
univer.createUnit(UniverInstanceType.UNIVER_DOC, DEFAULT_DOCUMENT_DATA_EN);
|
||||
univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO1);
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line ts/naming-convention
|
||||
interface Window {
|
||||
univer?: Univer;
|
||||
univerAPI?: ReturnType<typeof FUniver.newAPI>;
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
import('./lazy').then((lazy) => {
|
||||
const plugins = lazy.default();
|
||||
plugins.forEach((p) => univer.registerPlugin(p[0], p[1]));
|
||||
|
||||
univer.createUnit(UniverInstanceType.UNIVER_DOC, DEFAULT_DOCUMENT_DATA_CN);
|
||||
univer.createUnit(UniverInstanceType.UNIVER_SLIDE, DEFAULT_SLIDE_DATA);
|
||||
});
|
||||
}, LOAD_LAZY_PLUGINS_TIMEOUT);
|
||||
|
||||
window.univer = univer;
|
||||
window.univerAPI = FUniver.newAPI(univer);
|
||||
|
||||
function registerBasicPlugins(univer: Univer) {
|
||||
univer.registerPlugin(UniverDocsPlugin);
|
||||
univer.registerPlugin(UniverFormulaEnginePlugin, {
|
||||
notExecuteFormula: true,
|
||||
});
|
||||
univer.registerPlugin(UniverRenderEnginePlugin);
|
||||
univer.registerPlugin(UniverUniUIPlugin, {
|
||||
container: 'app',
|
||||
});
|
||||
|
||||
univer.registerPlugin(UniverDocsUIPlugin, {
|
||||
override: [
|
||||
[DocUIController, {
|
||||
useFactory: (injector) => {
|
||||
injector.createInstance(UniDocsUIController, {});
|
||||
},
|
||||
deps: [Injector],
|
||||
}],
|
||||
],
|
||||
});
|
||||
|
||||
const worker = new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
|
||||
univer.registerPlugin(UniverRPCMainThreadPlugin, { workerURL: worker });
|
||||
univer.onDispose(() => worker.terminate());
|
||||
|
||||
univer.registerPlugin(UniverThreadCommentUIPlugin);
|
||||
|
||||
univer.registerPlugin(UniverDocsDrawingUIPlugin);
|
||||
}
|
||||
|
||||
function registerSheetPlugins(univer: Univer) {
|
||||
univer.registerPlugin(UniverSheetsPlugin);
|
||||
univer.registerPlugin(UniverSheetsUIPlugin, {
|
||||
override: [
|
||||
[SheetUIController, {
|
||||
useFactory: (injector) => {
|
||||
injector.createInstance(UniSheetsUIController, {});
|
||||
},
|
||||
deps: [Injector],
|
||||
}],
|
||||
],
|
||||
});
|
||||
univer.registerPlugin(UniverSheetsNumfmtPlugin);
|
||||
univer.registerPlugin(UniverSheetsNumfmtUIPlugin);
|
||||
univer.registerPlugin(UniverSheetsFormulaPlugin);
|
||||
univer.registerPlugin(UniverSheetsFormulaUIPlugin);
|
||||
univer.registerPlugin(UniverSheetsFindReplacePlugin);
|
||||
univer.registerPlugin(UniverSheetsHyperLinkUIPlugin);
|
||||
univer.registerPlugin(UniverSheetsSortUIPlugin);
|
||||
univer.registerPlugin(UniverSheetsThreadCommentPlugin);
|
||||
univer.registerPlugin(UniverSheetsConditionalFormattingUIPlugin);
|
||||
univer.registerPlugin(UniverSheetsDrawingUIPlugin);
|
||||
}
|
||||
|
||||
function registerSlidePlugins(univer: Univer) {
|
||||
univer.registerPlugin(UniverSlidesPlugin);
|
||||
univer.registerPlugin(UniverSlidesUIPlugin, {
|
||||
override: [
|
||||
[SlidesUIController, {
|
||||
useClass: UniSlidesUIController,
|
||||
}],
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
function registerUniPlugins(univer: Univer) {
|
||||
univer.registerPlugin(UniverDocUniFormulaPlugin);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright 2023-present DreamNum Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { LocaleType, Univer } from '@univerjs/core';
|
||||
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
|
||||
import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc';
|
||||
import { UniverSheetsPlugin } from '@univerjs/sheets';
|
||||
|
||||
const univer = new Univer({
|
||||
locale: LocaleType.ZH_CN,
|
||||
});
|
||||
|
||||
univer.registerPlugin(UniverSheetsPlugin, { onlyRegisterFormulaRelatedMutations: true });
|
||||
univer.registerPlugin(UniverFormulaEnginePlugin);
|
||||
univer.registerPlugin(UniverRPCWorkerThreadPlugin);
|
||||
|
||||
declare let self: WorkerGlobalScope & typeof globalThis & { univer: Univer };
|
||||
self.univer = univer;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user