From 1e7696d423505d3cc79ca99b3b46063a35365e78 Mon Sep 17 00:00:00 2001 From: qq_41923622 Date: Thu, 18 Sep 2025 18:18:12 +0800 Subject: [PATCH] [fix]up --- packages/core/vitest.config.ts | 3 - packages/data-validation/package.json | 76 ------------------------ packages/data-validation/tsconfig.json | 9 --- packages/sheets-ui/tailwind.config.ts | 27 --------- packages/sheets-ui/tsconfig.json | 9 --- packages/sheets-ui/tsconfig.node.json | 4 -- packages/sheets-ui/vitest.config.ts | 3 - src/main.ts | 81 ++++++++++++++++++++++++++ vite.config.ts | 9 +++ 9 files changed, 90 insertions(+), 131 deletions(-) delete mode 100644 packages/core/vitest.config.ts delete mode 100644 packages/data-validation/package.json delete mode 100644 packages/data-validation/tsconfig.json delete mode 100644 packages/sheets-ui/tailwind.config.ts delete mode 100644 packages/sheets-ui/tsconfig.json delete mode 100644 packages/sheets-ui/tsconfig.node.json delete mode 100644 packages/sheets-ui/vitest.config.ts diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts deleted file mode 100644 index af97c6d7..00000000 --- a/packages/core/vitest.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import createConfig from '@univerjs-infra/shared/vitest'; - -export default createConfig(); diff --git a/packages/data-validation/package.json b/packages/data-validation/package.json deleted file mode 100644 index 9e9611ae..00000000 --- a/packages/data-validation/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@univerjs/data-validation", - "version": "0.10.8", - "private": false, - "description": "Data validation library for Univer", - "author": "DreamNum ", - "license": "Apache-2.0", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/univer" - }, - "homepage": "https://univer.ai", - "repository": { - "type": "git", - "url": "https://github.com/dream-num/univer" - }, - "bugs": { - "url": "https://github.com/dream-num/univer/issues" - }, - "keywords": [ - "univer" - ], - "exports": { - ".": "./src/index.ts", - "./*": "./src/*" - }, - "main": "./src/index.ts", - "types": "./lib/types/index.d.ts", - "publishConfig": { - "access": "public", - "main": "./lib/es/index.js", - "module": "./lib/es/index.js", - "exports": { - ".": { - "import": "./lib/es/index.js", - "require": "./lib/cjs/index.js", - "types": "./lib/types/index.d.ts" - }, - "./*": { - "import": "./lib/es/*", - "require": "./lib/cjs/*", - "types": "./lib/types/index.d.ts" - }, - "./lib/*": "./lib/*" - } - }, - "directories": { - "lib": "lib" - }, - "files": [ - "lib" - ], - "scripts": { - "dev": "vite", - "test": "vitest run", - "test:watch": "vitest", - "coverage": "vitest run --coverage", - "build": "univer-cli build" - }, - "peerDependencies": { - "rxjs": ">=7.0.0" - }, - "dependencies": { - "@univerjs/core": "workspace:*" - }, - "devDependencies": { - "@univerjs-infra/shared": "workspace:*", - "@univerjs/core": "workspace:*", - "@univerjs/protocol": "0.1.46", - "@univerjs/sheets": "workspace:*", - "rxjs": "^7.8.2", - "typescript": "^5.9.2", - "vite": "^7.1.4", - "vitest": "^3.2.4" - } -} diff --git a/packages/data-validation/tsconfig.json b/packages/data-validation/tsconfig.json deleted file mode 100644 index c62210cb..00000000 --- a/packages/data-validation/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@univerjs-infra/shared/tsconfigs/base", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types" - }, - "references": [{ "path": "./tsconfig.node.json" }], - "include": ["src"] -} diff --git a/packages/sheets-ui/tailwind.config.ts b/packages/sheets-ui/tailwind.config.ts deleted file mode 100644 index 75967f18..00000000 --- a/packages/sheets-ui/tailwind.config.ts +++ /dev/null @@ -1,27 +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 type { Config } from 'tailwindcss'; -import preset from '@univerjs-infra/shared/tailwind'; - -const config: Config = { - presets: [preset], - content: [ - './src/**/*.{js,ts,jsx,tsx}', - ], -}; - -export default config; diff --git a/packages/sheets-ui/tsconfig.json b/packages/sheets-ui/tsconfig.json deleted file mode 100644 index c62210cb..00000000 --- a/packages/sheets-ui/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@univerjs-infra/shared/tsconfigs/base", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types" - }, - "references": [{ "path": "./tsconfig.node.json" }], - "include": ["src"] -} diff --git a/packages/sheets-ui/tsconfig.node.json b/packages/sheets-ui/tsconfig.node.json deleted file mode 100644 index 4947a099..00000000 --- a/packages/sheets-ui/tsconfig.node.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "@univerjs-infra/shared/tsconfigs/node", - "include": ["vitest.config.ts"] -} diff --git a/packages/sheets-ui/vitest.config.ts b/packages/sheets-ui/vitest.config.ts deleted file mode 100644 index af97c6d7..00000000 --- a/packages/sheets-ui/vitest.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import createConfig from '@univerjs-infra/shared/vitest'; - -export default createConfig(); diff --git a/src/main.ts b/src/main.ts index 92a37240..ed219909 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,3 +24,84 @@ console.log('ddd') // setupCounter(document.querySelector('#counter')!) +import { LocaleType, mergeLocales, Univer, UniverInstanceType } from '../packages/core/src' +import { FUniver } from '../packages/core/src/facade' +import DesignZhCN from '../packages/design/src/locale/zh-CN' +import { UniverDocsPlugin } from '../packages/docs/src' +import { UniverDocsUIPlugin } from '../packages/docs-ui/src' +import DocsUIZhCN from '../packages/docs-ui/src/locale/zh-CN' +import { UniverFormulaEnginePlugin } from '../packages/engine-formula/src' +import { UniverRenderEnginePlugin } from '../packages/engine-render/src' +import { UniverSheetsPlugin } from '../packages/sheets/src' +import { UniverSheetsFormulaPlugin } from '../packages/sheets-formula/src' +import { UniverSheetsFormulaUIPlugin } from '../packages/sheets-formula-ui/src' +import SheetsFormulaUIZhCN from '../packages/sheets-formula-ui/src/locale/zh-CN' +import { UniverSheetsNumfmtPlugin } from '../packages/sheets-numfmt/src' +import { UniverSheetsNumfmtUIPlugin } from '../packages/sheets-numfmt-ui/src' +import SheetsNumfmtUIZhCN from '../packages/sheets-numfmt-ui/src/locale/zh-CN' +import { UniverSheetsUIPlugin } from '../packages/sheets-ui/src' +import SheetsUIZhCN from '../packages/sheets-ui/src/locale/zh-CN' +import SheetsZhCN from '../packages/sheets/src/locale/zh-CN' +import { UniverUIPlugin } from '../packages/ui/src' +import UIZhCN from '../packages/ui/src/locale/zh-CN' +// import '../packages/design/src/globals.css' +// import '../packages/ui/src/globals.css' +// import '../packages/docs-ui/src/globals.css' +// import '../packages/sheets-ui/src/src/globals.css' +// import '../packages/sheets-formula-ui/src/globals.css' +// import '../packages/sheets-numfmt-ui/src/globals.css' + + +import '../packages/engine-formula/src/facade' +import '../packages/ui/src/facade' +import '../packages/docs-ui/src/facade' +import '../packages/sheets/src/facade' +import '../packages/sheets-ui/src/facade' +import '../packages/sheets-formula/src/facade' +import '../packages/sheets-numfmt/src/facade' + +const univer = new Univer({ + locale: LocaleType.ZH_CN, + locales: { + [LocaleType.ZH_CN]: mergeLocales( + DesignZhCN, + UIZhCN, + DocsUIZhCN, + SheetsZhCN, + SheetsUIZhCN, + SheetsFormulaUIZhCN, + SheetsNumfmtUIZhCN, + ), + }, +}) +univer.registerPlugin([ + UniverRenderEnginePlugin, + UniverFormulaEnginePlugin, + [UniverUIPlugin, { + container: 'app', + }], + UniverDocsPlugin, + UniverDocsUIPlugin, + UniverSheetsPlugin, + UniverSheetsUIPlugin, + UniverSheetsFormulaPlugin, + UniverSheetsFormulaUIPlugin, + UniverSheetsNumfmtPlugin, + UniverSheetsNumfmtUIPlugin, +]) +univer.registerPlugin(UniverRenderEnginePlugin) +univer.registerPlugin(UniverFormulaEnginePlugin) +univer.registerPlugin(UniverUIPlugin, { + container: 'app', +}) +// univer.registerPlugin(UniverDocsPlugin) +// univer.registerPlugin(UniverDocsUIPlugin) +// univer.registerPlugin(UniverSheetsPlugin) +// univer.registerPlugin(UniverSheetsUIPlugin) +// univer.registerPlugin(UniverSheetsFormulaPlugin) +// univer.registerPlugin(UniverSheetsFormulaUIPlugin) +// univer.registerPlugin(UniverSheetsNumfmtPlugin) +// univer.registerPlugin(UniverSheetsNumfmtUIPlugin) +univer.createUnit(UniverInstanceType.UNIVER_SHEET, {}) +const univerAPI = FUniver.newAPI(univer) + diff --git a/vite.config.ts b/vite.config.ts index f32a06d1..71df2f67 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from 'vite' +import {resolve} from 'path' // import { viteStaticCopy } from 'vite-plugin-static-copy' @@ -7,6 +8,14 @@ export default defineConfig({ host: true, allowedHosts: true }, + resolve:{ + alias:[ + { + find: '@univerjs/', + replacement: `${resolve(__dirname,'./packages')}/`, + } + ] + } // plugins: [ // viteStaticCopy({ // targets: [ -- GitLab