@cerema/cadriciel 1.7.1 → 1.7.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/cli/global/create.js +11 -8
- package/cli/global/install.js +2 -2
- package/package.json +1 -1
package/cli/global/create.js
CHANGED
|
@@ -19,7 +19,7 @@ module.exports = (args) => {
|
|
|
19
19
|
// We use npm install to handle downloading and unpacking
|
|
20
20
|
// We install to a distinct prefix to avoid polluting global or current project
|
|
21
21
|
// --no-save ensures it doesn't try to write to a package.json
|
|
22
|
-
const result = spawnSync(
|
|
22
|
+
const result = spawnSync(`npm install ${PACKAGE_NAME}@latest --force --no-save --prefix "${CACHE_DIR}"`, {
|
|
23
23
|
stdio: 'pipe',
|
|
24
24
|
encoding: 'utf-8',
|
|
25
25
|
shell: true
|
|
@@ -124,21 +124,22 @@ module.exports = (args) => {
|
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
// Execute Copy
|
|
127
|
-
|
|
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.
|
|
134
|
+
const stat = await fs.promises.stat(srcPath);
|
|
134
135
|
if (stat.isDirectory()) {
|
|
135
|
-
fse.
|
|
136
|
+
await fse.copy(srcPath, destPath);
|
|
136
137
|
} else {
|
|
137
|
-
fse.
|
|
138
|
-
fse.
|
|
138
|
+
await fse.ensureDir(path.dirname(destPath));
|
|
139
|
+
await fse.copy(srcPath, destPath);
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
|
-
});
|
|
142
|
+
}));
|
|
142
143
|
|
|
143
144
|
// 2. Run Hooks (post_create)
|
|
144
145
|
if (starter.config.hooks && starter.config.hooks.post_create) {
|
|
@@ -218,7 +219,7 @@ module.exports = (args) => {
|
|
|
218
219
|
name: 'selectedStarterId',
|
|
219
220
|
message: 'Select a template:',
|
|
220
221
|
choices: starters.map(s => ({
|
|
221
|
-
name: `${chalk.bold(s.name)} - ${s.description}`,
|
|
222
|
+
name: `${chalk.bold(s.name)} - ${s.description}${isTestMode ? ` (${s.path})` : ''}`,
|
|
222
223
|
value: s.id
|
|
223
224
|
}))
|
|
224
225
|
}
|
|
@@ -252,6 +253,8 @@ module.exports = (args) => {
|
|
|
252
253
|
|
|
253
254
|
// 5. Generate
|
|
254
255
|
await generateProject(starter, { selectedFeatures }, targetName);
|
|
256
|
+
|
|
257
|
+
if (isTestMode) process.exit(0);
|
|
255
258
|
},
|
|
256
259
|
};
|
|
257
260
|
};
|
package/cli/global/install.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = (args) => {
|
|
|
7
7
|
const { spawn } = require('child_process');
|
|
8
8
|
|
|
9
9
|
const checkIfCommandExists = (command, callback) => {
|
|
10
|
-
const proc = spawn(
|
|
10
|
+
const proc = spawn(`which ${command}`, { shell: true });
|
|
11
11
|
|
|
12
12
|
let found = false;
|
|
13
13
|
proc.stdout.on('data', (data) => {
|
|
@@ -87,7 +87,7 @@ module.exports = (args) => {
|
|
|
87
87
|
}
|
|
88
88
|
args.push(imageEntry.image);
|
|
89
89
|
|
|
90
|
-
const dockerPull = spawn(
|
|
90
|
+
const dockerPull = spawn(`docker ${args.join(' ')}`, { shell: true });
|
|
91
91
|
let stderrOutput = '';
|
|
92
92
|
|
|
93
93
|
dockerPull.stdout.on('data', () => { });
|