create-pubinfo 0.4.1 → 0.4.2
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.cjs +26 -17
- package/dist/index.js +26 -17
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,7 @@ var import_consola6 = __toESM(require("consola"), 1);
|
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "create-pubinfo",
|
|
33
33
|
type: "module",
|
|
34
|
-
version: "0.4.
|
|
34
|
+
version: "0.4.2",
|
|
35
35
|
description: "\u521D\u59CB\u5316\u9879\u76EE\u6846\u67B6",
|
|
36
36
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
37
37
|
license: "MIT",
|
|
@@ -62,7 +62,7 @@ var package_default = {
|
|
|
62
62
|
ofetch: "^1.3.4",
|
|
63
63
|
ora: "^8.0.1",
|
|
64
64
|
rimraf: "^5.0.5",
|
|
65
|
-
semver: "^7.6.
|
|
65
|
+
semver: "^7.6.2"
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -73,19 +73,34 @@ var import_consola = __toESM(require("consola"), 1);
|
|
|
73
73
|
var import_ansi_colors = __toESM(require("ansi-colors"), 1);
|
|
74
74
|
var import_ora = __toESM(require("ora"), 1);
|
|
75
75
|
var import_semver = require("semver");
|
|
76
|
+
|
|
77
|
+
// src/constant.ts
|
|
78
|
+
var REMOTE_URL = "http://124.223.184.245:20000/templates";
|
|
79
|
+
var PKG_NAME = "monorepo-project-template";
|
|
80
|
+
var VERSION_FILE = "version.json";
|
|
81
|
+
var SETTING_FILE_PATH = "src/settings.default.ts";
|
|
82
|
+
var APPS_DIR = "apps";
|
|
83
|
+
var APPS = [
|
|
84
|
+
{ name: "\u7528\u6237\u6743\u9650\u7CFB\u7EDF\uFF08rbac\uFF09", value: "rbac" }
|
|
85
|
+
// { name: '初始化项目模板(admin)', value: 'admin' },
|
|
86
|
+
];
|
|
87
|
+
var METADATA_DIR = "configs/metadata";
|
|
88
|
+
var META_FILENAME = "pubinfo.json";
|
|
89
|
+
|
|
90
|
+
// src/download.ts
|
|
76
91
|
var pubinfo = async (input2, { auth }) => {
|
|
77
92
|
const semver = (0, import_semver.coerce)(input2);
|
|
78
93
|
return {
|
|
79
94
|
name: "pubinfo",
|
|
80
95
|
version: input2,
|
|
81
96
|
headers: { Authorization: `token ${auth}` },
|
|
82
|
-
tar:
|
|
97
|
+
tar: `${REMOTE_URL}/${PKG_NAME}-${semver?.version}.tar.gz`
|
|
83
98
|
};
|
|
84
99
|
};
|
|
85
100
|
async function download(options) {
|
|
86
101
|
const finish = loading();
|
|
87
102
|
try {
|
|
88
|
-
await (0, import_giget.downloadTemplate)(`pubinfo
|
|
103
|
+
await (0, import_giget.downloadTemplate)(`pubinfo:${PKG_NAME}-${options.version}`, {
|
|
89
104
|
providers: { pubinfo },
|
|
90
105
|
force: true,
|
|
91
106
|
forceClean: true,
|
|
@@ -93,7 +108,9 @@ async function download(options) {
|
|
|
93
108
|
dir: options.dir
|
|
94
109
|
});
|
|
95
110
|
} catch (error) {
|
|
96
|
-
|
|
111
|
+
if (error.message.includes(REMOTE_URL))
|
|
112
|
+
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
113
|
+
import_consola.default.error(`\u4E0B\u8F7D\u5931\u8D25: ${error.message}`);
|
|
97
114
|
import_node_process.default.exit(1);
|
|
98
115
|
} finally {
|
|
99
116
|
finish();
|
|
@@ -155,16 +172,6 @@ function assignValues(target, source) {
|
|
|
155
172
|
target[key] = value;
|
|
156
173
|
}
|
|
157
174
|
|
|
158
|
-
// src/constant.ts
|
|
159
|
-
var SETTING_FILE_PATH = "src/settings.default.ts";
|
|
160
|
-
var APPS_DIR = "apps";
|
|
161
|
-
var APPS = [
|
|
162
|
-
{ name: "\u7528\u6237\u6743\u9650\u7CFB\u7EDF\uFF08rbac\uFF09", value: "rbac" }
|
|
163
|
-
// { name: '初始化项目模板(admin)', value: 'admin' },
|
|
164
|
-
];
|
|
165
|
-
var METADATA_DIR = "configs/metadata";
|
|
166
|
-
var META_FILENAME = "pubinfo.json";
|
|
167
|
-
|
|
168
175
|
// src/rewrite.ts
|
|
169
176
|
async function rewrite(options) {
|
|
170
177
|
const { dir } = options;
|
|
@@ -247,7 +254,7 @@ var import_ofetch = require("ofetch");
|
|
|
247
254
|
var import_ora2 = __toESM(require("ora"), 1);
|
|
248
255
|
var import_semver2 = require("semver");
|
|
249
256
|
async function fetchVersion() {
|
|
250
|
-
const versions = await (0, import_ofetch.ofetch)(
|
|
257
|
+
const versions = await (0, import_ofetch.ofetch)(`${REMOTE_URL}/${VERSION_FILE}`);
|
|
251
258
|
versions.sort((v1, v2) => -(0, import_semver2.compare)(v1, v2));
|
|
252
259
|
return {
|
|
253
260
|
latest: versions[0],
|
|
@@ -266,7 +273,9 @@ async function fetchData() {
|
|
|
266
273
|
version
|
|
267
274
|
};
|
|
268
275
|
} catch (error) {
|
|
269
|
-
|
|
276
|
+
if (error.message.includes(REMOTE_URL))
|
|
277
|
+
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
278
|
+
import_consola4.default.error(`\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38: ${error.message}`);
|
|
270
279
|
import_node_process3.default.exit(1);
|
|
271
280
|
} finally {
|
|
272
281
|
spinner.stop();
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import consola6 from "consola";
|
|
|
8
8
|
var package_default = {
|
|
9
9
|
name: "create-pubinfo",
|
|
10
10
|
type: "module",
|
|
11
|
-
version: "0.4.
|
|
11
|
+
version: "0.4.2",
|
|
12
12
|
description: "\u521D\u59CB\u5316\u9879\u76EE\u6846\u67B6",
|
|
13
13
|
author: "Werheng <werheng.zhang@gmail.com>",
|
|
14
14
|
license: "MIT",
|
|
@@ -39,7 +39,7 @@ var package_default = {
|
|
|
39
39
|
ofetch: "^1.3.4",
|
|
40
40
|
ora: "^8.0.1",
|
|
41
41
|
rimraf: "^5.0.5",
|
|
42
|
-
semver: "^7.6.
|
|
42
|
+
semver: "^7.6.2"
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -50,19 +50,34 @@ import consola from "consola";
|
|
|
50
50
|
import colors from "ansi-colors";
|
|
51
51
|
import ora from "ora";
|
|
52
52
|
import { coerce } from "semver";
|
|
53
|
+
|
|
54
|
+
// src/constant.ts
|
|
55
|
+
var REMOTE_URL = "http://124.223.184.245:20000/templates";
|
|
56
|
+
var PKG_NAME = "monorepo-project-template";
|
|
57
|
+
var VERSION_FILE = "version.json";
|
|
58
|
+
var SETTING_FILE_PATH = "src/settings.default.ts";
|
|
59
|
+
var APPS_DIR = "apps";
|
|
60
|
+
var APPS = [
|
|
61
|
+
{ name: "\u7528\u6237\u6743\u9650\u7CFB\u7EDF\uFF08rbac\uFF09", value: "rbac" }
|
|
62
|
+
// { name: '初始化项目模板(admin)', value: 'admin' },
|
|
63
|
+
];
|
|
64
|
+
var METADATA_DIR = "configs/metadata";
|
|
65
|
+
var META_FILENAME = "pubinfo.json";
|
|
66
|
+
|
|
67
|
+
// src/download.ts
|
|
53
68
|
var pubinfo = async (input2, { auth }) => {
|
|
54
69
|
const semver = coerce(input2);
|
|
55
70
|
return {
|
|
56
71
|
name: "pubinfo",
|
|
57
72
|
version: input2,
|
|
58
73
|
headers: { Authorization: `token ${auth}` },
|
|
59
|
-
tar:
|
|
74
|
+
tar: `${REMOTE_URL}/${PKG_NAME}-${semver?.version}.tar.gz`
|
|
60
75
|
};
|
|
61
76
|
};
|
|
62
77
|
async function download(options) {
|
|
63
78
|
const finish = loading();
|
|
64
79
|
try {
|
|
65
|
-
await downloadTemplate(`pubinfo
|
|
80
|
+
await downloadTemplate(`pubinfo:${PKG_NAME}-${options.version}`, {
|
|
66
81
|
providers: { pubinfo },
|
|
67
82
|
force: true,
|
|
68
83
|
forceClean: true,
|
|
@@ -70,7 +85,9 @@ async function download(options) {
|
|
|
70
85
|
dir: options.dir
|
|
71
86
|
});
|
|
72
87
|
} catch (error) {
|
|
73
|
-
|
|
88
|
+
if (error.message.includes(REMOTE_URL))
|
|
89
|
+
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
90
|
+
consola.error(`\u4E0B\u8F7D\u5931\u8D25: ${error.message}`);
|
|
74
91
|
process.exit(1);
|
|
75
92
|
} finally {
|
|
76
93
|
finish();
|
|
@@ -132,16 +149,6 @@ function assignValues(target, source) {
|
|
|
132
149
|
target[key] = value;
|
|
133
150
|
}
|
|
134
151
|
|
|
135
|
-
// src/constant.ts
|
|
136
|
-
var SETTING_FILE_PATH = "src/settings.default.ts";
|
|
137
|
-
var APPS_DIR = "apps";
|
|
138
|
-
var APPS = [
|
|
139
|
-
{ name: "\u7528\u6237\u6743\u9650\u7CFB\u7EDF\uFF08rbac\uFF09", value: "rbac" }
|
|
140
|
-
// { name: '初始化项目模板(admin)', value: 'admin' },
|
|
141
|
-
];
|
|
142
|
-
var METADATA_DIR = "configs/metadata";
|
|
143
|
-
var META_FILENAME = "pubinfo.json";
|
|
144
|
-
|
|
145
152
|
// src/rewrite.ts
|
|
146
153
|
async function rewrite(options) {
|
|
147
154
|
const { dir } = options;
|
|
@@ -224,7 +231,7 @@ import { ofetch } from "ofetch";
|
|
|
224
231
|
import ora2 from "ora";
|
|
225
232
|
import { compare } from "semver";
|
|
226
233
|
async function fetchVersion() {
|
|
227
|
-
const versions = await ofetch(
|
|
234
|
+
const versions = await ofetch(`${REMOTE_URL}/${VERSION_FILE}`);
|
|
228
235
|
versions.sort((v1, v2) => -compare(v1, v2));
|
|
229
236
|
return {
|
|
230
237
|
latest: versions[0],
|
|
@@ -243,7 +250,9 @@ async function fetchData() {
|
|
|
243
250
|
version
|
|
244
251
|
};
|
|
245
252
|
} catch (error) {
|
|
246
|
-
|
|
253
|
+
if (error.message.includes(REMOTE_URL))
|
|
254
|
+
error.message = error.message.replace(REMOTE_URL, "[REMOTE_URL]");
|
|
255
|
+
consola4.error(`\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38: ${error.message}`);
|
|
247
256
|
process3.exit(1);
|
|
248
257
|
} finally {
|
|
249
258
|
spinner.stop();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pubinfo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"description": "初始化项目框架",
|
|
6
6
|
"author": "Werheng <werheng.zhang@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"ofetch": "^1.3.4",
|
|
27
27
|
"ora": "^8.0.1",
|
|
28
28
|
"rimraf": "^5.0.5",
|
|
29
|
-
"semver": "^7.6.
|
|
29
|
+
"semver": "^7.6.2"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"dev": "tsup --watch src",
|