@cerema/cadriciel 1.7.2 → 1.7.4

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.
@@ -124,21 +124,27 @@ module.exports = (args) => {
124
124
  });
125
125
 
126
126
  // Execute Copy
127
- copyTasks.forEach(task => {
127
+ // Execute Copy
128
+ await Promise.all(copyTasks.map(async (task) => {
128
129
  const srcPath = path.join(starter.path, task.src);
129
130
  const destPath = path.join(targetPath, task.dest);
130
131
 
131
132
  if (fs.existsSync(srcPath)) {
132
133
  // Check if file or directory
133
- const stat = fs.statSync(srcPath);
134
+ const stat = await fs.promises.stat(srcPath);
135
+ const filterFunc = (src, dest) => {
136
+ if (path.basename(src) === 'node_modules') return false;
137
+ return true;
138
+ }
139
+
134
140
  if (stat.isDirectory()) {
135
- fse.copySync(srcPath, destPath);
141
+ await fse.copy(srcPath, destPath, { filter: filterFunc });
136
142
  } else {
137
- fse.ensureDirSync(path.dirname(destPath));
138
- fse.copySync(srcPath, destPath);
143
+ await fse.ensureDir(path.dirname(destPath));
144
+ await fse.copy(srcPath, destPath);
139
145
  }
140
146
  }
141
- });
147
+ }));
142
148
 
143
149
  // 2. Run Hooks (post_create)
144
150
  if (starter.config.hooks && starter.config.hooks.post_create) {
@@ -218,7 +224,7 @@ module.exports = (args) => {
218
224
  name: 'selectedStarterId',
219
225
  message: 'Select a template:',
220
226
  choices: starters.map(s => ({
221
- name: `${chalk.bold(s.name)} - ${s.description}`,
227
+ name: `${chalk.bold(s.name)} - ${s.description}${isTestMode ? ` (${s.path})` : ''}`,
222
228
  value: s.id
223
229
  }))
224
230
  }
@@ -252,6 +258,8 @@ module.exports = (args) => {
252
258
 
253
259
  // 5. Generate
254
260
  await generateProject(starter, { selectedFeatures }, targetName);
261
+
262
+ if (isTestMode) process.exit(0);
255
263
  },
256
264
  };
257
265
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerema/cadriciel",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "npm": ">=8.0.0",