From 72ec564f2c15a271b6627c387f99cbb7e03be67c Mon Sep 17 00:00:00 2001 From: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Date: Wed, 8 Jul 2020 11:23:33 +0800 Subject: [PATCH 01/26] fix: remove sylvanas (#192) * fix: remove sylvanas * fix: comment * chore: version --- packages/block-service/package.json | 3 --- packages/block-service/src/index.ts | 33 +++++++++++++------------ packages/component-service/package.json | 4 +-- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/packages/block-service/package.json b/packages/block-service/package.json index c993b4064..4a379aa46 100644 --- a/packages/block-service/package.json +++ b/packages/block-service/package.json @@ -11,14 +11,11 @@ "@iceworks/common-service": "^0.1.3", "@iceworks/material-utils": "^0.1.3", "@iceworks/project-service": "^0.1.4", - "@typescript-eslint/parser": "^1.9.0", - "eslint-plugin-react": "^7.14.2", "fs-extra": "^9.0.0", "fs-readdir-recursive": "^1.1.0", "glob": "^7.1.4", "ice-npm-utils": "^2.0.0", "junk": "^3.1.0", - "sylvanas": "^0.4.3", "typescript": "^3.8.3", "uppercamelcase": "^3.0.0" }, diff --git a/packages/block-service/src/index.ts b/packages/block-service/src/index.ts index 3874f65c0..e2a578338 100644 --- a/packages/block-service/src/index.ts +++ b/packages/block-service/src/index.ts @@ -1,9 +1,9 @@ import * as path from 'path'; import * as vscode from 'vscode'; import * as fsExtra from 'fs-extra'; -import * as glob from 'glob'; +// import * as glob from 'glob'; +// import * as transfromTsToJs from 'sylvanas'; import * as readFiles from 'fs-readdir-recursive'; -import * as transfromTsToJs from 'sylvanas'; import { getAndExtractTarball, readPackageJSON } from 'ice-npm-utils'; import { getTarballURLByMaterielSource, IMaterialBlock } from '@iceworks/material-utils'; import { @@ -84,20 +84,21 @@ export const bulkDownload = async function (blocks: IMaterialBlock[], localPath: console.log('blockType: ', blockType, 'projectType: ', projectType); - // transfrom ts to js - if (blockType === 'ts' && projectType === 'js') { - const files = glob.sync('**/*.@(ts|tsx)', { - cwd: blockSourceSrcPath, - }); - - console.log('transfrom ts to js', files.join(',')); - - transfromTsToJs(files, { - cwd: blockSourceSrcPath, - outDir: blockSourceSrcPath, - action: 'overwrite', - }); - } + // TODO: transfrom ts to js + // why? the package sylvanas depends on the eslint, which can't use webpack to bundle the extensions + // if (blockType === 'ts' && projectType === 'js') { + // const files = glob.sync('**/*.@(ts|tsx)', { + // cwd: blockSourceSrcPath, + // }); + + // console.log('transfrom ts to js', files.join(',')); + + // transfromTsToJs(files, { + // cwd: blockSourceSrcPath, + // outDir: blockSourceSrcPath, + // action: 'overwrite', + // }); + // } await fsExtra.move(blockSourceSrcPath, blockDir); await fsExtra.remove(blockTempDir); diff --git a/packages/component-service/package.json b/packages/component-service/package.json index 777aabd65..f1e41b5f0 100644 --- a/packages/component-service/package.json +++ b/packages/component-service/package.json @@ -1,6 +1,6 @@ { "name": "@iceworks/component-service", - "version": "0.1.0", + "version": "0.1.1", "description": "Iceworks component service for VSCode extension.", "files": [ "lib" @@ -11,8 +11,6 @@ "@iceworks/common-service": "^0.1.3", "@iceworks/material-utils": "^0.1.3", "@iceworks/project-service": "^0.1.4", - "@typescript-eslint/parser": "^1.9.0", - "eslint-plugin-react": "^7.14.2", "typescript": "^3.8.3", "uppercamelcase": "^3.0.0" }, From 8c0148993a7ace25b09616b2a141bc8e2a16a46c Mon Sep 17 00:00:00 2001 From: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Date: Wed, 8 Jul 2020 22:26:19 +0800 Subject: [PATCH 02/26] feat: use webpack build (#194) --- .../.vscode/launch.json | 12 +++--- .../iceworks-component-builder/.vscodeignore | 1 + .../iceworks-component-builder/package.json | 10 +++-- .../iceworks-component-builder/tsconfig.json | 6 ++- .../webpack.config.js | 39 +++++++++++++++++++ .../.vscode/launch.json | 12 +++--- .../iceworks-material-import/.vscodeignore | 1 + .../iceworks-material-import/package.json | 10 +++-- .../iceworks-material-import/tsconfig.json | 6 ++- .../webpack.config.js | 39 +++++++++++++++++++ .../iceworks-page-builder/.vscode/launch.json | 12 +++--- .../iceworks-page-builder/.vscodeignore | 1 + extensions/iceworks-page-builder/package.json | 10 +++-- .../iceworks-page-builder/tsconfig.json | 6 ++- .../iceworks-page-builder/webpack.config.js | 39 +++++++++++++++++++ 15 files changed, 171 insertions(+), 33 deletions(-) create mode 100644 extensions/iceworks-component-builder/webpack.config.js create mode 100644 extensions/iceworks-material-import/webpack.config.js create mode 100644 extensions/iceworks-page-builder/webpack.config.js diff --git a/extensions/iceworks-component-builder/.vscode/launch.json b/extensions/iceworks-component-builder/.vscode/launch.json index df110ac54..bbcb24370 100644 --- a/extensions/iceworks-component-builder/.vscode/launch.json +++ b/extensions/iceworks-component-builder/.vscode/launch.json @@ -11,12 +11,12 @@ "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - "--extensionDevelopmentPath=${workspaceRoot}" + "--extensionDevelopmentPath=${workspaceFolder}" ], - "stopOnEntry": false, - "sourceMaps": true, - "outDir": "${workspaceRoot}/src", - "preLaunchTask": "${defaultBuildTask}" - } + "outFiles": [ + "${workspaceFolder}/build/*.js" + ], + "preLaunchTask": "npm: webpack" + }, ] } \ No newline at end of file diff --git a/extensions/iceworks-component-builder/.vscodeignore b/extensions/iceworks-component-builder/.vscodeignore index 48732a796..4ab60bcc5 100644 --- a/extensions/iceworks-component-builder/.vscodeignore +++ b/extensions/iceworks-component-builder/.vscodeignore @@ -5,3 +5,4 @@ **/*.map **/*.ts web/** +node_modules \ No newline at end of file diff --git a/extensions/iceworks-component-builder/package.json b/extensions/iceworks-component-builder/package.json index 1f6e057ad..7024a3f84 100644 --- a/extensions/iceworks-component-builder/package.json +++ b/extensions/iceworks-component-builder/package.json @@ -89,15 +89,19 @@ } }, "scripts": { - "vscode:prepublish": "rm -rf build && npm run build:web && npm run compile", + "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", - "watch": "tsc -watch -p tsconfig.json", + "webpack": "webpack --mode development", + "webpack-dev": "webpack --mode development --watch", "compile": "tsc -p ./tsconfig.json" }, "devDependencies": { "@types/node": "^13.11.0", - "@types/vscode": "^1.41.0" + "@types/vscode": "^1.41.0", + "ts-loader": "^7.0.5", + "webpack": "^4.43.0", + "webpack-cli": "^3.3.11" }, "dependencies": { "@iceworks/block-service": "^0.1.5", diff --git a/extensions/iceworks-component-builder/tsconfig.json b/extensions/iceworks-component-builder/tsconfig.json index 71cd434cb..2ddd1bbab 100644 --- a/extensions/iceworks-component-builder/tsconfig.json +++ b/extensions/iceworks-component-builder/tsconfig.json @@ -1,11 +1,13 @@ { "extends": "../../tsconfig.extension.json", "compilerOptions": { - "rootDir": "src", + "rootDir": "./", "outDir": "build" }, + "include": [ + "src" + ], "exclude": [ - "node_modules", ".vscode-test", "web" ] diff --git a/extensions/iceworks-component-builder/webpack.config.js b/extensions/iceworks-component-builder/webpack.config.js new file mode 100644 index 000000000..ae2486f61 --- /dev/null +++ b/extensions/iceworks-component-builder/webpack.config.js @@ -0,0 +1,39 @@ +const path = require('path'); + +const tsConfigPath = path.join(__dirname, 'tsconfig.json'); + +const config = { + target: 'node', + entry: './src/extension.ts', + output: { + path: path.resolve(__dirname, 'build'), + filename: 'extension.js', + libraryTarget: 'commonjs2', + devtoolModuleFilenameTemplate: '../[resource-path]' + }, + devtool: 'source-map', + externals: { + vscode: 'commonjs vscode' + }, + resolve: { + extensions: ['.ts', '.js'] + }, + module: { + rules: [ + { + test: /\.ts$/, + use: [ + { + loader: 'ts-loader', + options: { + transpileOnly: true, + configFile: tsConfigPath, + }, + } + ] + } + ] + } +}; + +module.exports = config; \ No newline at end of file diff --git a/extensions/iceworks-material-import/.vscode/launch.json b/extensions/iceworks-material-import/.vscode/launch.json index df110ac54..bbcb24370 100644 --- a/extensions/iceworks-material-import/.vscode/launch.json +++ b/extensions/iceworks-material-import/.vscode/launch.json @@ -11,12 +11,12 @@ "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - "--extensionDevelopmentPath=${workspaceRoot}" + "--extensionDevelopmentPath=${workspaceFolder}" ], - "stopOnEntry": false, - "sourceMaps": true, - "outDir": "${workspaceRoot}/src", - "preLaunchTask": "${defaultBuildTask}" - } + "outFiles": [ + "${workspaceFolder}/build/*.js" + ], + "preLaunchTask": "npm: webpack" + }, ] } \ No newline at end of file diff --git a/extensions/iceworks-material-import/.vscodeignore b/extensions/iceworks-material-import/.vscodeignore index 4daafa9be..58b48eba3 100644 --- a/extensions/iceworks-material-import/.vscodeignore +++ b/extensions/iceworks-material-import/.vscodeignore @@ -4,3 +4,4 @@ **/*.map **/*.ts web/** +node_modules \ No newline at end of file diff --git a/extensions/iceworks-material-import/package.json b/extensions/iceworks-material-import/package.json index d96234095..351095ae2 100644 --- a/extensions/iceworks-material-import/package.json +++ b/extensions/iceworks-material-import/package.json @@ -36,15 +36,19 @@ ] }, "scripts": { - "vscode:prepublish": "rm -rf build && npm run build:web && npm run compile", + "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", - "watch": "tsc -watch -p ./tsconfig.json", + "webpack": "webpack --mode development", + "webpack-dev": "webpack --mode development --watch", "compile": "tsc -p ./tsconfig.json" }, "devDependencies": { "@types/node": "^13.11.0", - "@types/vscode": "^1.41.0" + "@types/vscode": "^1.41.0", + "ts-loader": "^7.0.5", + "webpack": "^4.43.0", + "webpack-cli": "^3.3.11" }, "dependencies": { "@iceworks/block-service": "^0.1.7", diff --git a/extensions/iceworks-material-import/tsconfig.json b/extensions/iceworks-material-import/tsconfig.json index 71cd434cb..2ddd1bbab 100644 --- a/extensions/iceworks-material-import/tsconfig.json +++ b/extensions/iceworks-material-import/tsconfig.json @@ -1,11 +1,13 @@ { "extends": "../../tsconfig.extension.json", "compilerOptions": { - "rootDir": "src", + "rootDir": "./", "outDir": "build" }, + "include": [ + "src" + ], "exclude": [ - "node_modules", ".vscode-test", "web" ] diff --git a/extensions/iceworks-material-import/webpack.config.js b/extensions/iceworks-material-import/webpack.config.js new file mode 100644 index 000000000..ae2486f61 --- /dev/null +++ b/extensions/iceworks-material-import/webpack.config.js @@ -0,0 +1,39 @@ +const path = require('path'); + +const tsConfigPath = path.join(__dirname, 'tsconfig.json'); + +const config = { + target: 'node', + entry: './src/extension.ts', + output: { + path: path.resolve(__dirname, 'build'), + filename: 'extension.js', + libraryTarget: 'commonjs2', + devtoolModuleFilenameTemplate: '../[resource-path]' + }, + devtool: 'source-map', + externals: { + vscode: 'commonjs vscode' + }, + resolve: { + extensions: ['.ts', '.js'] + }, + module: { + rules: [ + { + test: /\.ts$/, + use: [ + { + loader: 'ts-loader', + options: { + transpileOnly: true, + configFile: tsConfigPath, + }, + } + ] + } + ] + } +}; + +module.exports = config; \ No newline at end of file diff --git a/extensions/iceworks-page-builder/.vscode/launch.json b/extensions/iceworks-page-builder/.vscode/launch.json index df110ac54..bbcb24370 100644 --- a/extensions/iceworks-page-builder/.vscode/launch.json +++ b/extensions/iceworks-page-builder/.vscode/launch.json @@ -11,12 +11,12 @@ "request": "launch", "runtimeExecutable": "${execPath}", "args": [ - "--extensionDevelopmentPath=${workspaceRoot}" + "--extensionDevelopmentPath=${workspaceFolder}" ], - "stopOnEntry": false, - "sourceMaps": true, - "outDir": "${workspaceRoot}/src", - "preLaunchTask": "${defaultBuildTask}" - } + "outFiles": [ + "${workspaceFolder}/build/*.js" + ], + "preLaunchTask": "npm: webpack" + }, ] } \ No newline at end of file diff --git a/extensions/iceworks-page-builder/.vscodeignore b/extensions/iceworks-page-builder/.vscodeignore index 4daafa9be..58b48eba3 100644 --- a/extensions/iceworks-page-builder/.vscodeignore +++ b/extensions/iceworks-page-builder/.vscodeignore @@ -4,3 +4,4 @@ **/*.map **/*.ts web/** +node_modules \ No newline at end of file diff --git a/extensions/iceworks-page-builder/package.json b/extensions/iceworks-page-builder/package.json index 2a7aa92f3..171a04c82 100644 --- a/extensions/iceworks-page-builder/package.json +++ b/extensions/iceworks-page-builder/package.json @@ -89,15 +89,19 @@ } }, "scripts": { - "vscode:prepublish": "rm -rf build && npm run build:web && npm run compile", + "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", - "watch": "tsc -watch -p ./tsconfig.json", + "webpack": "webpack --mode development", + "webpack-dev": "webpack --mode development --watch", "compile": "tsc -p ./tsconfig.json" }, "devDependencies": { "@types/node": "^13.11.0", - "@types/vscode": "^1.41.0" + "@types/vscode": "^1.41.0", + "ts-loader": "^7.0.5", + "webpack": "^4.43.0", + "webpack-cli": "^3.3.11" }, "dependencies": { "@iceworks/common-service": "^0.1.3", diff --git a/extensions/iceworks-page-builder/tsconfig.json b/extensions/iceworks-page-builder/tsconfig.json index 71cd434cb..2ddd1bbab 100644 --- a/extensions/iceworks-page-builder/tsconfig.json +++ b/extensions/iceworks-page-builder/tsconfig.json @@ -1,11 +1,13 @@ { "extends": "../../tsconfig.extension.json", "compilerOptions": { - "rootDir": "src", + "rootDir": "./", "outDir": "build" }, + "include": [ + "src" + ], "exclude": [ - "node_modules", ".vscode-test", "web" ] diff --git a/extensions/iceworks-page-builder/webpack.config.js b/extensions/iceworks-page-builder/webpack.config.js new file mode 100644 index 000000000..ae2486f61 --- /dev/null +++ b/extensions/iceworks-page-builder/webpack.config.js @@ -0,0 +1,39 @@ +const path = require('path'); + +const tsConfigPath = path.join(__dirname, 'tsconfig.json'); + +const config = { + target: 'node', + entry: './src/extension.ts', + output: { + path: path.resolve(__dirname, 'build'), + filename: 'extension.js', + libraryTarget: 'commonjs2', + devtoolModuleFilenameTemplate: '../[resource-path]' + }, + devtool: 'source-map', + externals: { + vscode: 'commonjs vscode' + }, + resolve: { + extensions: ['.ts', '.js'] + }, + module: { + rules: [ + { + test: /\.ts$/, + use: [ + { + loader: 'ts-loader', + options: { + transpileOnly: true, + configFile: tsConfigPath, + }, + } + ] + } + ] + } +}; + +module.exports = config; \ No newline at end of file From ebe39c4e926bb4dc8e861ee95728f9e92019d275 Mon Sep 17 00:00:00 2001 From: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Date: Thu, 9 Jul 2020 14:30:51 +0800 Subject: [PATCH 03/26] chore: command palette zhcn title (#199) * chore: input box docs * chore: typo * fix: typo * fix: comment * feat: add commandPalette and editor context * chore: remove editor context --- extensions/iceworks-app/package.json | 42 ++++++++++++------- extensions/iceworks-app/package.nls.json | 29 ++++++------- .../iceworks-app/package.nls.zh-cn.json | 37 ++++++++-------- .../iceworks-component-builder/package.json | 2 +- .../package.nls.json | 5 ++- .../package.nls.zh-cn.json | 5 ++- .../iceworks-material-import/package.json | 2 +- .../iceworks-material-import/package.nls.json | 3 ++ .../package.nls.zh-cn.json | 3 ++ extensions/iceworks-page-builder/package.json | 2 +- .../iceworks-page-builder/package.nls.json | 5 ++- .../package.nls.zh-cn.json | 5 ++- .../iceworks-project-creator/package.json | 4 +- .../iceworks-project-creator/package.nls.json | 3 ++ .../package.nls.zh-cn.json | 3 ++ 15 files changed, 91 insertions(+), 59 deletions(-) create mode 100644 extensions/iceworks-material-import/package.nls.json create mode 100644 extensions/iceworks-material-import/package.nls.zh-cn.json create mode 100644 extensions/iceworks-project-creator/package.nls.json create mode 100644 extensions/iceworks-project-creator/package.nls.zh-cn.json diff --git a/extensions/iceworks-app/package.json b/extensions/iceworks-app/package.json index e92ee6c31..b8d5fc055 100644 --- a/extensions/iceworks-app/package.json +++ b/extensions/iceworks-app/package.json @@ -90,11 +90,11 @@ "commands": [ { "command": "iceworksApp.configHelper.start", - "title": "Iceworks: Set Configuration" + "title": "%iceworksApp.command.configHelper.start.title%" }, { "command": "iceworksApp.npmScripts.refresh", - "title": "%iceworksApp.npmScripts.refresh.title%", + "title": "%iceworksApp.command.npmScripts.refresh.title%", "icon": { "light": "assets/light/refresh.svg", "dark": "assets/dark/refresh.svg" @@ -102,7 +102,7 @@ }, { "command": "iceworksApp.npmScripts.executeCommand", - "title": "%iceworksApp.npmScripts.executeCommand.title%", + "title": "%iceworksApp.command.npmScripts.executeCommand.title%", "icon": { "light": "assets/light/run.svg", "dark": "assets/dark/run.svg" @@ -110,7 +110,7 @@ }, { "command": "iceworksApp.pages.add", - "title": "%iceworksApp.pages.add.title%", + "title": "%iceworksApp.command.pages.add.title%", "icon": { "light": "assets/light/add.svg", "dark": "assets/dark/add.svg" @@ -118,7 +118,7 @@ }, { "command": "iceworksApp.pages.refresh", - "title": "%iceworksApp.pages.refresh.title%", + "title": "%iceworksApp.command.pages.refresh.title%", "icon": { "light": "assets/light/refresh.svg", "dark": "assets/dark/refresh.svg" @@ -126,11 +126,11 @@ }, { "command": "iceworksApp.pages.openFile", - "title": "%iceworksApp.pages.openFile.title%" + "title": "%iceworksApp.command.pages.openFile.title%" }, { "command": "iceworksApp.components.add", - "title": "%iceworksApp.components.add.title%", + "title": "%iceworksApp.command.components.add.title%", "icon": { "light": "assets/light/add.svg", "dark": "assets/dark/add.svg" @@ -138,7 +138,7 @@ }, { "command": "iceworksApp.components.refresh", - "title": "%iceworksApp.components.refresh.title%", + "title": "%iceworksApp.command.components.refresh.title%", "icon": { "light": "assets/light/refresh.svg", "dark": "assets/dark/refresh.svg" @@ -146,7 +146,7 @@ }, { "command": "iceworksApp.nodeDependencies.addDepsAndDevDeps", - "title": "%iceworksApp.nodeDependencies.addDepsAndDevDeps.title%", + "title": "%iceworksApp.command.nodeDependencies.addDepsAndDevDeps.title%", "icon": { "light": "assets/light/add.svg", "dark": "assets/dark/add.svg" @@ -154,7 +154,7 @@ }, { "command": "iceworksApp.nodeDependencies.reinstall", - "title": "%iceworksApp.nodeDependencies.reinstall.title%", + "title": "%iceworksApp.command.nodeDependencies.reinstall.title%", "icon": { "light": "assets/light/install.svg", "dark": "assets/dark/install.svg" @@ -162,7 +162,7 @@ }, { "command": "iceworksApp.nodeDependencies.refresh", - "title": "%iceworksApp.nodeDependencies.refresh.title%", + "title": "%iceworksApp.command.nodeDependencies.refresh.title%", "icon": { "light": "assets/light/refresh.svg", "dark": "assets/dark/refresh.svg" @@ -170,7 +170,7 @@ }, { "command": "iceworksApp.nodeDependencies.dependencies.add", - "title": "%iceworksApp.nodeDependencies.dependencies.add.title%", + "title": "%iceworksApp.command.nodeDependencies.dependencies.add.title%", "icon": { "light": "assets/light/add.svg", "dark": "assets/dark/add.svg" @@ -178,7 +178,7 @@ }, { "command": "iceworksApp.nodeDependencies.devDependencies.add", - "title": "%iceworksApp.nodeDependencies.devDependencies.add.title%", + "title": "%iceworksApp.command.nodeDependencies.devDependencies.add.title%", "icon": { "light": "assets/light/add.svg", "dark": "assets/dark/add.svg" @@ -186,7 +186,7 @@ }, { "command": "iceworksApp.nodeDependencies.upgrade", - "title": "%iceworksApp.nodeDependencies.upgrade.title%", + "title": "%iceworksApp.command.nodeDependencies.upgrade.title%", "icon": { "light": "assets/light/upgrade.svg", "dark": "assets/dark/upgrade.svg" @@ -194,6 +194,20 @@ } ], "menus": { + "commandPalette": [ + { + "command": "iceworksApp.nodeDependencies.reinstall" + }, + { + "command": "iceworksApp.nodeDependencies.dependencies.add" + }, + { + "command": "iceworksApp.nodeDependencies.devDependencies.add" + }, + { + "command": "iceworksApp.nodeDependencies.addDepsAndDevDeps" + } + ], "view/title": [ { "command": "iceworksApp.npmScripts.refresh", diff --git a/extensions/iceworks-app/package.nls.json b/extensions/iceworks-app/package.nls.json index 78cd2f5bc..86afdcd3e 100644 --- a/extensions/iceworks-app/package.nls.json +++ b/extensions/iceworks-app/package.nls.json @@ -8,19 +8,20 @@ "iceworksApp.viewsWelcome.pages.contents": "Pages could not be found.", "iceworksApp.viewsWelcome.components.contents": "Components could not be found.", "iceworksApp.viewsWelcome.nodeDependencies.contents": "Node dependencies could not be found in package.json.", - "iceworksApp.npmScripts.refresh.title": "Refresh", - "iceworksApp.npmScripts.executeCommand.title": "Run", - "iceworksApp.pages.add.title": "Add Pages", - "iceworksApp.pages.refresh.title": "Refresh", - "iceworksApp.pages.openFile.title": "Open File", - "iceworksApp.components.add.title": "Add Components", - "iceworksApp.components.refresh.title": "Refresh", - "iceworksApp.nodeDependencies.addDepsAndDevDeps.title": "Add Dependencies", - "iceworksApp.nodeDependencies.dependencies.add.title": "Add Dependency", - "iceworksApp.nodeDependencies.devDependencies.add.title": "Add DevDependency", - "iceworksApp.nodeDependencies.reinstall.title": "Reinstall Dependencies", - "iceworksApp.nodeDependencies.refresh.title": "Refresh", - "iceworksApp.nodeDependencies.upgrade.title": "Upgrade Dependency", + "iceworksApp.command.configHelper.start.title": "Iceworks: Set Configuration", + "iceworksApp.command.npmScripts.refresh.title": "Refresh", + "iceworksApp.command.npmScripts.executeCommand.title": "Run", + "iceworksApp.command.pages.add.title": "Add Pages", + "iceworksApp.command.pages.refresh.title": "Refresh", + "iceworksApp.command.pages.openFile.title": "Open File", + "iceworksApp.command.components.add.title": "Add Components", + "iceworksApp.command.components.refresh.title": "Refresh", + "iceworksApp.command.nodeDependencies.addDepsAndDevDeps.title": "Iceworks: Add Dependencies", + "iceworksApp.command.nodeDependencies.dependencies.add.title": "Iceworks: Add Dependency", + "iceworksApp.command.nodeDependencies.devDependencies.add.title": "Iceworks: Add DevDependency", + "iceworksApp.command.nodeDependencies.reinstall.title": "Iceworks: Reinstall Dependencies", + "iceworksApp.command.nodeDependencies.refresh.title": "Refresh", + "iceworksApp.command.nodeDependencies.upgrade.title": "Upgrade Dependency", "iceworksApp.configuration.properties.iceworks.packageManager.description": "Iceworks npm package manager.", "iceworksApp.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm registry." -} +} \ No newline at end of file diff --git a/extensions/iceworks-app/package.nls.zh-cn.json b/extensions/iceworks-app/package.nls.zh-cn.json index ba5600505..9e6e8b033 100644 --- a/extensions/iceworks-app/package.nls.zh-cn.json +++ b/extensions/iceworks-app/package.nls.zh-cn.json @@ -4,23 +4,24 @@ "iceworksApp.view.components.name": "组件列表", "iceworksApp.view.nodeDependencies.name": "依赖列表", "iceworksApp.viewsWelcome.welcome.contents": "要使用 Iceworks,您需要先打开或创建一个应用。\n[打开文件夹](command:vscode.openFolder)\n[创建应用](command:iceworks-project-creator.start)\n[设置](command:iceworksApp.configHelper.start)\n查看[文档](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks)以学习如何在 VS Code 中如何使用 Iceworks App。", - "iceworksApp.viewsWelcome.npmScripts.contents": "没找到 npm 脚本。", - "iceworksApp.viewsWelcome.pages.contents": "没找到页面。", - "iceworksApp.viewsWelcome.components.contents": "没找到组件。", - "iceworksApp.viewsWelcome.nodeDependencies.contents": "没找到依赖。", - "iceworksApp.npmScripts.refresh.title": "刷新", - "iceworksApp.npmScripts.executeCommand.title": "运行", - "iceworksApp.pages.add.title": "添加页面", - "iceworksApp.pages.refresh.title": "刷新", - "iceworksApp.pages.openFile.title": "打开文件", - "iceworksApp.components.add.title": "添加组件", - "iceworksApp.components.refresh.title": "刷新", - "iceworksApp.nodeDependencies.addDepsAndDevDeps.title": "添加依赖", - "iceworksApp.nodeDependencies.dependencies.add.title": "添加dependency", - "iceworksApp.nodeDependencies.devDependencies.add.title": "添加devDependency", - "iceworksApp.nodeDependencies.reinstall.title": "重装依赖", - "iceworksApp.nodeDependencies.refresh.title": "刷新", - "iceworksApp.nodeDependencies.upgrade.title": "升级依赖", + "iceworksApp.viewsWelcome.npmScripts.contents": "未找到 npm 脚本。", + "iceworksApp.viewsWelcome.pages.contents": "未找到页面。", + "iceworksApp.viewsWelcome.components.contents": "未找到组件。", + "iceworksApp.viewsWelcome.nodeDependencies.contents": "未找到依赖。", + "iceworksApp.command.configHelper.start.title": "Iceworks: 设置", + "iceworksApp.command.npmScripts.refresh.title": "刷新", + "iceworksApp.command.npmScripts.executeCommand.title": "运行", + "iceworksApp.command.pages.add.title": "添加页面", + "iceworksApp.command.pages.refresh.title": "刷新", + "iceworksApp.command.pages.openFile.title": "打开文件", + "iceworksApp.command.components.add.title": "添加组件", + "iceworksApp.command.components.refresh.title": "刷新", + "iceworksApp.command.nodeDependencies.addDepsAndDevDeps.title": "Iceworks: 添加依赖", + "iceworksApp.command.nodeDependencies.dependencies.add.title": "Iceworks: 添加 dependency", + "iceworksApp.command.nodeDependencies.devDependencies.add.title": "Iceworks: 添加 devDependency", + "iceworksApp.command.nodeDependencies.reinstall.title": "Iceworks: 重装依赖", + "iceworksApp.command.nodeDependencies.refresh.title": "刷新", + "iceworksApp.command.nodeDependencies.upgrade.title": "升级依赖", "iceworksApp.configuration.properties.iceworks.packageManager.description": "Iceworks npm 包管理工具", "iceworksApp.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm 镜像源" -} +} \ No newline at end of file diff --git a/extensions/iceworks-component-builder/package.json b/extensions/iceworks-component-builder/package.json index 7024a3f84..515b4cd37 100644 --- a/extensions/iceworks-component-builder/package.json +++ b/extensions/iceworks-component-builder/package.json @@ -31,7 +31,7 @@ "commands": [ { "command": "iceworks-component-builder.generate", - "title": "Iceworks: Generate Component" + "title": "%iceworksComponentBuilder.commands.generate.title%" } ], "configuration": { diff --git a/extensions/iceworks-component-builder/package.nls.json b/extensions/iceworks-component-builder/package.nls.json index 631a80710..9f5c558c5 100644 --- a/extensions/iceworks-component-builder/package.nls.json +++ b/extensions/iceworks-component-builder/package.nls.json @@ -1,5 +1,6 @@ { "iceworksComponentBuilder.configuration.properties.iceworks.packageManager.description": "Iceworks npm package manager.", "iceworksComponentBuilder.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm registry.", - "iceworksComponentBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks material sources, decide which materials to use." -} + "iceworksComponentBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks material sources, decide which materials to use.", + "iceworksComponentBuilder.commands.generate.title": "Iceworks: Generate Component" +} \ No newline at end of file diff --git a/extensions/iceworks-component-builder/package.nls.zh-cn.json b/extensions/iceworks-component-builder/package.nls.zh-cn.json index b6377c27f..e03bd5ae8 100644 --- a/extensions/iceworks-component-builder/package.nls.zh-cn.json +++ b/extensions/iceworks-component-builder/package.nls.zh-cn.json @@ -1,5 +1,6 @@ { "iceworksComponentBuilder.configuration.properties.iceworks.packageManager.description": "Iceworks npm 包管理工具.", "iceworksComponentBuilder.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm 镜像源", - "iceworksComponentBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks 物料源,决定使用哪些物料。" -} + "iceworksComponentBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks 物料源,决定使用哪些物料。", + "iceworksComponentBuilder.commands.generate.title": "Iceworks: 生成组件" +} \ No newline at end of file diff --git a/extensions/iceworks-material-import/package.json b/extensions/iceworks-material-import/package.json index 351095ae2..313f582f1 100644 --- a/extensions/iceworks-material-import/package.json +++ b/extensions/iceworks-material-import/package.json @@ -31,7 +31,7 @@ "commands": [ { "command": "iceworks-material-import.start", - "title": "Iceworks: Import Material" + "title": "%iceworksMaterialImport.commands.start.title%" } ] }, diff --git a/extensions/iceworks-material-import/package.nls.json b/extensions/iceworks-material-import/package.nls.json new file mode 100644 index 000000000..001ef4192 --- /dev/null +++ b/extensions/iceworks-material-import/package.nls.json @@ -0,0 +1,3 @@ +{ + "iceworksMaterialImport.commands.start.title": "Iceworks: Import Material" +} \ No newline at end of file diff --git a/extensions/iceworks-material-import/package.nls.zh-cn.json b/extensions/iceworks-material-import/package.nls.zh-cn.json new file mode 100644 index 000000000..a11f958ed --- /dev/null +++ b/extensions/iceworks-material-import/package.nls.zh-cn.json @@ -0,0 +1,3 @@ +{ + "iceworksMaterialImport.commands.start.title": "Iceworks: 使用物料" +} \ No newline at end of file diff --git a/extensions/iceworks-page-builder/package.json b/extensions/iceworks-page-builder/package.json index 171a04c82..316eb5d79 100644 --- a/extensions/iceworks-page-builder/package.json +++ b/extensions/iceworks-page-builder/package.json @@ -31,7 +31,7 @@ "commands": [ { "command": "iceworks-page-builder.create", - "title": "Iceworks: Create Page" + "title": "%iceworksPageBuilder.commands.create.title%" } ], "configuration": { diff --git a/extensions/iceworks-page-builder/package.nls.json b/extensions/iceworks-page-builder/package.nls.json index 7ae6a1113..9543a3a0b 100644 --- a/extensions/iceworks-page-builder/package.nls.json +++ b/extensions/iceworks-page-builder/package.nls.json @@ -1,5 +1,6 @@ { "iceworksPageBuilder.configuration.properties.iceworks.packageManager.description": "Iceworks npm package manager.", "iceworksPageBuilder.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm registry.", - "iceworksPageBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks material sources, decide which materials to use." -} + "iceworksPageBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks material sources, decide which materials to use.", + "iceworksPageBuilder.commands.create.title": "Iceworks: Create Page" +} \ No newline at end of file diff --git a/extensions/iceworks-page-builder/package.nls.zh-cn.json b/extensions/iceworks-page-builder/package.nls.zh-cn.json index 6949fc6a3..e2f527913 100644 --- a/extensions/iceworks-page-builder/package.nls.zh-cn.json +++ b/extensions/iceworks-page-builder/package.nls.zh-cn.json @@ -1,5 +1,6 @@ { "iceworksPageBuilder.configuration.properties.iceworks.packageManager.description": "Iceworks npm 包管理工具.", "iceworksPageBuilder.configuration.properties.iceworks.npmRegistry.description": "Iceworks npm 镜像源", - "iceworksPageBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks 物料源,决定使用哪些物料。" -} + "iceworksPageBuilder.configuration.properties.iceworks.materialSources.description": "Iceworks 物料源,决定使用哪些物料。", + "iceworksPageBuilder.commands.create.title": "Iceworks: 创建页面" +} \ No newline at end of file diff --git a/extensions/iceworks-project-creator/package.json b/extensions/iceworks-project-creator/package.json index 014aa511c..11faf28a6 100644 --- a/extensions/iceworks-project-creator/package.json +++ b/extensions/iceworks-project-creator/package.json @@ -26,7 +26,7 @@ "commands": [ { "command": "iceworks-project-creator.start", - "title": "Iceworks: Create Application" + "title": "%iceworksProjectCreator.commands.start.title%" } ], "configuration": { @@ -98,4 +98,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/package.nls.json b/extensions/iceworks-project-creator/package.nls.json new file mode 100644 index 000000000..2443df460 --- /dev/null +++ b/extensions/iceworks-project-creator/package.nls.json @@ -0,0 +1,3 @@ +{ + "iceworksProjectCreator.commands.start.title": "Iceworks: Create Application" +} \ No newline at end of file diff --git a/extensions/iceworks-project-creator/package.nls.zh-cn.json b/extensions/iceworks-project-creator/package.nls.zh-cn.json new file mode 100644 index 000000000..daa2ff6e0 --- /dev/null +++ b/extensions/iceworks-project-creator/package.nls.zh-cn.json @@ -0,0 +1,3 @@ +{ + "iceworksProjectCreator.commands.start.title": "Iceworks: 创建应用" +} \ No newline at end of file From 93848d21f1b4572c1a9a266c30f4027ce9caee94 Mon Sep 17 00:00:00 2001 From: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Date: Fri, 10 Jul 2020 10:55:52 +0800 Subject: [PATCH 04/26] feat: sef default scaffold (#202) * feat: scaffold selected * feat: scaffold selected * feat: icon * chore: version * fix: comment --- .../iceworks-project-creator/CHANGELOG.md | 4 ++ .../iceworks-project-creator/package.json | 2 +- .../iceworks-project-creator/web/package.json | 4 +- .../web/src/assets/app.svg | 1 + .../web/src/assets/js.svg | 2 +- .../web/src/assets/logo.png | Bin 18915 -> 0 bytes .../web/src/assets/pc.svg | 1 + .../web/src/assets/ts.svg | 2 +- .../web/src/assets/wireless.svg | 20 +++++++++ .../ScaffoldMarket/index.module.scss | 2 +- .../components/ScaffoldMarket/index.tsx | 39 +++++++++++------- .../web/src/pages/CreateProject/index.tsx | 9 ++-- .../iceworks-project-creator/web/src/types.ts | 10 ++++- packages/material-service/package.json | 2 +- packages/material-service/src/index.ts | 3 ++ 15 files changed, 71 insertions(+), 30 deletions(-) create mode 100644 extensions/iceworks-project-creator/web/src/assets/app.svg delete mode 100644 extensions/iceworks-project-creator/web/src/assets/logo.png create mode 100644 extensions/iceworks-project-creator/web/src/assets/pc.svg create mode 100644 extensions/iceworks-project-creator/web/src/assets/wireless.svg diff --git a/extensions/iceworks-project-creator/CHANGELOG.md b/extensions/iceworks-project-creator/CHANGELOG.md index dbc1e30ae..8e6f5b873 100644 --- a/extensions/iceworks-project-creator/CHANGELOG.md +++ b/extensions/iceworks-project-creator/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.2.0 + +- feat: default select a scaffold + ## 0.1.9 - style: better styles of the webview diff --git a/extensions/iceworks-project-creator/package.json b/extensions/iceworks-project-creator/package.json index 11faf28a6..0529bdb43 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.1.9", + "version": "0.2.0", "engines": { "vscode": "^1.41.0" }, diff --git a/extensions/iceworks-project-creator/web/package.json b/extensions/iceworks-project-creator/web/package.json index b512061cd..e69974b5e 100644 --- a/extensions/iceworks-project-creator/web/package.json +++ b/extensions/iceworks-project-creator/web/package.json @@ -1,6 +1,6 @@ { "name": "web-for-iceworks-project-creator", - "version": "0.1.4", + "version": "0.2.0", "description": "web for Iceworks project creator", "private": true, "devDependencies": { @@ -34,4 +34,4 @@ "type": "git", "url": "https://github.com/ice-lab/iceworks.git" } -} +} \ No newline at end of file diff --git a/extensions/iceworks-project-creator/web/src/assets/app.svg b/extensions/iceworks-project-creator/web/src/assets/app.svg new file mode 100644 index 000000000..7aec25c77 --- /dev/null +++ b/extensions/iceworks-project-creator/web/src/assets/app.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-project-creator/web/src/assets/js.svg b/extensions/iceworks-project-creator/web/src/assets/js.svg index ba40dc7b7..c35012e6c 100644 --- a/extensions/iceworks-project-creator/web/src/assets/js.svg +++ b/extensions/iceworks-project-creator/web/src/assets/js.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/extensions/iceworks-project-creator/web/src/assets/logo.png b/extensions/iceworks-project-creator/web/src/assets/logo.png deleted file mode 100644 index 2004c78ce15dcab916fb461ddc2c7aca22eb628a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18915 zcmc(H30#s{_kT?_T27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Q@e`H?|KP8pUI9@@g11m` zY~u_@NN@FK%;5Iwe#0cogVz7xPi`RS?CYiT;r%_ix6tYEfD#n?;f$gc?&zFP*8QWe zpZ~4zs();pWzVr1-7%1Cp=3pS<)B-M<^ypRK?+^K9v&W+YFL0|?|LZ2=8_BVKrrFY zWI}|XW(d5wFd!&sg17@jl;*lJ-$j z%^OX0|E>67xUb(dYb+F$os-jJXc{oqD%KSp!#{gzAbd^+3=h@}MRZJ_X7m9Ax5rVE z6cAXN5h@@a)U%TWj2s3gme26G(Y`pqy2Dz*OuhmuV&ppMf|5>;%Pb)L3~?sSgrS!@ z&l)h_N1XN@tMrVPl{gH)F_EOj$J<(<{iem%4y-FtfCZ1Y1A^YZ%~puOksoa947`K23r_~j%QrHy3Al=>>sA)F?2z_$wG8LrJG$qp8oIjV0kOfz zScOrTq-0&Lt>BB0N6l&0h|oLOTjPmAd$#-!{}Sq1z)!(c`He-3zaIZ0M(emkveRV2 zuIXX7DqZ`3^eY8_|Ho9av||w)Nq+p7&=m9%zVR)O6bEXVf_JQ zLdN>)-eTv6qX-bOzj)LR7ais&HX5yXv7OOXX~%d_z+M7Kl38y|?+=%*U0U&=gl_Qq z?8dk&)WeK=xAGG{y$^hM!P-LC3Kr&?2_?;w*CbCvzsJay;mRK+_aRgSFR7E?NyMC& h(FN;GWnd99zlX$EP2Vj7e!OYkzCAX(3wEB0{6AQ7tStZl diff --git a/extensions/iceworks-project-creator/web/src/assets/pc.svg b/extensions/iceworks-project-creator/web/src/assets/pc.svg new file mode 100644 index 000000000..00a792b7e --- /dev/null +++ b/extensions/iceworks-project-creator/web/src/assets/pc.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-project-creator/web/src/assets/ts.svg b/extensions/iceworks-project-creator/web/src/assets/ts.svg index 8fb815312..76ceca398 100644 --- a/extensions/iceworks-project-creator/web/src/assets/ts.svg +++ b/extensions/iceworks-project-creator/web/src/assets/ts.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/extensions/iceworks-project-creator/web/src/assets/wireless.svg b/extensions/iceworks-project-creator/web/src/assets/wireless.svg new file mode 100644 index 000000000..577e51fd5 --- /dev/null +++ b/extensions/iceworks-project-creator/web/src/assets/wireless.svg @@ -0,0 +1,20 @@ + + + + diff --git a/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.module.scss b/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.module.scss index 218371a8d..febf96222 100644 --- a/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.module.scss +++ b/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.module.scss @@ -37,7 +37,7 @@ .loading { width: 100%; - height: 100%; + height: 90%; } .mainScaffolds { diff --git a/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.tsx b/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.tsx index e0f67aea1..a2706e1a0 100644 --- a/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.tsx +++ b/extensions/iceworks-project-creator/web/src/pages/CreateProject/components/ScaffoldMarket/index.tsx @@ -7,13 +7,13 @@ import NotFound from '@/components/NotFound'; import callService from '@/callService'; import { IMaterialSource, IMaterialScaffold } from '@iceworks/material-utils'; import { mainScaffoldsList, tsScaffoldsList, jsScaffoldsList } from '@/constant'; +import { IScaffoldMarket } from '@/types'; import styles from './index.module.scss'; const projectTypes = ['react', 'rax', 'vue']; -const ScaffoldMarket = ({ onScaffoldSelect, children, onOpenConfigPanel, materialSources }) => { +const ScaffoldMarket = ({ onScaffoldSelect, curProjectField, children, onOpenConfigPanel, materialSources }) => { const [selectedSource, setSelectedSource] = useState({}); - const [SelectedMaterial, setSelectedMaterial] = useState(null); const [mainScaffolds, setMainScaffolds] = useState([]); const [otherScaffolds, setOtherScaffolds] = useState([]); const [loading, setLoading] = useState(false); @@ -26,7 +26,6 @@ const ScaffoldMarket = ({ onScaffoldSelect, children, onOpenConfigPanel, materia const { mainScaffolds, otherScaffolds } = data as any; setMainScaffolds(mainScaffolds); setOtherScaffolds(otherScaffolds); - setSelectedMaterial(null); } catch (err) { // ignore } finally { @@ -34,12 +33,11 @@ const ScaffoldMarket = ({ onScaffoldSelect, children, onOpenConfigPanel, materia } } - function onScaffoldMaterialClick(scaffold) { - setSelectedMaterial(scaffold.name); - onScaffoldSelect(scaffold); + function onScaffoldClick(scaffold) { + onScaffoldSelect(selectedSource, scaffold); } - async function getScaffolds(source: string) { + async function getScaffolds(source: string): Promise { try { const scaffolds = await callService('project', 'getScaffolds', source) as IMaterialScaffold[]; let main = scaffolds.filter(scaffold => mainScaffoldsList.includes(scaffold.source.npm)); @@ -61,13 +59,18 @@ const ScaffoldMarket = ({ onScaffoldSelect, children, onOpenConfigPanel, materia if (!materialSources.length) { return; } - setSelectedSource(materialSources[0]); - const source = materialSources[0].source; + const selectedSource = curProjectField.source ? curProjectField.source : materialSources[0] + setSelectedSource(selectedSource); + const source = selectedSource.source; const data = await getScaffolds(source); - const { mainScaffolds, otherScaffolds } = data as any; + const { mainScaffolds, otherScaffolds } = data as IScaffoldMarket; setMainScaffolds(mainScaffolds); setOtherScaffolds(otherScaffolds); + if (mainScaffolds.length > 0) { + const selectedScaffold = curProjectField.scaffold ? curProjectField.scaffold : mainScaffolds[0]; + onScaffoldSelect(selectedSource, selectedScaffold); + } } catch (error) { Notification.error({ content: error.message }); } finally { @@ -84,12 +87,18 @@ const ScaffoldMarket = ({ onScaffoldSelect, children, onOpenConfigPanel, materia
{materialSources && materialSources.map(item => { + let iconName = 'app'; const projectType = item.type.toLocaleLowerCase(); + if (item.client) { + iconName = item.client.toLocaleLowerCase(); + } else if (projectTypes.includes(projectType)) { + iconName = projectType; + } return - {projectType} + {projectType}
{item.name}
} @@ -125,8 +134,8 @@ const ScaffoldMarket = ({ onScaffoldSelect, children, onOpenConfigPanel, materia } content={item.description} media={item.screenshot} - selected={SelectedMaterial === item.name} - onClick={() => onScaffoldMaterialClick(item)} + selected={curProjectField.scaffold.name === item.name} + onClick={() => onScaffoldClick(item)} /> ) }) : @@ -153,8 +162,8 @@ const ScaffoldMarket = ({ onScaffoldSelect, children, onOpenConfigPanel, materia } content={item.description} media={item.screenshot} - selected={SelectedMaterial === item.name} - onClick={() => onScaffoldMaterialClick(item)} + selected={curProjectField.scaffold.name === item.name} + onClick={() => onScaffoldClick(item)} /> ) })} 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 e33079136..17d64e4e1 100644 --- a/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.tsx +++ b/extensions/iceworks-project-creator/web/src/pages/CreateProject/index.tsx @@ -25,7 +25,7 @@ const CreateProject: React.FC = () => { const [materialSources, setMaterialSources] = useState>([]); const existProjectsRef = useRef([]); const steps = [ - + , @@ -73,14 +73,11 @@ const CreateProject: React.FC = () => { }; function goPrev() { - if (currentStep === 1) { - setCurProjectField({ ...curProjectField, scaffold: null }); - } setStep(currentStep - 1); }; - function onScaffoldSelect(scaffold) { - setCurProjectField({ ...curProjectField, scaffold }) + function onScaffoldSelect(source, scaffold) { + setCurProjectField({ ...curProjectField, scaffold, source }); }; async function onScaffoldSubmit() { diff --git a/extensions/iceworks-project-creator/web/src/types.ts b/extensions/iceworks-project-creator/web/src/types.ts index 89ac8013a..0b6cc02e7 100644 --- a/extensions/iceworks-project-creator/web/src/types.ts +++ b/extensions/iceworks-project-creator/web/src/types.ts @@ -1,9 +1,10 @@ -import { IMaterialScaffold } from '@iceworks/material-utils'; +import { IMaterialScaffold, IMaterialSource } from '@iceworks/material-utils'; export interface IProjectField { projectName: string; projectPath: string; - scaffold: IMaterialScaffold | null; + scaffold: IMaterialScaffold; + source: IMaterialSource; scaffoldType: string; } @@ -27,4 +28,9 @@ export interface IGitLabGroup { 'name': string; 'path': string; 'web_url': string; +} + +export interface IScaffoldMarket { + mainScaffolds: IMaterialScaffold[]; + otherScaffolds: IMaterialScaffold[]; } \ No newline at end of file diff --git a/packages/material-service/package.json b/packages/material-service/package.json index 320df6382..99843c2b9 100644 --- a/packages/material-service/package.json +++ b/packages/material-service/package.json @@ -1,6 +1,6 @@ { "name": "@iceworks/material-service", - "version": "0.1.7", + "version": "0.2.0", "description": "Iceworks material service for VSCode extension.", "files": [ "lib" diff --git a/packages/material-service/src/index.ts b/packages/material-service/src/index.ts index e56337090..21ed34f6c 100644 --- a/packages/material-service/src/index.ts +++ b/packages/material-service/src/index.ts @@ -13,12 +13,14 @@ const OFFICAL_MATERIAL_SOURCES = [ { name: 'PC Web', type: 'react', + client: 'pc', source: ICE_MATERIAL_SOURCE, description: '基于 Fusion 基础组件和 ICE 脚手架的官方物料' }, { name: '无线跨端', type: 'rax', + client: 'wireless', source: 'https://ice.alicdn.com/assets/materials/rax-materials.json', description: '基于 Rax 组件和 Rax 脚手架的官方物料' } @@ -27,6 +29,7 @@ const OFFICAL_MATERIAL_SOURCES_FOR_EXTERNAL = [ { name: 'Vue 物料源', type: 'vue', + client: 'pc', source: 'https://ice.alicdn.com/assets/materials/vue-materials.json', description: '基于 Element, Vue CLI 的 Vue 官方物料' } From 05c75ad474b51b2495f1587df20a5ff916f7c890 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Fri, 10 Jul 2020 10:57:18 +0800 Subject: [PATCH 05/26] feat: support SASS style preview for icejs (#206) * fix: selector undefined * feat: support scss * feat: add changelog --- extensions/iceworks-style-helper/CHANGELOG.md | 4 ++++ extensions/iceworks-style-helper/package.json | 2 +- .../iceworks-style-helper/src/styleInfoViewer/findStyle.ts | 6 +++--- .../src/styleInfoViewer/findStyleDependencies.ts | 5 ++++- .../src/styleInfoViewer/findStyleSelectors.ts | 6 ++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/extensions/iceworks-style-helper/CHANGELOG.md b/extensions/iceworks-style-helper/CHANGELOG.md index 5aa50039b..21c3401fa 100644 --- a/extensions/iceworks-style-helper/CHANGELOG.md +++ b/extensions/iceworks-style-helper/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.3.1 + +Support ICE css module style preview and completion. + ## 0.3.0 Add Sass Variables Helper: diff --git a/extensions/iceworks-style-helper/package.json b/extensions/iceworks-style-helper/package.json index ca8f14697..26eab0e45 100644 --- a/extensions/iceworks-style-helper/package.json +++ b/extensions/iceworks-style-helper/package.json @@ -3,7 +3,7 @@ "displayName": "Iceworks Style Helper", "description": "Easily write styles in JSX.", "publisher": "iceworks-team", - "version": "0.3.0", + "version": "0.3.1", "engines": { "vscode": "^1.41.0" }, diff --git a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts index d8fafb509..c6d09edeb 100644 --- a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts +++ b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyle.ts @@ -30,9 +30,9 @@ 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.includes(`.${className}`)); - + + matched = stylesheet.rules.find(rule => rule.selectors && rule.selectors.includes(`.${className}`)); + // Just find one matched stylesheet. if (matched) { matched.file = file; diff --git a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleDependencies.ts b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleDependencies.ts index c31ab1abb..78fc7a844 100644 --- a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleDependencies.ts +++ b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleDependencies.ts @@ -2,6 +2,8 @@ import * as fs from 'fs'; import * as babelParser from '@babel/parser'; import traverse from '@babel/traverse'; +const supportFiles = ['css', 'scss', 'sass']; + // import styles from './xxx.css'; -> { source: './xxx.css', identifier: 'styles' } // import './xxx.css'; -> { source: './xxx.css', identifier: null } export interface IStyleDependency { @@ -23,7 +25,8 @@ export function findStyleDependencies(file: string) { traverse(ast, { ImportDeclaration(path) { const { node } = path; - if (/\.css$/i.test(node.source.value)) { + // Example /\.css$|\.scss$|\.sass$/ + if (new RegExp(`${supportFiles.map(supportFile => `\\.${supportFile}$`).join('|')}`, 'i').test(node.source.value)) { StyleDependencies.push({ source: node.source.value, // Just return first identifier. diff --git a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleSelectors.ts b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleSelectors.ts index 722afd495..23ff5bb59 100644 --- a/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleSelectors.ts +++ b/extensions/iceworks-style-helper/src/styleInfoViewer/findStyleSelectors.ts @@ -14,10 +14,12 @@ export default function findStyleSelectors(directory: string, styleDependencies: // eslint-disable-next-line stylesheet.rules.forEach((rule: IStyle) => { - selectors = selectors.concat(rule.selectors); + if (rule.selectors) { + selectors = selectors.concat(rule.selectors); + } }); } - + return selectors; }; From 3938f3f208fcaa4f04b847b78d62c36fefd94b32 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Fri, 10 Jul 2020 14:09:08 +0800 Subject: [PATCH 06/26] feat: supprot className (#210) --- extensions/iceworks-style-helper/CHANGELOG.md | 3 ++- extensions/iceworks-style-helper/README.en.md | 4 ++++ extensions/iceworks-style-helper/README.md | 4 ++++ extensions/iceworks-style-helper/package.json | 5 ++++- .../src/styleInfoViewer/index.ts | 12 ++++++++---- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/extensions/iceworks-style-helper/CHANGELOG.md b/extensions/iceworks-style-helper/CHANGELOG.md index 21c3401fa..44ef473aa 100644 --- a/extensions/iceworks-style-helper/CHANGELOG.md +++ b/extensions/iceworks-style-helper/CHANGELOG.md @@ -2,7 +2,8 @@ ## 0.3.1 -Support ICE css module style preview and completion. +- Support ICE css module style preview and completion. +- Support className preview, definition and completion. ## 0.3.0 diff --git a/extensions/iceworks-style-helper/README.en.md b/extensions/iceworks-style-helper/README.en.md index 2f794fb7f..77b57c30f 100644 --- a/extensions/iceworks-style-helper/README.en.md +++ b/extensions/iceworks-style-helper/README.en.md @@ -21,6 +21,10 @@ Write styles easier in [JSX](https://reactjs.org/docs/introducing-jsx.html), fri ![demo](https://img.alicdn.com/tfs/TB1UDGht.Y1gK0jSZFMXXaWcVXa-1468-906.gif) +* When editing the 'className' attribute of a component in a JSX file, an automatic completion reminder will be given: + + ![demo](https://img.alicdn.com/tfs/TB1JqP0Nfb2gK0jSZK9XXaEgFXa-900-561.gif) + ### Class name When editing the 'class' name of a CSS, LESS or SASS file, an automatic completion reminder will be given: diff --git a/extensions/iceworks-style-helper/README.md b/extensions/iceworks-style-helper/README.md index 61cc00aa8..5ac5cdabe 100644 --- a/extensions/iceworks-style-helper/README.md +++ b/extensions/iceworks-style-helper/README.md @@ -20,6 +20,10 @@ ![使用示例](https://img.alicdn.com/tfs/TB1pb1ltYY1gK0jSZTEXXXDQVXa-1468-906.gif) ![使用示例](https://img.alicdn.com/tfs/TB1UDGht.Y1gK0jSZFMXXaWcVXa-1468-906.gif) + +* 在 JSX 文件中编辑组件的 `className` 属性时给予自动补全提醒,预览及条跳转: + + ![使用示例](https://img.alicdn.com/tfs/TB1JqP0Nfb2gK0jSZK9XXaEgFXa-900-561.gif) ### 样式文件 diff --git a/extensions/iceworks-style-helper/package.json b/extensions/iceworks-style-helper/package.json index 26eab0e45..c2271d3f7 100644 --- a/extensions/iceworks-style-helper/package.json +++ b/extensions/iceworks-style-helper/package.json @@ -15,7 +15,10 @@ "Rax", "React", "JSX", - "Inline Style" + "Inline Style", + "Style", + "CSS", + "ClassName" ], "icon": "assets/logo.png", "activationEvents": [ diff --git a/extensions/iceworks-style-helper/src/styleInfoViewer/index.ts b/extensions/iceworks-style-helper/src/styleInfoViewer/index.ts index 480d45f6b..3c227e4d9 100644 --- a/extensions/iceworks-style-helper/src/styleInfoViewer/index.ts +++ b/extensions/iceworks-style-helper/src/styleInfoViewer/index.ts @@ -51,7 +51,12 @@ function provideCompletionItems(document: vscode.TextDocument, position: vscode. const styleDependencies = findStyleDependencies(fileName); for (let i = 0, l = styleDependencies.length; i < l; i++) { - if (styleDependencies[i].identifier && new RegExp(`${styleDependencies[i].identifier}\\.$`).test(word)) { + if ( + // className=xxx + /className=/.test(line.text) || + // style={styles.xxx} + (styleDependencies[i].identifier && new RegExp(`${styleDependencies[i].identifier}\\.$`).test(word)) + ) { return findStyleSelectors(directory, styleDependencies).map((selector: string) => { // Remove class selector `.`, When use styles.xxx. return new vscode.CompletionItem(selector.replace('.', ''), vscode.CompletionItemKind.Variable); @@ -83,9 +88,8 @@ export default function styleInfoViewer(context: vscode.ExtensionContext) { vscode.languages.registerCompletionItemProvider( language, { provideCompletionItems }, - // match [styles identifier].xxx - // Example: `import test from './xxx.css'` match test.xxx; - '.' + // eslint-disable-next-line + '.', '\"', '\'', ' ', ) ); }); From c0bdcc1f26692b385200a52628bc23c08504e581 Mon Sep 17 00:00:00 2001 From: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Date: Fri, 10 Jul 2020 14:21:00 +0800 Subject: [PATCH 07/26] feat: add material import to edit context (#203) * feat: open material-import to editor-context * chore: update change log * feat: editor context * chore: nls * chore: typo * fix: comment --- extensions/iceworks-material-import/CHANGELOG.md | 4 ++++ extensions/iceworks-material-import/package.json | 13 +++++++++++-- packages/common-service/src/index.ts | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/extensions/iceworks-material-import/CHANGELOG.md b/extensions/iceworks-material-import/CHANGELOG.md index fdbdbc8e1..25c634440 100644 --- a/extensions/iceworks-material-import/CHANGELOG.md +++ b/extensions/iceworks-material-import/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.1.2 + +- feat: quick activate iceworks-material-import extensions by editor context + ## 0.1.1 - style: better style of the webview diff --git a/extensions/iceworks-material-import/package.json b/extensions/iceworks-material-import/package.json index 313f582f1..4128ede4d 100644 --- a/extensions/iceworks-material-import/package.json +++ b/extensions/iceworks-material-import/package.json @@ -3,7 +3,7 @@ "displayName": "Iceworks Material Import", "description": "Quick import material in a visual way.", "publisher": "iceworks-team", - "version": "0.1.1", + "version": "0.1.2", "engines": { "vscode": "^1.41.0" }, @@ -33,7 +33,16 @@ "command": "iceworks-material-import.start", "title": "%iceworksMaterialImport.commands.start.title%" } - ] + ], + "menus": { + "editor/context": [ + { + "command": "iceworks-material-import.start", + "group": "iceworksMaterialImport", + "when": "editorTextFocus && iceworks:isJSXFile" + } + ] + } }, "scripts": { "vscode:prepublish": "rm -rf build && npm run build:web && webpack --mode production", diff --git a/packages/common-service/src/index.ts b/packages/common-service/src/index.ts index 7abdb08ec..33ca842dc 100644 --- a/packages/common-service/src/index.ts +++ b/packages/common-service/src/index.ts @@ -68,6 +68,10 @@ export function onChangeActiveTextEditor(context: vscode.ExtensionContext) { vscode.window.onDidChangeActiveTextEditor( editor => { if (editor) { + const fsPath = editor.document.uri.fsPath; + const isJSXFile = fsPath.match(/^.*\.(jsx?|tsx)$/g); + vscode.commands.executeCommand('setContext', 'iceworks:isJSXFile', isJSXFile); + // save active text editor id const { id } = editor as any; console.log('activeTextEditor Id', id); From ee4979e06fbe1c997fe1332813c5b15d5c6c2849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=96=87=E6=B6=9B?= Date: Fri, 10 Jul 2020 14:54:52 +0800 Subject: [PATCH 08/26] feat: automatically open application creator on first installation (#211) * feat: automatically open application creator on first installation * docs: add changlog * chore: change key --- extensions/iceworks-app/src/extension.ts | 3 +- .../iceworks-project-creator/CHANGELOG.md | 1 + .../iceworks-project-creator/package.json | 3 +- .../iceworks-project-creator/src/extension.ts | 29 ++++++++++++++----- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/extensions/iceworks-app/src/extension.ts b/extensions/iceworks-app/src/extension.ts index d5c892f6f..df9bde2f1 100644 --- a/extensions/iceworks-app/src/extension.ts +++ b/extensions/iceworks-app/src/extension.ts @@ -54,8 +54,9 @@ export async function activate(context: vscode.ExtensionContext) { const projectType = await getProjectType(); const isNotTargetProject = projectType === 'unknown'; vscode.commands.executeCommand('setContext', 'iceworks:isNotTargetProject', isNotTargetProject); - if (isNotTargetProject) + if (isNotTargetProject) { vscode.commands.executeCommand('iceworks-project-creator.start'); + } } catch (e) { vscode.commands.executeCommand('setContext', 'iceworks:isNotTargetProject', true); vscode.commands.executeCommand('iceworks-project-creator.start'); diff --git a/extensions/iceworks-project-creator/CHANGELOG.md b/extensions/iceworks-project-creator/CHANGELOG.md index 8e6f5b873..d1593636a 100644 --- a/extensions/iceworks-project-creator/CHANGELOG.md +++ b/extensions/iceworks-project-creator/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.2.0 - feat: default select a scaffold +- feat: automatically open application creator on first installation ## 0.1.9 diff --git a/extensions/iceworks-project-creator/package.json b/extensions/iceworks-project-creator/package.json index 0529bdb43..90cfd085f 100644 --- a/extensions/iceworks-project-creator/package.json +++ b/extensions/iceworks-project-creator/package.json @@ -19,7 +19,8 @@ ], "icon": "assets/logo.png", "activationEvents": [ - "onCommand:iceworks-project-creator.start" + "onCommand:iceworks-project-creator.start", + "onStartupFinished" ], "main": "./build/extension.js", "contributes": { diff --git a/extensions/iceworks-project-creator/src/extension.ts b/extensions/iceworks-project-creator/src/extension.ts index 5c5b1c2d9..54ebf2296 100644 --- a/extensions/iceworks-project-creator/src/extension.ts +++ b/extensions/iceworks-project-creator/src/extension.ts @@ -13,22 +13,35 @@ export function activate(context: vscode.ExtensionContext) { // data collection const logger = new Logger(name, globalState); - logger.recordDAU(); - logger.recordActivate(version); // auto set configuration initExtension(context); + let webviewPanel: vscode.WebviewPanel; + function activeWebview() { - const webviewPanel: vscode.WebviewPanel = window.createWebviewPanel('iceworks', '创建应用 - Iceworks', ViewColumn.One, { - enableScripts: true, - retainContextWhenHidden: true, - }); - webviewPanel.webview.html = getHtmlForWebview(extensionPath); - connectService(webviewPanel, context, { services, logger }); + logger.recordDAU(); + logger.recordActivate(version); + + if (webviewPanel) { + webviewPanel.reveal(); + } else { + webviewPanel = window.createWebviewPanel('iceworks', '创建应用 - Iceworks', ViewColumn.One, { + enableScripts: true, + retainContextWhenHidden: true, + }); + webviewPanel.webview.html = getHtmlForWebview(extensionPath); + connectService(webviewPanel, context, { services, logger }); + } } subscriptions.push(vscode.commands.registerCommand('iceworks-project-creator.start', function () { activeWebview(); })); + + const stateKey = 'iceworks.projectCreator.autoActivedWebview'; + if (!globalState.get(stateKey)) { + activeWebview(); + globalState.update(stateKey, true); + } } From 45e2992c50991185ca38ce797627feb8c99d316a Mon Sep 17 00:00:00 2001 From: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Date: Fri, 10 Jul 2020 14:55:54 +0800 Subject: [PATCH 09/26] feat: iceworks project viewer style(#177) * feat: add stop command * feat: add stop command * feat: auto install deps * feat: refresh when file changed * fix: fix terminal dispose * fix: treeItem class name * fix: comment * feat: add inputboxs * chore: inputBox text --- extensions/iceworks-app/CHANGELOG.md | 5 ++ extensions/iceworks-app/assets/dark/stop.svg | 1 + extensions/iceworks-app/assets/light/stop.svg | 1 + extensions/iceworks-app/package.json | 17 +++- .../src/commands/executeCommand.ts | 28 +++++++ .../iceworks-app/src/commands/stopCommand.ts | 9 +++ extensions/iceworks-app/src/constants.ts | 2 + extensions/iceworks-app/src/extension.ts | 10 ++- .../src/inputBoxs/showDepsInputBox.ts | 14 ++++ extensions/iceworks-app/src/openEntryFile.ts | 14 ++++ .../src/quickPicks/showDepsQuickPick.ts | 17 ++++ .../showExtensionsQuickPick.ts} | 15 +--- .../statusBar/createExtensionsStatusBar.ts | 10 +++ extensions/iceworks-app/src/utils.ts | 56 ------------- .../iceworks-app/src/views/componentsView.ts | 80 ++++++++++++------- .../src/views/nodeDependenciesView.ts | 77 ++++++++---------- .../iceworks-app/src/views/npmScriptsView.ts | 56 ++++++++----- .../iceworks-app/src/views/pagesView.ts | 32 +++++--- packages/common-service/package.json | 4 +- packages/common-service/src/index.ts | 6 +- 20 files changed, 271 insertions(+), 183 deletions(-) create mode 100644 extensions/iceworks-app/assets/dark/stop.svg create mode 100644 extensions/iceworks-app/assets/light/stop.svg create mode 100644 extensions/iceworks-app/src/commands/executeCommand.ts create mode 100644 extensions/iceworks-app/src/commands/stopCommand.ts create mode 100644 extensions/iceworks-app/src/inputBoxs/showDepsInputBox.ts create mode 100644 extensions/iceworks-app/src/openEntryFile.ts create mode 100644 extensions/iceworks-app/src/quickPicks/showDepsQuickPick.ts rename extensions/iceworks-app/src/{createStatusBarItem.ts => quickPicks/showExtensionsQuickPick.ts} (68%) create mode 100644 extensions/iceworks-app/src/statusBar/createExtensionsStatusBar.ts delete mode 100644 extensions/iceworks-app/src/utils.ts diff --git a/extensions/iceworks-app/CHANGELOG.md b/extensions/iceworks-app/CHANGELOG.md index 5bdd916e9..296e43945 100644 --- a/extensions/iceworks-app/CHANGELOG.md +++ b/extensions/iceworks-app/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 0.2.0 +- feat: install dependencies automatically when node_modules does not exist +- feat: refresh dependencies list、pages list and components list automatically +- feat: support stopping scripts + ## 0.1.34 - feat: add Iceworks status bar entry diff --git a/extensions/iceworks-app/assets/dark/stop.svg b/extensions/iceworks-app/assets/dark/stop.svg new file mode 100644 index 000000000..6ed5ae5af --- /dev/null +++ b/extensions/iceworks-app/assets/dark/stop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/assets/light/stop.svg b/extensions/iceworks-app/assets/light/stop.svg new file mode 100644 index 000000000..2538b4940 --- /dev/null +++ b/extensions/iceworks-app/assets/light/stop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/iceworks-app/package.json b/extensions/iceworks-app/package.json index b8d5fc055..0a7adc1af 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.1.34", + "version": "0.2.0", "engines": { "vscode": "^1.41.0" }, @@ -108,6 +108,14 @@ "dark": "assets/dark/run.svg" } }, + { + "command": "iceworksApp.npmScripts.stop", + "title": "%iceworksApp.npmScripts.stop.title%", + "icon": { + "light": "assets/light/stop.svg", + "dark": "assets/dark/stop.svg" + } + }, { "command": "iceworksApp.pages.add", "title": "%iceworksApp.command.pages.add.title%", @@ -252,7 +260,12 @@ ], "view/item/context": [ { - "command": "iceworksApp.npmScripts.executeCommand", + "command": "iceworksApp.npmScripts.run", + "when": "view == npmScripts && viewItem == script", + "group": "inline" + }, + { + "command": "iceworksApp.npmScripts.stop", "when": "view == npmScripts && viewItem == script", "group": "inline" }, diff --git a/extensions/iceworks-app/src/commands/executeCommand.ts b/extensions/iceworks-app/src/commands/executeCommand.ts new file mode 100644 index 000000000..53ee58d89 --- /dev/null +++ b/extensions/iceworks-app/src/commands/executeCommand.ts @@ -0,0 +1,28 @@ +import * as vscode from 'vscode'; +import { Terminal, TerminalOptions } from 'vscode'; +import { ITerminalMap } from '../types'; + +export default function executeCommand(terminalMapping: ITerminalMap, script: vscode.Command, id?: string) { + if (!script.arguments) { + return; + } + const args = script.arguments; + const [cwd, command] = args; + if (!command) { + return; + } + + const terminalId = id || command; + let terminal: Terminal; + + if (terminalMapping.has(terminalId)) { + terminal = terminalMapping.get(terminalId)!; + } else { + const terminalOptions: TerminalOptions = { cwd, name: command }; + terminal = vscode.window.createTerminal(terminalOptions); + terminalMapping.set(terminalId, terminal); + } + + terminal.show(); + terminal.sendText(command); +} \ No newline at end of file diff --git a/extensions/iceworks-app/src/commands/stopCommand.ts b/extensions/iceworks-app/src/commands/stopCommand.ts new file mode 100644 index 000000000..e6c4b7f53 --- /dev/null +++ b/extensions/iceworks-app/src/commands/stopCommand.ts @@ -0,0 +1,9 @@ +import { ITerminalMap } from '../types'; + +export default function stopCommand(terminalMapping: ITerminalMap, scriptId: string) { + const currentTerminal = terminalMapping.get(scriptId); + if (currentTerminal) { + currentTerminal.dispose(); + terminalMapping.delete(scriptId); + } +} \ No newline at end of file diff --git a/extensions/iceworks-app/src/constants.ts b/extensions/iceworks-app/src/constants.ts index 9d63cbd32..a82ac4134 100644 --- a/extensions/iceworks-app/src/constants.ts +++ b/extensions/iceworks-app/src/constants.ts @@ -11,3 +11,5 @@ export const nodeDepTypes: NodeDepTypes[] = [ 'dependencies', 'devDependencies' ]; + +export const showExtensionsQuickPickCommandId = 'iceworksApp.showExtensionsQuickPick'; diff --git a/extensions/iceworks-app/src/extension.ts b/extensions/iceworks-app/src/extension.ts index df9bde2f1..f58b6a428 100644 --- a/extensions/iceworks-app/src/extension.ts +++ b/extensions/iceworks-app/src/extension.ts @@ -9,7 +9,9 @@ import { createComponentsTreeProvider } from './views/componentsView'; import { createPagesTreeProvider } from './views/pagesView'; import { ITerminalMap } from './types'; import services from './services'; -import { createStatusBarItem, openCommandPaletteCommandId, registerOpenCommandPalette } from './createStatusBarItem'; +import { showExtensionsQuickPickCommandId } from './constants'; +import showExtensionsQuickPick from './quickPicks/showExtensionsQuickPick'; +import createExtensionsStatusBar from './statusBar/createExtensionsStatusBar'; // eslint-disable-next-line const { name, version } = require('../package.json'); @@ -27,9 +29,9 @@ export async function activate(context: vscode.ExtensionContext) { initExtension(context); // init statusBarItem - const statusBarItem = createStatusBarItem(); - subscriptions.push(vscode.commands.registerCommand(openCommandPaletteCommandId, registerOpenCommandPalette)); - subscriptions.push(statusBarItem); + const extensionsStatusBar = createExtensionsStatusBar(); + subscriptions.push(vscode.commands.registerCommand(showExtensionsQuickPickCommandId, showExtensionsQuickPick)); + subscriptions.push(extensionsStatusBar); // init webview function activeWebview() { const webviewPanel: vscode.WebviewPanel = window.createWebviewPanel('iceworks', '设置 - Iceworks', ViewColumn.One, { diff --git a/extensions/iceworks-app/src/inputBoxs/showDepsInputBox.ts b/extensions/iceworks-app/src/inputBoxs/showDepsInputBox.ts new file mode 100644 index 000000000..47b5e72b2 --- /dev/null +++ b/extensions/iceworks-app/src/inputBoxs/showDepsInputBox.ts @@ -0,0 +1,14 @@ +import * as vscode from 'vscode'; +import { NodeDepTypes, ITerminalMap } from '../types'; +import executeCommand from '../commands/executeCommand'; + +export default async function showDepsInputBox(terminals: ITerminalMap, nodeDependenciesInstance: any, depType: NodeDepTypes) { + const result = await vscode.window.showInputBox({ + placeHolder: '例如: lodash react@latest', + prompt: `请输入需要添加到 ${depType} 的依赖名称, 支持通过空格添加多个依赖` + }); + if (!result) { + return; + } + executeCommand(terminals, nodeDependenciesInstance.getAddDependencyScript(depType, result)); +} diff --git a/extensions/iceworks-app/src/openEntryFile.ts b/extensions/iceworks-app/src/openEntryFile.ts new file mode 100644 index 000000000..057ebd9bf --- /dev/null +++ b/extensions/iceworks-app/src/openEntryFile.ts @@ -0,0 +1,14 @@ +import * as path from 'path'; +import * as vscode from 'vscode'; +import * as fsExtra from 'fs-extra'; +import { entryFileSuffix } from './constants'; + +export default function openEntryFile(p: string) { + const currentSuffix = entryFileSuffix.find((suffix) => fsExtra.pathExistsSync(path.join(p, `index${suffix}`))); + if (currentSuffix) { + const resource = vscode.Uri.file(path.join(p, `index${currentSuffix}`)); + vscode.window.showTextDocument(resource); + } else { + vscode.window.showErrorMessage('Entry file not found.'); + } +} diff --git a/extensions/iceworks-app/src/quickPicks/showDepsQuickPick.ts b/extensions/iceworks-app/src/quickPicks/showDepsQuickPick.ts new file mode 100644 index 000000000..0b31f98d7 --- /dev/null +++ b/extensions/iceworks-app/src/quickPicks/showDepsQuickPick.ts @@ -0,0 +1,17 @@ +import * as vscode from 'vscode'; +import { nodeDepTypes } from '../constants'; +import { NodeDepTypes, ITerminalMap } from '../types'; +import showDepsInputBox from '../inputBoxs/showDepsInputBox'; + +export default function showDepsQuickPick(terminals: ITerminalMap, nodeDependenciesInstance: any) { + const quickPick = vscode.window.createQuickPick(); + quickPick.items = nodeDepTypes.map(label => ({ label, detail: `Install ${label}` })); + quickPick.onDidChangeSelection(selection => { + if (selection[0]) { + showDepsInputBox(terminals, nodeDependenciesInstance, selection[0].label as NodeDepTypes) + .catch(console.error); + } + }); + quickPick.onDidHide(() => quickPick.dispose()); + quickPick.show(); +}; \ No newline at end of file diff --git a/extensions/iceworks-app/src/createStatusBarItem.ts b/extensions/iceworks-app/src/quickPicks/showExtensionsQuickPick.ts similarity index 68% rename from extensions/iceworks-app/src/createStatusBarItem.ts rename to extensions/iceworks-app/src/quickPicks/showExtensionsQuickPick.ts index d4b87453a..2d55d9d64 100644 --- a/extensions/iceworks-app/src/createStatusBarItem.ts +++ b/extensions/iceworks-app/src/quickPicks/showExtensionsQuickPick.ts @@ -1,16 +1,7 @@ import * as vscode from 'vscode'; -const { window } = vscode; +const { window, commands } = vscode; -export const openCommandPaletteCommandId = 'iceworksApp.openVSCodePanel'; - -export function createStatusBarItem() { - const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100); - statusBarItem.text = 'Iceworks'; - statusBarItem.command = openCommandPaletteCommandId; - statusBarItem.show(); - return statusBarItem; -} const extensionOptions = [ { label: 'Iceworks 创建应用', detail: '快速创建多端应用(例如:React/Rax/Vue...)', command: 'iceworks-project-creator.start', }, { label: 'Iceworks 生成页面', detail: '使用低代码的方式生成网页视图', command: 'iceworks-page-builder.create', }, @@ -18,13 +9,13 @@ const extensionOptions = [ { label: 'Iceworks 导入物料', detail: '使用可视化的方式添加物料到应用中', command: 'iceworks-material-import.start' }, ] -export function registerOpenCommandPalette() { +export default function showExtensionsQuickPick() { const quickPick = window.createQuickPick(); quickPick.items = extensionOptions.map((options) => ({ label: options.label, detail: options.detail })); quickPick.onDidChangeSelection(selection => { if (selection[0]) { const currentExtension = extensionOptions.find(option => option.label === selection[0].label)!; - vscode.commands.executeCommand(currentExtension.command); + commands.executeCommand(currentExtension.command); quickPick.dispose(); } }); diff --git a/extensions/iceworks-app/src/statusBar/createExtensionsStatusBar.ts b/extensions/iceworks-app/src/statusBar/createExtensionsStatusBar.ts new file mode 100644 index 000000000..21c6711f9 --- /dev/null +++ b/extensions/iceworks-app/src/statusBar/createExtensionsStatusBar.ts @@ -0,0 +1,10 @@ +import * as vscode from 'vscode'; +import { showExtensionsQuickPickCommandId } from '../constants'; + +export default function createExtensionsStatusBar() { + const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100); + statusBarItem.text = 'Iceworks'; + statusBarItem.command = showExtensionsQuickPickCommandId; + statusBarItem.show(); + return statusBarItem; +} \ No newline at end of file diff --git a/extensions/iceworks-app/src/utils.ts b/extensions/iceworks-app/src/utils.ts deleted file mode 100644 index 467d8c7e1..000000000 --- a/extensions/iceworks-app/src/utils.ts +++ /dev/null @@ -1,56 +0,0 @@ -import * as path from 'path'; -import * as fse from 'fs-extra'; -import * as vscode from 'vscode'; -import { Terminal, TerminalOptions } from 'vscode'; -import { entryFileSuffix } from './constants'; -import { ITerminalMap } from './types'; - -export function createTerminalName(cwd: string, command: string): string { - return `${path.basename(cwd)} - ${command}`; -} - -export function pathExists(p: string) { - try { - fse.accessSync(p); - } catch (err) { - return false; - } - return true; -} - -export function executeCommand(terminalMapping: ITerminalMap, script: vscode.Command) { - if (!script.arguments) { - return; - } - const args = script.arguments; - const [cwd, command] = args; - let terminalName = args[2]; - if (!command) { - return; - } - terminalName = terminalName || command; - const name: string = createTerminalName(cwd, terminalName); - - let terminal: Terminal; - - if (terminalMapping.has(name)) { - terminal = terminalMapping.get(name)!; - } else { - const terminalOptions: TerminalOptions = { cwd, name }; - terminal = vscode.window.createTerminal(terminalOptions); - terminalMapping.set(name, terminal); - } - - terminal.show(); - terminal.sendText(command); -} - -export function openEntryFile(p: string) { - const currentSuffix = entryFileSuffix.find(suffix => pathExists(path.join(p, `index${suffix}`))); - if (currentSuffix) { - const resource = vscode.Uri.file(path.join(p, `index${currentSuffix}`)); - vscode.window.showTextDocument(resource); - } else { - vscode.window.showErrorMessage('Entry file not found.'); - } -} diff --git a/extensions/iceworks-app/src/views/componentsView.ts b/extensions/iceworks-app/src/views/componentsView.ts index 26c051232..30b4d9b69 100644 --- a/extensions/iceworks-app/src/views/componentsView.ts +++ b/extensions/iceworks-app/src/views/componentsView.ts @@ -1,16 +1,18 @@ import * as vscode from 'vscode'; import * as fse from 'fs-extra'; import * as path from 'path'; -import { pathExists, openEntryFile } from '../utils'; +import { checkPathExists } from '@iceworks/common-service'; +import { componentsPath } from '@iceworks/project-service'; +import openEntryFile from '../openEntryFile'; -class ComponentsProvider implements vscode.TreeDataProvider { +class ComponentsProvider implements vscode.TreeDataProvider { private workspaceRoot: string; private extensionContext: vscode.ExtensionContext; - private onDidChange: vscode.EventEmitter = new vscode.EventEmitter(); + private onDidChange: vscode.EventEmitter = new vscode.EventEmitter(); - readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event; + readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event; constructor(context: vscode.ExtensionContext, workspaceRoot: string) { this.extensionContext = context; @@ -21,54 +23,64 @@ class ComponentsProvider implements vscode.TreeDataProvider { this.onDidChange.fire(undefined); } - getTreeItem(element: Component): vscode.TreeItem { + getTreeItem(element: ComponentTreeItem): vscode.TreeItem { return element; } - getChildren() { + async getChildren() { if (!this.workspaceRoot) { return Promise.resolve([]); } const componentsPath = path.join(this.workspaceRoot, 'src', 'components'); - if (pathExists(componentsPath)) { - const components = this.getComponents(componentsPath); - return Promise.resolve(components); - } else { + try { + const isComponentPathExists = await checkPathExists(componentsPath); + if (isComponentPathExists) { + const components = this.getComponents(componentsPath); + return Promise.resolve(components); + } else { + return Promise.resolve([]); + } + } catch (error) { return Promise.resolve([]); } } private async getComponents(componentsPath: string) { - if (pathExists(componentsPath)) { - const toComponent = (componentName: string) => { - const pageEntryPath = path.join(componentsPath, componentName); - - const cmdObj: vscode.Command = { - command: 'iceworksApp.components.openFile', - title: 'Open File', - arguments: [pageEntryPath] - }; + try { + const isComponentPathExists = await checkPathExists(componentsPath); + if (isComponentPathExists) { + const toComponent = (componentName: string) => { + const pageEntryPath = path.join(componentsPath, componentName); + + const command: vscode.Command = { + command: 'iceworksApp.components.openFile', + title: 'Open File', + arguments: [pageEntryPath] + }; - return new Component(this.extensionContext, componentName, cmdObj); - }; - const dirNames = await fse.readdir(componentsPath); - // except file - const componentNames = dirNames.filter(dirname => { - const stat = fse.statSync(path.join(componentsPath, dirname)); - return stat.isDirectory(); - }); - return componentNames.map(componentName => toComponent(componentName)); - } else { + return new ComponentTreeItem(this.extensionContext, componentName, command); + }; + const dirNames = await fse.readdir(componentsPath); + // except file + const componentNames = dirNames.filter(dirname => { + const stat = fse.statSync(path.join(componentsPath, dirname)); + return stat.isDirectory(); + }); + return componentNames.map(componentName => toComponent(componentName)); + } else { + return []; + } + } catch (e) { return []; } } } -class Component extends vscode.TreeItem { +class ComponentTreeItem extends vscode.TreeItem { constructor( public readonly extensionContext: vscode.ExtensionContext, public readonly label: string, - public readonly command?: vscode.Command + public readonly command: vscode.Command ) { super(label); } @@ -90,4 +102,10 @@ export function createComponentsTreeProvider(context: vscode.ExtensionContext, r }); vscode.commands.registerCommand('iceworksApp.components.refresh', () => componentsProvider.refresh()); vscode.commands.registerCommand('iceworksApp.components.openFile', (p) => openEntryFile(p)); + + const pattern = path.join(componentsPath); + const fileWatcher = vscode.workspace.createFileSystemWatcher(pattern); + fileWatcher.onDidChange(() => componentsProvider.refresh()); + fileWatcher.onDidCreate(() => componentsProvider.refresh()); + fileWatcher.onDidDelete(() => componentsProvider.refresh()); } \ No newline at end of file diff --git a/extensions/iceworks-app/src/views/nodeDependenciesView.ts b/extensions/iceworks-app/src/views/nodeDependenciesView.ts index 25b242e58..f078a9a89 100644 --- a/extensions/iceworks-app/src/views/nodeDependenciesView.ts +++ b/extensions/iceworks-app/src/views/nodeDependenciesView.ts @@ -8,22 +8,25 @@ import { getPackageLocalVersion } from 'ice-npm-utils'; import { getDataFromSettingJson, createNpmCommand, + checkPathExists } from '@iceworks/common-service'; -import { pathExists, executeCommand } from '../utils'; -import { NodeDepTypes, ITerminalMap } from '../types'; +import { dependencyDir } from '@iceworks/project-service'; +import executeCommand from '../commands/executeCommand'; +import { NodeDepTypes } from '../types'; import { nodeDepTypes } from '../constants'; - +import showDepsInputBox from '../inputBoxs/showDepsInputBox'; +import showDepsQuickPick from '../quickPicks/showDepsQuickPick'; const rimrafAsync = util.promisify(rimraf); -class DepNodeProvider implements vscode.TreeDataProvider { +class DepNodeProvider implements vscode.TreeDataProvider { private workspaceRoot: string; private extensionContext: vscode.ExtensionContext; - private onDidChange: vscode.EventEmitter = new vscode.EventEmitter(); + private onDidChange: vscode.EventEmitter = new vscode.EventEmitter(); - readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event; + readonly onDidChangeTreeData: vscode.Event = this.onDidChange.event; packageJsonPath: string; @@ -41,11 +44,11 @@ class DepNodeProvider implements vscode.TreeDataProvider { this.onDidChange.fire(undefined); } - getTreeItem(element: DependencyNode): vscode.TreeItem { + getTreeItem(element: DependencyTreeItem): vscode.TreeItem { return element; } - getChildren(element?: DependencyNode) { + getChildren(element?: DependencyTreeItem) { if (!this.workspaceRoot) { return Promise.resolve([]); } @@ -56,7 +59,7 @@ class DepNodeProvider implements vscode.TreeDataProvider { return deps; } else { return Promise.resolve( - nodeDepTypes.map(nodeDepType => new DependencyNode(this.extensionContext, nodeDepType, vscode.TreeItemCollapsibleState.Collapsed))); + nodeDepTypes.map(nodeDepType => new DependencyTreeItem(this.extensionContext, nodeDepType, vscode.TreeItemCollapsibleState.Collapsed, nodeDepType))); } } @@ -70,11 +73,11 @@ class DepNodeProvider implements vscode.TreeDataProvider { }; private async getDepsInPackageJson(packageJsonPath: string, label: NodeDepTypes) { - if (pathExists(packageJsonPath)) { + if (await checkPathExists(packageJsonPath)) { const packageJson = JSON.parse(await fse.readFile(packageJsonPath, 'utf-8')); const workspaceDir: string = path.dirname(packageJsonPath); - let deps: DependencyNode[] = []; + let deps: DependencyTreeItem[] = []; if (packageJson[label]) { deps = await Promise.all(Object.keys(packageJson[label]).map(async dep => { const version = this.getDepVersion(dep); @@ -105,14 +108,14 @@ class DepNodeProvider implements vscode.TreeDataProvider { }; }; - public packageJsonExists() { - return pathExists(this.packageJsonPath); + public async packageJsonExists() { + return await checkPathExists(this.packageJsonPath); } public async getReinstallScript() { const workspaceDir: string = path.dirname(this.packageJsonPath); const nodeModulesPath = path.join(workspaceDir, 'node_modules'); - if (pathExists(nodeModulesPath)) { + if (await checkPathExists(nodeModulesPath)) { await rimrafAsync(nodeModulesPath); } const npmCommand = createNpmCommand('install'); @@ -147,16 +150,18 @@ class DepNodeProvider implements vscode.TreeDataProvider { } } -class DependencyNode extends vscode.TreeItem { +class DependencyTreeItem extends vscode.TreeItem { constructor( public readonly extensionContext: vscode.ExtensionContext, public readonly label: string, public readonly collapsibleState: vscode.TreeItemCollapsibleState, + public readonly id: string, public readonly command?: vscode.Command, public readonly version?: string, public readonly outDated?: boolean ) { super(label, collapsibleState); + this.id = id; } get description(): string { @@ -181,40 +186,26 @@ export function createNodeDependenciesTreeProvider(context, rootPath, terminals) const nodeDependenciesProvider = new DepNodeProvider(context, rootPath); vscode.window.registerTreeDataProvider('nodeDependencies', nodeDependenciesProvider); vscode.commands.registerCommand('iceworksApp.nodeDependencies.refresh', () => nodeDependenciesProvider.refresh()); - vscode.commands.registerCommand('iceworksApp.nodeDependencies.upgrade', (node: DependencyNode) => executeCommand(terminals, node.command!)); + vscode.commands.registerCommand('iceworksApp.nodeDependencies.upgrade', (node: DependencyTreeItem) => { + if (node.command) + executeCommand(terminals, node.command, node.id); + }); vscode.commands.registerCommand('iceworksApp.nodeDependencies.reinstall', async () => { - if (nodeDependenciesProvider.packageJsonExists()) { + if (await nodeDependenciesProvider.packageJsonExists()) { const script = await nodeDependenciesProvider.getReinstallScript(); executeCommand(terminals, script!); } }); - context.subscriptions.push(vscode.commands.registerCommand('iceworksApp.nodeDependencies.dependencies.add', () => showDepInputBox(terminals, nodeDependenciesProvider, 'dependencies'))); - context.subscriptions.push(vscode.commands.registerCommand('iceworksApp.nodeDependencies.devDependencies.add', () => showDepInputBox(terminals, nodeDependenciesProvider, 'devDependencies'))); - context.subscriptions.push(vscode.commands.registerCommand('iceworksApp.nodeDependencies.addDepsAndDevDeps', () => addDepCommandHandler(terminals, nodeDependenciesProvider))); -} + context.subscriptions.push(vscode.commands.registerCommand('iceworksApp.nodeDependencies.dependencies.add', () => showDepsInputBox(terminals, nodeDependenciesProvider, 'dependencies'))); + context.subscriptions.push(vscode.commands.registerCommand('iceworksApp.nodeDependencies.devDependencies.add', () => showDepsInputBox(terminals, nodeDependenciesProvider, 'devDependencies'))); + context.subscriptions.push(vscode.commands.registerCommand('iceworksApp.nodeDependencies.addDepsAndDevDeps', () => showDepsQuickPick(terminals, nodeDependenciesProvider))); -export function addDepCommandHandler(terminals: ITerminalMap, nodeDependenciesInstance: any) { - const quickPick = vscode.window.createQuickPick(); - quickPick.items = nodeDepTypes.map(label => ({ label, detail: `Install ${label}` })); - quickPick.onDidChangeSelection(selection => { - if (selection[0]) { - showDepInputBox(terminals, nodeDependenciesInstance, selection[0].label as NodeDepTypes) - .catch(console.error); - } - }); - quickPick.onDidHide(() => quickPick.dispose()); - quickPick.show(); -}; - -async function showDepInputBox(terminals: ITerminalMap, nodeDependenciesInstance: any, depType: NodeDepTypes) { - const result = await vscode.window.showInputBox({ - placeHolder: 'Please input the module name you want to install. For example lodash / loadsh@latest', - }); - if (!result) { - return; - } - executeCommand(terminals, nodeDependenciesInstance.getAddDependencyScript(depType, result)); + const pattern = path.join(rootPath, dependencyDir); + const fileWatcher = vscode.workspace.createFileSystemWatcher(pattern); + fileWatcher.onDidChange(() => nodeDependenciesProvider.refresh()); + fileWatcher.onDidCreate(() => nodeDependenciesProvider.refresh()); + fileWatcher.onDidDelete(() => nodeDependenciesProvider.refresh()); } function toDep(extensionContext: vscode.ExtensionContext, workspaceDir: string, moduleName: string, version: string, outdated: boolean) { @@ -228,5 +219,5 @@ function toDep(extensionContext: vscode.ExtensionContext, workspaceDir: string, arguments: [workspaceDir, npmCommand] } : undefined; - return new DependencyNode(extensionContext, moduleName, vscode.TreeItemCollapsibleState.None, command, version, outdated); + return new DependencyTreeItem(extensionContext, moduleName, vscode.TreeItemCollapsibleState.None, `dependency-${moduleName}`, command, version, outdated); }; diff --git a/extensions/iceworks-app/src/views/npmScriptsView.ts b/extensions/iceworks-app/src/views/npmScriptsView.ts index 886694e1b..6e614d0bc 100644 --- a/extensions/iceworks-app/src/views/npmScriptsView.ts +++ b/extensions/iceworks-app/src/views/npmScriptsView.ts @@ -1,25 +1,27 @@ import * as vscode from 'vscode'; import * as fse from 'fs-extra'; import * as path from 'path'; -import { createNpmCommand } from '@iceworks/common-service' -import { pathExists, executeCommand } from '../utils'; +import { createNpmCommand, checkPathExists } from '@iceworks/common-service'; +import { dependencyDir, packageJSONFilename } from '@iceworks/project-service'; +import executeCommand from '../commands/executeCommand'; +import stopCommand from '../commands/stopCommand'; import { ITerminalMap } from '../types'; -export class NpmScriptsProvider implements vscode.TreeDataProvider