Skip to content

Commit

Permalink
refactor: strengthen the codeblitz brand (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
bytemain authored Jul 23, 2024
1 parent 5b99af3 commit 527e3be
Show file tree
Hide file tree
Showing 25 changed files with 232 additions and 682 deletions.
81 changes: 81 additions & 0 deletions .coderabbit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
language: zh-CN
tone_instructions: ''
early_access: true
enable_free_tier: true
reviews:
profile: chill
request_changes_workflow: false
high_level_summary: true
high_level_summary_placeholder: '@coderabbitai summary'
auto_title_placeholder: '@coderabbitai'
review_status: false
poem: false
collapse_walkthrough: true
sequence_diagrams: true
path_filters: []
path_instructions: []
abort_on_close: true
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords: []
labels: []
drafts: false
base_branches: []
tools:
shellcheck:
enabled: true
ruff:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
languagetool:
enabled: true
enabled_only: false
level: default
enabled_rules: []
disabled_rules:
- EN_UNPAIRED_BRACKETS
- EN_UNPAIRED_QUOTES
enabled_categories: []
disabled_categories:
- TYPOS
- TYPOGRAPHY
- CASING
biome:
enabled: true
hadolint:
enabled: true
swiftlint:
enabled: true
phpstan:
enabled: true
level: default
golangci-lint:
enabled: true
yamllint:
enabled: true
gitleaks:
enabled: true
checkov:
enabled: true
detekt:
enabled: true
eslint:
enabled: true
ast-grep:
packages: []
rule_dirs: []
util_dirs: []
essential_rules: true
chat:
auto_reply: true
knowledge_base:
opt_out: false
learnings:
scope: auto
issues:
scope: auto
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI

# Cancel prev CI if new commit come
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
push:
branches:
- main
- v*.*
pull_request:
branches:
- main
- v*.*
paths:
- 'packages/**'
- package.json
- yarn.lock

jobs:
unittest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn_cache_dir_path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
id: yarn_cache
with:
path: ${{ steps.yarn_cache_dir_path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install && Build
run: |
yarn install --immutable
yarn run init
- name: CI
run: |
yarn run ci
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CORE_CODECOV_TOKEN }}
directory: ./coverage
3 changes: 2 additions & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
[https://codeblitz.cloud.alipay.com/](https://codeblitz.cloud.alipay.com/)

## 项目启动

### 准备
需要安装 yarn >= 1.0,使用 yarn 的 [workspaces](https://classic.yarnpkg.com/en/docs/workspaces/) 来管理 packages
需要安装 yarn >= 1.22,使用 yarn 的 [workspaces](https://classic.yarnpkg.com/en/docs/workspaces/) 来管理 packages

### 启动项目
```bash
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ English | [简体中文](./README-zh_CN.md)
## Project Startup

### Preparation
Need to install yarn >= 1.0 and use yarn's [workspaces](https://classic.yarnpkg.com/en/docs/workspaces/) to manage packages
Need to install yarn >= 1.22 and use yarn's [workspaces](https://classic.yarnpkg.com/en/docs/workspaces/) to manage packages
### Start the project
```bash
1. yarn
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"update-package": "node scripts/utils/update-package",
"release": "node scripts/release",
"release:next": "node scripts/release --tag=next"
"release:next": "node scripts/release --tag=next",
"ci": "yarn type-check && yarn test"
},
"author": "antgroup",
"license": "MIT",
Expand Down Expand Up @@ -78,10 +79,10 @@
"typescript": "^4.2.3"
},
"resolutions": {
"node-gyp": "10.1.0"
"node-gyp": "npm:@favware/skip-dependency@latest",
"nsfw": "npm:@favware/skip-dependency@latest",
"spdlog": "npm:@favware/skip-dependency@latest",
"node-pty": "npm:@favware/skip-dependency@latest"
},
"packageManager": "[email protected]",
"dependencies": {
"node-gyp": "10.1.0"
}
"packageManager": "[email protected]"
}
4 changes: 3 additions & 1 deletion packages/code-service/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CodePlatformRegistry } from '../../code-api/src/common/config';
import { parseGitmodules, parseSubmoduleUrl } from '../src/utils';

