Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into fix/hyper-link-range-s…
Browse files Browse the repository at this point in the history
…elector
  • Loading branch information
weird94 committed Sep 29, 2024
2 parents 8373152 + d0a9f24 commit 79bc52f
Show file tree
Hide file tree
Showing 117 changed files with 1,097 additions and 976 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: 📦 Build

on:
push:
branches: [dev]
branches:
- dev
pull_request:
branches: [dev]
branches:
- dev

permissions:
contents: read
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: 🧪 CI Test

on:
push:
branches: [main, dev]
branches:
- dev
pull_request:
branches: [main, dev]
branches:
- dev

permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 🎭 Playwright Tests

on:
pull_request:
branches: [dev]
branches:
- dev

jobs:
e2e-test:
Expand Down
80 changes: 8 additions & 72 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,56 +70,13 @@ jobs:
- name: 🐙 Publish
run: |
if [[ ${{ needs.prepare.outputs.release_type }} == "alpha" ]]; then
pnpm publish --access public --tag ${{ needs.prepare.outputs.release_type }} -r --no-git-checks
else
if [[ ${{ needs.prepare.outputs.release_type }} == "stable" ]]; then
pnpm publish --access public -r --no-git-checks
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

release-verdaccio:
needs: [prepare]
if: github.repository == 'dream-num/univer'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: 🚚 Install dependencies and build
run: |
pnpm install
pnpm build
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: ${{ secrets.VERDACCIO_URL }}
scope: '@univerjs'

- name: 🐙 Publish
run: |
if [[ ${{ needs.prepare.outputs.release_type }} == "alpha" ]]; then
pnpm publish --access public --tag ${{ needs.prepare.outputs.release_type }} -r --no-git-checks
else
pnpm publish --access public -r --no-git-checks
pnpm publish --access public --tag ${{ needs.prepare.outputs.release_type }} -r --no-git-checks
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.VERDACCIO_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

build-demo:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -149,29 +106,8 @@ jobs:
id: vercel-demo
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID}}

sync-cnpm:
runs-on: ubuntu-latest
needs: [release-npm]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: 🚚 Install dependencies
run: pnpm install cnpm -g

- name: 🐙 Sync to cnpm
run: pnpm sync:cnpm
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID }}

build-storybook:
runs-on: ubuntu-latest
Expand All @@ -196,12 +132,12 @@ jobs:
id: vercel-storybook
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID}}
vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK}}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID_STORYBOOK }}
vercel-args: --prod

notify:
needs: [release-npm, release-verdaccio, build-demo, build-storybook]
needs: [release-npm, build-demo, build-storybook]
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/sync-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: 🔮 Sync Mirror

on:
push:
branches: [main, dev]
branches:
- main
- dev

jobs:
sync:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/sync-pro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 🔫 Sync to Pro

on:
push:
branches: [dev]
branches:
- dev

jobs:
update-submodules:
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@


# [0.3.0](https://github.com/dream-num/univer/compare/v0.3.0-alpha.1...v0.3.0) (2024-09-29)


### Features

