docs: update contributing

This commit is contained in:
Wenzhao Hu
2024-10-16 20:57:55 +08:00
parent 9aad18a181
commit 49d590c2e2
4 changed files with 53 additions and 108 deletions
@@ -1,40 +0,0 @@
name: 📸 Update Snapshots on Comment
on:
issue_comment:
types: [created]
jobs:
udpate-snapshots:
if: contains(github.event.comment.body, '/update-snapshots')
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.issue.pull_request.head.ref }}
fetch-depth: 0
- name: Get Branch Name
id: get_branch
run: echo "##[set-output name=branch;]${{ github.event.issue.pull_request.head.ref }}"
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Update Snapshots
uses: ./.github/actions/update-snapshots
- name: Commit Updated Snapshots
shell: bash
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git checkout ${{ steps.get_branch.outputs.branch }}
git add -A
git commit -m "chore(snapshots): update snapshots" || exit 0
git push
+1 -1
View File
@@ -199,7 +199,7 @@ pnpm test:e2e
### Update Snapshots
Univer uses Playwright to perform visual comparison tests. If you have made changes to the UI, the CI may fail due to visual differences. You can update the snapshots ~~by commenting the PR with `/update-snapshots` like [this](https://github.com/dream-num/univer/pull/3655#issuecomment-2398951289), or you can~~ run this GitHub Action [📸 Manually Update Snapshots · Workflow runs · dream-num/univer (github.com)](https://github.com/dream-num/univer/actions/workflows/update-snapshots-manually.yml) manually.
Univer uses Playwright to perform visual comparison tests. If you have made changes to the UI, the CI may fail due to visual differences. You can update the snapshots by running this GitHub Action [📸 Manually Update Snapshots · Workflow runs · dream-num/univer (github.com)](https://github.com/dream-num/univer/actions/workflows/update-snapshots-manually.yml) on your branch.
### Clean code
+9 -1
View File
@@ -14,12 +14,16 @@
* limitations under the License.
*/
import type { Plugin, PluginCtor } from '@univerjs/core';
import { UniverActionRecorderPlugin } from '@univerjs/action-recorder';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
import { UniverUniscriptPlugin } from '@univerjs/uniscript';
import type { Plugin, PluginCtor } from '@univerjs/core';
export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {
return [
@@ -40,9 +44,13 @@ export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCt
return '/vs/editor/editor.worker.js';
},
}],
[UniverSheetsConditionalFormattingUIPlugin],
[UniverActionRecorderPlugin],
[UniverSheetsHyperLinkUIPlugin],
[UniverSheetsCrosshairHighlightPlugin],
[UniverSheetsFilterUIPlugin, { useRemoteFilterValuesGenerator: false }],
[UniverSheetsDrawingUIPlugin],
[UniverSheetsFindReplacePlugin],
[UniverDebuggerPlugin],
];
}
+43 -66
View File
@@ -18,11 +18,9 @@ import type { Nullable } from '@univerjs/core';
import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';
import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { defaultTheme } from '@univerjs/design';
import { UniverDocsPlugin } from '@univerjs/docs';
import { UniverDocsUIPlugin } from '@univerjs/docs-ui';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
import { FUniver } from '@univerjs/facade';
@@ -30,20 +28,17 @@ import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';
import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
import { UniverSheetsPlugin } from '@univerjs/sheets';
import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
import { UniverSheetsDataValidationUIPlugin } from '@univerjs/sheets-data-validation-ui';
import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';
import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
import { UniverSheetsHyperLinkPlugin } from '@univerjs/sheets-hyper-link';
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
import { IThreadCommentMentionDataService, UniverSheetsThreadCommentPlugin, UniverThreadCommentUIPlugin } from '@univerjs/sheets-thread-comment';
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
import { UniverUIPlugin } from '@univerjs/ui';
import { enUS, faIR, ruRU, viVN, zhCN, zhTW } from '../locales';
@@ -52,60 +47,7 @@ const IS_E2E: boolean = !!process.env.IS_E2E;
const LOAD_LAZY_PLUGINS_TIMEOUT = 1_000;
// univer
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
locales: {
[LocaleType.ZH_CN]: zhCN,
[LocaleType.EN_US]: enUS,
[LocaleType.RU_RU]: ruRU,
[LocaleType.ZH_TW]: zhTW,
[LocaleType.VI_VN]: viVN,
[LocaleType.FA_IR]: faIR,
},
logLevel: LogLevel.VERBOSE,
});
univer.registerPlugin(UniverRPCMainThreadPlugin, {
workerURL: new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }),
} as IUniverRPCMainThreadConfig);
univer.registerPlugin(UniverDocsPlugin);
univer.registerPlugin(UniverRenderEnginePlugin);
univer.registerPlugin(UniverUIPlugin, { container: 'app' });
univer.registerPlugin(UniverDocsUIPlugin);
univer.registerPlugin(UniverSheetsPlugin, { notExecuteFormula: true });
univer.registerPlugin(UniverSheetsUIPlugin);
// sheet feature plugins
univer.registerPlugin(UniverSheetsNumfmtPlugin);
univer.registerPlugin(UniverSheetsZenEditorPlugin);
univer.registerPlugin(UniverFormulaEnginePlugin, { notExecuteFormula: true });
univer.registerPlugin(UniverSheetsFormulaPlugin, { notExecuteFormula: true });
univer.registerPlugin(UniverSheetsFormulaUIPlugin);
univer.registerPlugin(UniverSheetsDataValidationPlugin);
univer.registerPlugin(UniverSheetsDataValidationUIPlugin);
// filter plugin
univer.registerPlugin(UniverSheetsFilterPlugin);
// mock lazy load
setTimeout(() => {
// hyperlink
univer.registerPlugin(UniverSheetsHyperLinkUIPlugin);
}, 500);
// sort
univer.registerPlugin(UniverSheetsSortUIPlugin);
// condition formatting
univer.registerPlugin(UniverSheetsConditionalFormattingPlugin);
univer.registerPlugin(UniverSheetsConditionalFormattingUIPlugin);
// drawing
univer.registerPlugin(UniverSheetsDrawingUIPlugin);
const mockUser = {
export const mockUser = {
userID: 'Owner_qxVnhPbQ',
name: 'Owner',
avatar: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgBtZU9TxtBEIbfWRzFSIdkikhBSqRQkJqkCKTCFkqVInSUSaT0wC8w/gXxD4gU2nRJkXQWhAZowDUUWKIwEgWWbEEB3mVmx3dn4DA2nB/ppNuPeWd29mMIPXDr+RxwtgRHeW6+guNPRxogqnL7Dwz9psJ27S4NShaeZTH3kwXy6I81dlRKcmRui88swdq9AcSFL7Buz1Vmlns64MiLsCjzwnIYHLH57tbfFbs7KRaXyEU8FVZofqccOfA5l7Q8LPIkGrwnb2RPNEXWFVMUF3L+kDCk0btDDAMzOm5YfAHDwp4tG74wnzAsiOYMnJ3GoDybA7IT98/jm5+JNnfiIzAS6LlqHQBN/i6b2t/cV1Hh6BfwYlHnHP4AXi5q/8kmMMpOs8+BixZw/Fd6xUEHEbnkgclvQP2fGp7uShRKnQ3G32rkjV1th8JhIGG7tR/JyjGteSOZELwGMmNqIIigRCLRh2OZIE6BjItdd7pCW6Uhm1zzkUtungSxwEUzNpQ+GQumtH1ej1MqgmNT6vwmhCq5yuwq56EYTbgeQUz3yvrpV1b4ok3nYJ+eYhgYmjRUqErx2EDq0Fr8FhG++iqVGqxlUJI/70Ar0UgJaWHj6hYVHJrfKssAHot1JfqwE9WVWzXZVd5z2Ws/4PnmtEjkXeKJDvxUecLbWOXH/DP6QQ4J72NS0adedp1aseBfXP8odlZFfPvBF7SN/8hky1TYuPOAXAEipMx15u5ToAAAAABJRU5ErkJggg==',
@@ -135,12 +77,47 @@ class CustomMentionDataService implements IThreadCommentMentionDataService {
}
}
// comment
univer.registerPlugin(UniverThreadCommentUIPlugin, { overrides: [[IThreadCommentMentionDataService, { useClass: CustomMentionDataService }]] });
univer.registerPlugin(UniverSheetsThreadCommentPlugin);
// univer
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
locales: {
[LocaleType.ZH_CN]: zhCN,
[LocaleType.EN_US]: enUS,
[LocaleType.RU_RU]: ruRU,
[LocaleType.ZH_TW]: zhTW,
[LocaleType.VI_VN]: viVN,
[LocaleType.FA_IR]: faIR,
},
logLevel: LogLevel.VERBOSE,
});
// debugger plugin
univer.registerPlugin(UniverDebuggerPlugin);
univer.registerPlugin(UniverRPCMainThreadPlugin, {
workerURL: new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }),
} as IUniverRPCMainThreadConfig);
univer.registerPlugin(UniverDocsPlugin);
univer.registerPlugin(UniverRenderEnginePlugin);
univer.registerPlugin(UniverUIPlugin, { container: 'app' });
univer.registerPlugin(UniverDocsUIPlugin);
univer.registerPlugin(UniverSheetsPlugin, { notExecuteFormula: true });
univer.registerPlugin(UniverSheetsUIPlugin);
univer.registerPlugin(UniverSheetsNumfmtPlugin);
univer.registerPlugin(UniverSheetsZenEditorPlugin);
univer.registerPlugin(UniverFormulaEnginePlugin, { notExecuteFormula: true });
univer.registerPlugin(UniverSheetsFormulaPlugin, { notExecuteFormula: true });
univer.registerPlugin(UniverSheetsFormulaUIPlugin);
univer.registerPlugin(UniverSheetsDataValidationPlugin);
univer.registerPlugin(UniverSheetsDataValidationUIPlugin);
univer.registerPlugin(UniverSheetsConditionalFormattingPlugin);
univer.registerPlugin(UniverSheetsFilterPlugin);
univer.registerPlugin(UniverSheetsHyperLinkPlugin);
univer.registerPlugin(UniverSheetsSortUIPlugin);
univer.registerPlugin(UniverThreadCommentUIPlugin, {
overrides: [[IThreadCommentMentionDataService, { useClass: CustomMentionDataService }]],
});
univer.registerPlugin(UniverSheetsThreadCommentPlugin);
const injector = univer.__getInjector();
const userManagerService = injector.get(UserManagerService);