@yaoxfly/cli 1.0.7 → 1.0.8
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/bin/add.js +2 -27
- package/bin/create.js +4 -43
- package/bin/delete.js +1 -26
- package/bin/list.js +1 -26
- package/bin/utils.js +4 -2
- package/package.json +1 -1
- package/template.json +4 -0
- package/version.json +1 -1
package/bin/add.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -43,9 +20,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
43
20
|
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
44
21
|
const utils_1 = require("./utils");
|
|
45
22
|
const add = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
const
|
|
47
|
-
let templateObj = yield template;
|
|
48
|
-
templateObj = templateObj.default;
|
|
23
|
+
const templateObj = (0, utils_1.readTemplates)();
|
|
49
24
|
const question = [
|
|
50
25
|
{
|
|
51
26
|
name: "name",
|
|
@@ -78,7 +53,7 @@ const add = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
78
53
|
type: 'input',
|
|
79
54
|
message: "请输入模板描述",
|
|
80
55
|
validate: (val) => {
|
|
81
|
-
if (val.length >=
|
|
56
|
+
if (val.length >= 70)
|
|
82
57
|
return 'The description is more than 70 characters!';
|
|
83
58
|
return true;
|
|
84
59
|
}
|
package/bin/create.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -82,12 +59,8 @@ const create = (projectName, options) => __awaiter(void 0, void 0, void 0, funct
|
|
|
82
59
|
console.log(chalk_1.default.green('You can use option -f to force delete the directory except for direct mode !'));
|
|
83
60
|
return;
|
|
84
61
|
}
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const choices = [];
|
|
88
|
-
Object.keys(templateObj.default).forEach(key => {
|
|
89
|
-
choices.push(`${key} (${templateObj.default[key].description})`);
|
|
90
|
-
});
|
|
62
|
+
const templateObj = (0, utils_1.readTemplates)();
|
|
63
|
+
const choices = Object.entries(templateObj).map(([key, template]) => `${key} (${template.description})`);
|
|
91
64
|
const param = [
|
|
92
65
|
{
|
|
93
66
|
type: 'list',
|
|
@@ -119,7 +92,7 @@ const create = (projectName, options) => __awaiter(void 0, void 0, void 0, funct
|
|
|
119
92
|
choices: ['pnpm', 'npm', 'yarn'],
|
|
120
93
|
when: (answers) => {
|
|
121
94
|
const { install, templateName } = answers;
|
|
122
|
-
return install && templateName !== 'monorope-component';
|
|
95
|
+
return install === true && templateName !== 'monorope-component';
|
|
123
96
|
}
|
|
124
97
|
},
|
|
125
98
|
];
|
|
@@ -154,24 +127,12 @@ const create = (projectName, options) => __awaiter(void 0, void 0, void 0, funct
|
|
|
154
127
|
fs_1.default.writeFileSync(filePath, JSON.stringify(packageJsonData, null, 2));
|
|
155
128
|
spinner.succeed();
|
|
156
129
|
const gitignorePath = `${projectName}/.gitignore`;
|
|
157
|
-
const fileContent = (
|
|
130
|
+
const fileContent = fs_1.default.readFileSync(gitignorePath, 'utf-8');
|
|
158
131
|
const newContent = fileContent
|
|
159
132
|
.split('\n')
|
|
160
133
|
.filter(line => !line.includes('pnpm-lock.yaml'))
|
|
161
134
|
.join('\n');
|
|
162
135
|
fs_1.default.writeFileSync(gitignorePath, newContent, 'utf-8');
|
|
163
|
-
try {
|
|
164
|
-
console.log(chalk_1.default.white('\n Start update... \n'));
|
|
165
|
-
const output = yield (0, child_process_1.execSync)(`npx npm-check-updates@16.14.20 -u --target semver --packageManager ${installMode}`, {
|
|
166
|
-
cwd: projectName,
|
|
167
|
-
encoding: 'utf-8',
|
|
168
|
-
stdio: 'inherit'
|
|
169
|
-
});
|
|
170
|
-
output && console.log('Command output:\n', output);
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
console.error('Error executing command:\n', error.message);
|
|
174
|
-
}
|
|
175
136
|
if (install) {
|
|
176
137
|
const stdout = yield (0, utils_1.shellExec)({
|
|
177
138
|
directive: `${installMode} install --force`,
|
package/bin/delete.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -43,9 +20,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
43
20
|
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
44
21
|
const utils_1 = require("./utils");
|
|
45
22
|
const del = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
const
|
|
47
|
-
let templateObj = yield template;
|
|
48
|
-
templateObj = templateObj.default;
|
|
23
|
+
const templateObj = (0, utils_1.readTemplates)();
|
|
49
24
|
const question = [
|
|
50
25
|
{
|
|
51
26
|
name: "name",
|
package/bin/list.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -40,9 +17,7 @@ exports.list = void 0;
|
|
|
40
17
|
const utils_1 = require("./utils");
|
|
41
18
|
const chalk_1 = __importDefault(require("chalk"));
|
|
42
19
|
const list = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
-
const template = Promise.resolve().then(() => __importStar(require((0, utils_1.resolve)('../template'))));
|
|
44
|
-
const templateObj = yield template;
|
|
45
20
|
console.log(chalk_1.default.grey('The template list is: \n'));
|
|
46
|
-
console.log(
|
|
21
|
+
console.log((0, utils_1.readTemplates)());
|
|
47
22
|
});
|
|
48
23
|
exports.list = list;
|
package/bin/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.hasPackage = exports.resolve = exports.shellExec = exports.readFile = void 0;
|
|
6
|
+
exports.hasPackage = exports.readTemplates = exports.resolve = exports.shellExec = exports.readFile = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const ora_1 = __importDefault(require("ora"));
|
|
9
9
|
const child_process_1 = require("child_process");
|
|
@@ -22,7 +22,7 @@ const readFile = (filePath) => {
|
|
|
22
22
|
};
|
|
23
23
|
exports.readFile = readFile;
|
|
24
24
|
const shellExec = (config) => {
|
|
25
|
-
const { directive, cwd, loading, log } = config
|
|
25
|
+
const { directive, cwd, loading, log } = config;
|
|
26
26
|
return new Promise((resolve, reject) => {
|
|
27
27
|
log && console.log(`\n ${log} \n`);
|
|
28
28
|
const spinner = (0, ora_1.default)(loading);
|
|
@@ -42,6 +42,8 @@ const shellExec = (config) => {
|
|
|
42
42
|
exports.shellExec = shellExec;
|
|
43
43
|
const resolve = (...file) => path_1.default.resolve(__dirname, ...file);
|
|
44
44
|
exports.resolve = resolve;
|
|
45
|
+
const readTemplates = () => JSON.parse((0, fs_1.readFileSync)((0, exports.resolve)('../template.json'), 'utf-8'));
|
|
46
|
+
exports.readTemplates = readTemplates;
|
|
45
47
|
const hasPackage = () => {
|
|
46
48
|
const fn = (tool) => {
|
|
47
49
|
try {
|
package/package.json
CHANGED
package/template.json
CHANGED
|
@@ -11,5 +11,9 @@
|
|
|
11
11
|
"monorope-component": {
|
|
12
12
|
"url": "yaoxfly/monorope-component",
|
|
13
13
|
"description": "[monorope]、typeScript、vue3、vite、pnpm"
|
|
14
|
+
},
|
|
15
|
+
"vue3-admin-frame": {
|
|
16
|
+
"url": "yaoxfly/vue3-admin-frame",
|
|
17
|
+
"description": "[vue3.x]、typeScript 、vite3、pinia、eslint、axios、mock、multiple environments"
|
|
14
18
|
}
|
|
15
19
|
}
|
package/version.json
CHANGED