create-pubinfo 2.0.0-rc.2 → 2.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -15
- package/package.json +1 -1
- package/templates/pubinfo-template/_gitignore +1 -0
- package/templates/pubinfo-template/package.json +4 -3
- package/templates/pubinfo-template/src/layouts/index.vue +15 -9
- package/templates/pubinfo-template/src/views/system/login/components/LoginWithPhone.vue +1 -1
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import { rimrafSync } from "rimraf";
|
|
|
19
19
|
//#region package.json
|
|
20
20
|
var name = "create-pubinfo";
|
|
21
21
|
var type = "module";
|
|
22
|
-
var version = "2.0.0-rc.
|
|
22
|
+
var version = "2.0.0-rc.4";
|
|
23
23
|
var description = "初始化项目框架";
|
|
24
24
|
var author = "Werheng <werheng.zhang@gmail.com>";
|
|
25
25
|
var license = "MIT";
|
|
@@ -86,8 +86,7 @@ function copyDir(srcDir, destDir) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
function copy(src, dest) {
|
|
89
|
-
|
|
90
|
-
if (stat.isDirectory()) copyDir(src, dest);
|
|
89
|
+
if (fs.statSync(src).isDirectory()) copyDir(src, dest);
|
|
91
90
|
else fs.copyFileSync(src, dest);
|
|
92
91
|
}
|
|
93
92
|
async function readJSON(path) {
|
|
@@ -107,8 +106,7 @@ function assignValues(target, source) {
|
|
|
107
106
|
for (const [key, value] of Object.entries(source)) target[key] = value;
|
|
108
107
|
}
|
|
109
108
|
function validateInput(input$1) {
|
|
110
|
-
|
|
111
|
-
if (forbiddenChars.test(input$1)) return "错误提示: 该值不能包含空格或者非法字符 (例如, <>:\"/\\|?*).";
|
|
109
|
+
if (/[<>:"/\\|?*\s]/.test(input$1)) return "错误提示: 该值不能包含空格或者非法字符 (例如, <>:\"/\\|?*).";
|
|
112
110
|
return true;
|
|
113
111
|
}
|
|
114
112
|
|
|
@@ -127,8 +125,7 @@ function generate(options, version$1) {
|
|
|
127
125
|
return content.replace(/enabled:[^,]+,/g, `enabled: ${options.openapi},`);
|
|
128
126
|
});
|
|
129
127
|
rewriteFile(resolve(targetPath, "package.json"), (content) => {
|
|
130
|
-
|
|
131
|
-
return content.replace(pattern, (_match, pkgName) => {
|
|
128
|
+
return content.replace(/"(@?pubinfo(?:\/module-(?:auth|rbac))?)":\s*"[^"]+"/g, (_match, pkgName) => {
|
|
132
129
|
return `"${pkgName}": "${version$1}"`;
|
|
133
130
|
});
|
|
134
131
|
});
|
|
@@ -175,8 +172,7 @@ async function fetchData() {
|
|
|
175
172
|
});
|
|
176
173
|
spinner.start();
|
|
177
174
|
try {
|
|
178
|
-
|
|
179
|
-
return { version: version$1 };
|
|
175
|
+
return { version: await fetchVersion() };
|
|
180
176
|
} catch (error) {
|
|
181
177
|
if (error.message.includes(REMOTE_URL)) error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
182
178
|
consola.error(`网络连接异常: ${error.message}`);
|
|
@@ -202,20 +198,17 @@ async function init() {
|
|
|
202
198
|
validate: validateInput
|
|
203
199
|
});
|
|
204
200
|
if (existsSync(answer.dir)) {
|
|
205
|
-
|
|
206
|
-
if (!overwrite) throw Error;
|
|
201
|
+
if (!await confirm({ message: `目录 ${colors.cyan(answer.dir)} 已存在,是否覆盖?` })) throw Error;
|
|
207
202
|
}
|
|
208
203
|
answer.openapi = await confirm({
|
|
209
204
|
message: "运行时自动生成接口对接文件,若关闭可通过指令生成(openapi)",
|
|
210
205
|
default: false
|
|
211
206
|
});
|
|
212
|
-
|
|
207
|
+
if (await select({
|
|
213
208
|
message: "使用 v1 or v2 版本?",
|
|
214
209
|
default: "v2",
|
|
215
210
|
choices: ["v1", "v2"]
|
|
216
|
-
})
|
|
217
|
-
const isV1 = V1orV2 === "v1";
|
|
218
|
-
if (isV1) {
|
|
211
|
+
}) === "v1") {
|
|
219
212
|
const { version: version$1 } = await fetchData();
|
|
220
213
|
answer.optionsV1 = JSON.parse(JSON.stringify(answer));
|
|
221
214
|
answer.optionsV1.version = await select({
|
package/package.json
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"build": "pubinfo build",
|
|
9
9
|
"preview": "pubinfo preview",
|
|
10
10
|
"commit": "pubinfo commit",
|
|
11
|
-
"prepare": "pubinfo commit --init
|
|
11
|
+
"prepare": "pubinfo setup && pubinfo commit --init",
|
|
12
|
+
"lint": "pnpm run lint:eslint && pnpm run lint:stylelint",
|
|
12
13
|
"lint:eslint": "eslint . --cache --fix",
|
|
13
14
|
"lint:stylelint": "stylelint \"src/**/*.{css,scss,vue}\" --cache --fix",
|
|
14
15
|
"viewer:eslint-rule": "pnpx @eslint/config-inspector",
|
|
@@ -36,12 +37,12 @@
|
|
|
36
37
|
"typescript": "^5.8.3"
|
|
37
38
|
},
|
|
38
39
|
"simple-git-hooks": {
|
|
39
|
-
"pre-commit": "pnpm lint-staged
|
|
40
|
+
"pre-commit": "pnpm lint-staged",
|
|
40
41
|
"commit-msg": "pnpm exec pubinfo commit --edit $1"
|
|
41
42
|
},
|
|
42
43
|
"lint-staged": {
|
|
43
44
|
"*.{vue,js,ts,jsx,tsx,md,json}": "eslint --cache --fix",
|
|
44
|
-
"*.{css,scss,vue}": "stylelint --cache --fix"
|
|
45
|
+
"*.{css,less,scss,vue}": "stylelint --cache --fix"
|
|
45
46
|
},
|
|
46
47
|
"config": {
|
|
47
48
|
"commitizen": {
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Copyright,
|
|
4
4
|
Layout,
|
|
5
|
-
LayoutContent,
|
|
6
|
-
LayoutHeader,
|
|
7
|
-
LayoutProvider,
|
|
8
5
|
Logo,
|
|
6
|
+
Tool,
|
|
9
7
|
Tools,
|
|
10
8
|
} from 'pubinfo';
|
|
11
9
|
|
|
@@ -14,25 +12,33 @@ const dev = import.meta.env.DEV;
|
|
|
14
12
|
</script>
|
|
15
13
|
|
|
16
14
|
<template>
|
|
17
|
-
<
|
|
15
|
+
<Layout.Provider :app-title="title" :is-dev="dev">
|
|
18
16
|
<Layout>
|
|
19
17
|
<template #header>
|
|
20
|
-
<
|
|
18
|
+
<Layout.Header>
|
|
21
19
|
<template #logo>
|
|
22
20
|
<Logo name="logo" />
|
|
23
21
|
</template>
|
|
24
22
|
|
|
25
23
|
<template #tools>
|
|
26
|
-
<Tools
|
|
24
|
+
<Tools>
|
|
25
|
+
<Tool.Fullscreen />
|
|
26
|
+
<Tool.PageReload />
|
|
27
|
+
<Tool.DarkModeToggle />
|
|
28
|
+
</Tools>
|
|
27
29
|
</template>
|
|
28
|
-
</
|
|
30
|
+
</Layout.Header>
|
|
29
31
|
</template>
|
|
30
32
|
|
|
31
|
-
<
|
|
33
|
+
<template #sidebar>
|
|
34
|
+
<Layout.Sidebar />
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<Layout.Content />
|
|
32
38
|
|
|
33
39
|
<template #footer>
|
|
34
40
|
<Copyright />
|
|
35
41
|
</template>
|
|
36
42
|
</Layout>
|
|
37
|
-
</
|
|
43
|
+
</Layout.Provider>
|
|
38
44
|
</template>
|