forked from rocboss/paopao-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.删除多余文件 2.新增前端发布时显示版本及编译时间 3.支持 vue3 ref sugar
- Loading branch information
Showing
9 changed files
with
71 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"version": "", | ||
"buildTime": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { Plugin } from "vite" | ||
import { resolve } from "path" | ||
import { readFileSync, writeFileSync } from "fs" | ||
|
||
function getFormatTime() { | ||
let date = new Date(); | ||
let year: string | number = date.getFullYear(); | ||
let month: string | number = date.getMonth() + 1; | ||
let day: string | number = date.getDate(); | ||
let h: string | number = date.getHours(); | ||
let m: string | number = date.getMinutes(); | ||
let s: string | number = date.getSeconds(); | ||
if (month < 10) month = "0"+month; | ||
if (day < 10) day = "0"+day; | ||
if (h < 10) h = "0"+h; | ||
if (m < 10) m = "0"+m; | ||
if (s < 10) s = "0"+s; | ||
return [year, month, day].join("-") + " " + [h, m, s].join(":"); | ||
} | ||
|
||
/** | ||
* 自动修改版本号 | ||
* @returns | ||
*/ | ||
export function changePackageVersion(): Plugin { | ||
if (process.env.NODE_ENV === "production") { | ||
let packagePath = resolve(__dirname, "./info.json"); | ||
let packageStr = readFileSync(packagePath, { | ||
encoding: "utf-8" | ||
}); | ||
let packageJson = JSON.parse(packageStr); | ||
let version = packageJson.version; | ||
let versionArr: (string | number)[] = version.split("."); | ||
let lastVersionNum = +versionArr[versionArr.length - 1]; | ||
lastVersionNum++; | ||
versionArr.splice(versionArr.length - 1, 1, lastVersionNum); | ||
packageJson.version = versionArr.join("."); | ||
packageJson.buildTime = getFormatTime(); | ||
writeFileSync(packagePath, JSON.stringify(packageJson, null, "\t"), { | ||
encoding: "utf-8" | ||
}) | ||
} | ||
return { | ||
name: "changePackageVersion" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,10 +206,10 @@ | |
resolved "https://registry.npmmirror.com/@vicons/tabler/-/tabler-0.12.0.tgz" | ||
integrity sha512-3+wUFuxb7e8OzZ8Wryct1pzfA2vyoF4lwW98O9s27ZrfCGaJGNmqG+q8A7vQ92Mf+COCgxpK+rhNPTtTvaU6qw== | ||
|
||
"@vitejs/plugin-vue@^2.3.1": | ||
version "2.3.1" | ||
resolved "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-2.3.1.tgz" | ||
integrity sha512-YNzBt8+jt6bSwpt7LP890U1UcTOIZZxfpE5WOJ638PNxSEKOqAi0+FSKS0nVeukfdZ0Ai/H7AFd6k3hayfGZqQ== | ||
"@vitejs/plugin-vue@^2.3.3": | ||
version "2.3.3" | ||
resolved "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-2.3.3.tgz#fbf80cc039b82ac21a1acb0f0478de8f61fbf600" | ||
integrity sha512-SmQLDyhz+6lGJhPELsBdzXGc+AcaT8stgkbiTFGpXPe8Tl1tJaBw1A6pxDqDuRsVkD8uscrkx3hA7QDOoKYtyw== | ||
|
||
"@vue/[email protected]": | ||
version "3.2.33" | ||
|