cmyr-template-cli 1.12.5 → 1.13.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.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.12.4" , '-v, --version');
16
+ program.version("1.13.1" , '-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
@@ -99,7 +99,7 @@ async function getFastGitRepo(repository) {
99
99
  }
100
100
  async function asyncExec(cmd, options) {
101
101
  return new Promise((resolve, reject) => {
102
- child_process.exec(cmd, options, (err, stdout, stderr) => {
102
+ const ls = child_process.exec(cmd, options, (err, stdout, stderr) => {
103
103
  if (err) {
104
104
  return reject(err);
105
105
  }
@@ -108,6 +108,12 @@ async function asyncExec(cmd, options) {
108
108
  }
109
109
  resolve(stdout);
110
110
  });
111
+ ls.stdout.on('data', (data) => {
112
+ console.log(data);
113
+ });
114
+ ls.stderr.on('data', (data) => {
115
+ console.log(colors__default["default"].red(data));
116
+ });
111
117
  });
112
118
  }
113
119
  async function initProject(answers) {
@@ -168,17 +174,7 @@ async function init(projectPath, answers) {
168
174
  await asyncExec('git add .', {
169
175
  cwd: projectPath,
170
176
  });
171
- const loading = ora__default["default"]('正在安装依赖……').start();
172
- try {
173
- await asyncExec(`${PACKAGE_MANAGER} i`, {
174
- cwd: projectPath,
175
- });
176
- loading.succeed('依赖安装成功!');
177
- }
178
- catch (error) {
179
- console.error(error);
180
- loading.fail('依赖安装失败!');
181
- }
177
+ await installNpmPackages(projectPath);
182
178
  await asyncExec('git add .', {
183
179
  cwd: projectPath,
184
180
  });
@@ -202,6 +198,21 @@ async function getGitUserName() {
202
198
  const username = (await asyncExec('git config user.name')) || '';
203
199
  return username.trim();
204
200
  }
201
+ async function installNpmPackages(projectPath) {
202
+ const loading = ora__default["default"]('正在安装依赖……').start();
203
+ try {
204
+ const files = ['.npmrc'];
205
+ await copyFilesFromTemplates(projectPath, files);
206
+ await asyncExec(`${PACKAGE_MANAGER} i`, {
207
+ cwd: projectPath,
208
+ });
209
+ loading.succeed('依赖安装成功!');
210
+ }
211
+ catch (error) {
212
+ console.error(error);
213
+ loading.fail('依赖安装失败!');
214
+ }
215
+ }
205
216
  async function initDependabot(projectPath, answers) {
206
217
  try {
207
218
  const { isOpenSource, isRemoveDependabot } = answers;
@@ -785,10 +796,9 @@ module.exports = function (plop) {
785
796
  message: '请选择项目模板',
786
797
  choices() {
787
798
  return [
788
- 'vue',
789
- 'vue3',
790
- 'vite2',
799
+ 'vite3',
791
800
  'vite2-vue2',
801
+ 'vite2',
792
802
  'electron-vue',
793
803
  'nuxt',
794
804
  'uni',
@@ -803,6 +813,8 @@ module.exports = function (plop) {
803
813
  'rollup',
804
814
  'webpack',
805
815
  'github-action',
816
+ 'vue',
817
+ 'vue3',
806
818
  ].map((e) => `${e}-template`);
807
819
  },
808
820
  default: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.12.5",
3
+ "version": "1.13.2",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",