mirror of
https://github.com/dream-num/univer.git
synced 2026-09-01 15:29:43 +08:00
feat(umd): create all-in-one UMD bundle (#2062)
* feat(umd): create all-in-one UMD bundle * chore: optimize packaging
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
name: 🩺 CI Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, dev]
|
||||
pull_request:
|
||||
branches: [main, dev]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
eslint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: 🌡️ Run ESLint
|
||||
run: pnpm lint --quiet
|
||||
|
||||
typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: 🧼 Type checking
|
||||
run: npm run lint:types
|
||||
@@ -29,3 +29,37 @@ jobs:
|
||||
uses: codecov/codecov-action@v3
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
eslint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: 🌡️ Run ESLint
|
||||
run: pnpm lint --quiet
|
||||
|
||||
typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: 🧼 Type checking
|
||||
run: pnpm lint:types
|
||||
|
||||
@@ -26,14 +26,14 @@ jobs:
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install --with-deps
|
||||
run: pnpm dlx playwright install --with-deps
|
||||
|
||||
# build the example locally and run from the built files
|
||||
- name: Build E2E Client
|
||||
run: pnpm build:e2e
|
||||
|
||||
- name: Run Playwright Tests
|
||||
run: pnpm exec playwright test
|
||||
run: pnpm dlx playwright test
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
- name: 🚚 Install dependencies and build
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm run build
|
||||
pnpm build
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
@@ -139,7 +139,7 @@ jobs:
|
||||
|
||||
# ================= Deploy Demo =================
|
||||
- name: 📦 Build demo
|
||||
run: pnpm run build:demo
|
||||
run: pnpm build:demo
|
||||
|
||||
- name: Copy demo to workspace
|
||||
run: |
|
||||
|
||||
@@ -39,8 +39,9 @@ const config: StorybookConfig = {
|
||||
const rootDir = resolve(__dirname, rootPath);
|
||||
if (existsSync(rootDir)) {
|
||||
readdirSync(rootDir).forEach((pkg) => {
|
||||
const pkgDir = resolve(rootDir, pkg, 'package.json');
|
||||
if (existsSync(pkgDir)) {
|
||||
const pkgPath = resolve(rootDir, pkg, 'package.json');
|
||||
const srcDir = resolve(rootDir, pkg, 'src');
|
||||
if (existsSync(pkgPath) && existsSync(srcDir)) {
|
||||
stories.push({
|
||||
directory: `${rootPath}/${pkg}/src`,
|
||||
files: '**/*.stories.@(js|jsx|mjs|ts|tsx)',
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
"lint:types": "turbo lint:types",
|
||||
"test": "turbo test -- --passWithNoTests",
|
||||
"coverage": "turbo coverage -- --passWithNoTests",
|
||||
"build": "turbo build",
|
||||
"build": "turbo build && pnpm --filter @univerjs/umd build:umd",
|
||||
"build:demo": "turbo build:demo",
|
||||
"build:e2e": "pnpm --filter univer-examples build:e2e",
|
||||
"serve:e2e": "serve ./examples/local",
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"name": "@univerjs/core",
|
||||
"version": "0.1.7",
|
||||
"private": false,
|
||||
"packageManager": "pnpm@9.0.5",
|
||||
"description": "Core library for Univer.",
|
||||
"author": "DreamNum <developer@univer.ai>",
|
||||
"license": "Apache-2.0",
|
||||
@@ -68,7 +67,7 @@
|
||||
"rxjs": ">=7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@univerjs/protocol": "^0.1.19",
|
||||
"@univerjs/protocol": "^0.1.20",
|
||||
"nanoid": "5.0.7",
|
||||
"numeral": "^2.0.6"
|
||||
},
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
"rxjs": ">=7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@univerjs/protocol": "^0.1.19"
|
||||
"@univerjs/protocol": "^0.1.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
"rxjs": ">=7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@univerjs/protocol": "^0.1.19"
|
||||
"@univerjs/protocol": "^0.1.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# @univerjs/sheets-filter-ui
|
||||
|
||||
[](https://npmjs.org/packages/@univerjs/sheets-filter-ui)
|
||||
[](https://img.shields.io/npm/l/@univerjs/sheets-filter-ui)
|
||||

|
||||

|
||||
|
||||
## 简介
|
||||
|
||||
`@univerjs/sheets-filter-ui` 为 sheets 提供了筛选功能的用户界面。
|
||||
|
||||
## 使用指南
|
||||
|
||||
你应该将此插件与 `@univerjs/sheets-filter` 包一起使用。
|
||||
|
||||
```ts
|
||||
import '@univerjs/sheets-filter-ui/lib/index.css';
|
||||
|
||||
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
|
||||
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
|
||||
|
||||
univer.registerPlugin(UniverSheetsFilterPlugin);
|
||||
univer.registerPlugin(UniverSheetsFilterUIPlugin);
|
||||
```
|
||||
|
||||
### 安装
|
||||
|
||||
```shell
|
||||
# 使用 npm
|
||||
npm install @univerjs/sheets-filter-ui
|
||||
|
||||
# 使用 pnpm
|
||||
pnpm add @univerjs/sheets-filter-ui
|
||||
```
|
||||
@@ -1,16 +1,34 @@
|
||||
# @univerjs/sheets-filter-ui
|
||||
|
||||
[](https://npmjs.org/packages/@univerjs/0.1.1)
|
||||
[](https://img.shields.io/npm/l/@univerjs/0.1.1)
|
||||
[](https://npmjs.org/packages/@univerjs/sheets-filter-ui)
|
||||
[](https://img.shields.io/npm/l/@univerjs/sheets-filter-ui)
|
||||

|
||||

|
||||
|
||||
## Introduction
|
||||
|
||||
> TODO: Introduction
|
||||
`@univerjs/sheets-filter-ui` provides a user interface for filtering in sheets.
|
||||
|
||||
## Usage
|
||||
|
||||
You should use this plugin with the `@univerjs/sheets-filter` package.
|
||||
|
||||
```ts
|
||||
import '@univerjs/sheets-filter-ui/lib/index.css';
|
||||
|
||||
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
|
||||
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
|
||||
|
||||
univer.registerPlugin(UniverSheetsFilterPlugin);
|
||||
univer.registerPlugin(UniverSheetsFilterUIPlugin);
|
||||
```
|
||||
|
||||
### Installation
|
||||
|
||||
```shell
|
||||
npm i @univerjs/0.1.1
|
||||
# Using npm
|
||||
npm install @univerjs/sheets-filter-ui
|
||||
|
||||
# Using pnpm
|
||||
pnpm add @univerjs/sheets-filter-ui
|
||||
```
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "@univerjs/sheets-filter-ui",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"description": "",
|
||||
"version": "0.1.7",
|
||||
"private": false,
|
||||
"description": "Univer Sheets Filter UI",
|
||||
"author": "DreamNum <developer@univer.ai>",
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
@@ -67,14 +67,14 @@
|
||||
"@univerjs/sheets-filter": "workspace:*",
|
||||
"@univerjs/sheets-ui": "workspace:*",
|
||||
"@univerjs/ui": "workspace:*",
|
||||
"@wendellhu/redi": ">=0.12.13",
|
||||
"clsx": ">=2.0.0",
|
||||
"react": ">=16.9.0",
|
||||
"@wendellhu/redi": "^0.13.3",
|
||||
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
||||
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
||||
"rxjs": ">=7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@univerjs/icons": "^0.1.42",
|
||||
"rc-virtual-list": "^3.11.4"
|
||||
"@univerjs/icons": "^0.1.44",
|
||||
"rc-virtual-list": "^3.11.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
@@ -85,13 +85,13 @@
|
||||
"@univerjs/sheets-filter": "workspace:*",
|
||||
"@univerjs/sheets-ui": "workspace:*",
|
||||
"@univerjs/ui": "workspace:*",
|
||||
"@wendellhu/redi": "^0.13.1",
|
||||
"clsx": "^2.1.0",
|
||||
"@wendellhu/redi": "^0.13.3",
|
||||
"clsx": "^2.1.1",
|
||||
"less": "^4.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.10",
|
||||
"vitest": "^1.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# @univerjs/sheets-filter
|
||||
|
||||
[](https://npmjs.org/packages/@univerjs/sheets-filter)
|
||||
[](https://img.shields.io/npm/l/@univerjs/sheets-filter)
|
||||
|
||||
## 简介
|
||||
|
||||
`@univerjs/sheets-filter` 是 Univer Sheet 的筛选插件。
|
||||
|
||||
## 使用指南
|
||||
|
||||
你应该将此插件与 `@univerjs/sheets-filter-ui` 包一起使用。
|
||||
|
||||
### 安装
|
||||
|
||||
```shell
|
||||
# 使用 npm
|
||||
npm install @univerjs/sheets-filter
|
||||
|
||||
# 使用 pnpm
|
||||
pnpm add @univerjs/sheets-filter
|
||||
```
|
||||
@@ -1,16 +1,22 @@
|
||||
# @univerjs/sheets-filter
|
||||
|
||||
[](https://npmjs.org/packages/@univerjs/0.0.1)
|
||||
[](https://img.shields.io/npm/l/@univerjs/0.0.1)
|
||||
[](https://npmjs.org/packages/@univerjs/sheets-filter)
|
||||
[](https://img.shields.io/npm/l/@univerjs/sheets-filter)
|
||||
|
||||
## Introduction
|
||||
|
||||
> TODO: Introduction
|
||||
`@univerjs/sheets-filter` is a filter plugin for Univer Sheet.
|
||||
|
||||
## Usage
|
||||
|
||||
You should use this plugin with the `@univerjs/sheets-filter-ui` package.
|
||||
|
||||
### Installation
|
||||
|
||||
```shell
|
||||
npm i @univerjs/0.0.1
|
||||
# Using npm
|
||||
npm install @univerjs/sheets-filter
|
||||
|
||||
# Using pnpm
|
||||
pnpm add @univerjs/sheets-filter
|
||||
```
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "@univerjs/sheets-filter",
|
||||
"version": "0.1.1",
|
||||
"private": true,
|
||||
"description": "",
|
||||
"version": "0.1.7",
|
||||
"private": false,
|
||||
"description": "A library for filtering data in Univer Sheet",
|
||||
"author": "DreamNum <developer@univer.ai>",
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
@@ -58,21 +58,19 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
"@univerjs/shared": "workspace:*",
|
||||
"@univerjs/sheets": "workspace:*",
|
||||
"@wendellhu/redi": ">=0.12.13",
|
||||
"@wendellhu/redi": "^0.13.3",
|
||||
"rxjs": ">=7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
"@univerjs/shared": "workspace:*",
|
||||
"@univerjs/sheets": "workspace:*",
|
||||
"@wendellhu/redi": "^0.13.1",
|
||||
"@wendellhu/redi": "^0.13.3",
|
||||
"rxjs": "^7.8.1",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.1.4",
|
||||
"vitest": "^1.3.1"
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.10",
|
||||
"vitest": "^1.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
"@univerjs/engine-formula": "workspace:*",
|
||||
"@univerjs/engine-render": "workspace:*",
|
||||
"@univerjs/sheets": "workspace:*",
|
||||
"@univerjs/sheets-numfmt": "workspace:*",
|
||||
"@univerjs/sheets-ui": "workspace:*",
|
||||
"@univerjs/ui": "workspace:*",
|
||||
"@wendellhu/redi": "^0.13.3",
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
"peerDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
"@univerjs/design": "workspace:*",
|
||||
"@univerjs/engine-formula": "workspace:*",
|
||||
"@univerjs/engine-numfmt": "workspace:*",
|
||||
"@univerjs/engine-render": "workspace:*",
|
||||
"@univerjs/sheets": "workspace:*",
|
||||
|
||||
@@ -65,12 +65,13 @@
|
||||
"peerDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
"@univerjs/engine-formula": "workspace:*",
|
||||
"@univerjs/engine-numfmt": "workspace:*",
|
||||
"@univerjs/engine-render": "workspace:*",
|
||||
"@wendellhu/redi": "^0.13.3",
|
||||
"rxjs": ">=7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@univerjs/protocol": "^0.1.19"
|
||||
"@univerjs/protocol": "^0.1.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# @univerjs/umd
|
||||
|
||||
[](https://npmjs.org/package/@univerjs/umd)
|
||||
[](https://img.shields.io/npm/l/@univerjs/umd)
|
||||
|
||||
## 简介
|
||||
|
||||
`@univerjs/umd` 是 Univer 的 UMD 包。它是一个独立的库版本,可以在任何 web 项目中使用,无需模块打包工具。
|
||||
|
||||
## 使用指南
|
||||
|
||||
您可以使用以下脚本标签在 HTML 文件中包含 UMD 包:
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/@univerjs/umd/lib/univer.full.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/@univerjs/umd/lib/univer.css">
|
||||
```
|
||||
|
||||
如果您的项目中已经使用了 React、ReactDOM 和 RxJS,您可以选择 UMD 包的精简版本,该版本不包含这些依赖项。
|
||||
|
||||
```diff
|
||||
+ <script src="https://unpkg.com/react/umd/react.production.min.js"></script>
|
||||
+ <script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
|
||||
+ <script src="https://unpkg.com/rxjs/dist/bundles/rxjs.umd.min.js"></script>
|
||||
|
||||
- <script src="https://unpkg.com/@univerjs/umd/lib/univer.full.umd.js"></script>
|
||||
+ <script src="https://unpkg.com/@univerjs/umd/lib/univer.slim.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/@univerjs/umd/lib/univer.css">
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
# @univerjs/umd
|
||||
|
||||
[](https://npmjs.org/package/@univerjs/umd)
|
||||
[](https://img.shields.io/npm/l/@univerjs/umd)
|
||||
|
||||
## Introduction
|
||||
|
||||
`@univerjs/umd` is a UMD bundle for Univer. It is a standalone version of the library that can be used in any web project without the need for a module bundler.
|
||||
|
||||
## Usage
|
||||
|
||||
You can include the UMD bundle in your HTML file using the following script tag:
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/@univerjs/umd/lib/univer.full.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/@univerjs/umd/lib/univer.css">
|
||||
```
|
||||
|
||||
If you are already using React, ReactDOM, and RxJS in your project, you can opt for the slim version of the UMD bundle, which excludes these dependencies.
|
||||
|
||||
```diff
|
||||
+ <script src="https://unpkg.com/react/umd/react.production.min.js"></script>
|
||||
+ <script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
|
||||
+ <script src="https://unpkg.com/rxjs/dist/bundles/rxjs.umd.min.js"></script>
|
||||
|
||||
- <script src="https://unpkg.com/@univerjs/umd/lib/univer.full.umd.js"></script>
|
||||
+ <script src="https://unpkg.com/@univerjs/umd/lib/univer.slim.umd.js"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/@univerjs/umd/lib/univer.css">
|
||||
```
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "@univerjs/umd",
|
||||
"version": "0.1.7",
|
||||
"private": false,
|
||||
"description": "UMD bundle for Univer",
|
||||
"author": "DreamNum <developer@univer.ai>",
|
||||
"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"
|
||||
],
|
||||
"main": "./lib/univer.full.umd.js",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"exports": {
|
||||
"./lib/*": "./lib/*"
|
||||
}
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=16.0.0",
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build:umd": "node ./scripts/index.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@univerjs/core": "workspace:*",
|
||||
"@univerjs/data-validation": "workspace:*",
|
||||
"@univerjs/design": "workspace:*",
|
||||
"@univerjs/docs": "workspace:*",
|
||||
"@univerjs/docs-ui": "workspace:*",
|
||||
"@univerjs/engine-formula": "workspace:*",
|
||||
"@univerjs/engine-numfmt": "workspace:*",
|
||||
"@univerjs/engine-render": "workspace:*",
|
||||
"@univerjs/facade": "workspace:*",
|
||||
"@univerjs/find-replace": "workspace:*",
|
||||
"@univerjs/image": "workspace:*",
|
||||
"@univerjs/network": "workspace:*",
|
||||
"@univerjs/protocol": "^0.1.20",
|
||||
"@univerjs/rpc": "workspace:*",
|
||||
"@univerjs/sheets": "workspace:*",
|
||||
"@univerjs/sheets-conditional-formatting": "workspace:*",
|
||||
"@univerjs/sheets-conditional-formatting-ui": "workspace:*",
|
||||
"@univerjs/sheets-data-validation": "workspace:*",
|
||||
"@univerjs/sheets-filter": "workspace:*",
|
||||
"@univerjs/sheets-filter-ui": "workspace:*",
|
||||
"@univerjs/sheets-find-replace": "workspace:*",
|
||||
"@univerjs/sheets-formula": "workspace:*",
|
||||
"@univerjs/sheets-numfmt": "workspace:*",
|
||||
"@univerjs/sheets-ui": "workspace:*",
|
||||
"@univerjs/sheets-zen-editor": "workspace:*",
|
||||
"@univerjs/slides": "workspace:*",
|
||||
"@univerjs/slides-ui": "workspace:*",
|
||||
"@univerjs/ui": "workspace:*",
|
||||
"@univerjs/uniscript": "workspace:*",
|
||||
"@wendellhu/redi": "^0.13.3",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.10",
|
||||
"monaco-editor": "0.48.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"rxjs": "^7.8.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* Copyright 2023-present DreamNum Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* TODO: @jikkai
|
||||
* 1. monaco-editor is not included in the build. User may not able to use uniscript by default.
|
||||
* 2. lodash is not included in the build.
|
||||
* 3. vue is not included in the build. User may not able to extend the UI with Vue.
|
||||
*/
|
||||
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const nodeModulesPath = path.resolve(__dirname, '../node_modules');
|
||||
|
||||
function buildCSS() {
|
||||
const libs = [
|
||||
'@univerjs/design',
|
||||
'@univerjs/ui',
|
||||
'@univerjs/docs-ui',
|
||||
'@univerjs/sheets-ui',
|
||||
'@univerjs/sheets-formula',
|
||||
'@univerjs/sheets-numfmt',
|
||||
'@univerjs/sheets-zen-editor',
|
||||
'@univerjs/sheets-data-validation',
|
||||
'@univerjs/sheets-conditional-formatting-ui',
|
||||
'@univerjs/sheets-filter-ui',
|
||||
'@univerjs/slides-ui',
|
||||
'@univerjs/find-replace',
|
||||
'@univerjs/uniscript',
|
||||
];
|
||||
|
||||
const output = libs.map((lib) => {
|
||||
const file = path.resolve(nodeModulesPath, lib, 'lib/index.css');
|
||||
|
||||
if (!fs.existsSync(file)) {
|
||||
throw new Error(`File not found: ${file}`);
|
||||
}
|
||||
|
||||
return fs.readFileSync(file, 'utf-8');
|
||||
});
|
||||
|
||||
return output.join('\n');
|
||||
}
|
||||
|
||||
function buildExternalLib({ react, rxjs }) {
|
||||
const libs = [
|
||||
'clsx/dist/clsx.min.js',
|
||||
'dayjs/dayjs.min.js',
|
||||
'@wendellhu/redi/dist/redi.js',
|
||||
'@wendellhu/redi/dist/react-bindings.js',
|
||||
];
|
||||
if (react) {
|
||||
libs.unshift(
|
||||
'react/umd/react.production.min.js',
|
||||
'react-dom/umd/react-dom.production.min.js'
|
||||
);
|
||||
}
|
||||
if (rxjs) {
|
||||
libs.unshift('rxjs/dist/bundles/rxjs.umd.min.js');
|
||||
}
|
||||
|
||||
const output = libs.map((lib) => {
|
||||
const file = path.resolve(nodeModulesPath, lib);
|
||||
|
||||
if (!fs.existsSync(file)) {
|
||||
throw new Error(`File not found: ${file}`);
|
||||
}
|
||||
|
||||
return fs.readFileSync(file, 'utf-8');
|
||||
});
|
||||
|
||||
return output.join('\n');
|
||||
}
|
||||
|
||||
function buildJS() {
|
||||
const libs = [
|
||||
'@univerjs/protocol',
|
||||
'@univerjs/core',
|
||||
'@univerjs/design',
|
||||
'@univerjs/engine-render',
|
||||
'@univerjs/engine-numfmt',
|
||||
'@univerjs/engine-formula',
|
||||
'@univerjs/ui',
|
||||
'@univerjs/docs',
|
||||
'@univerjs/docs-ui',
|
||||
'@univerjs/sheets',
|
||||
'@univerjs/sheets-ui',
|
||||
'@univerjs/sheets-formula',
|
||||
'@univerjs/sheets-numfmt',
|
||||
'@univerjs/sheets-zen-editor',
|
||||
'@univerjs/sheets-conditional-formatting',
|
||||
'@univerjs/sheets-conditional-formatting-ui',
|
||||
'@univerjs/find-replace',
|
||||
'@univerjs/sheets-find-replace',
|
||||
'@univerjs/data-validation',
|
||||
'@univerjs/sheets-data-validation',
|
||||
'@univerjs/sheets-filter',
|
||||
'@univerjs/sheets-filter-ui',
|
||||
'@univerjs/slides',
|
||||
'@univerjs/slides-ui',
|
||||
'@univerjs/rpc',
|
||||
'@univerjs/network',
|
||||
'@univerjs/facade',
|
||||
'@univerjs/uniscript',
|
||||
];
|
||||
|
||||
const output = libs.map((lib) => {
|
||||
const file = path.resolve(nodeModulesPath, lib, 'lib/umd/index.js');
|
||||
|
||||
if (!fs.existsSync(file)) {
|
||||
throw new Error(`File not found: ${file}`);
|
||||
}
|
||||
|
||||
return fs.readFileSync(file, 'utf-8');
|
||||
});
|
||||
|
||||
return output.join('\n');
|
||||
}
|
||||
|
||||
function generateOutput(filename, output) {
|
||||
const outputFile = path.resolve(__dirname, `../lib/${filename}`);
|
||||
|
||||
if (!fs.existsSync(outputFile)) {
|
||||
fs.mkdirSync(path.dirname(outputFile), { recursive: true });
|
||||
}
|
||||
|
||||
fs.writeFileSync(outputFile, output, 'utf-8');
|
||||
}
|
||||
|
||||
function main() {
|
||||
generateOutput('univer.css', buildCSS());
|
||||
|
||||
const outputJS = buildJS();
|
||||
|
||||
const fullLib = buildExternalLib({
|
||||
react: true,
|
||||
rxjs: true,
|
||||
});
|
||||
generateOutput('univer.full.umd.js', `${fullLib}\n${outputJS}`);
|
||||
|
||||
const slimLib = buildExternalLib({
|
||||
react: false,
|
||||
rxjs: false,
|
||||
});
|
||||
generateOutput('univer.slim.umd.js', `${slimLib}\n${outputJS}`);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('\u001B[32m[@univerjs/umd] Build completed.');
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
Generated
+1660
-1275
File diff suppressed because it is too large
Load Diff
+9
-2
@@ -5,17 +5,24 @@
|
||||
],
|
||||
"pipeline": {
|
||||
"test": {
|
||||
"cache": false
|
||||
},
|
||||
|
||||
"coverage": {
|
||||
"cache": false
|
||||
},
|
||||
"build": {},
|
||||
|
||||
"build": {
|
||||
"cache": false
|
||||
},
|
||||
|
||||
"build:demo": {},
|
||||
|
||||
"build:e2e": {},
|
||||
|
||||
"dev:demo": {
|
||||
"cache": false
|
||||
},
|
||||
|
||||
"lint:types": {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user