Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(build): optimize build configurations for multiple packages #2374

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor(build): optimize build configurations for multiple packages
  • Loading branch information
jikkai committed May 31, 2024
commit 79699f89d124677dc55e24566ffcb0f8090f4d77
2 changes: 1 addition & 1 deletion common/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@vitest/coverage-istanbul": "^1.6.0",
"happy-dom": "13.3.8",
"javascript-obfuscator": "^4.1.0",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.6.0"
}
Expand Down
3 changes: 3 additions & 0 deletions common/shared/vite/auto-externalize-dependency-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ exports.autoExternalizeDependency = function autoExternalizeDependency() {

Array.from(externals)
.sort()
.filter((ext) => {
return !ext.endsWith('.less');
})
.forEach((ext) => {
const { version, name, optional } = externalMap[ext] ?? {};

Expand Down
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@univerjs/uniscript": "workspace:*",
"@wendellhu/redi": "0.15.2",
"clsx": "^2.1.1",
"monaco-editor": "0.48.0",
"monaco-editor": "0.49.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-mosaic-component": "^6.1.0",
Expand Down
30 changes: 27 additions & 3 deletions examples/src/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ import UniscriptZhCN from '@univerjs/uniscript/locale/zh-CN';
import SheetPermissionUIEnUS from '@univerjs/sheets-permission-ui/locale/en-US';
import SheetPermissionUIRuRU from '@univerjs/sheets-permission-ui/locale/ru-RU';
import SheetPermissionUIZhCN from '@univerjs/sheets-permission-ui/locale/zh-CN';
import SheetsHyperLinkUIEnUS from '@univerjs/sheets-hyper-link-ui/locale/en-US';
import SheetsHyperLinkUIRuRU from '@univerjs/sheets-hyper-link-ui/locale/ru-RU';
import SheetsHyperLinkUIZhCN from '@univerjs/sheets-hyper-link-ui/locale/zh-CN';
import DrawingUIEnUS from '@univerjs/drawing-ui/locale/en-US';
import DrawingUIRuRU from '@univerjs/drawing-ui/locale/ru-RU';
import DrawingUIZhCN from '@univerjs/drawing-ui/locale/zh-CN';
import SheetsDrawingUIEnUS from '@univerjs/sheets-drawing-ui/locale/en-US';
import SheetsDrawingUIRuRU from '@univerjs/sheets-drawing-ui/locale/ru-RU';
import SheetsDrawingUIZhCN from '@univerjs/sheets-drawing-ui/locale/zh-CN';
import DocsDrawingUIEnUS from '@univerjs/docs-drawing-ui/locale/en-US';
import DocsDrawingUIRuRU from '@univerjs/docs-drawing-ui/locale/ru-RU';
import DocsDrawingUIZhCN from '@univerjs/docs-drawing-ui/locale/zh-CN';

export const zhCN = Tools.deepMerge(
SheetsZhCN,
Expand All @@ -80,7 +92,11 @@ export const zhCN = Tools.deepMerge(
ThreadCommentUIZhCN,
SheetsNumfmtZhCN,
UniscriptZhCN,
SheetPermissionUIZhCN
SheetPermissionUIZhCN,
SheetsHyperLinkUIZhCN,
DrawingUIZhCN,
SheetsDrawingUIZhCN,
DocsDrawingUIZhCN
);

export const enUS = Tools.deepMerge(
Expand All @@ -99,7 +115,11 @@ export const enUS = Tools.deepMerge(
ThreadCommentUIEnUS,
SheetsNumfmtEnUS,
UniscriptEnUS,
SheetPermissionUIEnUS
SheetPermissionUIEnUS,
SheetsHyperLinkUIEnUS,
DrawingUIEnUS,
SheetsDrawingUIEnUS,
DocsDrawingUIEnUS
);

export const ruRU = Tools.deepMerge(
Expand All @@ -118,5 +138,9 @@ export const ruRU = Tools.deepMerge(
ThreadCommentUIRuRU,
SheetsNumfmtRuRU,
UniscriptRuRU,
SheetPermissionUIRuRU
SheetPermissionUIRuRU,
SheetsHyperLinkUIRuRU,
DrawingUIRuRU,
SheetsDrawingUIRuRU,
DocsDrawingUIRuRU
);
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"dayjs": "^1.11.11",
"rxjs": "^7.8.1",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vitest": "^1.6.0"
}
}
2 changes: 1 addition & 1 deletion packages/data-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@wendellhu/redi": "0.15.2",
"rxjs": "^7.8.1",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vitest": "^1.6.0"
}
}
2 changes: 1 addition & 1 deletion packages/debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@wendellhu/redi": "0.15.2",
"rxjs": "^7.8.1",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vitest": "^1.6.0",
"vue": "^3.4.27"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@rc-component/color-picker": "^1.5.3",
"@rc-component/trigger": "^1.18.3",
"@types/react-mentions": "^4.1.13",
"@univerjs/icons": "^0.1.54",
"@univerjs/icons": "^0.1.55",
"rc-dialog": "^9.4.0",
"rc-dropdown": "^4.2.0",
"rc-input": "^1.4.5",
Expand Down Expand Up @@ -107,7 +107,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vitest": "^1.6.0"
}
}
23 changes: 14 additions & 9 deletions packages/docs-drawing-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@univerjs/docs-drawing-ui",
"version": "0.0.1",
"private": true,
"version": "0.1.12",
"private": false,
"description": "",
"author": "DreamNum <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -68,14 +68,19 @@
"peerDependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/design": "workspace:*",
"@univerjs/docs": "workspace:*",
"@univerjs/docs-ui": "workspace:*",
"@univerjs/drawing": "workspace:*",
"@univerjs/drawing-ui": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@univerjs/ui": "workspace:*",
"@wendellhu/redi": ">=0.12.13",
"@wendellhu/redi": "0.15.2",
"clsx": ">=2.0.0",
"react": ">=16.9.0",
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
"rxjs": ">=7.0.0"
},
"dependencies": {
"@univerjs/icons": "^0.1.54"
"@univerjs/icons": "^0.1.55"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand All @@ -88,13 +93,13 @@
"@univerjs/shared": "workspace:*",
"@univerjs/ui": "workspace:*",
"@wendellhu/redi": "0.15.2",
"clsx": "^2.1.0",
"clsx": "^2.1.1",
"less": "^4.2.0",
"ot-json1": "^1.0.2",
"react": "18.2.0",
"rxjs": "^7.8.1",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vitest": "^1.3.1"
"typescript": "^5.4.5",
"vite": "^5.2.12",
"vitest": "^1.6.0"
}
}
4 changes: 3 additions & 1 deletion packages/docs-drawing-ui/src/locale/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

