Skip to content

Commit

Permalink
release: 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinhui authored Aug 10, 2020
2 parents c6b7589 + 6f3c9fa commit e05667f
Show file tree
Hide file tree
Showing 110 changed files with 3,992 additions and 180 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const tsRules = deepmerge(tslint, {
},
rules: {
...commonRules,
'@typescript-eslint/array-type': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-inferrable-types': 1,
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/array-type': 0,
Expand Down
3 changes: 3 additions & 0 deletions extensions/iceworks-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## 0.4.4
- feat: add Iceworks debug.

## 0.4.3

- fix: build error
Expand Down
6 changes: 6 additions & 0 deletions extensions/iceworks-app/README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ If you install [Iceworks suite](https://marketplace.visualstudio.com/items?ItemN
> NOTE: if you do not find the Iceworks icon, Activate Extension the Iceworks plugin by following the action in 'Activate Extension'.
2. Click the Iceworks plugin icon to enter the Iceworks command palette.

### Debug

![debug-demo](https://img.alicdn.com/tfs/TB1vCixhP39YK4jSZPcXXXrUFXa-1200-695.gif)

For more information, please see [Reference Document](https://github.com/ice-lab/iceworks/blob/master/extensions/iceworks-app/docs/debug.en.md)

## More

See the [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) to know more features.
Expand Down
6 changes: 6 additions & 0 deletions extensions/iceworks-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
> 注意 : 如果没有 Iceworks 图标,请按照 `激活` 章节的内容来激活此按钮。
2. 点击 Iceworks 按钮,打开命令面板。

### 工程调试

![debug-demo](https://img.alicdn.com/tfs/TB1vCixhP39YK4jSZPcXXXrUFXa-1200-695.gif)

更多请看[参考文档](https://github.com/ice-lab/iceworks/blob/master/extensions/iceworks-app/docs/debug.md)

## 更多

访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。
Expand Down
85 changes: 85 additions & 0 deletions extensions/iceworks-app/docs/debug.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Iceworks Debug

[简体中文]((./debug.md)) | English

Use VS Code and Chrome to debug the source code.

![debug-demo](https://img.alicdn.com/tfs/TB1vCixhP39YK4jSZPcXXXrUFXa-1200-695.gif)

Click the debug button in the upper right corner of the file to start debugging. Will insert .vscode/launch.json and .vscode/tasks.json in your project directory, and start VS Code Debug.

PS: You can add the .vscode directory to the .gitignore config.

## launch.json

It is automatically injected by Iceworks and is a standard VS Code debugging configuration. For more configuration, please refer to [VS Code debug document](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations).

The default config is as follows:

```json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome", // Use 'Debugger for Chrome' preview.
"request": "launch", // Debugging will start a new Chrome instance, replace 'attach' can select the current Chrome instance, but Chrome needs to be restarted
"name": "Iceworks Debug",
"url": "http://localhost:3333", // Project debugging service address
"urlFilter": "http://localhost:3333/**/*", // Monitor all URLs of the project debugging service
"webRoot": "${workspaceFolder}",
"userDataDir": "${workspaceFolder}/.vscode/chrome-debug-user-data", // Used to save Chrome user data (such as installed browser extensions)
"preLaunchTask": "Iceworks Start Background Tasks",
"postDebugTask": "Iceworks Stop Background Tasks"
}
]
}
```

## tasks.json

It is automatically injected by Iceworks and is a standard VS Code debugging configuration. For more configuration, please refer to [VS Code tasks document]( https://code.visualstudio.com/docs/editor/tasks#vscode).

The default config is as follows:

```json
{
"version": "2.0.0",
"tasks": [
{
"label": "Iceworks Start Background Tasks",
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"pattern": {
"regexp": "ERROR in .*" // build-scirpt log
},
"background": {
"beginsPattern": ".*(@alib/build-scripts|ice\\.js|rax\\.js).*", // build-scirpt log
"endsPattern": ".*http://localhost:3333.*" // build-scirpt log
}
}
},
{
"label": "Iceworks Stop Background Tasks",
"type": "process",
"command": [
"${command:workbench.action.tasks.terminate}", // VS Code built-in command
"${command:workbench.action.acceptSelectedQuickOpenItem}" // VS Code built-in command
]
}
]
}

```

## Change dev url
If the project dev url is not `http://localhost:3333`, you can modify the url address configured by `url` and `urlFilter` in launch.json, and `endsPattern` in tasks.json with the new dev url.

## Chrome

A new instance of Chrome is opened for debugging. The first time you start Chrome without data (no user mode, no extensions), the data operated during the debugging process will be saved (history, installed extensions ...).

Rax project,Recommended to install [Guan Extension](https://chrome.google.com/webstore/detail/guan-extension/jfalnandddhgfnmejfgjgfbfnnkhljog)

If you want to use your own Chrome, you can switch the request configuration in launch.json to `attach`. You must close the current Chrome.
84 changes: 84 additions & 0 deletions extensions/iceworks-app/docs/debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Iceworks Debug

简体中文 | [English](./debug.en.md)

使用 VS Code 和 Chrome 对源码进行调试。

![debug-demo](https://img.alicdn.com/tfs/TB1vCixhP39YK4jSZPcXXXrUFXa-1200-695.gif)

点击文件右上角的 debug 按钮启动调试。 会在您的工程目录中插入 .vscode/launch.json 和 .vscode/tasks.json ,并启动 VS Code Debug。

PS: 可将 .vscode 目录添加至 .gitignore 配置中。

## launch.json

由 Iceworks 自动注入,为标准的 VS Code 调试配置。更多配置可参考 [VS Code debug 文档](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations)。默认配置如下:

```json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome", // 通过 'Debugger for Chrome' 扩展启动 Chrome 预览。
"request": "launch", // 调试会启动新的 Chrome 实例,替换 attach 可选取当前 Chrome 实例,但需要重启 Chrome。
"name": "Iceworks Debug",
"url": "http://localhost:3333", // 当前工程调试服务地址
"urlFilter": "http://localhost:3333/**/*", // 监听当前工程调试服务所有的 url
"webRoot": "${workspaceFolder}",
"userDataDir": "${workspaceFolder}/.vscode/chrome-debug-user-data", // 用于存放 Chrome 的用户数据(安装的浏览器插件等)
"preLaunchTask": "Iceworks Start Background Tasks",
"postDebugTask": "Iceworks Stop Background Tasks"
}
]
}
```

## tasks.json

由 Iceworks 自动注入,为标准的 VS Code 调试配置。更多配置可参考 [VS Code tasks 文档]( https://code.visualstudio.com/docs/editor/tasks#vscode)。默认配置如下:

```json
{
"version": "2.0.0",
"tasks": [
{
"label": "Iceworks Start Background Tasks",
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"pattern": {
"regexp": "ERROR in .*" // build-scirpt 日志
},
"background": {
"beginsPattern": ".*(@alib/build-scripts|ice\\.js|rax\\.js).*", // build-scirpt 日志
"endsPattern": ".*http://localhost:3333.*" // build-scirpt 日志
}
}
},
{
"label": "Iceworks Stop Background Tasks",
"type": "process",
"command": [
"${command:workbench.action.tasks.terminate}", // VS Code 内置命令
"${command:workbench.action.acceptSelectedQuickOpenItem}" // VS Code 内置命令
]
}
]
}

```

## 更改端口号
若需要 debug 的工程调试链接不为 `http://localhost:3333` 时,可以修改 launch.json 中的 `url``urlFilter` 配置的地址链接,以及 tasks.json 中的 `endsPattern` 为新的调试地址即可。

## Chrome 实例

默认开启新的 Chrome 实例进行调试。首次启动为无数据 Chrome (无用户态,无插件),在调试过程操作的数据将得以保存(历史,安装插件等)。

Rax 项目,推荐安装 [Guan Extension](https://chrome.google.com/webstore/detail/guan-extension/jfalnandddhgfnmejfgjgfbfnnkhljog)

### 其他

如果想使用常用登录态的 Chrome 进行提示,可切换 launch.json 中的 request 配置为 `attach`,且必须关闭当前 Chrome。

11 changes: 7 additions & 4 deletions extensions/iceworks-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Iceworks Application Viewer",
"description": "Quick view your Universal Application(React/Rax/Vue, etc).",
"publisher": "iceworks-team",
"version": "0.4.3",
"version": "0.4.4",
"engines": {
"vscode": "^1.41.0"
},
Expand Down Expand Up @@ -125,8 +125,8 @@
}
},
{
"command": "iceworksApp.editorMenu.runDev",
"title": "%iceworksApp.command.npmScripts.runDev.title%",
"command": "iceworksApp.editorMenu.runDebug",
"title": "%iceworksApp.command.npmScripts.runDebug.title%",
"icon": {
"light": "assets/light/runDev.svg",
"dark": "assets/dark/runDev.svg"
Expand Down Expand Up @@ -270,7 +270,7 @@
],
"editor/title": [
{
"command": "iceworksApp.editorMenu.runDev",
"command": "iceworksApp.editorMenu.runDebug",
"group": "navigation@01",
"when": "iceworks:showScriptIconInEditorTitleMenu"
},
Expand Down Expand Up @@ -425,13 +425,16 @@
"@iceworks/project-service": "^0.1.6",
"@iceworks/recorder": "^0.1.0",
"@iceworks/vscode-webview": "^0.1.2",
"comment-json": "^3.0.2",
"ejs": "^3.1.3",
"fs-extra": "^9.0.0",
"ice-npm-utils": "^2.0.0",
"latest-version": "^5.1.0",
"rimraf": "^3.0.2",
"util": "^0.12.3"
},
"extensionDependencies": [
"msjsdiag.debugger-for-chrome",
"iceworks-team.iceworks-project-creator",
"iceworks-team.iceworks-ui-builder",
"iceworks-team.iceworks-material-helper"
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-app/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"iceworksApp.command.npmScripts.refresh.title": "Refresh",
"iceworksApp.command.npmScripts.run.title": "Run Script",
"iceworksApp.command.npmScripts.stop.title": "Stop Script",
"iceworksApp.command.npmScripts.runDev.title": "Iceworks: Run Dev",
"iceworksApp.command.npmScripts.runDebug.title": "Iceworks: Debug",
"iceworksApp.command.npmScripts.stopDev.title": "Iceworks: Stop Dev",
"iceworksApp.command.npmScripts.runBuild.title": "Iceworks: Run Build",
"iceworksApp.command.pages.add.title": "Add Pages",
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-app/package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"iceworksApp.command.npmScripts.refresh.title": "刷新",
"iceworksApp.command.npmScripts.run.title": "运行脚本",
"iceworksApp.command.npmScripts.stop.title": "停止脚本",
"iceworksApp.command.npmScripts.runDev.title": "Iceworks: 开始本地调试",
"iceworksApp.command.npmScripts.runDebug.title": "Iceworks: 开始本地调试",
"iceworksApp.command.npmScripts.stopDev.title": "Iceworks: 停止本地调试",
"iceworksApp.command.npmScripts.runBuild.title": "Iceworks: 本地构建",
"iceworksApp.command.pages.add.title": "添加页面",
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-app/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export const nodeDepTypes: NodeDepTypes[] = ['dependencies', 'devDependencies'];

export const showExtensionsQuickPickCommandId = 'iceworksApp.showExtensionsQuickPick';

export const editorTitleRunDevCommandId = 'npmScripts-editor-title-run-dev';
export const editorTitleRunDebugCommandId = 'npmScripts-editor-title-run-dev';
export const editorTitleRunBuildCommandId = 'npmScripts-editor-title-run-build';
40 changes: 26 additions & 14 deletions extensions/iceworks-app/src/createEditorMenuAction.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
import * as vscode from 'vscode';
import { createNpmCommand, checkPathExists, checkIsAliInternal, registerCommand } from '@iceworks/common-service';
import { dependencyDir, projectPath } from '@iceworks/project-service';
import { editorTitleRunDevCommandId, editorTitleRunBuildCommandId } from './constants';
import { setDebugConfig } from './debugConfig/index';
import { editorTitleRunDebugCommandId, editorTitleRunBuildCommandId } from './constants';
import { ITerminalMap } from './types';
import showDefPublishEnvQuickPick from './quickPicks/showDefPublishEnvQuickPick';
import executeCommand from './commands/executeCommand';

export default async function createEditorMenuAction(terminals: ITerminalMap) {
const EDITOR_MENU_RUN_DEV = 'iceworksApp.editorMenu.runDev';
registerCommand(EDITOR_MENU_RUN_DEV, async () => {
const pathExists = await checkPathExists(projectPath, dependencyDir);
const command: vscode.Command = {
command: EDITOR_MENU_RUN_DEV,
title: 'Run Dev',
arguments: [projectPath, createNpmCommand('run', 'start')],
};
const commandId = editorTitleRunDevCommandId;
if (!pathExists) {
command.arguments = [projectPath, `${createNpmCommand('install')} && ${command.arguments![1]}`];
executeCommand(terminals, command, commandId);
const EDITOR_MENU_RUN_DEBUG = 'iceworksApp.editorMenu.runDebug';
registerCommand(EDITOR_MENU_RUN_DEBUG, async () => {
// Check dependences
if (!(await checkPathExists(projectPath, dependencyDir))) {
vscode.window.showInformationMessage('"node_modules" directory not found! Install dependencies first.');
executeCommand(
terminals,
{
command: EDITOR_MENU_RUN_DEBUG,
title: 'Run Install',
arguments: [projectPath, createNpmCommand('install')],
},
editorTitleRunDebugCommandId
);
return;
}
executeCommand(terminals, command, commandId);

// Prepare VS Code debug config
setDebugConfig();

// Run Debug
let workspaceFolder;
if (vscode.workspace.workspaceFolders) {
workspaceFolder = vscode.workspace.workspaceFolders[0];
}
vscode.debug.startDebugging(workspaceFolder, 'Iceworks Debug');
});

const isAliInternal = await checkIsAliInternal();
Expand Down
Loading

0 comments on commit e05667f

Please sign in to comment.