diff --git a/.editorconfig b/.editorconfig
index 5760be583..319299684 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,12 +1,13 @@
-# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
+end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
+quote_type = single
[*.md]
trim_trailing_whitespace = false
diff --git a/.eslintignore b/.eslintignore
index e1184ee65..7d1137ffe 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,23 +1,20 @@
# 忽略目录
-build/
-tests/
-demo/
-.ice/
-def-login-client/
-
-# node 覆盖率文件
-coverage/
+build
+lib
+es
+dist
+tests
+demo
node_modules
-extensions/*/build/
+.ice
+def-login-client
+coverage/
.vscode-test
-packages/*/lib/
-packages/*/es/
-packages/*/build/
-app/main_dist/
-app/build/
tmp
.tmp
__mocks__
+out
+__tests__
# 忽略文件
**/*-min.js
diff --git a/.eslintrc.js b/.eslintrc.js
index 5d752f2f4..76643ef43 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,47 +1,7 @@
-const { eslint, tslint, deepmerge } = require('@ice/spec');
-
-const commonRules = {
- 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.tsx'] }],
- 'react/jsx-no-target-blank': [0],
- '@typescript-eslint/indent': 0,
- 'prefer-object-spread': 0,
- 'max-classes-per-file': 0,
- 'class-methods-use-this': 0,
-};
-
-const jsRules = deepmerge(eslint, {
- env: {
- jest: true,
- },
- rules: {
- ...commonRules,
- },
-});
-
-const tsRules = deepmerge(tslint, {
- env: {
- jest: true,
- },
+module.exports = {
+ extends: 'eslint-config-ali/typescript/react',
rules: {
- ...commonRules,
- '@typescript-eslint/no-inferrable-types': 1,
- '@typescript-eslint/ban-ts-ignore': 0,
- '@typescript-eslint/array-type': 0,
- '@typescript-eslint/no-non-null-assertion': 0,
- '@typescript-eslint/explicit-function-return-type': 0,
- '@typescript-eslint/explicit-member-accessibility': 0,
- '@typescript-eslint/no-parameter-properties': 0,
+ 'no-return-await': 1,
+ '@typescript-eslint/no-parameter-properties': 1,
},
-});
-
-delete tsRules.root;
-
-module.exports = {
- ...jsRules,
- overrides: [
- {
- ...tsRules,
- files: ['**/*.ts', '**/*.tsx'],
- },
- ],
};
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6b67b01b4..27bd1d840 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,9 +18,6 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: |
npm run setup:packages
- npm run lint
- npm run prettier
- npm run docs:check
npm run dependency:check
npm run test
npm run coverage
diff --git a/.gitignore b/.gitignore
index f917e556d..828ccc0a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,7 @@ node_modules
.DS_Store
.eslintcache
.happypack
-.vscode
+extensions/*/web/.vscode
coverage/
tmp/
.tmp/
diff --git a/.prettierrc.js b/.prettierrc.js
index 03631c513..24c5859e6 100644
--- a/.prettierrc.js
+++ b/.prettierrc.js
@@ -1,5 +1,7 @@
-const { prettier, deepmerge } = require('@ice/spec');
-
-module.exports = deepmerge(prettier, {
- printWidth: 120,
-});
+module.exports = {
+ printWidth: 100,
+ tabWidth: 2,
+ semi: true,
+ singleQuote: true,
+ trailingComma: 'all',
+};
diff --git a/.stylelintignore b/.stylelintignore
new file mode 100644
index 000000000..a35ef79bf
--- /dev/null
+++ b/.stylelintignore
@@ -0,0 +1,20 @@
+# 忽略目录
+build
+lib
+es
+dist
+tests
+demo
+node_modules
+.ice
+def-login-client
+coverage/
+.vscode-test
+tmp
+.tmp
+__mocks__
+__tests__
+
+# 忽略文件
+**/*-min.js
+**/*.min.js
diff --git a/.stylelintrc.js b/.stylelintrc.js
new file mode 100644
index 000000000..74a5a54e3
--- /dev/null
+++ b/.stylelintrc.js
@@ -0,0 +1,3 @@
+module.exports = {
+ extends: 'stylelint-config-ali',
+};
diff --git a/commitlint.config.js b/commitlint.config.js
new file mode 100644
index 000000000..52f3b754b
--- /dev/null
+++ b/commitlint.config.js
@@ -0,0 +1,3 @@
+module.exports = {
+ extends: ['ali'],
+};
diff --git a/extensions/iceworks-app/CHANGELOG.md b/extensions/iceworks-app/CHANGELOG.md
index ac7d3a337..30f563c73 100644
--- a/extensions/iceworks-app/CHANGELOG.md
+++ b/extensions/iceworks-app/CHANGELOG.md
@@ -1,5 +1,10 @@
# Change Log
+## 0.5.0
+
+- feat: Add Iceworks Doctor
+- feat: Add welcome page
+
## 0.4.10
- docs: update text for find component and generate page
diff --git a/extensions/iceworks-app/package.json b/extensions/iceworks-app/package.json
index 1ad41d782..e79724def 100644
--- a/extensions/iceworks-app/package.json
+++ b/extensions/iceworks-app/package.json
@@ -3,7 +3,7 @@
"displayName": "Iceworks Application Viewer",
"description": "Quick view your Universal Application(React/Rax/Vue, etc).",
"publisher": "iceworks-team",
- "version": "0.4.10",
+ "version": "0.5.0",
"engines": {
"vscode": "^1.41.0"
},
@@ -100,6 +100,10 @@
"dark": "assets/dark/setting.svg"
}
},
+ {
+ "command": "iceworksApp.welcome.start",
+ "title": "%iceworksApp.command.welcome.start.title%"
+ },
{
"command": "iceworksApp.editorMenu.DefPublish",
"title": "%iceworksApp.command.DefPublish.title%",
@@ -440,6 +444,11 @@
"https://registry.npm.taobao.org"
],
"description": "%iceworksApp.configuration.properties.iceworks.npmRegistry.description%"
+ },
+ "iceworks.showWelcomePage": {
+ "type": "boolean",
+ "default": true,
+ "description": "%iceworksApp.configuration.properties.iceworks.showWelcomePage.description%"
}
}
}
diff --git a/extensions/iceworks-app/package.nls.json b/extensions/iceworks-app/package.nls.json
index 7a63af2ee..49373ffd7 100644
--- a/extensions/iceworks-app/package.nls.json
+++ b/extensions/iceworks-app/package.nls.json
@@ -5,11 +5,12 @@
"iceworksApp.view.components.name": "Components",
"iceworksApp.view.nodeDependencies.name": "Node Dependencies",
"iceworksApp.viewsWelcome.welcome.contents": "To use Iceworks, you need to open or create a application first. \n[Open a Folder](command:vscode.openFolder)\n[Create Application](command:iceworks-project-creator.start)\n[Configuration](command:iceworksApp.configHelper.start)\nRead the [docs](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) to learn more about how to use Iceworks in VS Code.",
- "iceworksApp.viewsWelcome.npmScripts.contents": "npm scripts could not be found in package.json.",
- "iceworksApp.viewsWelcome.pages.contents": "Pages could not be found.",
- "iceworksApp.viewsWelcome.components.contents": "Components could not be found.",
- "iceworksApp.viewsWelcome.nodeDependencies.contents": "Node dependencies could not be found in package.json.",
+ "iceworksApp.viewsWelcome.npmScripts.contents": "npm scripts could not be found in package.json",
+ "iceworksApp.viewsWelcome.pages.contents": "Pages could not be found",
+ "iceworksApp.viewsWelcome.components.contents": "Components could not be found",
+ "iceworksApp.viewsWelcome.nodeDependencies.contents": "Node dependencies could not be found in package.json",
"iceworksApp.command.configHelper.start.title": "Iceworks: Settings",
+ "iceworksApp.command.welcome.start.title": "Iceworks: Welcome",
"iceworksApp.command.DefPublish.title": "Iceworks: Def Publish",
"iceworksApp.command.quickEntries.start.title": "Start",
"iceworksApp.command.npmScripts.refresh.title": "Refresh",
@@ -33,5 +34,6 @@
"iceworksApp.command.nodeDependencies.refresh.title": "Refresh",
"iceworksApp.command.nodeDependencies.upgrade.title": "Upgrade Dependency",
"iceworksApp.configuration.properties.iceworks.packageManager.description": "Iceworks npm package manager.",
- "iceworksApp.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm registry."
+ "iceworksApp.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm registry.",
+ "iceworksApp.configuration.properties.iceworks.showWelcomePage.description": "Show welcome page"
}
diff --git a/extensions/iceworks-app/package.nls.zh-cn.json b/extensions/iceworks-app/package.nls.zh-cn.json
index 2f3b1c6df..627a5d85f 100644
--- a/extensions/iceworks-app/package.nls.zh-cn.json
+++ b/extensions/iceworks-app/package.nls.zh-cn.json
@@ -5,11 +5,12 @@
"iceworksApp.view.components.name": "组件列表",
"iceworksApp.view.nodeDependencies.name": "依赖列表",
"iceworksApp.viewsWelcome.welcome.contents": "要使用 Iceworks,您需要先打开或创建一个应用。\n[打开文件夹](command:vscode.openFolder)\n[创建应用](command:iceworks-project-creator.start)\n[设置](command:iceworksApp.configHelper.start)\n查看[文档](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)以学习如何在 VS Code 中如何使用 Iceworks App。",
- "iceworksApp.viewsWelcome.npmScripts.contents": "未找到 npm 脚本。",
- "iceworksApp.viewsWelcome.pages.contents": "未找到页面。",
- "iceworksApp.viewsWelcome.components.contents": "未找到组件。",
- "iceworksApp.viewsWelcome.nodeDependencies.contents": "未找到依赖。",
+ "iceworksApp.viewsWelcome.npmScripts.contents": "未找到 npm 脚本",
+ "iceworksApp.viewsWelcome.pages.contents": "未找到页面",
+ "iceworksApp.viewsWelcome.components.contents": "未找到组件",
+ "iceworksApp.viewsWelcome.nodeDependencies.contents": "未找到依赖",
"iceworksApp.command.configHelper.start.title": "Iceworks: 设置",
+ "iceworksApp.command.welcome.start.title": "Iceworks: 欢迎",
"iceworksApp.command.DefPublish.title": "Iceworks: DEF 发布",
"iceworksApp.command.quickEntries.start.title": "启动",
"iceworksApp.command.npmScripts.refresh.title": "刷新",
@@ -33,5 +34,6 @@
"iceworksApp.command.nodeDependencies.refresh.title": "刷新",
"iceworksApp.command.nodeDependencies.upgrade.title": "升级依赖",
"iceworksApp.configuration.properties.iceworks.packageManager.description": "Iceworks npm 包管理工具",
- "iceworksApp.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm 镜像源"
+ "iceworksApp.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm 镜像源",
+ "iceworksApp.configuration.properties.iceworks.showWelcomePage.description": "是否显示欢迎页"
}
diff --git a/extensions/iceworks-app/src/commands/executeCommand.ts b/extensions/iceworks-app/src/commands/executeCommand.ts
index c980c5c71..d20fd81ba 100644
--- a/extensions/iceworks-app/src/commands/executeCommand.ts
+++ b/extensions/iceworks-app/src/commands/executeCommand.ts
@@ -11,9 +11,9 @@ export default function executeCommand(command: vscode.Command) {
return;
}
- const terminals = vscode.window.terminals;
+ const { terminals } = vscode.window;
- let terminal: Terminal | undefined = terminals.find((terminal: Terminal) => terminal.name === script);
+ let terminal: Terminal | undefined = terminals.find(({ name }) => name === script);
if (!terminal) {
const terminalOptions: TerminalOptions = { cwd, name: script };
terminal = vscode.window.createTerminal(terminalOptions);
diff --git a/extensions/iceworks-app/src/commands/stopCommand.ts b/extensions/iceworks-app/src/commands/stopCommand.ts
index 977dcddfb..184fda8c4 100644
--- a/extensions/iceworks-app/src/commands/stopCommand.ts
+++ b/extensions/iceworks-app/src/commands/stopCommand.ts
@@ -1,12 +1,12 @@
import * as vscode from 'vscode';
export default function stopCommand(command: vscode.Command) {
- const terminals = vscode.window.terminals;
+ const { terminals } = vscode.window;
const commandArgs = command.arguments;
if (!commandArgs) {
return;
}
- const [cwd, script] = commandArgs;
+ const [script] = commandArgs;
if (!script) {
return;
}
diff --git a/extensions/iceworks-app/src/constants.ts b/extensions/iceworks-app/src/constants.ts
index 320b6e57e..800b15080 100644
--- a/extensions/iceworks-app/src/constants.ts
+++ b/extensions/iceworks-app/src/constants.ts
@@ -6,3 +6,5 @@ export const showExtensionsQuickPickCommandId = 'iceworksApp.showEntriesQuickPic
export const editorTitleRunDebugCommandId = 'npmScripts-editor-title-run-dev';
export const editorTitleRunBuildCommandId = 'npmScripts-editor-title-run-build';
+
+export const projectExistsTime = 5;
diff --git a/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts b/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts
index ce3d5ac5a..144e7fcdc 100644
--- a/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts
+++ b/extensions/iceworks-app/src/debugConfig/getDefaultConfigs.ts
@@ -70,7 +70,7 @@ export function getLaunchConfig(launchUrl?: string): IDebugConfig {
baseUrl: BASE_URL,
startLabel: CONFIG_START_LABEL,
stopLabel: CONFIG_STOP_LABEL,
- })
+ }),
),
};
}
@@ -87,7 +87,7 @@ export function getTasksConfig(isPegasusProject = false, disableOpen = false): I
isPegasusProject,
startLabel: CONFIG_START_LABEL,
stopLabel: CONFIG_STOP_LABEL,
- })
+ }),
),
};
}
diff --git a/extensions/iceworks-app/src/debugConfig/index.ts b/extensions/iceworks-app/src/debugConfig/index.ts
index 113a3355d..3621e7261 100644
--- a/extensions/iceworks-app/src/debugConfig/index.ts
+++ b/extensions/iceworks-app/src/debugConfig/index.ts
@@ -22,7 +22,7 @@ function writeConfigFile(filePath: string, config: IDebugConfig) {
filePath,
'// See https://github.com/ice-lab/iceworks/blob/master/extensions/iceworks-app/docs/debug.md \n' +
'// for the documentation about the Iceworks debug \n' +
- `${JSON.stringify(config, null, ' ')}`
+ `${JSON.stringify(config, null, ' ')}`,
);
}
diff --git a/extensions/iceworks-app/src/extension.ts b/extensions/iceworks-app/src/extension.ts
index abf63d39f..74b7d0762 100644
--- a/extensions/iceworks-app/src/extension.ts
+++ b/extensions/iceworks-app/src/extension.ts
@@ -4,21 +4,23 @@ import { connectService, getHtmlForWebview } from '@iceworks/vscode-webview/lib/
import {
getProjectType,
checkIsPegasusProject,
+ checkIsNotTarget,
autoSetContext as autoSetContextByProject,
+ projectPath,
} from '@iceworks/project-service';
import { Recorder, recordDAU } from '@iceworks/recorder';
-import { initExtension, registerCommand } from '@iceworks/common-service';
+import { initExtension, registerCommand, getFolderExistsTime, getDataFromSettingJson } from '@iceworks/common-service';
import { createNpmScriptsTreeView } from './views/npmScriptsView';
import { createNodeDependenciesTreeView } from './views/nodeDependenciesView';
import { createComponentsTreeView } from './views/componentsView';
import { createPagesTreeView } from './views/pagesView';
import { createQuickEntriesTreeView } from './views/quickEntriesView';
import services from './services';
-import { showExtensionsQuickPickCommandId } from './constants';
+import { showExtensionsQuickPickCommandId, projectExistsTime } from './constants';
import showEntriesQuickPick from './quickPicks/showEntriesQuickPick';
-import createEditorMenuAction from './createEditorMenuAction';
+import createEditorMenuAction from './utils/createEditorMenuAction';
import createExtensionsStatusBar from './statusBar/createExtensionsStatusBar';
-import autoStart from './autoStart';
+import autoStart from './utils/autoStart';
import i18n from './i18n';
// eslint-disable-next-line
@@ -29,7 +31,7 @@ export async function activate(context: vscode.ExtensionContext) {
const { subscriptions, extensionPath } = context;
// auto set configuration & context
- initExtension(context);
+ initExtension(context, name);
autoSetContextByProject();
const projectType = await getProjectType();
@@ -43,44 +45,76 @@ export async function activate(context: vscode.ExtensionContext) {
recorder.recordActivate();
await showEntriesQuickPick();
- })
+ }),
);
// init config webview
- let webviewPanel: vscode.WebviewPanel | undefined;
+ let configWebviewPanel: vscode.WebviewPanel | undefined;
function activeConfigWebview(focusField: string) {
- if (webviewPanel) {
- webviewPanel.reveal();
+ if (configWebviewPanel) {
+ configWebviewPanel.reveal();
} else {
- webviewPanel = window.createWebviewPanel(
+ configWebviewPanel = window.createWebviewPanel(
'iceworks',
- i18n.format('extension.iceworksApp.extension.title'),
+ i18n.format('extension.iceworksApp.configHelper.extension.webviewTitle'),
ViewColumn.One,
{
enableScripts: true,
retainContextWhenHidden: true,
- }
+ },
);
const extraHtml = `
`;
- webviewPanel.webview.html = getHtmlForWebview(extensionPath, undefined, false, undefined, extraHtml);
- webviewPanel.onDidDispose(
+ configWebviewPanel.webview.html = getHtmlForWebview(extensionPath, 'confighelper', true, undefined, extraHtml);
+ configWebviewPanel.onDidDispose(
() => {
- webviewPanel = undefined;
+ configWebviewPanel = undefined;
},
null,
- context.subscriptions
+ context.subscriptions,
);
- connectService(webviewPanel, context, { services, recorder });
+ connectService(configWebviewPanel, context, { services, recorder });
}
}
subscriptions.push(
- registerCommand('iceworksApp.configHelper.start', function (focusField: string) {
+ registerCommand('iceworksApp.configHelper.start', (focusField: string) => {
recorder.recordActivate();
activeConfigWebview(focusField);
- })
+ }),
+ );
+ // init welcome webview
+ let welcomeWebviewPanel: vscode.WebviewPanel | undefined;
+ function activeWelcomeWebview() {
+ if (welcomeWebviewPanel) {
+ welcomeWebviewPanel.reveal();
+ } else {
+ welcomeWebviewPanel = window.createWebviewPanel(
+ 'iceworks',
+ i18n.format('extension.iceworksApp.welcome.extension.webviewTitle'),
+ ViewColumn.One,
+ {
+ enableScripts: true,
+ retainContextWhenHidden: true,
+ },
+ );
+
+ welcomeWebviewPanel.webview.html = getHtmlForWebview(extensionPath, 'welcome', true);
+ welcomeWebviewPanel.onDidDispose(
+ () => {
+ welcomeWebviewPanel = undefined;
+ },
+ null,
+ context.subscriptions,
+ );
+ connectService(welcomeWebviewPanel, context, { services, recorder });
+ }
+ }
+ subscriptions.push(
+ registerCommand('iceworksApp.welcome.start', () => {
+ activeWelcomeWebview();
+ }),
);
// init tree view
@@ -124,4 +158,15 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.commands.executeCommand('setContext', 'iceworks:showScriptIconInEditorTitleMenu', true);
await createEditorMenuAction();
}
+
+ // auto start welcome page when the application is new
+ const isNotTargetProject = await checkIsNotTarget();
+ // get showWelcomePage configuration from settings.json
+ const isShowWelcomePage = await getDataFromSettingJson('showWelcomePage', true);
+ if (projectPath && !isNotTargetProject && isShowWelcomePage) {
+ const curProjectExistsTime = getFolderExistsTime(projectPath);
+ if (projectExistsTime > curProjectExistsTime) {
+ vscode.commands.executeCommand('iceworksApp.welcome.start');
+ }
+ }
}
diff --git a/extensions/iceworks-app/src/locales/en-US.json b/extensions/iceworks-app/src/locales/en-US.json
index 1c8ce6ddf..391a43180 100644
--- a/extensions/iceworks-app/src/locales/en-US.json
+++ b/extensions/iceworks-app/src/locales/en-US.json
@@ -13,6 +13,8 @@
"extension.iceworksApp.showEntriesQuickPick.createComponent.detail": "Download coomponent materials to local",
"extension.iceworksApp.showEntriesQuickPick.openSettings.label": "Settings",
"extension.iceworksApp.showEntriesQuickPick.openSettings.detail": "Set the related functions provided by Iceworks",
+ "extension.iceworksApp.showEntriesQuickPick.openDashboard.label": "Open Dashboard",
+ "extension.iceworksApp.showEntriesQuickPick.openDashboard.detail": "Display project details and code quality",
"extension.iceworksApp.showEntriesQuickPick.showMaterialDocs.label": "Find Component",
"extension.iceworksApp.showEntriesQuickPick.showMaterialDocs.detail": "Quickly search and browse component documents",
"extension.iceworksApp.showEntriesQuickPick.runDebug.label": "Debug",
@@ -25,6 +27,8 @@
"extension.iceworksApp.showEntriesQuickPick.reinstall.detail": "Reinstall the dependency packages for the application",
"extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.label": "Add Dependency",
"extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.detail": "Add a new dependency package for the application",
+ "extension.iceworksApp.showEntriesQuickPick.welcomePage.label": "Welcome",
+ "extension.iceworksApp.showEntriesQuickPick.welcomePage.detail": "Show welcome page",
"extension.iceworksApp.showDepsInputBox.materialImport.placeHolder": "for example: lodash react@latest.",
"extension.iceworksApp.showDepsInputBox.materialImport.prompt": "Please enter the name of the dependency to be addded to <%= depType %>. Multiple dependencies should be spilted by Spaces.",
"extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.daily.label": "Daily",
@@ -33,6 +37,7 @@
"extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.prod.detail": "Release to production environment.",
"extension.iceworksApp.showDepsQuickPick.quickPickItem.detail": "Install <%= label %>",
"extension.iceworksApp.openEntryFile.ErrorMessage": "Cannot find entry",
- "extension.iceworksApp.extension.title": "Iceworks Settings",
+ "extension.iceworksApp.configHelper.extension.webviewTitle": "Settings - Iceworks",
+ "extension.iceworksApp.welcome.extension.webviewTitle": "Welcome - Iceworks",
"extension.iceworksApp.extension.emptyWorkplace": "Current workspace is empty, please open or create an application."
}
diff --git a/extensions/iceworks-app/src/locales/zh-CN.json b/extensions/iceworks-app/src/locales/zh-CN.json
index d5578bf54..a874f9560 100644
--- a/extensions/iceworks-app/src/locales/zh-CN.json
+++ b/extensions/iceworks-app/src/locales/zh-CN.json
@@ -13,6 +13,8 @@
"extension.iceworksApp.showEntriesQuickPick.materialImport.detail": "通过可视化操作添加组件到应用代码",
"extension.iceworksApp.showEntriesQuickPick.openSettings.label": "设置",
"extension.iceworksApp.showEntriesQuickPick.openSettings.detail": "设置 Iceworks 提供的相关功能",
+ "extension.iceworksApp.showEntriesQuickPick.openDashboard.label": "查看项目仪表盘",
+ "extension.iceworksApp.showEntriesQuickPick.openDashboard.detail": "查看项目信息及安全漏洞和质量问题",
"extension.iceworksApp.showEntriesQuickPick.showMaterialDocs.label": "查找组件",
"extension.iceworksApp.showEntriesQuickPick.showMaterialDocs.detail": "快速搜索组件文档并进行浏览",
"extension.iceworksApp.showEntriesQuickPick.runDebug.label": "启动调试",
@@ -25,6 +27,8 @@
"extension.iceworksApp.showEntriesQuickPick.reinstall.detail": "重新安装应用的依赖包",
"extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.label": "添加依赖",
"extension.iceworksApp.showEntriesQuickPick.addDepsAndDevDeps.detail": "为应用添加新的依赖",
+ "extension.iceworksApp.showEntriesQuickPick.welcomePage.label": "欢迎使用",
+ "extension.iceworksApp.showEntriesQuickPick.welcomePage.detail": "启动欢迎页",
"extension.iceworksApp.showDepsInputBox.materialImport.placeHolder": "例如: lodash react@latest",
"extension.iceworksApp.showDepsInputBox.materialImport.prompt": "请输入需要添加到 <%= depType %> 的依赖名称, 支持通过空格添加多个依赖",
"extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.daily.label": "日常环境",
@@ -33,5 +37,6 @@
"extension.iceworksApp.showDefPublishEnvQuickPick.DEFEnvOptions.prod.detail": "发布到生产环境",
"extension.iceworksApp.showDepsQuickPick.quickPickItem.detail": "安装 <%= label %>",
"extension.iceworksApp.openEntryFile.ErrorMessage": "没有找到入口",
- "extension.iceworksApp.extension.title": "设置 - Iceworks"
+ "extension.iceworksApp.configHelper.extension.webviewTitle": "设置 - Iceworks",
+ "extension.iceworksApp.welcome.extension.webviewTitle": "欢迎 - Iceworks"
}
diff --git a/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts b/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts
index 3da9de6e0..992655296 100644
--- a/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts
+++ b/extensions/iceworks-app/src/quickPicks/showEntriesQuickPick.ts
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
-import getQuickEntryOptions from '../getQuickEntryOptions';
+import getQuickEntryOptions from '../utils/getQuickEntryOptions';
const { window, commands } = vscode;
diff --git a/extensions/iceworks-app/src/autoStart.ts b/extensions/iceworks-app/src/utils/autoStart.ts
similarity index 99%
rename from extensions/iceworks-app/src/autoStart.ts
rename to extensions/iceworks-app/src/utils/autoStart.ts
index 0e14b4508..417675738 100644
--- a/extensions/iceworks-app/src/autoStart.ts
+++ b/extensions/iceworks-app/src/utils/autoStart.ts
@@ -3,6 +3,7 @@ import { checkIsNotTarget } from '@iceworks/project-service';
export default async function () {
const isNotTargetProject = await checkIsNotTarget();
+
if (isNotTargetProject) {
vscode.commands.executeCommand('iceworks-project-creator.start');
}
diff --git a/extensions/iceworks-app/src/createEditorMenuAction.ts b/extensions/iceworks-app/src/utils/createEditorMenuAction.ts
similarity index 90%
rename from extensions/iceworks-app/src/createEditorMenuAction.ts
rename to extensions/iceworks-app/src/utils/createEditorMenuAction.ts
index d83efaebe..514c3d4b4 100644
--- a/extensions/iceworks-app/src/createEditorMenuAction.ts
+++ b/extensions/iceworks-app/src/utils/createEditorMenuAction.ts
@@ -1,9 +1,9 @@
import * as vscode from 'vscode';
import { createNpmCommand, checkPathExists, checkIsAliInternal, registerCommand } from '@iceworks/common-service';
import { dependencyDir, projectPath } from '@iceworks/project-service';
-import { setDebugConfig } from './debugConfig/index';
-import showDefPublishEnvQuickPick from './quickPicks/showDefPublishEnvQuickPick';
-import executeCommand from './commands/executeCommand';
+import { setDebugConfig } from '../debugConfig/index';
+import showDefPublishEnvQuickPick from '../quickPicks/showDefPublishEnvQuickPick';
+import executeCommand from '../commands/executeCommand';
export default async function createEditorMenuAction() {
const EDITOR_MENU_RUN_DEBUG = 'iceworksApp.editorMenu.runDebug';
diff --git a/extensions/iceworks-app/src/getQuickEntryOptions.ts b/extensions/iceworks-app/src/utils/getQuickEntryOptions.ts
similarity index 83%
rename from extensions/iceworks-app/src/getQuickEntryOptions.ts
rename to extensions/iceworks-app/src/utils/getQuickEntryOptions.ts
index a8f92003e..c910174e8 100644
--- a/extensions/iceworks-app/src/getQuickEntryOptions.ts
+++ b/extensions/iceworks-app/src/utils/getQuickEntryOptions.ts
@@ -1,6 +1,7 @@
+import * as vscode from 'vscode';
import { getProjectType, checkIsPegasusProject, checkIsNotTarget } from '@iceworks/project-service';
import { checkIsAliInternal } from '@iceworks/common-service';
-import i18n from './i18n';
+import i18n from '../i18n';
const entries = [
{
@@ -8,6 +9,18 @@ const entries = [
detail: i18n.format('extension.iceworksApp.showEntriesQuickPick.projectCreater.detail'),
command: 'iceworks-project-creator.start',
},
+ {
+ label: i18n.format('extension.iceworksApp.showEntriesQuickPick.openDashboard.label'),
+ detail: i18n.format('extension.iceworksApp.showEntriesQuickPick.openDashboard.detail'),
+ command: 'iceworks-doctor.dashboard',
+ async condition() {
+ const doctorExtension = vscode.extensions.getExtension('iceworks-team.iceworks-doctor');
+ if (doctorExtension) {
+ return !(await checkIsNotTarget());
+ }
+ return false;
+ },
+ },
{
label: i18n.format('extension.iceworksApp.showEntriesQuickPick.generatePage.label'),
detail: i18n.format('extension.iceworksApp.showEntriesQuickPick.generatePage.detail'),
@@ -94,6 +107,11 @@ const entries = [
return !(await checkIsNotTarget());
},
},
+ {
+ label: i18n.format('extension.iceworksApp.showEntriesQuickPick.welcomePage.label'),
+ detail: i18n.format('extension.iceworksApp.showEntriesQuickPick.welcomePage.detail'),
+ command: 'iceworksApp.welcome.start',
+ },
{
label: i18n.format('extension.iceworksApp.showEntriesQuickPick.openSettings.label'),
detail: i18n.format('extension.iceworksApp.showEntriesQuickPick.openSettings.detail'),
@@ -103,13 +121,14 @@ const entries = [
export default async function () {
const conditionResults = await Promise.all(
- entries.map(async function ({ condition }) {
+ entries.map(async ({ condition }) => {
if (condition) {
- return await condition();
+ const result = await condition();
+ return result;
} else {
return true;
}
- })
+ }),
);
return entries.filter((v, index) => conditionResults[index]);
diff --git a/extensions/iceworks-app/src/openEntryFile.ts b/extensions/iceworks-app/src/utils/openEntryFile.ts
similarity index 84%
rename from extensions/iceworks-app/src/openEntryFile.ts
rename to extensions/iceworks-app/src/utils/openEntryFile.ts
index eef063995..508bcfd7e 100644
--- a/extensions/iceworks-app/src/openEntryFile.ts
+++ b/extensions/iceworks-app/src/utils/openEntryFile.ts
@@ -1,6 +1,4 @@
-import * as path from 'path';
import * as vscode from 'vscode';
-import * as fsExtra from 'fs-extra';
import { findIndexFile } from '@iceworks/common-service';
export default function openEntryFile(p: string) {
diff --git a/extensions/iceworks-app/src/views/componentsView.ts b/extensions/iceworks-app/src/views/componentsView.ts
index cf25e72c5..953d8de41 100644
--- a/extensions/iceworks-app/src/views/componentsView.ts
+++ b/extensions/iceworks-app/src/views/componentsView.ts
@@ -3,7 +3,7 @@ import * as fse from 'fs-extra';
import * as path from 'path';
import { checkPathExists, registerCommand } from '@iceworks/common-service';
import { componentsPath, projectPath } from '@iceworks/project-service';
-import openEntryFile from '../openEntryFile';
+import openEntryFile from '../utils/openEntryFile';
import showAddComponentQuickPick from '../quickPicks/showAddComponentQuickPick';
class ComponentsProvider implements vscode.TreeDataProvider {
@@ -12,7 +12,7 @@ class ComponentsProvider implements vscode.TreeDataProvider {
private extensionContext: vscode.ExtensionContext;
private onDidChange: vscode.EventEmitter = new vscode.EventEmitter<
- ComponentTreeItem | undefined
+ ComponentTreeItem | undefined
>();
readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event;
@@ -47,12 +47,12 @@ class ComponentsProvider implements vscode.TreeDataProvider {
}
}
- private async getComponents(componentsPath: string) {
+ private async getComponents(targetPath: string) {
try {
- const isComponentPathExists = await checkPathExists(componentsPath);
+ const isComponentPathExists = await checkPathExists(targetPath);
if (isComponentPathExists) {
const toComponent = (componentName: string) => {
- const componentPath = path.join(componentsPath, componentName);
+ const componentPath = path.join(targetPath, componentName);
const command: vscode.Command = {
command: 'iceworksApp.components.openFile',
@@ -62,10 +62,10 @@ class ComponentsProvider implements vscode.TreeDataProvider {
return new ComponentTreeItem(this.extensionContext, componentName, command, componentPath);
};
- const dirNames = await fse.readdir(componentsPath);
+ const dirNames = await fse.readdir(targetPath);
// except file
const componentNames = dirNames.filter((dirname) => {
- const stat = fse.statSync(path.join(componentsPath, dirname));
+ const stat = fse.statSync(path.join(targetPath, dirname));
return stat.isDirectory();
});
return componentNames.map((componentName) => toComponent(componentName));
@@ -83,7 +83,8 @@ class ComponentTreeItem extends vscode.TreeItem {
public readonly extensionContext: vscode.ExtensionContext,
public readonly label: string,
public readonly command: vscode.Command,
- public readonly path: string
+ // eslint-disable-next-line no-shadow
+ public readonly path: string,
) {
super(label);
}
diff --git a/extensions/iceworks-app/src/views/nodeDependenciesView.ts b/extensions/iceworks-app/src/views/nodeDependenciesView.ts
index 3ad3362c2..839b9acab 100644
--- a/extensions/iceworks-app/src/views/nodeDependenciesView.ts
+++ b/extensions/iceworks-app/src/views/nodeDependenciesView.ts
@@ -21,7 +21,7 @@ class DepNodeProvider implements vscode.TreeDataProvider {
private extensionContext: vscode.ExtensionContext;
private onDidChange: vscode.EventEmitter = new vscode.EventEmitter<
- DependencyTreeItem | undefined
+ DependencyTreeItem | undefined
>();
readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event;
@@ -57,14 +57,13 @@ class DepNodeProvider implements vscode.TreeDataProvider {
} else {
return Promise.resolve(
nodeDepTypes.map(
- (nodeDepType) =>
- new DependencyTreeItem(
- this.extensionContext,
- nodeDepType,
- vscode.TreeItemCollapsibleState.Collapsed,
- nodeDepType
- )
- )
+ (nodeDepType) => new DependencyTreeItem(
+ this.extensionContext,
+ nodeDepType,
+ vscode.TreeItemCollapsibleState.Collapsed,
+ nodeDepType,
+ ),
+ ),
);
}
}
@@ -96,7 +95,7 @@ class DepNodeProvider implements vscode.TreeDataProvider {
outdated = await this.getNpmOutdated(dep, version);
}
return toDep(this.extensionContext, workspaceDir, dep, version, outdated);
- })
+ }),
);
}
@@ -166,7 +165,7 @@ class DependencyTreeItem extends vscode.TreeItem {
public readonly id: string,
public readonly command?: vscode.Command,
public readonly version?: string,
- public readonly outDated?: boolean
+ public readonly outDated?: boolean,
) {
super(label, collapsibleState);
this.id = id;
@@ -186,10 +185,10 @@ class DependencyTreeItem extends vscode.TreeItem {
iconPath = {
dark: vscode.Uri.file(
- this.extensionContext.asAbsolutePath(`assets/dark/${this.version ? 'dependency' : 'dependency-entry'}.svg`)
+ this.extensionContext.asAbsolutePath(`assets/dark/${this.version ? 'dependency' : 'dependency-entry'}.svg`),
),
light: vscode.Uri.file(
- this.extensionContext.asAbsolutePath(`assets/light/${this.version ? 'dependency' : 'dependency-entry'}.svg`)
+ this.extensionContext.asAbsolutePath(`assets/light/${this.version ? 'dependency' : 'dependency-entry'}.svg`),
),
};
}
@@ -210,12 +209,8 @@ export function createNodeDependenciesTreeView(context) {
executeCommand(script);
}
});
- registerCommand('iceworksApp.nodeDependencies.dependencies.add', () =>
- showDepsInputBox(nodeDependenciesProvider, 'dependencies')
- );
- registerCommand('iceworksApp.nodeDependencies.devDependencies.add', () =>
- showDepsInputBox(nodeDependenciesProvider, 'devDependencies')
- );
+ registerCommand('iceworksApp.nodeDependencies.dependencies.add', () => showDepsInputBox(nodeDependenciesProvider, 'dependencies'));
+ registerCommand('iceworksApp.nodeDependencies.devDependencies.add', () => showDepsInputBox(nodeDependenciesProvider, 'devDependencies'));
registerCommand('iceworksApp.nodeDependencies.addDepsAndDevDeps', () => showDepsQuickPick(nodeDependenciesProvider));
const pattern = new vscode.RelativePattern(path.join(projectPath, dependencyDir), '**');
@@ -232,17 +227,17 @@ function toDep(
workspaceDir: string,
moduleName: string,
version: string,
- outdated: boolean
+ outdated: boolean,
) {
const packageManager = getDataFromSettingJson('packageManager');
const isYarn = packageManager === 'yarn';
const npmCommand = createNpmCommand(isYarn ? 'upgrade' : 'update', moduleName);
const command = outdated
? {
- command: 'iceworksApp.nodeDependencies.upgrade',
- title: 'Upgrade Dependency',
- arguments: [workspaceDir, npmCommand],
- }
+ command: 'iceworksApp.nodeDependencies.upgrade',
+ title: 'Upgrade Dependency',
+ arguments: [workspaceDir, npmCommand],
+ }
: undefined;
return new DependencyTreeItem(
extensionContext,
@@ -251,6 +246,6 @@ function toDep(
`nodeDependencies-${moduleName}`,
command,
version,
- outdated
+ outdated,
);
}
diff --git a/extensions/iceworks-app/src/views/npmScriptsView.ts b/extensions/iceworks-app/src/views/npmScriptsView.ts
index e2e41d561..01582607a 100644
--- a/extensions/iceworks-app/src/views/npmScriptsView.ts
+++ b/extensions/iceworks-app/src/views/npmScriptsView.ts
@@ -12,7 +12,7 @@ export class NpmScriptsProvider implements vscode.TreeDataProvider = new vscode.EventEmitter<
- ScriptTreeItem | undefined
+ ScriptTreeItem | undefined
>();
readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event;
@@ -56,9 +56,7 @@ export class NpmScriptsProvider implements vscode.TreeDataProvider
- toScript(script, packageJson.scripts[script], `npmScripts-${script}`)
- )
+ ? Object.keys(packageJson.scripts).map((script) => toScript(script, packageJson.scripts[script], `npmScripts-${script}`))
: [];
return scripts;
} else {
@@ -73,7 +71,7 @@ export class ScriptTreeItem extends vscode.TreeItem {
public readonly label: string,
public readonly tooltip: string,
public readonly command: vscode.Command,
- public readonly id: string
+ public readonly id: string,
) {
super(label);
this.id = id;
diff --git a/extensions/iceworks-app/src/views/pagesView.ts b/extensions/iceworks-app/src/views/pagesView.ts
index 66a6b7080..f573eb4dd 100644
--- a/extensions/iceworks-app/src/views/pagesView.ts
+++ b/extensions/iceworks-app/src/views/pagesView.ts
@@ -2,8 +2,8 @@ import * as vscode from 'vscode';
import * as fse from 'fs-extra';
import * as path from 'path';
import { checkPathExists, registerCommand } from '@iceworks/common-service';
-import { pagesPath, projectPath } from '@iceworks/project-service';
-import openEntryFile from '../openEntryFile';
+import { pagesPath as projectPagesPath, projectPath } from '@iceworks/project-service';
+import openEntryFile from '../utils/openEntryFile';
import i18n from '../i18n';
export class PagesProvider implements vscode.TreeDataProvider {
@@ -12,7 +12,7 @@ export class PagesProvider implements vscode.TreeDataProvider {
private extensionContext: vscode.ExtensionContext;
private onDidChange: vscode.EventEmitter = new vscode.EventEmitter<
- PageTreeItem | undefined
+ PageTreeItem | undefined
>();
readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event;
@@ -73,7 +73,8 @@ class PageTreeItem extends vscode.TreeItem {
public readonly extensionContext: vscode.ExtensionContext,
public readonly label: string,
public readonly command: vscode.Command,
- public readonly path: string
+ // eslint-disable-next-line no-shadow
+ public readonly path: string,
) {
super(label);
}
@@ -120,7 +121,7 @@ export function createPagesTreeView(context: vscode.ExtensionContext) {
registerCommand('iceworksApp.pages.openFile', (pagePath) => openEntryFile(pagePath));
registerCommand('iceworksApp.pages.delete', async (page) => await fse.remove(page.path));
- const pattern = new vscode.RelativePattern(pagesPath, '**');
+ const pattern = new vscode.RelativePattern(projectPagesPath, '**');
const fileWatcher = vscode.workspace.createFileSystemWatcher(pattern, false, false, false);
fileWatcher.onDidChange(() => pagesProvider.refresh());
fileWatcher.onDidCreate(() => pagesProvider.refresh());
diff --git a/extensions/iceworks-app/src/views/quickEntriesView.ts b/extensions/iceworks-app/src/views/quickEntriesView.ts
index 721072418..11e823dc7 100644
--- a/extensions/iceworks-app/src/views/quickEntriesView.ts
+++ b/extensions/iceworks-app/src/views/quickEntriesView.ts
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { registerCommand, executeCommand } from '@iceworks/common-service';
-import getQuickEntryOptions from '../getQuickEntryOptions';
+import getQuickEntryOptions from '../utils/getQuickEntryOptions';
export class QuickEntriesProvider implements vscode.TreeDataProvider {
private extensionContext: vscode.ExtensionContext;
@@ -36,7 +36,7 @@ class QuickEntryItem extends vscode.TreeItem {
public readonly extensionContext: vscode.ExtensionContext,
public readonly label: string,
public readonly tooltip: string,
- public readonly command: vscode.Command
+ public readonly command: vscode.Command,
) {
super(label);
}
diff --git a/extensions/iceworks-app/web/build.json b/extensions/iceworks-app/web/build.json
index 81682baa5..150871095 100644
--- a/extensions/iceworks-app/web/build.json
+++ b/extensions/iceworks-app/web/build.json
@@ -2,6 +2,7 @@
"devServer": {
"writeToDisk": true
},
+ "mpa": true,
"publicPath": "./",
"outputDir": "../build",
"plugins": [
diff --git a/extensions/iceworks-app/web/public/assets/dingtalk.svg b/extensions/iceworks-app/web/public/assets/dingtalk.svg
new file mode 100644
index 000000000..f0104889e
--- /dev/null
+++ b/extensions/iceworks-app/web/public/assets/dingtalk.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/extensions/iceworks-app/web/public/assets/doc.svg b/extensions/iceworks-app/web/public/assets/doc.svg
new file mode 100644
index 000000000..b9bf175db
--- /dev/null
+++ b/extensions/iceworks-app/web/public/assets/doc.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/extensions/iceworks-app/web/public/assets/updates.svg b/extensions/iceworks-app/web/public/assets/updates.svg
new file mode 100644
index 000000000..611957717
--- /dev/null
+++ b/extensions/iceworks-app/web/public/assets/updates.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/extensions/iceworks-app/web/public/index.html b/extensions/iceworks-app/web/public/index.html
index cf4a793e6..e0e6963d9 100644
--- a/extensions/iceworks-app/web/public/index.html
+++ b/extensions/iceworks-app/web/public/index.html
@@ -5,11 +5,11 @@
- Iceworks Application Creator
+ Iceworks App
-