From 11938a524570e53ee9ac0eba154e9ec4a6990318 Mon Sep 17 00:00:00 2001 From: Sky Date: Fri, 23 Sep 2022 17:34:48 +0800 Subject: [PATCH 1/5] chore: init CI config --- .github/workflows/main.yaml | 74 +++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..411bea3 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,74 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: + - develop + - main + paths: + - 'package.json' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::node_modules" + + - uses: actions/cache@v3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install NPM dependencies + run: yarn install + + - name: Config git + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + - name: Get submit version + id: version + uses: ashley-taylor/read-json-property-action@v1.0 + with: + path: ./package.json + property: version + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + # integration submit + - name: Submit Widget + if: ${{ steps.extract_branch.outputs.branch == 'develop' }} + run: | + echo "Submit Widget integration" + npx -y @vikadata/widget-cli submit --version ${{steps.version.outputs.value}} --host ${{ secrets.VIKA_INTEGRATION_HOST }} --token ${{ secrets.VIKA_INTEGRATION_API_TOKEN }} + + # production submit + - name: Submit Widget + if: ${{ steps.extract_branch.outputs.branch == 'main' }} + run: | + echo "Submit Widget production" + npx -y @vikadata/widget-cli submit --version ${{steps.version.outputs.value}} --host ${{ secrets.VIKA_PRODUCTION_HOST }} --token ${{ secrets.VIKA_PRODUCTION_API_TOKEN }} + + - name: Push changes + uses: ad-m/github-push-action@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} \ No newline at end of file From 50342465543312200e631e0d7241b7bf85363d65 Mon Sep 17 00:00:00 2001 From: Sky Date: Fri, 23 Sep 2022 18:22:46 +0800 Subject: [PATCH 2/5] style: update comment --- src/bundler/plugins/fetch-plugin.tsx | 1 + src/bundler/plugins/unpkg-path-plugin.tsx | 6 +++--- src/components/container/container.tsx | 4 ---- src/components/editor_panel/editor_panel.tsx | 1 - src/render_components/components/list_deprecate/list.tsx | 3 --- src/store/features/editorSlice.ts | 4 ++-- 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/bundler/plugins/fetch-plugin.tsx b/src/bundler/plugins/fetch-plugin.tsx index 6f4a9b9..d433ad2 100644 --- a/src/bundler/plugins/fetch-plugin.tsx +++ b/src/bundler/plugins/fetch-plugin.tsx @@ -27,6 +27,7 @@ export const fetchPlugin = (inputCode: string) => { }; }) + // match css file build.onLoad({ filter: /.css$/ }, async (args: any) => { const { data, request } = await axios.get(args.path); const escaped = data diff --git a/src/bundler/plugins/unpkg-path-plugin.tsx b/src/bundler/plugins/unpkg-path-plugin.tsx index 0d41fb1..dde28e1 100644 --- a/src/bundler/plugins/unpkg-path-plugin.tsx +++ b/src/bundler/plugins/unpkg-path-plugin.tsx @@ -7,7 +7,7 @@ export const unpkgPathPlugin = (inputCode: string) => { return { name: 'unpkg-path-plugin', setup(build: esbuild.PluginBuild) { - // 处理入口文件 + // handle entry files build.onResolve({ filter: /(^index\.js$)/ }, (args: any) => { return { path: 'index.js', @@ -15,7 +15,7 @@ export const unpkgPathPlugin = (inputCode: string) => { }; }); - // 处理相对路径 + // match relative path in a module as "./" or "../" build.onResolve({ filter: /^\.+\// }, (args: any) => { const url = new URL(args.path, `${CDN_URL}${args.resolveDir}/`) @@ -25,7 +25,7 @@ export const unpkgPathPlugin = (inputCode: string) => { }; }); - // 处理引入的文件 + // match main file in a module build.onResolve({ filter: /.*/ }, async (args: any) => { return { namespace: RESOLVE_NAMESPACE, diff --git a/src/components/container/container.tsx b/src/components/container/container.tsx index a2993e3..31206ef 100644 --- a/src/components/container/container.tsx +++ b/src/components/container/container.tsx @@ -49,7 +49,6 @@ export const Container: FC = () => { defaultSizes={ATTACH_PANEL_DEFAULT_SIZES} className={'allotment'} > - {/* 代码编辑器 */} { /> - {/* API 文档 */} { onVisibleChange={function noRefCheck() {}} defaultSizes={ATTACH_PANEL_DEFAULT_SIZES} > - {/* 预览区 */}
{
- {/* console 面板 */} { onMount={onEditorDidMount} loading={} options={{ - // 迷你地图 minimap: { enabled: false, }, diff --git a/src/render_components/components/list_deprecate/list.tsx b/src/render_components/components/list_deprecate/list.tsx index da0141e..76609f5 100644 --- a/src/render_components/components/list_deprecate/list.tsx +++ b/src/render_components/components/list_deprecate/list.tsx @@ -67,11 +67,9 @@ export const ListDeprecate: React.FC & { Item: React.FC { props.onMouseOver && props.onMouseOver(e); - // onHoverListItem(e); }, onMouseOut: (e: React.MouseEvent) => { props.onMouseOut && props.onMouseOut(e); - // onOutListItem(e); }, onClick(e: React.MouseEvent) { if (child.props.disabled) { @@ -150,7 +148,6 @@ export const ListDeprecate: React.FC & { Item: React.FC; }; -// FIXME: line color const Item: React.FC = (props) => { const { currentIndex, children, className, ...rest } = props; diff --git a/src/store/features/editorSlice.ts b/src/store/features/editorSlice.ts index 1b118df..3e38bb4 100644 --- a/src/store/features/editorSlice.ts +++ b/src/store/features/editorSlice.ts @@ -3,8 +3,8 @@ import { Message } from 'console-feed/lib/definitions/Component'; import { RootState } from '../store'; export interface IEditorSlice { - isRunning: boolean; // 是否处于运行状态 - isInitialize: boolean; // 是否是初始状态 + isRunning: boolean; + isInitialize: boolean; bundledCode: string; logs: Message[]; isEditorPaneOpen: boolean; From 566383bd803c8fc8c02851dd189c051df1cb946a Mon Sep 17 00:00:00 2001 From: Sky Date: Sun, 25 Sep 2022 16:11:21 +0800 Subject: [PATCH 3/5] chore: clear unnecessary files --- .github/workflows/main.yaml | 74 ------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index 411bea3..0000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,74 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: CI - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the main branch - push: - branches: - - develop - - main - paths: - - 'package.json' - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - # persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::node_modules" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install NPM dependencies - run: yarn install - - - name: Config git - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - - - name: Get submit version - id: version - uses: ashley-taylor/read-json-property-action@v1.0 - with: - path: ./package.json - property: version - - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - # integration submit - - name: Submit Widget - if: ${{ steps.extract_branch.outputs.branch == 'develop' }} - run: | - echo "Submit Widget integration" - npx -y @vikadata/widget-cli submit --version ${{steps.version.outputs.value}} --host ${{ secrets.VIKA_INTEGRATION_HOST }} --token ${{ secrets.VIKA_INTEGRATION_API_TOKEN }} - - # production submit - - name: Submit Widget - if: ${{ steps.extract_branch.outputs.branch == 'main' }} - run: | - echo "Submit Widget production" - npx -y @vikadata/widget-cli submit --version ${{steps.version.outputs.value}} --host ${{ secrets.VIKA_PRODUCTION_HOST }} --token ${{ secrets.VIKA_PRODUCTION_API_TOKEN }} - - - name: Push changes - uses: ad-m/github-push-action@main - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} \ No newline at end of file From e7ecfa53b0fe6a677544b34456f154e8241f427a Mon Sep 17 00:00:00 2001 From: Sky Date: Sun, 25 Sep 2022 19:01:22 +0800 Subject: [PATCH 4/5] chore: update workflow config --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8ffc5ed..6bf01b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,7 +68,7 @@ jobs: npx -y @vikadata/widget-cli submit --version ${{steps.version.outputs.value}} --host ${{ secrets.VIKA_PRODUCTION_HOST }} --token ${{ secrets.VIKA_PRODUCTION_API_TOKEN }} - name: Push changes - uses: ad-m/github-push-action@main + uses: ad-m/github-push-action@mater with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} From e4d18bafb998807d3b9009ef6de93a9d0f223d26 Mon Sep 17 00:00:00 2001 From: Sky Date: Sun, 25 Sep 2022 19:05:03 +0800 Subject: [PATCH 5/5] chore: update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 854a40b..6e759ad 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.0.1", + "version": "0.0.2", "description": "a vika widget", "engines": { "node": ">=8.x"