Explorar el Código

[demo]Add npm link when debug

dufu1991 hace 3 años
padre
commit
fd7c8fdea2

+ 3 - 1
demo/package.json

@@ -3,9 +3,12 @@
 	"version": "0.0.0",
 	"scripts": {
 		"dev": "vite dev",
+		"dev_stdf": "npm link ../packages/stdf && vite dev",
 		"build": "vite build",
+		"build_stdf": "npm link ../packages/stdf && vite build",
 		"preview": "vite preview",
 		"dev_en": "vite --mode english",
+		"dev_stdf_en": "npm link ../packages/stdf && vite --mode english",
 		"button": "vite --mode button",
 		"icon": "vite --mode icon",
 		"navBar": "vite --mode navBar",
@@ -91,7 +94,6 @@
 		"autoprefixer": "^10.4.15",
 		"postcss": "^8.4.28",
 		"rollup-plugin-stdf-icon": "file:../packages/rollup-plugin-stdf-icon",
-		"stdf": "file:../packages/stdf",
 		"svelte": "^4.1.1",
 		"tailwindcss": "^3.3.3",
 		"vite": "^4.4.6"

+ 7 - 6
doc/guide/contribution.md

@@ -30,8 +30,9 @@
 > 由于 Demo 依赖的 rollup-plugin-stdf-icon 包是本地构建的,所以请先构建一下这个包。
 
 ```bash
-## 1. 克隆 STDF 仓库
+## 1. 克隆 STDF 仓库并进入
 git clone git@github.com:dufu1991/stdf.git
+cd stdf
 
 ## 2. 构建 rollup-plugin-stdf-icon 包
 cd packages/rollup-plugin-stdf-icon
@@ -48,8 +49,8 @@ bun run build
 ## or
 npm run build
 
-## 3. 进入项目 demo 目录
-cd stdf/demo
+## 3. 使用 Demo 工程调试 STDF
+cd demo
 
 ## 安装依赖
 bun i
@@ -58,10 +59,10 @@ pnpm i
 ## or
 npm i
 
-## 启动项目
-bun dev
+## 启动 Demo,注意 run stdf 命令包含了 npm link,会将 stdf 组件源码包链接到 Demo,实现源码实时调试。调试完毕记得执行 npm unlink stdf 解除链接。
+bun dev_stdf
 ## or
-npm run dev
+npm run dev_stdf
 ```
 
 启动成功之后,可在浏览器中打开 `http://localhost:8888` 查看效果,请将浏览器的开发者工具切换为移动端模式。

+ 8 - 7
doc/guide/contribution_en.md

@@ -28,10 +28,11 @@ Recommended installations:
 > Because the rollup-plugin-stdf-icon packages that the demo depends on are locally built, please build this packages first.
 
 ```bash
-## 1. Clone STDF repository
+## 1. Clone the STDF repository and enter
 git clone git@github.com:dufu1991/stdf.git
+cd stdf
 
-## 2. Build rollup-plugin-stdf-icon package
+## 2. Build the rollup-plugin-stdf-icon package
 cd packages/rollup-plugin-stdf-icon
 
 ## Install dependencies
@@ -46,8 +47,8 @@ bun run build
 ## or
 npm run build
 
-## 3. Enter the project demo directory
-cd stdf/demo
+## 3. Use the Demo project to debug STDF
+cd demo
 
 ## Install dependencies
 bun i
@@ -56,10 +57,10 @@ pnpm i
 ## or
 npm i
 
-## Start the project
-bun dev
+## Start Demo, note that the run stdf command includes npm link, which will link the stdf component source package to Demo to achieve real-time debugging of the source code. Remember to execute npm unlink stdf to unlink after debugging.
+bun dev_stdf_en
 ## or
-npm run dev
+npm run dev_stdf_en
 ```
 
 After the startup is successful, you can open `http://localhost:8888` in the browser to view the effect. Please switch the developer tools of the browser to the mobile mode.

+ 60 - 57
packages/vscode-extension/package.json

@@ -1,59 +1,62 @@
 {
-	"name": "stdf-vscode-extension",
-	"displayName": "STDF for VS Code",
-	"description": "A VS Code extension to facilitate STDF development",
-	"version": "0.0.16",
-	"publisher": "STDF",
-	"icon": "./src/assets/stdf-vscode-extension.png",
-	"main": "./src/extension.js",
-	"engines": {
-		"vscode": "^1.27.0"
-	},
-	"scripts": {
-		"files": "node scripts/files.js",
-		"package": "vsce package",
-		"publish": "vsce publish"
-	},
-	"categories": [
-		"Programming Languages"
-	],
-	"activationEvents": [
-		"onLanguage:svelte"
-	],
-	"sponsor": {
-		"url": "https://stdf.design?fund"
-	},
-	"keywords": [
-		"svelte",
-		"stdf",
-		"component",
-		"api",
-		"javascript"
-	],
-	"contributes": {
-		"commands": [],
-		"configuration": {
-			"type": "object",
-			"title": "STDF",
-			"properties": {
-				"STDF.English": {
-					"type": "boolean",
-					"default": false,
-					"description": "Whether to enable English or not in stdf-vscode-extension"
-				}
-			}
-		}
-	},
-	"devDependencies": {
-		"vscode": "^1.1.37"
-	},
-	"repository": {
-		"type": "git",
-		"url": "https://github.com/dufu1991/stdf/tree/main/packages/vscode-extension"
-	},
-	"bugs": {
-		"url": "https://github.com/dufu1991/stdf/issues?q=is:issue+is:open+vscode-extension"
-	},
-	"homepage": "https://github.com/dufu1991/stdf/tree/main/packages/vscode-extension/README.md",
-	"LICENSE": "https://github.com/dufu1991/stdf/blob/main/LICENSE"
+  "name": "stdf-vscode-extension",
+  "displayName": "STDF for VS Code",
+  "description": "A VS Code extension to facilitate STDF development",
+  "version": "0.0.16",
+  "publisher": "STDF",
+  "icon": "./src/assets/stdf-vscode-extension.png",
+  "main": "./src/extension.js",
+  "engines": {
+    "vscode": "^1.27.0"
+  },
+  "scripts": {
+    "files": "node scripts/files.js",
+    "package": "vsce package",
+    "publish": "vsce publish"
+  },
+  "categories": [
+    "Programming Languages"
+  ],
+  "activationEvents": [
+    "onLanguage:svelte"
+  ],
+  "sponsor": {
+    "url": "https://stdf.design?fund"
+  },
+  "keywords": [
+    "svelte",
+    "stdf",
+    "component",
+    "api",
+    "javascript"
+  ],
+  "contributes": {
+    "commands": [],
+    "configuration": {
+      "type": "object",
+      "title": "STDF",
+      "properties": {
+        "STDF.English": {
+          "type": "boolean",
+          "default": false,
+          "description": "Whether to enable English or not in stdf-vscode-extension"
+        }
+      }
+    }
+  },
+  "devDependencies": {
+    "vscode": "^1.1.37"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/dufu1991/stdf/tree/main/packages/vscode-extension"
+  },
+  "bugs": {
+    "url": "https://github.com/dufu1991/stdf/issues?q=is:issue+is:open+vscode"
+  },
+  "homepage": "https://github.com/dufu1991/stdf/tree/main/packages/vscode-extension/README.md",
+  "LICENSE": "https://github.com/dufu1991/stdf/blob/main/LICENSE",
+  "dependencies": {
+    "latest-version": "^7.0.0"
+  }
 }