const locale = {
import type zhCN from './zh-CN';

const locale: typeof zhCN = {
docImage: {
title: 'Image',

Expand Down
18 changes: 0 additions & 18 deletions packages/docs-drawing-ui/src/locale/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/docs-drawing-ui/src/locale/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import type enUS from './en-US';
import type zhCN from './zh-CN';

const locale: typeof enUS = {
const locale: typeof zhCN = {
docImage: {
title: 'Изображение',

Expand Down
4 changes: 1 addition & 3 deletions packages/docs-drawing-ui/src/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
* limitations under the License.
*/

import type enUS from './en-US';

const locale: typeof enUS = {
const locale = {
docImage: {
title: '图片',

Expand Down
6 changes: 0 additions & 6 deletions packages/docs-drawing-ui/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import { LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
import type { Dependency } from '@wendellhu/redi';
import { Inject, Injector } from '@wendellhu/redi';
import { enUS, zhCN } from './locale';
import { DocDrawingPopupMenuController } from './controllers/drawing-popup-menu.controller';
import { DocDrawingUIController } from './controllers/doc-drawing.controller';
import { DocDrawingUpdateController } from './controllers/doc-drawing-update.controller';
Expand All @@ -33,11 +32,6 @@ export class UniverDocsDrawingUIPlugin extends Plugin {
@Inject(LocaleService) private readonly _localeService: LocaleService
) {
super();

this._localeService.load({
zhCN,
enUS,
});
}

override onStarting(_injector: Injector): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"react": "18.2.0",
"rxjs": "^7.8.1",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vitest": "^1.6.0"
}
}
3 changes: 2 additions & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/drawing": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@wendellhu/redi": "0.15.2",
"rxjs": ">=7.0.0"
Expand All @@ -76,7 +77,7 @@
"@wendellhu/redi": "0.15.2",
"rxjs": "^7.8.1",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite": "^5.2.12",
"vitest": "^1.6.0"
}
}
21 changes: 11 additions & 10 deletions packages/drawing-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@univerjs/drawing-ui",
"version": "0.0.1",
"private": true,
"version": "0.1.12",
"private": false,
"description": "",
"author": "DreamNum <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -64,14 +64,15 @@
"peerDependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/design": "workspace:*",
"@univerjs/drawing": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"@univerjs/ui": "workspace:*",
"@wendellhu/redi": "0.15.2",
"clsx": ">=2.0.0",
"react": ">=16.9.0",
"rxjs": ">=7.0.0"
"react": "^16.9.0 || ^17.0.0 || ^18.0.0"
},
"dependencies": {
"@univerjs/icons": "^0.1.52"
"@univerjs/icons": "^0.1.55"
},
"devDependencies": {
"@univerjs/core": "workspace:*",
Expand All @@ -81,12 +82,12 @@
"@univerjs/shared": "workspace:*",
"@univerjs/ui": "workspace:*",
"@wendellhu/redi": "0.15.2",
"clsx": "^2.1.0",
"clsx": "^2.1.1",
"less": "^4.2.0",
"react": "^18.2.0",
"react": "18.2.0",
"rxjs": "^7.8.1",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vitest": "^1.3.1"
"typescript": "^5.4.5",
"vite": "^5.2.12",
"vitest": "^1.6.0"
}
}
7 changes: 0 additions & 7 deletions packages/drawing-ui/src/controllers/drawing-ui.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import { ComponentManager, IMenuService } from '@univerjs/ui';
import { Inject, Injector } from '@wendellhu/redi';
import { COMPONENT_IMAGE_POPUP_MENU } from '../views/image-popup-menu/component-name';
import { ImagePopupMenu } from '../views/image-popup-menu/ImagePopupMenu';
import zhCN from '../locale/zh-CN';
import enUS from '../locale/en-US';
import { AutoImageCropOperation, CloseImageCropOperation, OpenImageCropOperation } from '../commands/operations/image-crop.operation';
import { ImageViewer } from '../views/image-viewer/ImageViewer';
import { COMPONENT_IMAGE_VIEWER } from '../views/image-viewer/component-name';
Expand All @@ -38,11 +36,6 @@ export class DrawingUIController extends Disposable {
) {
super();

this._localeService.load({
zhCN,
enUS,
});

this._init();
}

Expand Down
4 changes: 3 additions & 1 deletion packages/drawing-ui/src/locale/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

const locale = {
import type zhCN from './zh-CN';

const locale: typeof zhCN = {
'image-popup': {
replace: 'Replace',
delete: 'Delete',
Expand Down
18 changes: 0 additions & 18 deletions packages/drawing-ui/src/locale/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/drawing-ui/src/locale/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

import type enUS from './en-US';
import type zhCN from './zh-CN';

const locale: typeof enUS = {
const locale: typeof zhCN = {
'image-popup': {
replace: 'Заменить',
delete: 'Удалить',
Expand Down
4 changes: 1 addition & 3 deletions packages/drawing-ui/src/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
* limitations under the License.
*/

import type enUS from './en-US';

const locale: typeof enUS = {
const locale = {
'image-popup': {
replace: '替换',
delete: '删除',
Expand Down
Loading
Loading