cmyr-template-cli 1.13.0 → 1.13.3

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.5" , '-v, --version');
16
+ program.version("1.13.2" , '-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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.13.0",
3
+ "version": "1.13.3",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@ RUN echo "http://mirrors.aliyun.com/alpine/edge/main/" > /etc/apk/repositories \
15
15
 
16
16
  WORKDIR /home/app
17
17
 
18
- COPY package.json /home/app/
18
+ COPY package.json .npmrc /home/app/
19
19
 
20
20
  RUN pnpm i
21
21