const submodules = [
Expand Down Expand Up @@ -31,8 +32,9 @@ describe(__filename, () => {
});

it('parseSubmoduleUrl', () => {
const configs = CodePlatformRegistry.instance().getCodePlatformConfigs();
submodules.forEach((item) => {
expect(parseSubmoduleUrl(item.url)).toEqual({
expect(parseSubmoduleUrl(item.url, configs)).toEqual({
owner: item.owner,
name: item.name,
platform: item.platform,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Codeblitz
# CodeBlitz

> 基于 OpenSumi 的纯前端版本 IDE 框架
Expand All @@ -10,4 +10,7 @@

## 开发文档

* CodeBlitz: [https://codeblitz.opensumi.com/](https://codeblitz.opensumi.com/)
* OpenSumi: [https://opensumi.com/zh](https://opensumi.com/zh)

## 示例 [codeblitz-sample](https://github.com/opensumi/codeblitz-sample)
4 changes: 2 additions & 2 deletions packages/core/src/api/renderApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const renderApp = (domElement: HTMLElement, props: IAppRendererProps) =>
);

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.APP_START_ERROR,
err?.message,
{ error: err },
);
Expand Down Expand Up @@ -94,7 +94,7 @@ export const AppRenderer: React.FC<IAppRendererProps> = ({ onLoad, Landing, ...o
setState({ error: err?.message || localize('error.unknown'), status: 'error' });

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.APP_START_ERROR,
err?.message,
{
error: err,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/api/renderEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const renderEditor = (domElement: HTMLElement, props: IEditorRendererProp
);

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.APP_START_ERROR,
err?.message,
{ error: err },
);
Expand Down Expand Up @@ -94,7 +94,7 @@ export const EditorRenderer: React.FC<IEditorRendererProps> = ({ onLoad, Landing
setState({ error: err?.message || localize('error.unknown'), status: 'error' });

(app.injector.get(IReporterService) as IReporterService).point(
REPORT_NAME.ALEX_APP_START_ERROR,
REPORT_NAME.APP_START_ERROR,
err?.message,
{
error: err,
Expand All @@ -117,7 +117,7 @@ export const EditorRenderer: React.FC<IEditorRendererProps> = ({ onLoad, Landing
);

return (
<Root {...state} Landing={Landing} className={`alex-editor ${rootClassName}`}>
<Root {...state} Landing={Landing} className={`codeblitz-editor ${rootClassName}`}>
{ideAppRef.current ? <ideAppRef.current /> : null}
</Root>
);
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/core/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@ import {
* 内置一些 commands 来调用内部的 service
*/

namespace ALEX_COMMANDS {
namespace CODEBLITZ_COMMANDS {
const CATEGORY = 'alex';

// 提供更改和获取默认偏好设置的能力,这个无法通过 extension 实现
export const ALEX_GET_DEFAULT_PREFERENCE: Command = {
export const GET_DEFAULT_PREFERENCE: Command = {
id: 'alex.getDefaultPreference',
category: CATEGORY,
};

export const ALEX_SET_DEFAULT_PREFERENCE: Command = {
export const SET_DEFAULT_PREFERENCE: Command = {
id: 'alex.setDefaultPreference',
category: CATEGORY,
};
}

@Domain(CommandContribution)
export class AlexCommandContribution implements CommandContribution {
export class CodeBlitzCommandContribution implements CommandContribution {
@Autowired(PreferenceProvider, { tag: PreferenceScope.Default })
private readonly defaultPreference: PreferenceProvider;

registerCommands(registry: CommandRegistry) {
registry.registerCommand(ALEX_COMMANDS.ALEX_GET_DEFAULT_PREFERENCE, {
registry.registerCommand(CODEBLITZ_COMMANDS.GET_DEFAULT_PREFERENCE, {
execute: (preferenceName: string, resourceUri?: string, language?: string) => {
return this.defaultPreference.get(preferenceName, resourceUri, language);
},
});

registry.registerCommand(ALEX_COMMANDS.ALEX_SET_DEFAULT_PREFERENCE, {
registry.registerCommand(CODEBLITZ_COMMANDS.SET_DEFAULT_PREFERENCE, {
execute: (preferenceName: string, value: any, resourceUri?: string, language?: string) => {
return this.defaultPreference.setPreference(preferenceName, value, resourceUri, language);
},
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/core/editor/editor.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { SCMService } from '@opensumi/ide-scm';
import { IWorkspaceService } from '@opensumi/ide-workspace';
import md5 from 'md5';
import * as path from 'path';
import { AlexCommandContribution } from '../commands';
import { CodeBlitzCommandContribution } from '../commands';
import { IDETheme } from '../extension/metadata';
import { IPropsService } from '../props.service';
import styles from '../style.module.less';
Expand Down Expand Up @@ -569,7 +569,7 @@ class EditorSpecialContribution extends Disposable
const tabHeight = this.runtimeConfig.hideEditorTab
? 0
: this.layoutViewSize.editorTabsHeight;
const root = document.querySelector('.alex-root') as HTMLElement;
const root = document.querySelector('.codeblitz-root') as HTMLElement;
root.style.height = `${contentHeight + tabHeight}px`;
monacoEditor.layout();
};
Expand Down Expand Up @@ -761,6 +761,6 @@ export class EditorSpecialModule extends BrowserModule {
},
ThemeContribution,
EditorSpecialContribution,
AlexCommandContribution,
CodeBlitzCommandContribution,
];
}
2 changes: 1 addition & 1 deletion packages/core/src/core/editor/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const getModules: () => ModuleConstructor[] = () => [

...extensionModules,

// Alex
// CodeBlitz
ClientModule,
PluginModule,
...ServerModuleCollection,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export const WEBVIEW_ENDPOINT = __WEBVIEW_ENDPOINT__;
export const WEBVIEW_SCRIPT = __WEBVIEW_SCRIPT__;

/**
* alex version
* codeblitz version
*/
export const VERSION = __VERSION__;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { RuntimeConfig } from '@codeblitzjs/ide-sumi-core';
import { Autowired, Injectable, Provider } from '@opensumi/di';
import { BrowserModule, Domain, KeybindingContribution, KeybindingRegistry } from '@opensumi/ide-core-browser';
import { AlexCommandContribution } from './commands';
import { ExtensionActivateContribution } from './extension/extension.contribution';
import { CodeBlitzCommandContribution } from '../commands';
import { ExtensionActivateContribution } from '../extension/extension.contribution';

@Domain(KeybindingContribution)
class AlexContribution implements KeybindingContribution {
class CodeBlitzContribution implements KeybindingContribution {
@Autowired(RuntimeConfig)
private readonly runtimeConfig: RuntimeConfig;

Expand All @@ -24,10 +24,10 @@ class AlexContribution implements KeybindingContribution {
}

@Injectable()
export class AlexModule extends BrowserModule {
export class CodeBlitzModule extends BrowserModule {
providers: Provider[] = [
ExtensionActivateContribution,
AlexCommandContribution,
AlexContribution,
CodeBlitzCommandContribution,
CodeBlitzContribution,
];
}
Loading

0 comments on commit 527e3be

Please sign in to comment.