Przeglądaj źródła

[vscode]fix stdf latestVersion

dufu1991 3 lat temu
rodzic
commit
71bd46cee9

+ 1 - 0
.gitignore

@@ -69,6 +69,7 @@ publish_en.md
 /packages/vscode-extension/LICENSE
 /packages/vscode-extension/src/doc
 /packages/vscode-extension/src/menuList.js
+/packages/vscode-extension/src/package.json
 
 
 

+ 2 - 2
packages/vscode-extension/CHANGELOG.md

@@ -1,6 +1,6 @@
-## 0.0.12
+## 0.0.13
 
-- Fixed known issues.(0.0.10 - 0.0.12)
+- Fixed known issues.(0.0.10 - 0.0.13)
 
 ## 0.0.9
 

+ 2 - 2
packages/vscode-extension/CHANGELOG_CN.md

@@ -1,6 +1,6 @@
-## 0.0.12
+## 0.0.13
 
-- 修复已知问题。(0.0.10 - 0.0.12)
+- 修复已知问题。(0.0.10 - 0.0.13)
 
 ## 0.0.9
 

+ 1 - 1
packages/vscode-extension/package.json

@@ -2,7 +2,7 @@
 	"name": "stdf-vscode-extension",
 	"displayName": "stdf-vscode-extension",
 	"description": "A VS Code extension to facilitate STDF development",
-	"version": "0.0.12",
+	"version": "0.0.13",
 	"publisher": "STDF",
 	"icon": "./src/assets/stdf-vscode-extension.png",
 	"main": "./src/extension.js",

+ 9 - 1
packages/vscode-extension/scripts/files.js

@@ -24,10 +24,10 @@ const copyDoc = () => {
 		files.forEach(file => {
 			if (file === 'api.md' || file === 'api_en.md') {
 				fs.copyFileSync(`../../doc/components/${component}/${file}`, `src/doc/components/${component}/${file}`);
-				console.log(`🎉 ${component}/${file} copy success!`);
 			}
 		});
 	});
+	console.log(`🎉 Total copy ${components.length}*2 files!`);
 };
 
 // 复制 ../../demo/src/data/menuList.js 文件到 src 目录下
@@ -48,6 +48,13 @@ const replaceMenuList = () => {
 	console.log('🎉 menuList replace success!');
 };
 
+// 复制 ../../packages/stdf/package.json 文件到 src 目录下
+// Copy ../../packages/stdf/package.json file to src directory
+const copyPackageJson = () => {
+	fs.copyFileSync('../../packages/stdf/package.json', './src/package.json');
+	console.log('🎉 package.json copy success!');
+};
+
 // 复制 ../../LICENSE 文件到 ./ 目录下
 // Copy ../../LICENSE file to ./ directory
 const copyLicense = () => {
@@ -59,4 +66,5 @@ createDoc();
 copyDoc();
 copyMenuList();
 replaceMenuList();
+copyPackageJson();
 copyLicense();

+ 6 - 6
packages/vscode-extension/src/extension.js

@@ -1,6 +1,10 @@
 const vscode = require('vscode');
 const path = require('path');
 
+// 读取 stdf 组件库的最新版本号,文件位置为 ./package.json
+// Read the latest version number of the stdf component library, the file location is ./package.json
+const latestVersion = require('./package.json').version;
+
 // 组件列表
 // components list
 const componentListOrgin = require('./menuList');
@@ -31,10 +35,6 @@ function activate() {
 		currentVersion = currentVersion.slice(1);
 	}
 
-	// 读取 stdf 组件库的最新版本号,文件位置为 ../../stdf/package.json
-	// Read the latest version number of the stdf component library, the file location is ../../stdf/package.json
-	const latestVersion = require('../../stdf/package.json').version;
-
 	// 当前文件是 .svelte 文件时且 isImportStdf 为 true 时,才注册悬浮提示
 	// When the current file is a .svelte file and isImportStdf is true, register the hover prompt
 	if (vscode.window.activeTextEditor.document.languageId === 'svelte' && isImportStdf) {
@@ -46,8 +46,8 @@ function activate() {
 				// 将单词首字母小写
 				// Lowercase the first letter of the word
 				const wordLower = word.charAt(0).toLowerCase() + word.slice(1);
-				// 如果单词为 components 数组中的一项,则显示提示信息,内容为 ../../doc/components/${componentspaths}/api.md 文件的内容
-				// If the word is an item in the components array, the prompt information is displayed, and the content is the content of the ../../doc/components/${componentspaths}/api.md file
+				// 如果单词为 components 数组中的一项,则显示提示信息,内容为 ./doc/components/${wordLower}/api.md 文件的内容
+				// If the word is an item in the components array, display the prompt information, and the content is the content of the ./doc/components/${wordLower}/api.md file
 				if (componentList.includes(word)) {
 					// 组合当前 STDF 版本和最新版本
 					// Combine the current STDF version and the latest version