Skip to content

Commit

Permalink
fix: auto init material source
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinhui authored Sep 24, 2020
2 parents 2b22183 + 36a7ade commit 54f8c7e
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 37 deletions.
28 changes: 15 additions & 13 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,29 @@ labels: 'bug'
重启 VS Code 将自动升级插件。
-->

* 插件名:
* 插件版本:
插件名/Extension:

## 您的本地环境信息
## 您的本地环境信息/Your local environment information

* 操作系统及其版本
* Node 版本:
* npm 版本:
* 操作系统及其版本/System and Version:
* Node version:
* npm version:

<!--
查看 Node 版本:`node -v`
查看 npm 版本:`npm -v`
Check Node version: `node -v`
Check npm version: `npm -v`
-->

## 您遇到的问题及复现步骤
## 您遇到的问题及复现步骤/What are your problems and how to reproduce them

<!--
如果可能的话,提供一个问题的最小演示
请尽可能地提供截图或录屏
如果可能的话,提供一个问题的最小演示/If possible, provide a minimal demonstration of the problem
请尽可能地提供截图或录屏/Please provide screenshots or videos as much as possible
-->

## 您期待的正确结果
## 您期待的正确结果/The right result you're looking forward to

<!-- 如果您有建议的解决方案,亦可进行说明 -->
<!--
如果您有建议的解决方案,亦可进行说明。
If you have a suggested solution, you can also explain it.
-->
28 changes: 20 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,30 @@ labels: 'enhancement'

---

### 问题描述
### 问题描述/Problem Description

<!-- 您提交的需求是否与缺陷相关?请简要地说明问题是什么。 -->
<!--
您提交的需求是否与缺陷相关?请简要地说明问题是什么。
Is the requirement you submitted related to the defect? Please briefly state what the problem is.
-->

### 建议的解决方案
### 建议的方案/Proposal

<!-- 以简洁明了的方式描述您想要的解决方案 -->
<!--
以简洁明了的方式描述您想要的解决方案。
Describe the solution you want in a concise way.
-->

### 考虑的备选方案
### 备选的方案/Alternatives

<!-- 对您考虑过的任何替代解决方案或功能的清晰描述。 -->
<!--
对您考虑过的任何替代解决方案或功能的清晰描述。
A clear description of any alternative solutions or features you have considered.
-->

### 附加信息
### 附加信息/Other Information

<!-- 在此处添加有关该需求的任何其他上下文。 -->
<!--
在此处添加有关该需求的任何其他上下文。
Add any other context here about the requirement.
-->
2 changes: 1 addition & 1 deletion .github/workflows/auto-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Auto Publisher
on:
push:
branches:
- product
- master

jobs:
build-and-publish:
Expand Down
4 changes: 4 additions & 0 deletions extensions/iceworks-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.5.3

- fix: compatible with scenarios without material source

## 0.5.2

- fix: if there is an active window, then do not show the welcome page
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Iceworks Application Viewer",
"description": "Quick view your Universal Application(React/Rax/Vue, etc).",
"publisher": "iceworks-team",
"version": "0.5.2",
"version": "0.5.3",
"engines": {
"vscode": "^1.41.0"
},
Expand Down
4 changes: 4 additions & 0 deletions extensions/iceworks-config-helper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.3.6

- fix: compatible with scenarios without material source

## 0.3.5

- fix: if there is an active window, then do not show the welcome page
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-config-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Iceworks Config Helper",
"description": "Easily write Config files in icejs(& rax-app)",
"publisher": "iceworks-team",
"version": "0.3.5",
"version": "0.3.6",
"engines": {
"vscode": "^1.41.0"
},
Expand Down
4 changes: 4 additions & 0 deletions extensions/iceworks-doctor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.1.3

- fix: compatible with scenarios without material source

## 0.1.2

- fix: if there is an active window, then do not show the welcome page
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-doctor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Iceworks Doctor",
"description": "A free security and quality audit tool for modern DevOps teams",
"publisher": "iceworks-team",
"version": "0.1.2",
"version": "0.1.3",
"engines": {
"vscode": "^1.41.0"
},
Expand Down
4 changes: 4 additions & 0 deletions extensions/iceworks-material-helper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.3.9

- fix: add materilSource config

## 0.3.8

