cmyr-template-cli 1.14.0 → 1.14.1

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 CHANGED
@@ -13,7 +13,7 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
13
13
 
14
14
  const program = new commander.Command('ct')
15
15
  .description('草梅项目创建器');
16
- program.version("1.13.4" , '-v, --version');
16
+ program.version("1.14.0" , '-v, --version');
17
17
  const args = process.argv.slice(2);
18
18
  if (args.length === 0) {
19
19
  args.push('create');
package/dist/plopfile.js CHANGED
@@ -100,17 +100,10 @@ async function createGithubRepo(authToken, data) {
100
100
  }
101
101
  async function loadToken(type) {
102
102
  const paths = [process.cwd(), process.env.HOME].map((e) => path__default["default"].join(e, '.ctrc'));
103
- let CONFIG_KEY = '';
104
- switch (type) {
105
- case 'github':
106
- CONFIG_KEY = 'GITHUB_TOKEN';
107
- break;
108
- case 'gitee':
109
- CONFIG_KEY = 'GITEE_TOKEN';
110
- break;
111
- default:
112
- throw new Error(`无效的 token 类型:${type}`);
103
+ if (!['GITHUB_TOKEN', 'GITEE_TOKEN'].includes(type)) {
104
+ throw new Error(`无效的 token 类型:${type}`);
113
105
  }
106
+ const CONFIG_KEY = type;
114
107
  for await (const p of paths) {
115
108
  try {
116
109
  if (await fs__default["default"].pathExists(p)) {
@@ -277,7 +270,7 @@ async function initRemoteGitRepo(projectPath, answers) {
277
270
  }
278
271
  switch (type) {
279
272
  case 'github': {
280
- const authToken = await loadToken(type);
273
+ const authToken = await loadToken('GITHUB_TOKEN');
281
274
  if (!authToken) {
282
275
  console.error(colors__default["default"].red(`未找到 ${type} token !跳过初始化!`));
283
276
  break;
@@ -297,7 +290,7 @@ async function initRemoteGitRepo(projectPath, answers) {
297
290
  return;
298
291
  }
299
292
  case 'gitee': {
300
- const access_token = await loadToken(type);
293
+ const access_token = await loadToken('GITEE_TOKEN');
301
294
  if (!access_token) {
302
295
  console.error(colors__default["default"].red(`未找到 ${type} token !跳过初始化!`));
303
296
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@lint-md/core": "^0.2.1",
72
- "axios": "^0.27.1",
72
+ "axios": "^1.0.0",
73
73
  "colors": "^1.4.0",
74
74
  "commander": "^9.0.0",
75
75
  "dayjs": "^1.9.6",