|  | @@ -1,40 +1,39 @@
 | 
	
		
			
				|  |  | -# .
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -This template should help get you started developing with Vue 3 in Vite.
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -## Recommended IDE Setup
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -## Type Support for `.vue` Imports in TS
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -1. Disable the built-in TypeScript Extension
 | 
	
		
			
				|  |  | -    1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
 | 
	
		
			
				|  |  | -    2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
 | 
	
		
			
				|  |  | -2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -## Customize configuration
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -See [Vite Configuration Reference](https://vitejs.dev/config/).
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -## Project Setup
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -```sh
 | 
	
		
			
				|  |  | -npm install
 | 
	
		
			
				|  |  | +# 自动更新版本号示例
 | 
	
		
			
				|  |  | +> ~~也许也不是很自动~~
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +经过了一小段时间选型放弃了以下方法:  
 | 
	
		
			
				|  |  | +- `git hook pre-commit` 无法同步到远程仓库所有人强制使用
 | 
	
		
			
				|  |  | +- `npm standard-version` deprecated了,悲。而且依赖于[约定式提交](https://www.conventionalcommits.org/zh-hans/v1.0.0/),我不确定能不能让大伙习惯使用这套东西
 | 
	
		
			
				|  |  | +- `npm commit-and-tag-version` `npm standard-version`的fork持续维护版本 同上
 | 
	
		
			
				|  |  | +- `google release-please` 只支持github
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +最后还是直接用了npm原生命令`npm version`  
 | 
	
		
			
				|  |  | +原理如下: 
 | 
	
		
			
				|  |  | +使用`npm version patch`会增加最后一位版本号,并且自动commit ~~没了~~
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +## 步骤
 | 
	
		
			
				|  |  | +- 在`package.json`中的`script`添加对应命令,比如原来是`"build:h5": "uni build"`, 添加一个 `"patch-build:h5": "npm version patch && uni build"`
 | 
	
		
			
				|  |  | +- 添加并提交你当前工作区,该命令不会在工作区没干净之前生效,如果需要尝试构建,使用原先的`build:h5`就行
 | 
	
		
			
				|  |  | +- 运行`npm run patch-build:h5`
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +## 本项目预览
 | 
	
		
			
				|  |  | +```bash
 | 
	
		
			
				|  |  | +npm run dev # 旧版本
 | 
	
		
			
				|  |  | +# 停止应用
 | 
	
		
			
				|  |  | +npm run patch-build # 构建并更新版本号
 | 
	
		
			
				|  |  | +npm run dev # 新版本
 | 
	
		
			
				|  |  |  ```
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -### Compile and Hot-Reload for Development
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -```sh
 | 
	
		
			
				|  |  | -npm run dev
 | 
	
		
			
				|  |  | +## 访问package.json
 | 
	
		
			
				|  |  | +虽然版本被更新了,但还是得访问到,修改以下文件以访问`package.json`  
 | 
	
		
			
				|  |  | +在`vite.config.ts`中的`resolve`字段添加`'@@': fileURLToPath(new URL('.', import.meta.url))`或者别的你喜欢的别名,这样可用直接访问根目录  
 | 
	
		
			
				|  |  | +```ts
 | 
	
		
			
				|  |  | +import packageJson from '@@/package.json' // 导入package.json
 | 
	
		
			
				|  |  | +const version = packageJson.version
 | 
	
		
			
				|  |  |  ```
 | 
	
		
			
				|  |  | +不过直接使用相对路径访问也是可行的
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -### Type-Check, Compile and Minify for Production
 | 
	
		
			
				|  |  | +如果是typescript项目, 需要另外在`ts.config.json`的include内添加`"package.json"`, 以及path中也要添加`"@@/*": ["./*"]`
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -```sh
 | 
	
		
			
				|  |  | -npm run build
 | 
	
		
			
				|  |  | -```
 | 
	
		
			
				|  |  | +## 附录
 |