diff --git a/extensions/iceworks-app/CHANGELOG.md b/extensions/iceworks-app/CHANGELOG.md index 296e43945..88345725b 100644 --- a/extensions/iceworks-app/CHANGELOG.md +++ b/extensions/iceworks-app/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.2.1 +- feat: add quick entry in the editor title menu +- fix: fail to set custom registry + ## 0.2.0 - feat: install dependencies automatically when node_modules does not exist - feat: refresh dependencies list、pages list and components list automatically diff --git a/extensions/iceworks-app/README.en.md b/extensions/iceworks-app/README.en.md index 3c7481d82..e753b9002 100644 --- a/extensions/iceworks-app/README.en.md +++ b/extensions/iceworks-app/README.en.md @@ -5,32 +5,90 @@ English | [简体中文](./README.md) # Iceworks Application Viewer -It helps you preview your Universal Application, including the information of npm scripts, pages, components and node dependencies. It also supports quick installation or upgrade dependencies, adding new pages and components, and much more. +Preview and manage your application from a framework perspective, including npm scripts, pages, components and dependencies, friendly for React and [Rax](https://rax.js.org/). ## Usage -### npm Scripts +### Initialize panel -- Support viewing the executable npm scripts of your app -- Support execute the npm scripts +After you install the Iceworks-APP plugin, an `Iceworks` icon will be added to your activity bar. Click it to enter Iceworks panel. -![script.gif](https://img.alicdn.com/tfs/TB1of.nHFT7gK0jSZFpXXaTkpXa-1272-786.gif) +The initialization panel appears if your current workspace is empty or ** isn't React/Rax application **. -### Pages and Components +![demo](https://user-images.githubusercontent.com/56879942/87553484-8e928980-c6e5-11ea-8183-a6ba7f4eae95.gif) -- Support jumping to corresponding pages and components -- Support adding pages and components(TODO) +### Create a new project -![pages&components.gif](https://img.alicdn.com/tfs/TB1tfArHHY1gK0jSZTEXXXDQVXa-1265-760.gif) +When you open an empty folder, the initialization panel automatically invokes the create application process, which you can also invoke by clicking the Create Application button on the panel. + +![demo](https://user-images.githubusercontent.com/56879942/87407459-c4a41080-c5f4-11ea-882e-d198afc35413.png) + +#### Setting + +![demo](https://user-images.githubusercontent.com/56879942/87531798-d1903500-c6c4-11ea-9c6d-e19d6241c91a.gif) + +1. Click Settings to enter the Settings page +2. Configure package management tools (default: npm) +3. Configure default image source (default: Taobao image) +4. Set up custom repositories (default: null) + +### Iceworks panel + +When your workspace is a React or Rax application, the Iceworks panel appears. + +#### View and execute npm Scripts + +![demo](https://user-images.githubusercontent.com/56879942/87393980-9f59d700-c5e1-11ea-9e07-0244926f54cc.gif) + +1. View executable script information in the left pane. +2. Click the `Play` button to execute the script at terminal immediately. +3. Click the `Stop` button to end the corresponding script executed at terminal. + +### Pages and Components + +#### Jump into corresponding pages and components + +![demo](https://user-images.githubusercontent.com/56879942/87393958-9963f600-c5e1-11ea-9c96-94fc10492577.gif) + +1. Click items in PAGES and COMPONENTS on the left panel. +2. Jump into files of selected projects. + +#### Wake up create pages and generate components( [Create Pages](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-page-builder)|[Generate Components](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-component-builder) ) + +![demo](https://user-images.githubusercontent.com/56879942/87393958-9963f600-c5e1-11ea-9c96-94fc10492577.gif) + +1. Click `+` in PAGES header to jump into GENERATE PAGES page. +2. Click `+` in COMPONENTS header to jump into CREATE COMPONENT page. ### Node Dependencies -- Support viewing the application dependency information -- Support installing new dependencies and upgrading dependencies -- Support installing and reinstalling dependencies -- Support setting npm client and npm registry +#### View the application dependency information and install new dependencies + +![demo](https://user-images.githubusercontent.com/56879942/87393973-9cf77d00-c5e1-11ea-8baa-96c8c41229cf.gif) + +1. View all installed dependencies in the project in NODE DEPENDENCIES in the bottom of ICE panel. +2. Click `⬆` button next to dependency item, you can update the dependency to the latest version. +3. Click `Reinstall Dependencies` button on NODE DEPENDENCIES header to reinstall all the dependencisce of the project. + +#### Install and reinstall dependencies + +![demo](https://user-images.githubusercontent.com/56879942/87393970-9bc65000-c5e1-11ea-9724-3bd47c4b21ed.gif) + +1. Click the `+` button on the NODE DEPENDENCIES header. +2. Select Install product Dependency or Debug Devdependency on the command panel that appears. +3. Type the npm package name and version information to be installed, such as' `typescript@latest`. +4. The npm package will be installed automatically. + NOTE: If the package was installed, it will be reinstalled. + +## Iceworks command palette + +If you install [Iceworks suite] (https://marketplace.visualstudio.com/items?ItemName=iceWorks-team.iceWorks), you can activate other extensions in VS Code command palette. + +![demo](https://user-images.githubusercontent.com/56879942/87544740-8d5b5f80-c6d9-11ea-85ff-bc31501911e1.gif) -![nodeDependencies.gif](https://img.alicdn.com/tfs/TB1SLgPXj39YK4jSZPcXXXrUFXa-1274-805.gif) +1. Find Iceworks in the bottom right of VS Code. + > 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. ## More diff --git a/extensions/iceworks-app/README.md b/extensions/iceworks-app/README.md index d21ba2971..b940bbca5 100644 --- a/extensions/iceworks-app/README.md +++ b/extensions/iceworks-app/README.md @@ -5,36 +5,94 @@ # Iceworks 应用大纲树 -它可以帮助你预览你的前端应用,包括 npm 脚本,页面,组件和依赖信息。它还支持快速安装或升级依赖,添加新页面和组件等等。 +从框架视角预览和管理您应用的组织,包括 npm 脚本、页面、组件和依赖信息。对 React 和 [Rax](https://rax.js.org/) 应用友好。 -## 用法 +## 功能 -### npm 脚本信息 +### 侧边栏 - 初始化 -- 支持查看应用可执行的 npm 脚本 -- 支持快速执行 npm 脚本 +当您安装了插件之后,VS Code 的活动栏上会增加 Iceworks 图标,单击此图标进入应用大纲树插件。 -![script.gif](https://img.alicdn.com/tfs/TB1of.nHFT7gK0jSZFpXXaTkpXa-1272-786.gif) +如您当前的**工作区为空**或**非 React/Rax 应用**,则会出现初始化侧边栏。 -### 页面和组件信息 +![使用示例](https://user-images.githubusercontent.com/56879942/87553484-8e928980-c6e5-11ea-8183-a6ba7f4eae95.gif) -- 支持快速跳转至对应的页面和组件 -- 支持快速添加页面和组件 (TODO) +#### 创建项目 -![pages&components.gif](https://img.alicdn.com/tfs/TB1tfArHHY1gK0jSZTEXXXDQVXa-1265-760.gif) +当您打开一个空文件夹时,初始化侧边栏将自动唤起创建应用流程,您也可以通过点击侧边栏上的「创建应用」按钮来唤起该流程。 -### 应用依赖信息 +![使用示例](https://user-images.githubusercontent.com/56879942/87407459-c4a41080-c5f4-11ea-882e-d198afc35413.png) -- 支持查看应用的依赖信息 -- 支持安装新依赖和升级依赖 -- 支持一键安装和重装依赖 -- 支持设置 npm 包管理工具和镜像地址 +#### 设置 -![nodeDependencies.gif](https://img.alicdn.com/tfs/TB1SLgPXj39YK4jSZPcXXXrUFXa-1274-805.gif) +![使用示例](https://user-images.githubusercontent.com/56879942/87531798-d1903500-c6c4-11ea-9c6d-e19d6241c91a.gif) + +1. 点击设置,进入设置页面 +2. 配置包管理工具(默认为 npm ) +3. 配置默认镜像源(默认为淘宝网镜像) +4. 选择自定义物料库 (无默认外部物料库) + +### 侧边栏 - 大纲树 + +当您的工作区是一个 React 或 Rax 应用,则会出现大纲树侧边栏。 + +#### 查看和执行应用的 npm 脚本 + +![使用示例](https://user-images.githubusercontent.com/56879942/87393980-9f59d700-c5e1-11ea-9e07-0244926f54cc.gif) + +1. 在左侧的面板处查看可执行的脚本信息; +2. 点击 `播放按钮` ,立即在终端执行脚本; +3. 点击 `终止按钮` ,结束在终端执行的对应脚本。 + +#### 页面和组件信息 + +##### 快速跳转至对应页面和组件的源码 + +![使用示例](https://user-images.githubusercontent.com/56879942/87393958-9963f600-c5e1-11ea-9c96-94fc10492577.gif) + +1. 点击左侧面板中页面列表和组件列表中的选项。 +2. 跳转到所选项目所在的源码文件 + +##### 支持激活添加页面和组件功能 (使用方法参照 [生成页面](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-page-builder)|[创建组件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-component-builder) ) + +![使用示例](https://user-images.githubusercontent.com/56879942/87393953-949f4200-c5e1-11ea-896a-fd2d592050e0.gif) + +1. 点击页面列表标题栏的 `+` 进入生成页面界面; +2. 点击组件列表标题栏的 `+` 进入创建组件界面。 + +#### 应用依赖信息 + +##### 查看依赖信息、升级依赖包或重装应用依赖 + +![使用示例](https://user-images.githubusercontent.com/56879942/87393973-9cf77d00-c5e1-11ea-8baa-96c8c41229cf.gif) + +1. 在左下角依赖库中查看应用安装的所有依赖; +2. 点击依赖项目旁边的 `⬆️` 按钮,即可更新到最新依赖; +3. 点击依赖列表标题框上的 `重装依赖` 按钮,即可重装应用的所有依赖包。 + +##### 一键安装或重装指定依赖 + +![使用示例](https://user-images.githubusercontent.com/56879942/87393970-9bc65000-c5e1-11ea-9724-3bd47c4b21ed.gif) + +1. 点击依赖列表标题框上面的 `+` 按钮; +2. 在出现的命令面板上选择安装为 Dependencies (生产环境的依赖)或 devDependencies (开发环境的依赖); +3. 输入需要安装的 npm 包及版本信息,例如 `typescript@latest` ; +4. npm 包将会自动安装,如果这个包已经添加到了依赖中,那么将会重新安装。 + + +### 命令面板 + +您可以通过点击窗口右下角状态栏上的「Iceworks」按钮激活 Iceworks 命令面板。 + +![使用示例](https://user-images.githubusercontent.com/56879942/87544740-8d5b5f80-c6d9-11ea-85ff-bc31501911e1.gif) + +1. 找到 VS Code 右下角的 Iceworks 。 + > 注意 : 如果没有 Iceworks 图标,请按照 `激活` 章节的内容来激活此按钮。 +2. 点击 Iceworks 按钮,打开命令面板。 ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License diff --git a/extensions/iceworks-app/assets/dark/build.svg b/extensions/iceworks-app/assets/dark/build.svg new file mode 100644 index 000000000..f4586f0cf --- /dev/null +++ b/extensions/iceworks-app/assets/dark/build.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/dark/publish.svg b/extensions/iceworks-app/assets/dark/publish.svg new file mode 100644 index 000000000..b4a1dcf9c --- /dev/null +++ b/extensions/iceworks-app/assets/dark/publish.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/dark/runDev.svg b/extensions/iceworks-app/assets/dark/runDev.svg new file mode 100644 index 000000000..fb7867311 --- /dev/null +++ b/extensions/iceworks-app/assets/dark/runDev.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/dark/setting.svg b/extensions/iceworks-app/assets/dark/setting.svg index 3f9ec0504..296b1eedd 100644 --- a/extensions/iceworks-app/assets/dark/setting.svg +++ b/extensions/iceworks-app/assets/dark/setting.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/light/build.svg b/extensions/iceworks-app/assets/light/build.svg new file mode 100644 index 000000000..10777ab04 --- /dev/null +++ b/extensions/iceworks-app/assets/light/build.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/light/publish.svg b/extensions/iceworks-app/assets/light/publish.svg new file mode 100644 index 000000000..5e4471ec3 --- /dev/null +++ b/extensions/iceworks-app/assets/light/publish.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/light/runDev.svg b/extensions/iceworks-app/assets/light/runDev.svg new file mode 100644 index 000000000..5fcb156df --- /dev/null +++ b/extensions/iceworks-app/assets/light/runDev.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/light/setting.svg b/extensions/iceworks-app/assets/light/setting.svg index 752c478b8..729b9d2a8 100644 --- a/extensions/iceworks-app/assets/light/setting.svg +++ b/extensions/iceworks-app/assets/light/setting.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/logo.png b/extensions/iceworks-app/assets/logo.png index 2004c78ce..bc5de7d9b 100644 Binary files a/extensions/iceworks-app/assets/logo.png and b/extensions/iceworks-app/assets/logo.png differ diff --git a/extensions/iceworks-app/package.json b/extensions/iceworks-app/package.json index c8f5dec42..9e60685f8 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.2.0", + "version": "0.2.1", "engines": { "vscode": "^1.41.0" }, @@ -90,7 +90,19 @@ "commands": [ { "command": "iceworksApp.configHelper.start", - "title": "%iceworksApp.command.configHelper.start.title%" + "title": "%iceworksApp.command.configHelper.start.title%", + "icon": { + "light": "assets/light/setting.svg", + "dark": "assets/dark/setting.svg" + } + }, + { + "command": "iceworksApp.DefPublish", + "title": "%iceworksApp.command.DefPublish.title%", + "icon": { + "light": "assets/light/publish.svg", + "dark": "assets/dark/publish.svg" + } }, { "command": "iceworksApp.npmScripts.refresh", @@ -116,6 +128,30 @@ "dark": "assets/dark/stop.svg" } }, + { + "command": "iceworksApp.npmScripts.runDev", + "title": "%iceworksApp.command.npmScripts.runDev.title%", + "icon": { + "light": "assets/light/runDev.svg", + "dark": "assets/dark/runDev.svg" + } + }, + { + "command": "iceworksApp.npmScripts.stopDev", + "title": "%iceworksApp.command.npmScripts.stopDev.title%", + "icon": { + "light": "assets/light/stop.svg", + "dark": "assets/dark/stop.svg" + } + }, + { + "command": "iceworksApp.npmScripts.runBuild", + "title": "%iceworksApp.command.npmScripts.runBuild.title%", + "icon": { + "light": "assets/light/build.svg", + "dark": "assets/dark/build.svg" + } + }, { "command": "iceworksApp.pages.add", "title": "%iceworksApp.command.pages.add.title%", @@ -216,6 +252,33 @@ "command": "iceworksApp.nodeDependencies.addDepsAndDevDeps" } ], + "editor/title": [ + { + "command": "iceworksApp.npmScripts.runDev", + "group": "navigation@01", + "when": "iceworks:showScriptIconInEditorTitleMenu && !iceworks:isRunningDev" + }, + { + "command": "iceworksApp.npmScripts.stopDev", + "group": "navigation@01", + "when": "iceworks:showScriptIconInEditorTitleMenu && iceworks:isRunningDev" + }, + { + "command": "iceworksApp.DefPublish", + "group": "navigation@02", + "when": "iceworks:showScriptIconInEditorTitleMenu && iceworks:isAliInternal" + }, + { + "command": "iceworksApp.npmScripts.runBuild", + "group": "navigation@02", + "when": "iceworks:showScriptIconInEditorTitleMenu && !iceworks:isAliInternal" + }, + { + "command": "iceworksApp.configHelper.start", + "group": "navigation@03", + "when": "iceworks:showScriptIconInEditorTitleMenu" + } + ], "view/title": [ { "command": "iceworksApp.npmScripts.refresh", @@ -320,7 +383,7 @@ "vscode:prepublish": "rm -rf build && npm run build:web && webpack --mode production", "build:web": "cd web && npm run build", "watch:web": "cd web && npm run start", - "webpack": "webpack --mode development", + "webpack": "rm -rf ./build/extension.js && webpack --mode development", "webpack-dev": "webpack --mode development --watch", "compile": "tsc -p ./tsconfig.json" }, diff --git a/extensions/iceworks-app/package.nls.json b/extensions/iceworks-app/package.nls.json index 0cf8f01ca..b8813db7b 100644 --- a/extensions/iceworks-app/package.nls.json +++ b/extensions/iceworks-app/package.nls.json @@ -9,9 +9,13 @@ "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: Set Configuration", + "iceworksApp.command.DefPublish.title": "Iceworks: Def Publish", "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.stopDev.title": "IceWorks: Stop Dev", + "iceworksApp.command.npmScripts.runBuild.title": "IceWorks: Run Build", "iceworksApp.command.pages.add.title": "Add Pages", "iceworksApp.command.pages.refresh.title": "Refresh", "iceworksApp.command.pages.openFile.title": "Open File", diff --git a/extensions/iceworks-app/package.nls.zh-cn.json b/extensions/iceworks-app/package.nls.zh-cn.json index 63138cb4a..0713116d7 100644 --- a/extensions/iceworks-app/package.nls.zh-cn.json +++ b/extensions/iceworks-app/package.nls.zh-cn.json @@ -9,9 +9,13 @@ "iceworksApp.viewsWelcome.components.contents": "未找到组件。", "iceworksApp.viewsWelcome.nodeDependencies.contents": "未找到依赖。", "iceworksApp.command.configHelper.start.title": "Iceworks: 设置", + "iceworksApp.command.DefPublish.title": "Iceworks: 使用 Def 发布", "iceworksApp.command.npmScripts.refresh.title": "刷新", "iceworksApp.command.npmScripts.run.title": "运行脚本", "iceworksApp.command.npmScripts.stop.title": "停止脚本", + "iceworksApp.command.npmScripts.runDev.title": "Iceworks: 开始本地调试", + "iceworksApp.command.npmScripts.stopDev.title": "Iceworks: 停止本地调试", + "iceworksApp.command.npmScripts.runBuild.title": "Iceworks: 本地构建", "iceworksApp.command.pages.add.title": "添加页面", "iceworksApp.command.pages.refresh.title": "刷新", "iceworksApp.command.pages.openFile.title": "打开文件", diff --git a/extensions/iceworks-app/src/constants.ts b/extensions/iceworks-app/src/constants.ts index a82ac4134..89a21291b 100644 --- a/extensions/iceworks-app/src/constants.ts +++ b/extensions/iceworks-app/src/constants.ts @@ -4,7 +4,8 @@ export const entryFileSuffix = [ '.jsx', '.js', '.tsx', - '.rml' + '.rml', + '.vue' ]; export const nodeDepTypes: NodeDepTypes[] = [ @@ -13,3 +14,6 @@ export const nodeDepTypes: NodeDepTypes[] = [ ]; export const showExtensionsQuickPickCommandId = 'iceworksApp.showExtensionsQuickPick'; + +export const editorTitleRunDevCommandId = 'npmScripts-editor-title-run-dev'; +export const editorTitleRunBuildCommandId = 'npmScripts-editor-title-run-build'; diff --git a/extensions/iceworks-app/src/extension.ts b/extensions/iceworks-app/src/extension.ts index f58b6a428..f5f2040bb 100644 --- a/extensions/iceworks-app/src/extension.ts +++ b/extensions/iceworks-app/src/extension.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import { Terminal, window, ViewColumn } from 'vscode'; import { connectService, getHtmlForWebview } from '@iceworks/vscode-webview/lib/vscode'; import { getProjectType } from '@iceworks/project-service'; -import { initExtension, Logger } from '@iceworks/common-service'; +import { initExtension, Logger, checkIsAliInternal } from '@iceworks/common-service'; import { createNpmScriptsTreeProvider } from './views/npmScriptsView'; import { createNodeDependenciesTreeProvider } from './views/nodeDependenciesView'; import { createComponentsTreeProvider } from './views/componentsView'; @@ -11,6 +11,7 @@ import { ITerminalMap } from './types'; import services from './services'; import { showExtensionsQuickPickCommandId } from './constants'; import showExtensionsQuickPick from './quickPicks/showExtensionsQuickPick'; +import showDefPublishEnvQuickPick from './quickPicks/showDefPublishEnvQuickPick'; import createExtensionsStatusBar from './statusBar/createExtensionsStatusBar'; // eslint-disable-next-line @@ -63,10 +64,19 @@ export async function activate(context: vscode.ExtensionContext) { vscode.commands.executeCommand('setContext', 'iceworks:isNotTargetProject', true); vscode.commands.executeCommand('iceworks-project-creator.start'); } + const terminals: ITerminalMap = new Map(); // init tree data providers createNpmScriptsTreeProvider(context, rootPath, terminals); createComponentsTreeProvider(context, rootPath); createPagesTreeProvider(context, rootPath); createNodeDependenciesTreeProvider(context, rootPath, terminals); + // show script icons in editor title menu + vscode.commands.executeCommand('setContext', 'iceworks:showScriptIconInEditorTitleMenu', true); + const isAliInternal = await checkIsAliInternal(); + // DEF publish command in editor title + vscode.commands.executeCommand('setContext', 'iceworks:isAliInternal', isAliInternal); + if (isAliInternal) { + context.subscriptions.push(vscode.commands.registerCommand('iceworksApp.DefPublish', () => showDefPublishEnvQuickPick(terminals, rootPath))); + } } diff --git a/extensions/iceworks-app/src/quickPicks/showDefPublishEnvQuickPick.ts b/extensions/iceworks-app/src/quickPicks/showDefPublishEnvQuickPick.ts new file mode 100644 index 000000000..67a36a8c3 --- /dev/null +++ b/extensions/iceworks-app/src/quickPicks/showDefPublishEnvQuickPick.ts @@ -0,0 +1,29 @@ +import * as vscode from 'vscode'; +import { ITerminalMap } from '../types'; +import executeCommand from '../commands/executeCommand'; + +const { window } = vscode; + +const DEFEnvOptions = [ + { label: 'daily', detail: '发布到日常环境', command: 'def p -d' }, + { label: 'prod', detail: '发布到线上环境', command: 'def p -o' }, +] + +export default function showDefPublishEnvQuickPick(terminalMapping: ITerminalMap, rootPath: string) { + const quickPick = window.createQuickPick(); + quickPick.items = DEFEnvOptions.map((options) => ({ label: options.label, detail: options.detail })); + quickPick.onDidChangeSelection(selection => { + if (selection[0]) { + const env = DEFEnvOptions.find(option => option.label === selection[0].label)!; + const command: vscode.Command = { + title: 'Publish', + command: 'iceworksApp.DefPublish', + arguments: [rootPath, env.command] + } + executeCommand(terminalMapping, command, `DefPublish-${env.label}`) + quickPick.dispose(); + } + }); + quickPick.onDidHide(() => quickPick.dispose()); + quickPick.show(); +} diff --git a/extensions/iceworks-app/src/views/nodeDependenciesView.ts b/extensions/iceworks-app/src/views/nodeDependenciesView.ts index f078a9a89..42218f405 100644 --- a/extensions/iceworks-app/src/views/nodeDependenciesView.ts +++ b/extensions/iceworks-app/src/views/nodeDependenciesView.ts @@ -219,5 +219,5 @@ function toDep(extensionContext: vscode.ExtensionContext, workspaceDir: string, arguments: [workspaceDir, npmCommand] } : undefined; - return new DependencyTreeItem(extensionContext, moduleName, vscode.TreeItemCollapsibleState.None, `dependency-${moduleName}`, command, version, outdated); + return new DependencyTreeItem(extensionContext, moduleName, vscode.TreeItemCollapsibleState.None, `nodeDependencies-${moduleName}`, command, version, outdated); }; diff --git a/extensions/iceworks-app/src/views/npmScriptsView.ts b/extensions/iceworks-app/src/views/npmScriptsView.ts index 6e614d0bc..561bc78e2 100644 --- a/extensions/iceworks-app/src/views/npmScriptsView.ts +++ b/extensions/iceworks-app/src/views/npmScriptsView.ts @@ -6,6 +6,7 @@ import { dependencyDir, packageJSONFilename } from '@iceworks/project-service'; import executeCommand from '../commands/executeCommand'; import stopCommand from '../commands/stopCommand'; import { ITerminalMap } from '../types'; +import { editorTitleRunDevCommandId, editorTitleRunBuildCommandId } from '../constants'; export class NpmScriptsProvider implements vscode.TreeDataProvider { private workspaceRoot: string; @@ -61,7 +62,7 @@ export class NpmScriptsProvider implements vscode.TreeDataProvider toScript(script, packageJson.scripts[script], `script-${script}`)) + ? Object.keys(packageJson.scripts).map((script) => toScript(script, packageJson.scripts[script], `npmScripts-${script}`)) : []; return scripts; } else { @@ -106,6 +107,45 @@ export function createNpmScriptsTreeProvider(context: vscode.ExtensionContext, r vscode.commands.registerCommand('iceworksApp.npmScripts.stop', (script: ScriptTreeItem) => stopCommand(terminals, script.id)); vscode.commands.registerCommand('iceworksApp.npmScripts.refresh', () => npmScriptsProvider.refresh()); + // commands in editor title + vscode.commands.registerCommand('iceworksApp.npmScripts.runDev', async () => { + const pathExists = await checkPathExists(rootPath, dependencyDir); + const command: vscode.Command = { + command: 'iceworksApp.npmScripts.runDev', + title: 'Run Dev', + arguments: [rootPath, createNpmCommand('run', 'start')] + }; + const commandId = editorTitleRunDevCommandId; + if (!pathExists) { + command.arguments = [rootPath, `${createNpmCommand('install')} && ${command.arguments![1]}`]; + executeCommand(terminals, command, commandId); + return; + } + executeCommand(terminals, command, commandId); + vscode.commands.executeCommand('setContext', 'iceworks:isRunningDev', true); + }); + + vscode.commands.registerCommand('iceworksApp.npmScripts.stopDev', () => { + stopCommand(terminals, editorTitleRunDevCommandId); + vscode.commands.executeCommand('setContext', 'iceworks:isRunningDev', false); + }); + + vscode.commands.registerCommand('iceworksApp.npmScripts.runBuild', async () => { + const pathExists = await checkPathExists(rootPath, dependencyDir); + const command: vscode.Command = { + command: 'iceworksApp.npmScripts.runBuild', + title: 'Run Build', + arguments: [rootPath, createNpmCommand('run', 'build')] + }; + const commandId = editorTitleRunBuildCommandId; + if (!pathExists) { + command.arguments = [rootPath, `${createNpmCommand('install')} && ${command.arguments![1]}`]; + executeCommand(terminals, command, commandId); + return; + } + executeCommand(terminals, command, commandId) + }); + const pattern = path.join(rootPath, packageJSONFilename); const fileWatcher = vscode.workspace.createFileSystemWatcher(pattern); fileWatcher.onDidChange(() => npmScriptsProvider.refresh()); diff --git a/extensions/iceworks-app/web/src/constants.ts b/extensions/iceworks-app/web/src/constants.ts index d6f161f7c..ec59441a1 100644 --- a/extensions/iceworks-app/web/src/constants.ts +++ b/extensions/iceworks-app/web/src/constants.ts @@ -7,4 +7,9 @@ export const npmRegistries = [ export const AliNpmRegistry = 'https://registry.npm.alibaba-inc.com'; -export const AliPackageManager = 'tnpm'; \ No newline at end of file +export const AliPackageManager = 'tnpm'; + +export const urlRegExp = new RegExp( + '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', + 'i' +) \ No newline at end of file diff --git a/extensions/iceworks-app/web/src/pages/ConfigHelper/index.module.scss b/extensions/iceworks-app/web/src/pages/ConfigHelper/index.module.scss index 46d5b07b6..bd8ef264c 100644 --- a/extensions/iceworks-app/web/src/pages/ConfigHelper/index.module.scss +++ b/extensions/iceworks-app/web/src/pages/ConfigHelper/index.module.scss @@ -8,3 +8,8 @@ } } } + +.loading { + width: 100%; + height: 80vh; +} diff --git a/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx b/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx index acab2b393..16511887f 100644 --- a/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx +++ b/extensions/iceworks-app/web/src/pages/ConfigHelper/index.tsx @@ -1,8 +1,8 @@ import React, { useState, useEffect } from 'react'; -import { Form, Select, Input, Notification } from '@alifd/next'; +import { Form, Select, Input, Notification, Loading } from '@alifd/next'; import { debounce } from 'throttle-debounce'; import { IMaterialSource } from '@iceworks/material-utils'; -import { packageManagers, npmRegistries, AliNpmRegistry, AliPackageManager } from '@/constants'; +import { packageManagers, npmRegistries, AliNpmRegistry, AliPackageManager, urlRegExp } from '@/constants'; import callService from '@/callService'; import CustomMaterialSource from './CustomMaterialSource'; import styles from './index.module.scss'; @@ -19,6 +19,7 @@ const CUSTOM_NPM_REGISTRY_SELECT_KEY = 'npm - 自定义镜像源'; const ConfigHelper = () => { const [materialSources, setMaterialSources] = useState([]); const [fields, setFields] = useState({}); + const [loading, setLoading] = useState(false); const onSourceAdd = async (materialSource: IMaterialSource) => { try { @@ -57,7 +58,7 @@ const ConfigHelper = () => { return; } if (name === CUSTOM_NPM_REGISTRY_FORM_ITEM_KEY && - !/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(value)) { + !urlRegExp.test(value)) { return; } if (name === CUSTOM_NPM_REGISTRY_FORM_ITEM_KEY) { @@ -74,6 +75,7 @@ const ConfigHelper = () => { useEffect(() => { async function initFormData() { try { + setLoading(true); const curPackageManager = await callService('common', 'getDataFromSettingJson', 'packageManager'); let curNpmRegistry = await callService('common', 'getDataFromSettingJson', 'npmRegistry'); const curMaterialSources = await callService('material', 'getUserSources'); @@ -92,6 +94,8 @@ const ConfigHelper = () => { setFields({ packageManager: curPackageManager, npmRegistry: curNpmRegistry, customNpmRegistry }); } catch (e) { Notification.error({ content: e.message }); + } finally { + setLoading(false); } } @@ -99,35 +103,39 @@ const ConfigHelper = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( -
-
- - - - - - - {fields.npmRegistry === CUSTOM_NPM_REGISTRY_SELECT_KEY && ( - - - - )} -
- -
+ <> + {loading ? : ( +
+
+ + + + + + + {fields.npmRegistry === CUSTOM_NPM_REGISTRY_SELECT_KEY && ( + + + + )} +
+ +
+ )} + ) } diff --git a/extensions/iceworks-component-builder/CHANGELOG.md b/extensions/iceworks-component-builder/CHANGELOG.md index c3577c1a6..39145679d 100644 --- a/extensions/iceworks-component-builder/CHANGELOG.md +++ b/extensions/iceworks-component-builder/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.1.10 + +Change the material setting entry to Iceworks setting. + ## 0.1.9 Use webpack to build this extension. diff --git a/extensions/iceworks-component-builder/README.en.md b/extensions/iceworks-component-builder/README.en.md index 866b693a5..1aad4d7cc 100644 --- a/extensions/iceworks-component-builder/README.en.md +++ b/extensions/iceworks-component-builder/README.en.md @@ -5,15 +5,26 @@ English | [简体中文](./README.md) # Iceworks Component Builder -Create a component in a low-code way. +Create components quickly from materials. ## Usage -![create-component](https://img.alicdn.com/tfs/TB1.WORe5cKOu4jSZKbXXc19XXa-960-600.gif) +Iceworks provides a huge amount of high-quality materials for React and [Rax](https://rax.js.org/) apps that can be added to your app with one click. -1. Enter the component name (to be used as the folder name) -2. Select the block to be download -3. Click "generate component" button to generate component code +### Activate Extension + +![demo](https://user-images.githubusercontent.com/56879942/87535699-77926e00-c6ca-11ea-9e21-65fad2e95e0f.gif) + +1. Through (Ctrl+Shift+P or ⇧⌘P) evoke vscode command palette +2. In the vscode command palette, enter 'Iceworks: Generate component', click the selected item or press enter to arouse the plugin; + +### Create components + +![demo](https://user-images.githubusercontent.com/56879942/87396941-2c069400-c5e6-11ea-8df8-f0ff5879da3b.gif) + +1. Fill in the component name (also the folder name of the componenent) +2. Select a material below. +3. Click `生成组件(Generate components)` button to generate component code. ## More diff --git a/extensions/iceworks-component-builder/README.md b/extensions/iceworks-component-builder/README.md index ac9862c0d..8fb5a358b 100644 --- a/extensions/iceworks-component-builder/README.md +++ b/extensions/iceworks-component-builder/README.md @@ -5,20 +5,31 @@ # Iceworks 组件创建插件 -使用低代码的方式创建前端组件。 +通过物料快速创建前端组件。 -## 用法 +## 功能 -![create-component](https://img.alicdn.com/tfs/TB1.WORe5cKOu4jSZKbXXc19XXa-960-600.gif) +### 激活 -1. 输入组件名(将用作文件夹名) -2. 选择区块 -3. 点击「生成组件」按钮,生成组件代码 +![使用示例](https://user-images.githubusercontent.com/56879942/87535699-77926e00-c6ca-11ea-9e21-65fad2e95e0f.gif) + +1. 通过 `⇧⌘P` ( MacOS ) 或 `Ctrl+Shift+p` ( Windows ) 快捷键唤起命令面板; +2. 输入 `Iceworks:Generate Component` ,点击选中的项目或按下键盘回车键,激活插件 + +### 创建前端组件 + +Iceworks 为 React 和 [Rax](https://rax.js.org/) 应用提供了海量的高质量物料,可一键添加到您的应用中。 + +![使用示例](https://user-images.githubusercontent.com/56879942/87535673-6f3a3300-c6ca-11ea-852e-f3a2bb3eb7bc.gif) + +1. 填写组件名(同时也是组件所在文件夹的名称); +2. 组件名输入框下方选择一个使用的区块; +3. 点击 `生成组件` 按钮,生成组件代码。 ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License -[MIT](https://github.com/ice-lab/iceworks/blob/master/LICENSE) +[MIT](https://github.com/ice-lab/iceworks/blob/master/LICENSE) \ No newline at end of file diff --git a/extensions/iceworks-component-builder/assets/logo.png b/extensions/iceworks-component-builder/assets/logo.png index 2004c78ce..32844c049 100644 Binary files a/extensions/iceworks-component-builder/assets/logo.png and b/extensions/iceworks-component-builder/assets/logo.png differ diff --git a/extensions/iceworks-component-builder/package.json b/extensions/iceworks-component-builder/package.json index 059181a3a..125202f65 100644 --- a/extensions/iceworks-component-builder/package.json +++ b/extensions/iceworks-component-builder/package.json @@ -3,7 +3,7 @@ "displayName": "Iceworks Component Builder", "description": "Build Component UI by low-code way", "publisher": "iceworks-team", - "version": "0.1.9", + "version": "0.1.10", "engines": { "vscode": "^1.41.0" }, diff --git a/extensions/iceworks-component-builder/web/src/pages/Home/index.tsx b/extensions/iceworks-component-builder/web/src/pages/Home/index.tsx index fca4d59f6..762f8f4a9 100644 --- a/extensions/iceworks-component-builder/web/src/pages/Home/index.tsx +++ b/extensions/iceworks-component-builder/web/src/pages/Home/index.tsx @@ -6,7 +6,7 @@ import styles from './index.module.scss'; async function onSettingsClick() { try { - await callService('common', 'executeCommand', 'workbench.action.openSettings', 'iceworks.materialSources'); + await callService('common', 'executeCommand', 'iceworksApp.configHelper.start'); } catch (e) { Notification.error({ content: e.message }); } diff --git a/extensions/iceworks-config-helper/.vscode/launch.json b/extensions/iceworks-config-helper/.vscode/launch.json index 86c4b6662..0795ba906 100644 --- a/extensions/iceworks-config-helper/.vscode/launch.json +++ b/extensions/iceworks-config-helper/.vscode/launch.json @@ -12,7 +12,11 @@ "runtimeExecutable": "${execPath}", "args": [ "--extensionDevelopmentPath=${workspaceFolder}" - ] + ], + "outFiles": [ + "${workspaceFolder}/out/**/*.js" + ], + "preLaunchTask": "${defaultBuildTask}" }, { "name": "Extension Tests", @@ -22,7 +26,11 @@ "args": [ "--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/test/suite/index" - ] + ], + "outFiles": [ + "${workspaceFolder}/out/test/**/*.js" + ], + "preLaunchTask": "${defaultBuildTask}" } ] -} +} \ No newline at end of file diff --git a/extensions/iceworks-config-helper/.vscode/tasks.json b/extensions/iceworks-config-helper/.vscode/tasks.json new file mode 100644 index 000000000..078ff7e01 --- /dev/null +++ b/extensions/iceworks-config-helper/.vscode/tasks.json @@ -0,0 +1,20 @@ +// See https://go.microsoft.com/fwlink/?LinkId=733558 +// for the documentation about the tasks.json format +{ + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "watch", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "presentation": { + "reveal": "never" + }, + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/extensions/iceworks-config-helper/CHANGELOG.md b/extensions/iceworks-config-helper/CHANGELOG.md index 8a8408d2a..b7fe4f4e6 100644 --- a/extensions/iceworks-config-helper/CHANGELOG.md +++ b/extensions/iceworks-config-helper/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.2.0 + +- feat: add ICE APP build.json validation + ## 0.1.0 - feat: add build.json validation diff --git a/extensions/iceworks-config-helper/README.en.md b/extensions/iceworks-config-helper/README.en.md index e8dfdf2d7..9743ade83 100644 --- a/extensions/iceworks-config-helper/README.en.md +++ b/extensions/iceworks-config-helper/README.en.md @@ -13,21 +13,19 @@ For icejs and rax-app configuration files(like app.json/build.json), provides vi Whenever you hover over some JSON key, shows the description in a Hover widget. -![img01](https://img.alicdn.com/tfs/TB1e1wYvEY1gK0jSZFCXXcwqXXa-1140-592.gif) +![demo](https://user-images.githubusercontent.com/56879942/87398212-290ca300-c5e8-11ea-9596-c15c380c0d7c.gif) ### Code Completion When you input it will show key suggestions related to your config. -![img02](https://img.alicdn.com/tfs/TB188ZZvrj1gK0jSZFuXXcrHpXa-1132-774.gif) +![demo](https://user-images.githubusercontent.com/56879942/87398228-2e69ed80-c5e8-11ea-8b2e-611924fa76bb.gif) ### Snippets -![img03](https://img.alicdn.com/tfs/TB1a6IZvuH2gK0jSZJnXXaT1FXa-1136-1334.gif) +Use code snippets for quick configuration: -### Validator - -Checks the config file setting accurately. +![demo](https://user-images.githubusercontent.com/56879942/87398223-2d38c080-c5e8-11ea-8eef-2f208f498210.gif) ## More diff --git a/extensions/iceworks-config-helper/README.md b/extensions/iceworks-config-helper/README.md index 494dfca5d..13cbc05dc 100644 --- a/extensions/iceworks-config-helper/README.md +++ b/extensions/iceworks-config-helper/README.md @@ -7,31 +7,29 @@ 为 icejs 和 rax-app 的配置类文件(build.json/app.json)提供可视化表单设置或代码编辑提醒、校验等功能。 -## 用法 +## 功能 -### 悬停信息 +### 悬停提示 -当您将鼠标悬停在某个 JSON 的字段上时,会出现悬浮小部件显示字段的描述: +当您将鼠标悬停在某个 JSON 的字段上时,会出现悬浮小部件显示字段的描述。 -![img01](https://img.alicdn.com/tfs/TB1e1wYvEY1gK0jSZFCXXcwqXXa-1140-592.gif) +![使用说明](https://user-images.githubusercontent.com/56879942/87398212-290ca300-c5e8-11ea-9596-c15c380c0d7c.gif) -### 输入提示 +### 自动补全 -当您在输入时,显示与您的配置相关的建议: +当您在输入时,显示与您的配置相关的建议。 -![img02](https://img.alicdn.com/tfs/TB188ZZvrj1gK0jSZFuXXcrHpXa-1132-774.gif) +![使用说明](https://user-images.githubusercontent.com/56879942/87398228-2e69ed80-c5e8-11ea-8b2e-611924fa76bb.gif) ### 代码片段 -![img03](https://img.alicdn.com/tfs/TB1a6IZvuH2gK0jSZJnXXaT1FXa-1136-1334.gif) +预设标准的代码片段,方便您进行快速配置。 -### 校验 - -检查配置文件的设置是否合法。 +![使用说明](https://user-images.githubusercontent.com/56879942/87398223-2d38c080-c5e8-11ea-8eef-2f208f498210.gif) ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License diff --git a/extensions/iceworks-config-helper/assets/logo.png b/extensions/iceworks-config-helper/assets/logo.png index 2004c78ce..f30b0eed9 100644 Binary files a/extensions/iceworks-config-helper/assets/logo.png and b/extensions/iceworks-config-helper/assets/logo.png differ diff --git a/extensions/iceworks-config-helper/package.json b/extensions/iceworks-config-helper/package.json index bfd43e36f..03a055f79 100644 --- a/extensions/iceworks-config-helper/package.json +++ b/extensions/iceworks-config-helper/package.json @@ -1,38 +1,55 @@ { - "name": "iceworks-config-helper", - "displayName": "Iceworks Config Helper", - "description": "Easily write Config files in icejs && raxapp", - "publisher": "iceworks-team", - "version": "0.1.1", - "engines": { - "vscode": "^1.41.0" - }, - "categories": [ - "Other" - ], - "keywords": [ - "ICE", - "Rax", - "config", - "raxjs", - "icejs" - ], - "icon": "assets/logo.png", - "contributes": { - "jsonValidation": [ - { - "fileMatch": "build.json", - "url": "./schemas/build.json" - } - ] - }, - "repository": { - "type": "git", - "url": "https://github.com/ice-lab/iceworks.git" - }, - "homepage": "https://github.com/ice-lab/iceworks/blob/master/extensions/iceworks-config-helper/README.md", - "bugs": { - "url": "https://github.com/ice-lab/iceworks/issues", - "email": "iceworksteam@163.com" - } -} + "name": "iceworks-config-helper", + "displayName": "Iceworks Config Helper", + "description": "Easily write Config files in icejs && raxapp", + "publisher": "iceworks-team", + "version": "0.2.0", + "engines": { + "vscode": "^1.41.0" + }, + "categories": [ + "Other" + ], + "keywords": [ + "ICE", + "Rax", + "config", + "raxjs", + "icejs" + ], + "icon": "assets/logo.png", + "activationEvents": [ + "*" + ], + "main": "./build/index.js", + "contributes": { + "jsonValidation": [ + { + "fileMatch": "build.json", + "url": "./schemas/ice.build.json" + } + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/ice-lab/iceworks.git" + }, + "homepage": "https://github.com/ice-lab/iceworks/blob/master/extensions/iceworks-config-helper/README.md", + "bugs": { + "url": "https://github.com/ice-lab/iceworks/issues", + "email": "iceworksteam@163.com" + }, + "scripts": { + "vscode:prepublish": "rm -rf build && npm run compile", + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./tsconfig.json" + }, + "devDependencies": { + "@types/node": "^12.11.7", + "@types/vscode": "^1.41.0", + "typescript": "^3.6.4" + }, + "dependencies": { + "@iceworks/project-service": "^0.1.6" + } +} \ No newline at end of file diff --git a/extensions/iceworks-config-helper/schemas/ice.build.json b/extensions/iceworks-config-helper/schemas/ice.build.json new file mode 100644 index 000000000..47d3ff4e8 --- /dev/null +++ b/extensions/iceworks-config-helper/schemas/ice.build.json @@ -0,0 +1,506 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "title": "The ICE APP build.json Schema", + "description": "The root schema comprises the entire JSON document.", + "default": {}, + "examples": [ + {} + ], + "required": [], + "properties": { + "alias": { + "type": "object", + "description": "Create aliases to import or require certain modules more easily.", + "default": {}, + "examples": [ + { + "@components": "src/components/" + } + ] + }, + "publicPath": { + "type": "string", + "description": "The public URL of the output directory.", + "default": "", + "examples": [ + "/" + ] + }, + "devPublicPath": { + "type": "string", + "description": "The public URL of the dev server output directory.", + "default": "", + "examples": [ + "/" + ] + }, + "sourceMap": { + "type": "boolean", + "description": "Whether to generate sourceMap", + "default": false, + "examples": [ + false + ] + }, + "externals": { + "type": "object", + "description": "This feature is typically most useful to library developers, see https://webpack.js.org/configuration/externals .", + "default": {}, + "examples": [ + {} + ], + "additionalProperties": true + }, + "hash": { + "type": [ + "boolean", + "string" + ], + "description": "If you want the hashed version of the built resource, you can set hash to true.", + "default": false, + "examples": [ + "contenthash" + ] + }, + "injectBabel": { + "type": [ + "boolean", + "string" + ], + "description": "Whether to inject core-js/stable and regenerator-runtime/runtime.", + "default": false, + "examples": [ + false + ] + }, + "minify": { + "type": "boolean", + "description": "The resources after construction will be compressed.", + "default": false, + "examples": [ + false + ] + }, + "outputAssetsPath": { + "type": "object", + "description": "Modify the built css/js file directory.", + "default": {}, + "examples": [ + { + "js": "js", + "css": "css" + } + ], + "additionalProperties": true + }, + "outputDir": { + "type": "string", + "description": "Modify the built file directory.", + "default": "", + "examples": [ + "build" + ] + }, + "devServer": { + "type": "object", + "description": "This set of options is picked up by webpack-dev-server and can be used to change its behavior in various ways.", + "default": {}, + "examples": [ + { + "compress": true, + "disableHostCheck": true, + "clientLogLevel": "error", + "hot": true, + "quiet": true, + "overlay": false, + "port": 9999 + } + ], + "additionalProperties": true, + "properties": { + "compress": { + "type": "boolean", + "description": "Enable gzip compression for everything served", + "default": false + }, + "disableHostCheck": { + "type": "boolean", + "description": "When set to true this option bypasses host checking. THIS IS NOT RECOMMENDED as apps that do not check the host are vulnerable to DNS rebinding attacks.", + "default": false + }, + "clientLogLevel": { + "type": "string", + "description": "The the console in your DevTools will show different level messages.", + "default": "error", + "pattern": "^(info|silent|trace|debug|info|warn|error|none|warning)$" + }, + "hot": { + "type": "boolean", + "description": "Enable webpack's Hot Module Replacement feature", + "default": false + }, + "quiet": { + "type": "boolean", + "description": "With devServer.quiet enabled, nothing except the initial startup information will be written to the console.", + "default": false + }, + "overlay": { + "type": "boolean", + "description": "Shows a full-screen overlay in the browser when there are compiler errors or warnings. If you want to show only compiler errors.", + "default": false + }, + "port": { + "type": "integer", + "description": "Specify a port number to listen for requests on.", + "default": 9999 + } + } + }, + "proxy": { + "type": "object", + "description": "Configure webpack's devServer.proxy attribute.", + "default": {}, + "examples": [ + { + "/**": { + "enable": true, + "target": "http://127.0.0.1:6001" + } + } + ], + "additionalProperties": true + }, + "vendor": { + "type": "boolean", + "description": "Configure whether to generate vendor.", + "default": false, + "examples": [ + true + ] + }, + "libraryTarget": { + "type": "string", + "description": "Configure webpack's output.libraryTarget attribute.", + "default": "", + "examples": [ + "" + ] + }, + "library": { + "type": "string", + "description": "Configure webpack's output.library attribute.", + "default": "", + "examples": [ + "" + ] + }, + "libraryExport": { + "type": "string", + "description": "Configure webpack's output.libraryExport attribute.", + "default": "", + "examples": [ + "" + ] + }, + "compileDependencies": { + "type": "array", + "description": "y default, babel-loader will compile relevant modules to be compatible with IE11. If you need babel to compile the specified file under node_modules, you can quickly add it in this configuration.", + "default": [], + "examples": [ + [ + "@alifd/next" + ] + ], + "additionalItems": true, + "items": { + "anyOf": [ + { + "type": "string", + "description": "Compile module dependencies under node_modules.", + "default": "", + "examples": [ + "@alifd/next" + ] + } + ] + } + }, + "cssLoaderOptions": { + "type": "object", + "description": "css-loader params, see https://webpack.js.org/loaders/css-loader/#options .", + "default": {}, + "examples": [ + {} + ], + "required": [], + "additionalProperties": true, + "properties": {} + }, + "lessLoaderOptions": { + "type": "object", + "description": "less-loader params, see https://webpack.js.org/loaders/less-loader/#options .", + "default": {}, + "examples": [ + {} + ], + "required": [], + "additionalProperties": true, + "properties": {} + }, + "sassLoaderOptions": { + "type": "object", + "description": "sass-loader params, see https://webpack.js.org/loaders/sass-loader/#options .", + "default": {}, + "examples": [ + {} + ], + "required": [], + "additionalProperties": true, + "properties": {} + }, + "postcssrc": { + "type": "boolean", + "description": "After opening the configuration item, the project will clear the built-in postcss configuration and read the configuration in the postcss configuration file postcssrc.js or postcss.config.js", + "default": false, + "examples": [ + false + ] + }, + "terserOptions": { + "type": "object", + "description": "terserPlugin params, see https://webpack.js.org/plugins/terser-webpack-plugin/ .", + "default": {}, + "examples": [ + {} + ], + "required": [], + "additionalProperties": true, + "properties": {} + }, + "babelPlugins": { + "type": "array", + "description": "Add an additional babel plugin to the babel-loader configuration.", + "default": [], + "examples": [ + [] + ], + "additionalItems": true, + "items": { + "anyOf": [] + } + }, + "babelPresets": { + "type": "array", + "description": "Add an additional babel preset to the configuration of babel-loader. If the preset is the same as the built-in preset, the configuration content in babelPresets will be used first.", + "default": [], + "examples": [ + [] + ], + "additionalItems": true, + "items": { + "anyOf": [] + } + }, + "ignoreHtmlTemplate": { + "type": "boolean", + "description": "After it is turned on, all built-in html-webpack-plugin settings will be removed when the build is built, and html files will no longer be generated.", + "default": false, + "examples": [ + false + ] + }, + "eslint": { + "type": [ + "object", + "boolean" + ], + "description": "The eslint code detection is disabled by default. If you need to enable it, set it to true. Configure eslint related options see https://github.com/webpack-contrib/eslint-loader .", + "default": {}, + "examples": [ + {} + ], + "required": [], + "additionalProperties": true, + "properties": {} + }, + "targets": { + "type": "object", + "description": "Configure the targets of @babel/preset-env, configure the minimum version of the browser, the newly configured targets will override the default values.", + "default": {}, + "examples": [ + { + "chrome": 49, + "ie": 11 + } + ], + "required": [], + "additionalProperties": true + }, + "disableRuntime": { + "type": "boolean", + "description": "Disable the ability to run time, if you need to close the configuration to true.", + "default": false, + "examples": [ + false + ] + }, + "tsChecker": { + "type": "boolean", + "description": "TypeScript type detection is turned off by default. If you need to enable it, set it to true.", + "default": false, + "examples": [ + false + ] + }, + "plugins": { + "type": "array", + "description": "Compiler plugins.", + "default": [], + "examples": [ + [ + [ + "build-plugin-fusion", + { + "themePackage": "@alifd/theme-design-pro" + } + ], + [ + "build-plugin-moment-locales", + { + "locales": [ + "zh-cn" + ] + } + ] + ] + ], + "additionalItems": true, + "items": { + "anyOf": [ + { + "type": "array", + "description": "See https://ice.work/docs/guide/advance/fusion .", + "default": [], + "examples": [ + [ + "build-plugin-fusion", + { + "themePackage": "@alifd/theme-design-pro" + } + ] + ], + "additionalItems": true, + "items": { + "anyOf": [ + { + "type": "string", + "description": "See https://ice.work/docs/guide/advance/fusion .", + "default": "", + "examples": [ + "build-plugin-fusion" + ] + }, + { + "type": "object", + "description": "build-plugin-fusion config.", + "default": {}, + "examples": [ + { + "themePackage": "@alifd/theme-design-pro" + } + ], + "additionalProperties": true, + "properties": { + "themePackage": { + "type": "string", + "description": "themePackage example: @alifd/theme-design-pro .", + "default": "", + "examples": [ + "@alifd/theme-design-pro" + ] + } + } + } + ] + } + }, + { + "type": "array", + "description": "See https://ice.work/docs/guide/develop/plugin-list .", + "default": [], + "examples": [ + [ + "build-plugin-moment-locales", + { + "locales": [ + "zh-cn" + ] + } + ] + ], + "additionalItems": true, + "items": { + "anyOf": [ + { + "type": "string", + "description": "See https://ice.work/docs/guide/develop/plugin-list .", + "default": "", + "examples": [ + "build-plugin-moment-locales" + ] + }, + { + "type": "object", + "description": "build-plugin-moment-locales config.", + "default": {}, + "examples": [ + { + "locales": [ + "zh-cn" + ] + } + ], + "additionalProperties": true, + "properties": { + "locales": { + "type": "array", + "description": "build-plugin-moment-locales config locales.", + "default": [], + "examples": [ + [ + "zh-cn" + ] + ], + "additionalItems": true, + "items": { + "anyOf": [ + { + "type": "string", + "description": "build-plugin-moment-locales config locales.", + "default": "", + "examples": [ + "zh-cn" + ] + } + ] + } + } + } + } + ] + } + }, + { + "type": "string", + "description": "See https://ice.work/docs/guide/develop/plugin-list .", + "default": "", + "examples": [ + "@ali/build-plugin-ice-def" + ] + } + ] + } + } + } +} \ No newline at end of file diff --git a/extensions/iceworks-config-helper/schemas/build.json b/extensions/iceworks-config-helper/schemas/rax.build.json similarity index 99% rename from extensions/iceworks-config-helper/schemas/build.json rename to extensions/iceworks-config-helper/schemas/rax.build.json index 4e2e0624b..30c3ffadc 100644 --- a/extensions/iceworks-config-helper/schemas/build.json +++ b/extensions/iceworks-config-helper/schemas/rax.build.json @@ -2,7 +2,7 @@ "definitions": {}, "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "title": "The build.json Schema", + "title": "The Rax APP build.json Schema", "required": [ "plugins" ], diff --git a/extensions/iceworks-config-helper/src/index.ts b/extensions/iceworks-config-helper/src/index.ts new file mode 100644 index 000000000..612152d31 --- /dev/null +++ b/extensions/iceworks-config-helper/src/index.ts @@ -0,0 +1,28 @@ +import * as vscode from 'vscode'; +import { getProjectFramework } from '@iceworks/project-service'; + +async function activate() { + + try { + const projectFramework = await getProjectFramework(); + + vscode.extensions.all.forEach(extension => { + if (extension.id !== 'iceworks-team.iceworks-config-helper') { + return; + } + + const packageJSON = extension.packageJSON; + if ( + packageJSON && packageJSON.contributes && + (projectFramework === 'rax-app' || projectFramework === 'icejs') + ) { + const jsonValidation = packageJSON.contributes.jsonValidation; + jsonValidation[0].url = `./schemas/${projectFramework === 'icejs' ? 'ice' : 'rax'}.build.json`; + } + }); + } catch (e) { + // ignore + } +}; + +exports.activate = activate; diff --git a/extensions/iceworks-config-helper/tsconfig.json b/extensions/iceworks-config-helper/tsconfig.json new file mode 100644 index 000000000..e0108d774 --- /dev/null +++ b/extensions/iceworks-config-helper/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.extension.json", + "compilerOptions": { + "outDir": "build", + "rootDir": "src", + "noImplicitAny": false, + "module": "commonjs", + "resolveJsonModule": true, + "esModuleInterop": true + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/extensions/iceworks-material-helper/CHANGELOG.md b/extensions/iceworks-material-helper/CHANGELOG.md index 8cb5f30d3..440f638cf 100644 --- a/extensions/iceworks-material-helper/CHANGELOG.md +++ b/extensions/iceworks-material-helper/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.1.4 + +Fix React component completion items, See: https://github.com/ice-lab/iceworks/issues/233 + ## 0.1.3 Fix docs typo. diff --git a/extensions/iceworks-material-helper/README.en.md b/extensions/iceworks-material-helper/README.en.md index 646865d43..27ab29e9c 100644 --- a/extensions/iceworks-material-helper/README.en.md +++ b/extensions/iceworks-material-helper/README.en.md @@ -7,13 +7,15 @@ English | [简体中文](./README.md) Write props easier in [JSX](https://reactjs.org/docs/introducing-jsx.html), friendly for React and [Rax](https://rax.js.org/). -> What is [material](https://ice.alibaba-inc.com/docs/materials/about)? - ## Usage When editing the props of a component in a JSX file, an automatic completion reminder will be given: -![demo](https://img.alicdn.com/tfs/TB1pNj5x7Y2gK0jSZFgXXc5OFXa-1688-780.gif) +![demo](https://user-images.githubusercontent.com/56879942/87399599-2dd25680-c5ea-11ea-9402-5e36ba7b8f98.gif) + +1. Use materials in JSX files (such as View). + > What is [material](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-component-builder)? +2. Enter part of props in the material tag, it will arouse automatic completion. ## More diff --git a/extensions/iceworks-material-helper/README.md b/extensions/iceworks-material-helper/README.md index 43e135d55..02ea75ac3 100644 --- a/extensions/iceworks-material-helper/README.md +++ b/extensions/iceworks-material-helper/README.md @@ -7,17 +7,21 @@ 在 [JSX](https://zh-hans.reactjs.org/docs/introducing-jsx.html) 中更快速地编写组件属性,对 React 和 [Rax](https://rax.js.org/) 应用友好。 -> 什么是[物料](https://ice.alibaba-inc.com/docs/materials/about)? +## 功能 -## 用法 +### 属性自动补全 在 JSX 文件中编辑组件的属性时将给予自动补全提醒: -![使用示例](https://img.alicdn.com/tfs/TB1pNj5x7Y2gK0jSZFgXXc5OFXa-1688-780.gif) +![使用说明](https://user-images.githubusercontent.com/56879942/87399599-2dd25680-c5ea-11ea-9402-5e36ba7b8f98.gif) + +1. 在 JSX 文件中使用物料(如 View ) + > 什么是[物料](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-component-builder)? +2. 在物料标签内输入属性的部分内容,将会激活自动补全提醒。 ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License diff --git a/extensions/iceworks-material-helper/assets/logo.png b/extensions/iceworks-material-helper/assets/logo.png index 2004c78ce..1c952a467 100644 Binary files a/extensions/iceworks-material-helper/assets/logo.png and b/extensions/iceworks-material-helper/assets/logo.png differ diff --git a/extensions/iceworks-material-helper/package.json b/extensions/iceworks-material-helper/package.json index a586101e2..c6d4f4c8e 100644 --- a/extensions/iceworks-material-helper/package.json +++ b/extensions/iceworks-material-helper/package.json @@ -3,7 +3,7 @@ "displayName": "Iceworks Material Helper", "description": "Easily use materials in JSX.", "publisher": "iceworks-team", - "version": "0.1.3", + "version": "0.1.4", "main": "./build/index.js", "engines": { "vscode": "^1.41.0" diff --git a/extensions/iceworks-material-helper/src/propsAutoComplete/getPropKeysFromDefinition.ts b/extensions/iceworks-material-helper/src/propsAutoComplete/getPropKeysFromDefinition.ts index 9015537f4..0271fa77d 100644 --- a/extensions/iceworks-material-helper/src/propsAutoComplete/getPropKeysFromDefinition.ts +++ b/extensions/iceworks-material-helper/src/propsAutoComplete/getPropKeysFromDefinition.ts @@ -9,8 +9,12 @@ export default function getPropKeysFromDefinition(componentPath): string[] { const propKeys: string[] = []; try { - // React/Rax component project has it's owner /types.d.ts - const componentTypesPath = `${path.dirname(componentPath)}/types.d.ts`; + let componentTypesPath = componentPath; + if (!componentTypesPath.endsWith('d.ts')) { + // Rax component project use types.ts + // If this ts component project not contain d.ts or types.ts, Don‘t show propKeys. + componentTypesPath = `${path.dirname(componentPath)}/types.ts`; + } if (fs.existsSync(componentTypesPath)) { const ast = parse(fs.readFileSync(componentTypesPath, 'utf-8'), { sourceType: 'module', diff --git a/extensions/iceworks-material-import/CHANGELOG.md b/extensions/iceworks-material-import/CHANGELOG.md index 25c634440..bb08d0e27 100644 --- a/extensions/iceworks-material-import/CHANGELOG.md +++ b/extensions/iceworks-material-import/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.1.3 + +- docs: change logo + ## 0.1.2 - feat: quick activate iceworks-material-import extensions by editor context @@ -10,4 +14,4 @@ ## 0.1.0 -- Initial release \ No newline at end of file +- Initial release diff --git a/extensions/iceworks-material-import/README.en.md b/extensions/iceworks-material-import/README.en.md index 5ceb2f077..2a6955a03 100644 --- a/extensions/iceworks-material-import/README.en.md +++ b/extensions/iceworks-material-import/README.en.md @@ -9,10 +9,31 @@ Add materials to the application in a visual way. ## Usage -![import-materials](https://img.alicdn.com/tfs/TB1wvG5aAcx_u4jSZFlXXXnUFXa-1279-904.gif) +### Activate Extension -1. Right click the location where you want to insert the material and select「iceworks: import material」, or click iceworks in the status bar of VSCode and select 「iceworks: import material」 -2. Click the block or the component and the code will be added to your code +![demo](https://user-images.githubusercontent.com/56879942/87401390-a63a1700-c5ec-11ea-91a6-f7d81ac5fd77.gif) + +1. Open vscode command palette through `Ctrl+Shift+P` or `⇧⌘P`. +2. Enter `Iceworks:Import Material` to activate this extension. + +### Use in pages + +![demo](https://user-images.githubusercontent.com/56879942/87619860-ba4a5980-c74f-11ea-84c1-9ef69ef17b18.gif) + +1. Click src/pages/*/index.tsx in the resource panel to open a page. +2. Activate the material-import extension. +3. Move cursor to a position for materials +4. Search the block materials, click the material to be used, and the material code will be automatically added to the corresponding position. +5. Search for component materials. Click the material to be used, and the material code will be automatically added to the corresponding position. + +### Use in components + +![demo](https://user-images.githubusercontent.com/56879942/87619875-c2a29480-c74f-11ea-945e-788a32e65881.gif) + +1. Click src/components/*/index.tsx in the resource panel to open a page. +2. Activate the material-import extension. +3. Move cursor to a position for materials +4. Search for component materials. Click the material to be used, and the material code will be automatically added to the corresponding position. ## More diff --git a/extensions/iceworks-material-import/README.md b/extensions/iceworks-material-import/README.md index 9c879b5b2..b0d3216e3 100644 --- a/extensions/iceworks-material-import/README.md +++ b/extensions/iceworks-material-import/README.md @@ -7,16 +7,37 @@ 使用可视化的方式添加物料到应用中。 -## 用法 +## 功能 -![使用物料](https://img.alicdn.com/tfs/TB1wvG5aAcx_u4jSZFlXXXnUFXa-1279-904.gif) +### 激活 -1. 在需要插入物料的位置点击右键,选择「Iceworks: 使用物料」,或者点击 VS Code 状态栏的「Iceworks」选择「Iceworks: 使用物料」 -2. 点击区块或者组件,物料代码将自动添加到相应的位置中 +![使用示例](https://user-images.githubusercontent.com/56879942/87538941-a19a5f00-c6cf-11ea-92f2-b8ed100792fc.gif) + +1. 通过 `⇧⌘P` 或 `Ctrl+Shift+P` 快捷键唤醒命令面板 +2. 输入 `Iceworks:Import Material` 激活物料添加插件 + +### 在页面中使用 + +![使用示例](https://user-images.githubusercontent.com/56879942/87619860-ba4a5980-c74f-11ea-84c1-9ef69ef17b18.gif) + +1. 在资源面板中点击 src/pages/*/index.tsx 打开页面源码 +2. 激活物料添加面板 +3. 选择需要插入物料的代码位置 +4. 搜索区块,点击需要使用的区块,物料代码将自动添加到相应的位置中 +5. 搜索组件,点击需要使用的组件,物料代码将自动添加到相应的位置中 + +### 在组件中使用 + +![使用示例](https://user-images.githubusercontent.com/56879942/87619875-c2a29480-c74f-11ea-945e-788a32e65881.gif) + +1. 在资源面板中点击 src/components/*/index.tsx 打开页面源码 +2. 激活物料添加面板 +3. 选择需要插入物料的代码位置 +4. 搜索组件,点击需要使用的组件,物料代码将自动添加到相应的位置中 ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License diff --git a/extensions/iceworks-material-import/assets/logo.png b/extensions/iceworks-material-import/assets/logo.png index 2004c78ce..bf25d7ce4 100644 Binary files a/extensions/iceworks-material-import/assets/logo.png and b/extensions/iceworks-material-import/assets/logo.png differ diff --git a/extensions/iceworks-material-import/package.json b/extensions/iceworks-material-import/package.json index 4128ede4d..090ed4df2 100644 --- a/extensions/iceworks-material-import/package.json +++ b/extensions/iceworks-material-import/package.json @@ -1,9 +1,9 @@ { "name": "iceworks-material-import", - "displayName": "Iceworks Material Import", + "displayName": "Iceworks Material Importer", "description": "Quick import material in a visual way.", "publisher": "iceworks-team", - "version": "0.1.2", + "version": "0.1.3", "engines": { "vscode": "^1.41.0" }, @@ -72,4 +72,4 @@ "url": "https://github.com/ice-lab/iceworks/issues", "email": "iceworksteam@163.com" } -} \ No newline at end of file +} diff --git a/extensions/iceworks-page-builder/CHANGELOG.md b/extensions/iceworks-page-builder/CHANGELOG.md index 296425d6f..dcd7e2da4 100644 --- a/extensions/iceworks-page-builder/CHANGELOG.md +++ b/extensions/iceworks-page-builder/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 0.1.10 + +Fix create vue page. +Change the material setting entry to Iceworks setting. + ## 0.1.9 Use webpack to build this extension. diff --git a/extensions/iceworks-page-builder/README.en.md b/extensions/iceworks-page-builder/README.en.md index 4f0498be9..3fad918b0 100644 --- a/extensions/iceworks-page-builder/README.en.md +++ b/extensions/iceworks-page-builder/README.en.md @@ -5,15 +5,25 @@ English | [简体中文](./README.md) # Iceworks Page Builder -Create a web page view in a low-code way. +Through GUI, you can quickly assemble pages with materials. ## Usage -![create-page](https://img.alicdn.com/tfs/TB1mdpDJKT2gK0jSZFvXXXnFXXa-960-600.gif) +### Activate Extension -1. Enter the page name (to be used as the folder name) -2. Select the block to be used for the page from the block list on the right, click to add it to the page preview area on the left -3. Click "generate page" button to generate page code +![demo](https://user-images.githubusercontent.com/56879942/87402315-f49be580-c5ed-11ea-87a8-4143a461124f.gif) + +1. Open vscode command palette by `Ctrl+Shift+P` or `⇧⌘P` . +2. In the command palette, type 'Iceworks: Create page' and click on the selected item or press enter on the keyboard to evoke page-builder extension. + +### Usage + +![demo](https://user-images.githubusercontent.com/56879942/87402326-f82f6c80-c5ed-11ea-8ffe-34263e8dd0be.gif) + +1. Enter the page name (to be used as the folder name). +2. Select the block to be used for the page from the block list on the right, click to add it to the page preview area on the left. +3. Rearrange blocks by dragging and dropping the order of the blocks in the left page preview area, or delete blocks by clicking icons in the upper right corner. +4. Click `生成界面(generate page)` button to generate page code. The page code will be generated into 'src /pages/' ## More diff --git a/extensions/iceworks-page-builder/README.md b/extensions/iceworks-page-builder/README.md index 5c58523e8..3d6919e06 100644 --- a/extensions/iceworks-page-builder/README.md +++ b/extensions/iceworks-page-builder/README.md @@ -5,19 +5,29 @@ # Iceworks 页面生成插件 -使用低代码的方式创建网页视图。 +通过可视化操作,以区块拼装的方式快速生成页面。 -## 用法 +## 功能 -![创建页面](https://img.alicdn.com/tfs/TB1mdpDJKT2gK0jSZFvXXXnFXXa-960-600.gif) +### 激活 + +![使用示例](https://user-images.githubusercontent.com/56879942/87402315-f49be580-c5ed-11ea-87a8-4143a461124f.gif) + +1. 通过 `⇧⌘P` 或 `Ctrl+Shift+P` 快捷键唤醒命令面板 +2. 在命令面板中输入 `Iceworks: 创建页面` ,点击选中的项目或按下键盘回车键,激活页面生成插件 + +### 使用 + +![使用示例](https://user-images.githubusercontent.com/56879942/87531900-f5ec1180-c6c4-11ea-8753-ad269d5768d5.gif) 1. 输入页面名称(将用作文件夹名) -2. 从右侧区块列表中选择页面需要使用的区块,添加到左侧页面预览区 -3. 点击“生成页面”按钮,生成页面代码 +2. 从右侧的区块列表中选择页面需要使用的区块,点击添加到左侧页面预览区 +3. 在左侧页面预览区可通过拖拽排序区块的顺序,或点击右上角的删除图标移除区块 +4. 点击“生成页面”按钮,生成页面代码,页面代码将生成到 `src/pages/` 目录下 ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License diff --git a/extensions/iceworks-page-builder/assets/logo.png b/extensions/iceworks-page-builder/assets/logo.png index 2004c78ce..3a383242a 100644 Binary files a/extensions/iceworks-page-builder/assets/logo.png and b/extensions/iceworks-page-builder/assets/logo.png differ diff --git a/extensions/iceworks-page-builder/package.json b/extensions/iceworks-page-builder/package.json index 753663d1b..9f2fa9600 100644 --- a/extensions/iceworks-page-builder/package.json +++ b/extensions/iceworks-page-builder/package.json @@ -3,7 +3,7 @@ "displayName": "Iceworks Page Builder", "description": "Build Page UI by low-code way", "publisher": "iceworks-team", - "version": "0.1.9", + "version": "0.1.10", "repository": { "type": "git", "url": "https://github.com/ice-lab/iceworks.git" diff --git a/extensions/iceworks-page-builder/web/src/pages/Home/index.tsx b/extensions/iceworks-page-builder/web/src/pages/Home/index.tsx index 87a81fbac..9551f458f 100644 --- a/extensions/iceworks-page-builder/web/src/pages/Home/index.tsx +++ b/extensions/iceworks-page-builder/web/src/pages/Home/index.tsx @@ -46,7 +46,7 @@ const Home = () => { async function onSettingsClick() { try { - await callService('common', 'executeCommand', 'workbench.action.openSettings', 'iceworks.materialSources'); + await callService('common', 'executeCommand', 'iceworksApp.configHelper.start'); } catch (e) { Notification.error({ content: e.message }); } diff --git a/extensions/iceworks-project-creator/CHANGELOG.md b/extensions/iceworks-project-creator/CHANGELOG.md index d1593636a..1cfd57601 100644 --- a/extensions/iceworks-project-creator/CHANGELOG.md +++ b/extensions/iceworks-project-creator/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 0.2.1 + +- docs: better docs +- feat: git group search and loading + ## 0.2.0 - feat: default select a scaffold diff --git a/extensions/iceworks-project-creator/README.en.md b/extensions/iceworks-project-creator/README.en.md index a0e35f50e..1d86a2baa 100644 --- a/extensions/iceworks-project-creator/README.en.md +++ b/extensions/iceworks-project-creator/README.en.md @@ -5,15 +5,25 @@ English | [简体中文](./README.md) # Iceworks Application Creator -Quick create a Universal Application(React/Rax/Vue, etc). +Create a Universal Application(React/Rax/Vue, etc) quickly. -## Quick Start +## Usage -1. Select a scaffold -2. Input your application Infomation -3. Create your application and open application automatically in a few seconds +### Activate Extension + +![demo](https://user-images.githubusercontent.com/56879942/87621232-e61b0e80-c752-11ea-852c-77bb164d2dab.gif) + +1. Open vscode command palette through `Ctrl+Shift+P` or `⇧⌘P`. +2. Enter `Iceworks: create Application` to activate the extension. + +### Create a new application + +![demo](https://user-images.githubusercontent.com/56879942/87621825-41013580-c754-11ea-8da8-e49e71397d08.gif) + +1. Select a scaffold. +2. Input your application Infomation. +3. Create your application and open application automatically. -![application-creator](https://img.alicdn.com/tfs/TB15ZmPXypE_u4jSZKbXXbCUVXa-1090-774.gif) ## More diff --git a/extensions/iceworks-project-creator/README.md b/extensions/iceworks-project-creator/README.md index 37bcc114c..81bc9f407 100644 --- a/extensions/iceworks-project-creator/README.md +++ b/extensions/iceworks-project-creator/README.md @@ -7,17 +7,26 @@ 快速创建多端应用(例如:React/Rax/Vue...) -## 快速开始 +## 功能 + +### 激活 + +![使用示例](https://user-images.githubusercontent.com/56879942/87621232-e61b0e80-c752-11ea-852c-77bb164d2dab.gif) + +1. 通过 `⇧⌘P` 或 `Ctrl+Shift+P` 快捷键唤醒命令面板 +2. 输入 `Iceworks: createApplication` 激活插件 + +### 创建应用 + +![使用示例](https://user-images.githubusercontent.com/56879942/87621825-41013580-c754-11ea-8da8-e49e71397d08.gif) 1. 选择模板 2. 输入应用信息 3. 创建应用并自动打开应用 -![application-creator](https://img.alicdn.com/tfs/TB15ZmPXypE_u4jSZKbXXbCUVXa-1090-774.gif) - ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License diff --git a/extensions/iceworks-project-creator/assets/logo.png b/extensions/iceworks-project-creator/assets/logo.png index 2004c78ce..46b338115 100644 Binary files a/extensions/iceworks-project-creator/assets/logo.png and b/extensions/iceworks-project-creator/assets/logo.png differ diff --git a/extensions/iceworks-project-creator/package.json b/extensions/iceworks-project-creator/package.json index 90cfd085f..a9d297925 100644 --- a/extensions/iceworks-project-creator/package.json +++ b/extensions/iceworks-project-creator/package.json @@ -3,7 +3,7 @@ "displayName": "Iceworks Application Creator", "description": "Quick create a Universal Application(React/Rax/Vue, etc).", "publisher": "iceworks-team", - "version": "0.2.0", + "version": "0.2.1", "engines": { "vscode": "^1.41.0" }, @@ -99,4 +99,4 @@ "url": "https://github.com/ice-lab/iceworks/issues", "email": "iceworksteam@163.com" } -} \ No newline at end of file +} diff --git a/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/CreateDEFProjectForm/index.tsx b/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/CreateDEFProjectForm/index.tsx index 01701cf41..ae586837d 100644 --- a/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/CreateDEFProjectForm/index.tsx +++ b/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/CreateDEFProjectForm/index.tsx @@ -62,6 +62,7 @@ const CreateDEFProjectForm: React.FC = ({ name="group" fillProps="name" key="name" + showSearch > {dataSource.map(item => ( {item.name} diff --git a/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.module.scss b/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.module.scss index 3654fc3c2..6b4cc59f9 100644 --- a/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.module.scss +++ b/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.module.scss @@ -1,26 +1,35 @@ -.cardContent { - margin: 0 20px; +.container { + width: 100%; - .header { - display: flex; - justify-content: space-between; - margin: 30px 0 50px; + .loading { + width: 100%; + height: 60vh; + } + + .cardContent { + margin: 0 20px; - .title { - font-size: 24px; - margin-bottom: 10px; - color: white; + .header { + display: flex; + justify-content: space-between; + margin: 30px 0 50px; + + .title { + font-size: 24px; + margin-bottom: 10px; + color: white; + } } - } - .content { - width: 100%; - display: flex; - justify-content: center; - margin: 0 auto; + .content { + width: 100%; + display: flex; + justify-content: center; + margin: 0 auto; + } } -} -.btn { - margin-right: 10px; + .btn { + margin-right: 10px; + } } diff --git a/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.tsx b/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.tsx index e4c06d7cb..28804f984 100644 --- a/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.tsx +++ b/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useRef } from 'react'; -import { Card, Form, Button, Notification, Icon } from '@alifd/next'; +import { Card, Form, Button, Notification, Icon, Loading } from '@alifd/next'; import callService from '@/callService'; import { IProjectField, IDEFProjectField, IGitLabExistProject } from '@/types'; import { IMaterialSource } from '@iceworks/material-utils'; @@ -23,6 +23,7 @@ const CreateProject: React.FC = () => { const [DEFFormErrorMsg, setDEFFormErrorMsg] = useState(''); const [groupDataSource, setGroupDataSource] = useState([]); const [materialSources, setMaterialSources] = useState>([]); + const [loading, setLoading] = useState(false); const existProjectsRef = useRef([]); const steps = [ @@ -210,51 +211,61 @@ const CreateProject: React.FC = () => { setIsAliInternal(isAliInternal); return isAliInternal; } catch (e) { - Notification.error({ content: e.message }) + Notification.error({ content: e.message }); + return false; } - return false } async function setDefaultFields(isAliInternal) { - try { - const userData = await callService('common', 'getDataFromSettingJson', 'user') || {}; - const workspace = await callService('common', 'getDataFromSettingJson', 'workspace') || ''; - const { empId, account, gitlabToken } = userData; - setCurProjectField({ ...curProjectField, projectPath: workspace }) - if (isAliInternal) { - setCurDEFProjectField({ ...curDEFProjectField, empId, account, gitlabToken }); - const dataSource = await callService('common', 'getGitLabGroups', gitlabToken); - setGroupDataSource(dataSource); - existProjectsRef.current = await callService('common', 'getExistProjects', gitlabToken); - } - } catch (e) { - // ignore + const userData = await callService('common', 'getDataFromSettingJson', 'user') || {}; + const workspace = await callService('common', 'getDataFromSettingJson', 'workspace') || ''; + const { empId, account, gitlabToken } = userData; + setCurProjectField({ ...curProjectField, projectPath: workspace }) + if (isAliInternal) { + setCurDEFProjectField({ ...curDEFProjectField, empId, account, gitlabToken }); + const dataSource = await callService('common', 'getGitLabGroups', gitlabToken); + setGroupDataSource(dataSource); + existProjectsRef.current = await callService('common', 'getExistProjects', gitlabToken); } } async function initMaterialSources() { const materialSources = await getMaterialSources(); setMaterialSources(materialSources); } - const isAliInternal = checkAliInternal(); - initMaterialSources(); - setDefaultFields(isAliInternal); + async function initData() { + try { + setLoading(true); + const isAliInternal = await checkAliInternal(); + await initMaterialSources(); + await setDefaultFields(isAliInternal); + } catch (e) { + Notification.error({ content: e.message }); + } finally { + setLoading(false); + } + } + initData(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( - - -
-
-
创建应用
-
海量可复用物料,搭配研发框架极速构建多端应用。
-
-
- - {currentStep === 0 && } +
+ + +
+
+
创建应用
+
海量可复用物料,搭配研发框架极速构建多端应用。
+
+
+ + {currentStep === 0 && } +
-
-
{steps[currentStep]}
- - + {loading ? : ( +
{steps[currentStep]}
+ )} + + +
); }; diff --git a/extensions/iceworks-style-helper/CHANGELOG.md b/extensions/iceworks-style-helper/CHANGELOG.md index 44ef473aa..3eb225098 100644 --- a/extensions/iceworks-style-helper/CHANGELOG.md +++ b/extensions/iceworks-style-helper/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.3.2 + +- Support nested CSS preview, definition and completion. + ## 0.3.1 - Support ICE css module style preview and completion. diff --git a/extensions/iceworks-style-helper/README.en.md b/extensions/iceworks-style-helper/README.en.md index 77b57c30f..989c98dd0 100644 --- a/extensions/iceworks-style-helper/README.en.md +++ b/extensions/iceworks-style-helper/README.en.md @@ -5,40 +5,76 @@ English | [简体中文](./README.md) # Iceworks Style Helper -Write styles easier in [JSX](https://reactjs.org/docs/introducing-jsx.html), friendly for React and [Rax](https://rax.js.org/). +Write styles easier in [JSX](https://reactjs.org/docs/introducing-jsx.html), provide a powerful auxiliary development functions in style files like CSS, SASS. Friendly for React and [Rax](https://rax.js.org/). ## Usage ### JSX -* When editing the 'style' attribute of a component in a JSX file, an automatic completion reminder will be given: +When editing the 'style' attribute of a component in a JSX file, an automatic completion reminder will be given: - ![demo](https://img.alicdn.com/tfs/TB1oyRBF1H2gK0jSZFEXXcqMpXa-1000-586.gif) +#### Inline style -* Automatic completion When editing the 'style' name of a component in a JSX file, Use `cmd + click` (Windows: `ctrl + click`) jump to the identifier under the cursor. +Automatic completion for style keys and values according to W3C standards: - ![demo](https://img.alicdn.com/tfs/TB1pb1ltYY1gK0jSZTEXXXDQVXa-1468-906.gif) +![demo](https://user-images.githubusercontent.com/56879942/87412958-3895e700-c5fc-11ea-88e2-3e3e78a07f9e.gif) - ![demo](https://img.alicdn.com/tfs/TB1UDGht.Y1gK0jSZFMXXaWcVXa-1468-906.gif) +##### Variable assignment -* When editing the 'className' attribute of a component in a JSX file, an automatic completion reminder will be given: +When using CSS Module, automatic completion of style fields is carried out according to style declaration: - ![demo](https://img.alicdn.com/tfs/TB1JqP0Nfb2gK0jSZK9XXaEgFXa-900-561.gif) +![demo](https://user-images.githubusercontent.com/56879942/87412953-36cc2380-c5fc-11ea-9315-f153b1415dc8.gif) -### Class name +### className + +Automatic completion, value previews, and defined jumps are given when editing the component's 'className' properties in the JSX file. + +#### Automatic completion + +According to the class selector in the style file 'import' , automatic completion will be provided when editing ‘className'. + +![demo](https://user-images.githubusercontent.com/56879942/87412926-2caa2500-c5fc-11ea-9acc-78974ddb1932.gif) +#### Value preview and define jump + +![demo](https://user-images.githubusercontent.com/56879942/87412950-35026000-c5fc-11ea-83ee-33de13681911.gif) + +1. Hover over the 'className' value, and the hover board displays the style declaration corresponding to the value. +2. Click the corresponding 'className' value to jump to the definition of the value. + +### Class name When editing the 'class' name of a CSS, LESS or SASS file, an automatic completion reminder will be given: -![demo](https://img.alicdn.com/tfs/TB1l_zMFhD1gK0jSZFKXXcJrVXa-500-355.gif) +![demo](https://user-images.githubusercontent.com/56879942/87416514-63366e80-c601-11ea-8f3e-05fe51a8f26b.gif) + +1. Declare the value of the component 'className' property in JSX file like ` home, Text0, Text1, text2 `. +2. Reference SASS files in JSX: 'import './index.scss''. +3. step into the 'index.css' file. +4. Enter ' . ' in ' index.css ' to get the auto-completion reminder of the above property values. + +### SASS + +#### Automatic completion When editing the variable. + +When a variable is entered in an SASS file, code completion is provided based on the reference file + +![demo](https://user-images.githubusercontent.com/56879942/87523081-026a6d00-c6b9-11ea-8e8a-5d62688c020d.gif) + +#### Show the variable value when hover it. + +![demo](https://user-images.githubusercontent.com/56879942/87412974-3e8bc800-c5fc-11ea-9a6c-ea62eecbfbff.gif) + +#### Automatic completion When editing the colors and attributes. + +When the attribute value is entered, if it is found that variables can be replaced as standard value,variable replacement suggestions will appear: + +![demo](https://user-images.githubusercontent.com/56879942/87531943-04d2c400-c6c5-11ea-9f74-be6721353e46.gif) -### Sass +#### variable identifier and link -* Automatic completion When editing the variable. -* Show the variable value when hover it. -* Automatic completion When editing the colors and attributes. -* Use `cmd + click` (Windows: `ctrl + click`) jump to the variable identifier under the cursor. +Use `cmd + click` (Windows: `ctrl + click`) jump to the variable identifier under the cursor. -![demo](https://img.alicdn.com/tfs/TB1RA_ZMeL2gK0jSZPhXXahvXXa-900-535.gif) +![demo](https://user-images.githubusercontent.com/56879942/87419478-2456e780-c606-11ea-9842-47a01b7e85c8.gif)ß ## More diff --git a/extensions/iceworks-style-helper/README.md b/extensions/iceworks-style-helper/README.md index 5ac5cdabe..154105a51 100644 --- a/extensions/iceworks-style-helper/README.md +++ b/extensions/iceworks-style-helper/README.md @@ -5,45 +5,88 @@ # Iceworks 样式开发辅助插件 -在 [JSX](https://zh-hans.reactjs.org/docs/introducing-jsx.html) 中更快速地编写内联样式,对 React 和 [Rax](https://rax.js.org/) 应用友好。 +方便您在 [JSX](https://zh-hans.reactjs.org/docs/introducing-jsx.html) 中更快速地编写内联样式,并对 CSS 、SASS 等样式文件提供强大的辅助开发功能。对 React 和 [Rax](https://rax.js.org/) 应用友好。 ## 用法 ### JSX 文件 -* 在 JSX 文件中编辑组件的 `style` 属性时将给予自动补全提醒: +#### style 属性 - ![使用示例](https://img.alicdn.com/tfs/TB1oyRBF1H2gK0jSZFEXXcqMpXa-1000-586.gif) +在 JSX 文件中编辑组件的 `style` 属性时给予自动补全提醒。 -* 在 JSX 文件中编辑组件的样式名时给予补全提醒并可通过 `cmd + 点击`( Windows: `ctrl + 点击` )跳转: +##### 行内样式 - ![使用示例](https://img.alicdn.com/tfs/TB1pb1ltYY1gK0jSZTEXXXDQVXa-1468-906.gif) +根据 w3c 标准给予样式字段和值的自动补全提醒: - ![使用示例](https://img.alicdn.com/tfs/TB1UDGht.Y1gK0jSZFMXXaWcVXa-1468-906.gif) +![使用示例](https://user-images.githubusercontent.com/56879942/87412958-3895e700-c5fc-11ea-88e2-3e3e78a07f9e.gif) -* 在 JSX 文件中编辑组件的 `className` 属性时给予自动补全提醒,预览及条跳转: +##### 变量赋值 + +使用 CSS Module 时,根据样式声明进行样式字段的自动补全: + +![使用示例](https://user-images.githubusercontent.com/56879942/87412953-36cc2380-c5fc-11ea-9315-f153b1415dc8.gif) + +#### className 属性 + +在 JSX 文件中编辑组件的 `className` 属性时给予自动补全提醒,值预览及定义跳转。 + +##### 自动补全提醒 + +在编辑组件的 `className` 时,根据文件 `import` 的样式文件内的类选择器进行自动补全提醒。 + +![使用示例](https://user-images.githubusercontent.com/56879942/87412926-2caa2500-c5fc-11ea-9acc-78974ddb1932.gif) + +##### 值预览及定义跳转 + +![使用示例](https://user-images.githubusercontent.com/56879942/87412950-35026000-c5fc-11ea-83ee-33de13681911.gif) + +1. 鼠标停留在 `className` 值上,出现悬浮部件显示该值对应的样式声明 + +2. 点击对应的 `className` 值,跳转到该值的定义处 - ![使用示例](https://img.alicdn.com/tfs/TB1JqP0Nfb2gK0jSZK9XXaEgFXa-900-561.gif) - ### 样式文件 -* 在 CSS、LESS、SASS 文件中编辑 `class` 名称时给予自动补全提醒: +在 CSS、LESS、SASS 文件中输入类选择器时,根据引用值进行自动补全提醒: + +![使用示例](https://user-images.githubusercontent.com/56879942/87416514-63366e80-c601-11ea-8f3e-05fe51a8f26b.gif) - ![使用示例](https://img.alicdn.com/tfs/TB1l_zMFhD1gK0jSZFKXXcJrVXa-500-355.gif) +1. 在 JSX 内声明组件 `className` 属性的值为 ` home , text0 , text1 , text2 ` +2. 在 JSX 内引用样式文件:`import './index.scss'` +3. 新建该 `index.css` 文件 +4. 在 `index.css` 内输入 `.` ,出现上述属性值的自动补全提醒 ### SASS 文件 -* 输入变量时给予自动补全提醒 -* 鼠标悬停在变量上时,预览变量对应值 -* 输入样式颜色值时给予变量的替换列表提醒 -* 通过 cmd + 点击( Windows: ctrl + 点击 )进行变量的定义代码跳转 +#### 变量自动补全提醒 -![使用示例](https://img.alicdn.com/tfs/TB1RA_ZMeL2gK0jSZPhXXahvXXa-900-535.gif) +在 SASS 文件内输入变量时,根据引用文件进行代码自动补全: + +![使用示例](https://user-images.githubusercontent.com/56879942/87523081-026a6d00-c6b9-11ea-8e8a-5d62688c020d.gif) + +#### 变量预览值 + +鼠标停留在变量上,出现悬浮部件显示该变量对应的值: + +![使用示例](https://user-images.githubusercontent.com/56879942/87412974-3e8bc800-c5fc-11ea-9a6c-ea62eecbfbff.gif) + +#### 属性值使用变量替换的建议 + +输入属性值时,如发现可使用变量进行替换,则出现变量替换提醒列表: + +![使用示例](https://user-images.githubusercontent.com/56879942/87531943-04d2c400-c6c5-11ea-9f74-be6721353e46.gif) + +#### 变量的定义跳转 + +通过 cmd + 点击( Windows: ctrl + 点击 )进行变量的定义代码跳转: + +![使用示例](https://user-images.githubusercontent.com/56879942/87419478-2456e780-c606-11ea-9842-47a01b7e85c8.gif) ## 更多 -访问 [Iceworks Pack](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) 了解更多 Iceworks 相关功能。 +访问 [Iceworks 套件](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)获取更多功能。 ## License [MIT](https://github.com/ice-lab/iceworks/blob/master/LICENSE) + diff --git a/extensions/iceworks-style-helper/assets/logo.png b/extensions/iceworks-style-helper/assets/logo.png index 2004c78ce..1f48dfb38 100644 Binary files a/extensions/iceworks-style-helper/assets/logo.png and b/extensions/iceworks-style-helper/assets/logo.png differ diff --git a/extensions/iceworks-style-helper/package.json b/extensions/iceworks-style-helper/package.json index c2271d3f7..d79ad5ebe 100644 --- a/extensions/iceworks-style-helper/package.json +++ b/extensions/iceworks-style-helper/package.json @@ -1,9 +1,9 @@ { "name": "iceworks-style-helper", - "displayName": "Iceworks Style Helper", - "description": "Easily write styles in JSX.", + "displayName": "React Style Helper", + "description": "Easily write styles(CSS/Less/SASS).", "publisher": "iceworks-team", - "version": "0.3.1", + "version": "0.3.2", "engines": { "vscode": "^1.41.0" }, @@ -17,8 +17,11 @@ "JSX", "Inline Style", "Style", + "SASS", + "Less", "CSS", - "ClassName" + "ClassName", + "iceworks" ], "icon": "assets/logo.png", "activationEvents": [ @@ -50,6 +53,7 @@ "@babel/parser": "^7.10.3", "@babel/traverse": "^7.10.3", "css": "^2.2.4", + "css-flatten": "^1.0.1", "datauri": "^2.0.0", "line-column": "^1.0.2", "tinycolor2": "^1.4.1", diff --git a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts index c6d09edeb..2ac2a6e5a 100644 --- a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts +++ b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts @@ -1,6 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; import css from 'css'; +import flatten from 'css-flatten'; import { IStyleDependency } from './findStyleDependencies'; // https://www.npmjs.com/package/css @@ -29,10 +30,42 @@ export function findStyle(directory: string, className: string, styleDependencie for (let i = 0, l = styleDependencies.length; i < l; i++) { const file = path.join(directory, styleDependencies[i].source); - const stylesheet = css.parse(fs.readFileSync(file, 'utf-8')).stylesheet; - - matched = stylesheet.rules.find(rule => rule.selectors && rule.selectors.includes(`.${className}`)); - + const fileContent = fs.readFileSync(file, 'utf-8'); + let cssContent = fileContent; + + if ( + // SASS file + /s(c|a)ss$/.test(file) && + // Not contain media and keyframes + fileContent.indexOf('@media') === -1 && + fileContent.indexOf(' @keyframes') === -1 + ) { + // Flattens nested SASS string + // https://www.npmjs.com/package/css-flatten + // Before: + // .foo { + // color: red; + // .bar { + // color: blue; + // } + // } + // After: + // .foo { + // color: red; + // } + // .foo .bar { + // color: blue; + // } + cssContent = flatten(fs.readFileSync(file, 'utf-8')); + } + + const stylesheet = css.parse(cssContent).stylesheet; + matched = stylesheet.rules.find( + rule => rule.selectors && + // Selector endWith className. Example: '.bar' can match '.foo .bar'. + rule.selectors.find(selector => selector.endsWith(className)) + ); + // Just find one matched stylesheet. if (matched) { matched.file = file; diff --git a/extensions/iceworks-style-helper/tsconfig.json b/extensions/iceworks-style-helper/tsconfig.json index ca734a741..be6e7d0be 100644 --- a/extensions/iceworks-style-helper/tsconfig.json +++ b/extensions/iceworks-style-helper/tsconfig.json @@ -6,7 +6,8 @@ "noImplicitAny": false, "module": "commonjs", "resolveJsonModule": true, - "esModuleInterop": true + "esModuleInterop": true, + "skipLibCheck": true }, "exclude": [ diff --git a/extensions/iceworks/CHANGELOG.md b/extensions/iceworks/CHANGELOG.md index 0c71dd938..8f1090212 100644 --- a/extensions/iceworks/CHANGELOG.md +++ b/extensions/iceworks/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.2.0 + +- docs: new logo and document + ## 0.1.7 - docs: update sample image diff --git a/extensions/iceworks/assets/logo.png b/extensions/iceworks/assets/logo.png index 2004c78ce..ec1f07e3a 100644 Binary files a/extensions/iceworks/assets/logo.png and b/extensions/iceworks/assets/logo.png differ diff --git a/extensions/iceworks/package.json b/extensions/iceworks/package.json index 002b7e8f2..fbb34fd62 100644 --- a/extensions/iceworks/package.json +++ b/extensions/iceworks/package.json @@ -1,9 +1,9 @@ { "name": "iceworks", "displayName": "Iceworks", - "description": "Universal Application Development Pack, using low-code technology.", + "description": "Universal Application Development Pack based on icejs and rax-app framework, provide visualization and intelligent technology to build Universal Application.", "publisher": "iceworks-team", - "version": "0.1.7", + "version": "0.2.0", "engines": { "vscode": "^1.41.0" }, diff --git a/packages/page-service/package.json b/packages/page-service/package.json index 33025add5..9082dd731 100644 --- a/packages/page-service/package.json +++ b/packages/page-service/package.json @@ -1,6 +1,6 @@ { "name": "@iceworks/page-service", - "version": "0.1.8", + "version": "0.1.9", "description": "Iceworks page service for VSCode extension.", "files": [ "lib" diff --git a/packages/page-service/src/index.ts b/packages/page-service/src/index.ts index b9d98d459..8165b8a09 100644 --- a/packages/page-service/src/index.ts +++ b/packages/page-service/src/index.ts @@ -2,11 +2,12 @@ import * as path from 'path'; import * as fsExtra from 'fs-extra'; import * as prettier from 'prettier'; import { IMaterialBlock } from '@iceworks/material-utils'; -import { pagesPath, COMPONENT_DIR_NAME, getProjectLanguageType } from '@iceworks/project-service'; +import { pagesPath, COMPONENT_DIR_NAME, getProjectLanguageType, getProjectFramework } from '@iceworks/project-service'; import { bulkGenerate } from '@iceworks/block-service'; import * as upperCamelCase from 'uppercamelcase'; import * as ejs from 'ejs'; - +import reactPageTemplate from './templates/template.react'; +import vuePageTemplate from './templates/template.vue'; /** * Generate page code based on blocks * @@ -27,22 +28,10 @@ export const generate = async function ({ pageName: name, blocks = [] }: { pageN try { await addBlocks(blocks, pageName); + const projectFramework = await getProjectFramework(); + const isVueProjectFramework = projectFramework === 'vue'; + const fileStr = isVueProjectFramework ? vuePageTemplate : reactPageTemplate; - const fileStr = `import React, { Component } from 'react'; -<% for(var i = 0; i < blocks.length; i++) { -%> -import <%= blocks[i].className %> from '<%= blocks[i].relativePath -%>'; -<% } -%> - -export default function () { - return ( -
- <% for(var i = 0; i < blocks.length; i++){ -%> - <% if (blocks[i].description) { %>{/* <%= blocks[i].description -%> */}<% } %> - <<%= blocks[i].className -%> /> - <% } -%> -
- ); -}` const fileContent = ejs.compile(fileStr)({ blocks: blocks.map((block: any) => { const blockName = upperCamelCase(block.name); @@ -56,12 +45,13 @@ export default function () { pageName, }); const projectLanguageType = await getProjectLanguageType(); - const fileName = `index.${projectLanguageType}x`; + const fileName = isVueProjectFramework ? 'index.vue' : `index.${projectLanguageType}x`; const dist = path.join(pagePath, fileName); + const prettierParserType = isVueProjectFramework ? 'vue' : 'babel'; const rendered = prettier.format(fileContent, { singleQuote: true, trailingComma: 'es5', - parser: 'babel', + parser: prettierParserType, }); await fsExtra.writeFile(dist, rendered, 'utf-8'); diff --git a/packages/page-service/src/templates/template.react.ts b/packages/page-service/src/templates/template.react.ts new file mode 100644 index 000000000..c77aa4bfa --- /dev/null +++ b/packages/page-service/src/templates/template.react.ts @@ -0,0 +1,17 @@ +const templateStr = `import React, { Component } from 'react'; +<% for(var i = 0; i < blocks.length; i++) { -%> +import <%= blocks[i].className %> from '<%= blocks[i].relativePath -%>'; +<% } -%> + +export default function () { + return ( +
+ <% for(var i = 0; i < blocks.length; i++){ -%> + <% if (blocks[i].description) { %>{/* <%= blocks[i].description -%> */}<% } %> + <<%= blocks[i].className -%> /> + <% } -%> +
+ ); +} +` +export default templateStr; \ No newline at end of file diff --git a/packages/page-service/src/templates/template.vue.ts b/packages/page-service/src/templates/template.vue.ts new file mode 100644 index 000000000..e0b9db83b --- /dev/null +++ b/packages/page-service/src/templates/template.vue.ts @@ -0,0 +1,25 @@ +const template = ` + +` + +export default template; diff --git a/packages/project-service/package.json b/packages/project-service/package.json index ca29418b7..3f0cefa30 100644 --- a/packages/project-service/package.json +++ b/packages/project-service/package.json @@ -1,6 +1,6 @@ { "name": "@iceworks/project-service", - "version": "0.1.11", + "version": "0.1.12", "description": "Iceworks project service for VSCode extension.", "files": [ "lib" diff --git a/packages/project-service/src/index.ts b/packages/project-service/src/index.ts index 91c45a0cd..5a9d320f6 100644 --- a/packages/project-service/src/index.ts +++ b/packages/project-service/src/index.ts @@ -61,6 +61,9 @@ export async function getProjectFramework() { if (devDependencies['ice.js'] || dependencies['ice.js']) { return 'icejs'; } + if (dependencies.vue) { + return 'vue'; + } return 'unknown'; } diff --git a/scripts/publish-extension.ts b/scripts/publish-extension.ts index 6ab4b22ad..a08511ce9 100644 --- a/scripts/publish-extension.ts +++ b/scripts/publish-extension.ts @@ -13,7 +13,7 @@ function checkPackagePublished() { const publishedPackages: string[] = getPublishedPackages(); const timeout = 10000; - const maxDetectTimes = 18; + const maxDetectTimes = 30; return Promise.all(publishedPackages.map((publishedPackage) => { return new Promise((resolve, retject) => { @@ -98,4 +98,5 @@ checkPackagePublished().then(() => { }); }).catch((e) => { console.error(e); + process.exit(1); });