- fix: if there is an active window, then do not show the welcome page
Expand Down
30 changes: 29 additions & 1 deletion extensions/iceworks-material-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "React Component Helper",
"description": "Easily use Component in React/Rax.",
"publisher": "iceworks-team",
"version": "0.3.8",
"version": "0.3.9",
"main": "./build/extension.js",
"engines": {
"vscode": "^1.41.0"
Expand Down Expand Up @@ -65,6 +65,34 @@
"default": false,
"description": "%iceworksMaterialHelper.configuration.openInBrowserDescription%",
"title": "Open Doc Link Inside VSCode"
},
"iceworks.materialSources": {
"type": "array",
"description": "%iceworksMaterialHelper.configuration.properties.iceworks.materialSources.description%",
"items": {
"type": "object",
"description": "Source",
"properties": {
"name": {
"type": "string",
"description": "name"
},
"type": {
"type": "string",
"description": "react or rax"
},
"source": {
"type": "string",
"description": "URL",
"format": "URL"
},
"description": {
"type": "string",
"description": "description"
}
}
},
"default": []
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion extensions/iceworks-material-helper/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"iceworksMaterialHelper.commands.start.title": "Iceworks: Import Material",
"iceworksMaterialHelper.commands.showAllMaterialQuickPicks.title": "Iceworks: Find Component",
"iceworksMaterialHelper.commands.showDocumentMaterialQuickPicks.title": "Iceworks: Find Components In Current File",
"iceworksMaterialHelper.configuration.openInBrowserDescription": "Whether open doc url inside VSCode, this function relys on 「Browser Preview」 extension,you need to install it manually before you can use this function"
"iceworksMaterialHelper.configuration.openInBrowserDescription": "Whether open doc url inside VSCode, this function relys on 「Browser Preview」 extension,you need to install it manually before you can use this function",
"iceworksMaterialHelper.configuration.properties.iceworks.materialSources.description": "Iceworks material sources, decide which materials to use."
}
3 changes: 2 additions & 1 deletion extensions/iceworks-material-helper/package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"iceworksMaterialHelper.commands.start.title": "Iceworks: 添加组件",
"iceworksMaterialHelper.commands.showAllMaterialQuickPicks.title": "Iceworks: 查找组件",
"iceworksMaterialHelper.commands.showDocumentMaterialQuickPicks.title": "Iceworks: 查找当前文件的组件",
"iceworksMaterialHelper.configuration.openInBrowserDescription": "是否在 VSCode 中打开网页,这个功能的实现依赖于 「Browser Preview」 插件,您需要手动安装此插件后才能使用这个功能。"
"iceworksMaterialHelper.configuration.openInBrowserDescription": "是否在 VSCode 中打开网页,这个功能的实现依赖于 「Browser Preview」 插件,您需要手动安装此插件后才能使用这个功能。",
"iceworksMaterialHelper.configuration.properties.iceworks.materialSources.description": "Iceworks 物料源,决定使用哪些物料。"
}
4 changes: 4 additions & 0 deletions extensions/iceworks-style-helper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.3.11

- fix: compatible with scenarios without material source

## 0.3.10

- fix: if there is an active window, then do not show the welcome page
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-style-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "React Style Helper",
"description": "Easily write styles(CSS/Less/SASS).",
"publisher": "iceworks-team",
"version": "0.3.10",
"version": "0.3.11",
"engines": {
"vscode": "^1.41.0"
},
Expand Down
4 changes: 4 additions & 0 deletions extensions/iceworks-time-steward/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 0.1.5

- fix: compatible with scenarios without material source

## 0.1.4

- fix: if there is an active window, then do not show the welcome page
Expand Down
2 changes: 1 addition & 1 deletion extensions/iceworks-time-steward/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Iceworks Time Steward(Beta)",
"description": "Metrics, insights, and time tracking automatically generated from your programming activity.",
"publisher": "iceworks-team",
"version": "0.1.4",
"version": "0.1.5",
"engines": {
"vscode": "^1.41.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common-service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iceworks/common-service",
"version": "0.1.20",
"version": "0.1.21",
"description": "Iceworks common service for VSCode extension.",
"files": [
"lib"
Expand Down
14 changes: 8 additions & 6 deletions packages/common-service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,30 @@ function onChangeActiveTextEditor(context: vscode.ExtensionContext) {
context.subscriptions
);
}

/**
* Compatible:
* If there is an official material source, remove it.
* The official material source will be added automatically when it is obtained.
*/
const didSetMaterialSourceStateKey = 'iceworks.materialSourceIsSet';
async function autoInitMaterialSource(globalState: vscode.Memento) {
const materialSourceIsSet = globalState.get(didSetMaterialSourceStateKey);
if (!materialSourceIsSet) {
console.log('autoInitMaterialSource: do');
const materialSources = getDataFromSettingJson(CONFIGURATION_KEY_MATERIAL_SOURCES);
// old materialSources and remove it from the previous users
const officalMaterialSources = [
'http://ice.alicdn.com/assets/materials/react-materials.json',
ALI_FUSION_MATERIAL_URL,
];
const newSources = materialSources.filter(
const newSources = Array.isArray(materialSources) ? materialSources.filter(
(materialSource) => !officalMaterialSources.includes(materialSource.source)
);
) : [];
saveDataToSettingJson(CONFIGURATION_KEY_MATERIAL_SOURCES, newSources);
}

vscode.workspace.onDidChangeConfiguration(function (event: vscode.ConfigurationChangeEvent) {
const isTrue = event.affectsConfiguration(CONFIGURATION_KEY_MATERIAL_SOURCES);
if (isTrue) {
console.log('autoSetPackageManager: did change');

globalState.update(didSetMaterialSourceStateKey, true);
}
});
Expand Down

0 comments on commit 54f8c7e

Please sign in to comment.