* **sheet:** add flag to get better performance ([#3631](https://github.com/dream-num/univer/issues/3631)) ([7f0d181](https://github.com/dream-num/univer/commit/7f0d181588ca03c8872693ec600e5e2bc5b809b9))

# [0.3.0-alpha.1](https://github.com/dream-num/univer/compare/v0.3.0-alpha.0...v0.3.0-alpha.1) (2024-09-29)


### Bug Fixes

* bg border return before getCell ([#3623](https://github.com/dream-num/univer/issues/3623)) ([2e7b201](https://github.com/dream-num/univer/commit/2e7b201ab8a6183242619dfc908ba3a9326ef01c))
* **data-validation:** remove useless interceptor mutations ([#3630](https://github.com/dream-num/univer/issues/3630)) ([fd48e15](https://github.com/dream-num/univer/commit/fd48e15e22ebf32c4cc5384cfea0f1735ff7d0b4))

# [0.3.0-alpha.0](https://github.com/dream-num/univer/compare/v0.2.15...v0.3.0-alpha.0) (2024-09-28)


Expand Down
2 changes: 1 addition & 1 deletion common/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@univerjs-infra/shared",
"version": "0.3.0-alpha.0",
"version": "0.3.0",
"private": true,
"description": "Some infrastructures for univerjs",
"author": "DreamNum <developer@univer.ai>",
Expand Down
11 changes: 5 additions & 6 deletions common/shared/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

const process = require('node:process');
const { resolve } = require('node:path');
const process = require('node:process');

const { defineConfig, mergeConfig } = require('vitest/config');
const { default: dts } = require('vite-plugin-dts');
const react = require('@vitejs/plugin-react');
const { default: dts } = require('vite-plugin-dts');
const { defineConfig, mergeConfig } = require('vitest/config');
const { autoExternalizeDependency } = require('./auto-externalize-dependency-plugin');
const { obfuscator } = require('./obfuscator');
const { buildPkg } = require('./build-pkg');
const { obfuscator } = require('./obfuscator');
const { convertLibNameFromPackageName } = require('./utils');

/**
Expand Down Expand Up @@ -78,8 +78,7 @@ function createViteConfig(overrideConfig, /** @type {IOptions} */ options) {
],
define: {
'process.env.NODE_ENV': JSON.stringify(mode),
'process.env.BUNDLE_TYPE': JSON.stringify(process.env.BUNDLE_TYPE ?? ''),
'process.env.BUILD_TIMESTAMP': JSON.stringify(parseInt(Date.now() / 1000)),
'process.env.BUILD_TIMESTAMP': JSON.stringify(Number.parseInt(Date.now() / 1000)),
},
test: {
css: {
Expand Down
13 changes: 5 additions & 8 deletions common/shared/vite/obfuscator.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@
* limitations under the License.
*/

const process = require('node:process');
const JavaScriptObfuscator = require('javascript-obfuscator');

exports.obfuscator = function obfuscator() {
return {
name: 'obfuscator',
enforce: 'post',
async generateBundle(_options, bundle) {
if (process.env.BUNDLE_TYPE === 'lite') {
for (const file in bundle) {
if (bundle[file].type === 'chunk' && /\.js$/.test(file)) {
const code = bundle[file].code;
const obfuscationResult = JavaScriptObfuscator.obfuscate(code);
bundle[file].code = obfuscationResult.getObfuscatedCode();
}
for (const file in bundle) {
if (bundle[file].type === 'chunk' && /\.js$/.test(file)) {
const code = bundle[file].code;
const obfuscationResult = JavaScriptObfuscator.obfuscate(code);
bundle[file].code = obfuscationResult.getObfuscatedCode();
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion common/storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@univerjs/storybook",
"version": "0.3.0-alpha.0",
"version": "0.3.0",
"private": true,
"description": "Some infrastructures for univerjs",
"author": "DreamNum <developer@univer.ai>",
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "univer",
"type": "module",
"version": "0.3.0-alpha.0",
"version": "0.3.0",
"private": true,
"packageManager": "pnpm@9.4.0",
"author": "DreamNum Inc. <developer@univer.ai>",
Expand Down Expand Up @@ -40,8 +40,7 @@
"lint:fix": "eslint . --fix",
"storybook:dev": "pnpm --filter @univerjs/storybook dev:storybook",
"storybook:build": "pnpm --filter @univerjs/storybook build:storybook",
"release": "release-it",
"sync:cnpm": "turbo sync:cnpm"
"release": "release-it"
},
"devDependencies": {
"@antfu/eslint-config": "3.7.3",
Expand Down
3 changes: 1 addition & 2 deletions packages-experimental/debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
],
"scripts": {
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/

import type { Workbook } from '@univerjs/core';
import { connectInjector, ICommandService, Inject, Injector, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType, useDependency } from '@univerjs/core';
import { connectInjector, ICommandService, IConfigService, Inject, Injector, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType, useDependency } from '@univerjs/core';
import { SetBackgroundColorCommand } from '@univerjs/sheets';
import { IMAGE_MENU_ID as SheetsImageMenuId } from '@univerjs/sheets-drawing-ui';
import { RenderSheetContent, SetRangeBoldCommand, SetRangeFontFamilyCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeStrickThroughCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SheetUIController } from '@univerjs/sheets-ui';
import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService, useObservable } from '@univerjs/ui';
import { BuiltinUniToolbarItemId, generateCloneMutation, UniToolbarService, UniUIPart } from '@univerjs/uniui';
import React from 'react';
import { SetBackgroundColorCommand } from '@univerjs/sheets';
import { IMAGE_MENU_ID as SheetsImageMenuId } from '@univerjs/sheets-drawing-ui';
import { UniSheetBar } from '../views/uni-sheet-bar/UniSheetBar';
import { SHEET_BOLD_MUTATION_ID, SHEET_ITALIC_MUTATION_ID, SHEET_STRIKE_MUTATION_ID, SHEET_UNDERLINE_MUTATION_ID } from './menu';
import { menuSchema } from './menu.schema';
Expand All @@ -36,6 +36,7 @@ export class UniSheetsUIController extends SheetUIController {
@IShortcutService shortcutService: IShortcutService,
@IMenuManagerService menuManagerService: IMenuManagerService,
@IUIPartsService uiPartsService: IUIPartsService,
@IConfigService configService: IConfigService,
@Inject(UniToolbarService) private readonly _toolbarService: UniToolbarService
) {
super(
Expand All @@ -45,7 +46,8 @@ export class UniSheetsUIController extends SheetUIController {
commandService,
shortcutService,
menuManagerService,
uiPartsService
uiPartsService,
configService
);
this._initUniMenus();
this._initMutations();
Expand Down
5 changes: 2 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@univerjs/core",
"version": "0.3.0-alpha.0",
"version": "0.3.0",
"private": false,
"description": "Core library for Univer.",
"author": "DreamNum <developer@univer.ai>",
Expand Down Expand Up @@ -56,8 +56,7 @@
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint:types": "tsc --noEmit",
"build": "tsc && vite build",
"sync:cnpm": "cnpm sync"
"build": "tsc && vite build"
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
Expand Down
16 changes: 10 additions & 6 deletions packages/core/src/services/command/command.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/

import type { IAccessor, IDisposable } from '../../common/di';
import { createIdentifier, Inject, Injector } from '../../common/di';
import type { IKeyValue } from '../../shared/types';

import { findLast, remove } from '../../common/array';
import { createIdentifier, Inject, Injector } from '../../common/di';
import { CustomCommandExecutionError } from '../../common/error';
import { sequence, sequenceAsync } from '../../common/sequence';
import { Disposable, DisposableCollection, toDisposable } from '../../shared/lifecycle';
import type { IKeyValue } from '../../shared/types';
import { IContextService } from '../context/context.service';
import { ILogService } from '../log/log.service';
import { CustomCommandExecutionError } from '../../common/error';

/**
* The type of a command.
Expand Down Expand Up @@ -270,7 +270,7 @@ class CommandRegistry {
}
}

interface ICommandExecutionStackItem extends ICommandInfo {}
interface ICommandExecutionStackItem extends ICommandInfo { }

export const NilCommand: ICommand = {
id: 'nil',
Expand Down Expand Up @@ -423,8 +423,12 @@ export class CommandService extends Disposable implements ICommandService {

throw new Error(`[CommandService]: command "${id}" is not registered.`);
} catch (error) {
this._logService.error(error);
throw error;
if (error instanceof CustomCommandExecutionError) {
return false as R;
} else {
this._logService.error(error);
throw error;
}
}
}

Expand Down
Loading

0 comments on commit 79bc52f

Please sign in to comment.