@cerema/cadriciel 1.4.4 → 1.4.5
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/bun.lockb +0 -0
- package/cli/global/install.js +2 -1
- package/cli.js +59 -5
- package/package.json +2 -1
package/bun.lockb
CHANGED
|
Binary file
|
package/cli/global/install.js
CHANGED
|
@@ -54,6 +54,7 @@ module.exports = (args) => {
|
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
dockerPull.stderr.on('data', (data) => {
|
|
57
|
+
console.log(data);
|
|
57
58
|
response.fail(chalk.red('Le service Docker ne répond pas.'));
|
|
58
59
|
return process.exit(1);
|
|
59
60
|
});
|
|
@@ -94,7 +95,7 @@ module.exports = (args) => {
|
|
|
94
95
|
start: () => {
|
|
95
96
|
addMapping();
|
|
96
97
|
const dockerImagesToInstall = [
|
|
97
|
-
'postgres
|
|
98
|
+
'cerema/postgres',
|
|
98
99
|
'cerema/cadriciel:1.0.0',
|
|
99
100
|
'dpage/pgadmin4',
|
|
100
101
|
'inbucket/inbucket:latest',
|
package/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ const path = require('path');
|
|
|
7
7
|
const { spawn } = require('child_process');
|
|
8
8
|
const os = require('os');
|
|
9
9
|
const userHomeDir = os.homedir();
|
|
10
|
+
const boxen = require('boxen');
|
|
10
11
|
|
|
11
12
|
const CADRICIEL_PATH = findCadricielDir(process.cwd());
|
|
12
13
|
const CADRICIEL_COMMAND =
|
|
@@ -21,6 +22,28 @@ try {
|
|
|
21
22
|
fs.unlinkSync(`${userHomeDir}/.cadriciel/account.json`);
|
|
22
23
|
} catch (e) {}
|
|
23
24
|
|
|
25
|
+
const checkVersion = async () => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const packageName = '@cerema/cadriciel';
|
|
28
|
+
const child = spawn('npm', ['view', packageName, 'version']);
|
|
29
|
+
|
|
30
|
+
let version = '';
|
|
31
|
+
|
|
32
|
+
child.stdout.on('data', (data) => {
|
|
33
|
+
version += data.toString();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
child.on('close', (code) => {
|
|
37
|
+
if (code !== 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
version = version.trim();
|
|
42
|
+
resolve(version);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
24
47
|
/**
|
|
25
48
|
* Recherche récursivement le répertoire '.cadriciel' à partir du chemin donné, en remontant vers les répertoires parents.
|
|
26
49
|
* @param {string} startPath - Le chemin de départ pour la recherche.
|
|
@@ -191,8 +214,39 @@ const processCommands = (args) => {
|
|
|
191
214
|
}
|
|
192
215
|
};
|
|
193
216
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
217
|
+
checkVersion()
|
|
218
|
+
.then((version) => {
|
|
219
|
+
const current_version = require(__dirname + '/package.json').version;
|
|
220
|
+
|
|
221
|
+
if (current_version != version) {
|
|
222
|
+
const message =
|
|
223
|
+
'Une nouvelle version (' +
|
|
224
|
+
version +
|
|
225
|
+
') a été détectée. Veuillez mettre à jour.\n' +
|
|
226
|
+
chalk.white.bold('npm i -g @cerema/cadriciel');
|
|
227
|
+
|
|
228
|
+
// Options pour le cadre
|
|
229
|
+
const boxenOptions = {
|
|
230
|
+
padding: 1,
|
|
231
|
+
margin: 1,
|
|
232
|
+
borderColor: 'yellow',
|
|
233
|
+
borderStyle: 'double',
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// Mise en forme du message avec Chalk
|
|
237
|
+
const styledMessage = chalk.yellow(message);
|
|
238
|
+
|
|
239
|
+
// Création de l'encadré avec Boxen
|
|
240
|
+
const framedMessage = boxen(styledMessage, boxenOptions);
|
|
241
|
+
|
|
242
|
+
console.log(framedMessage);
|
|
243
|
+
loadGlobalCommands();
|
|
244
|
+
processCommands(process.argv.splice(2));
|
|
245
|
+
if (process.argv.length <= 2) return displayBanner();
|
|
246
|
+
}
|
|
247
|
+
})
|
|
248
|
+
.catch((error) => {
|
|
249
|
+
loadGlobalCommands();
|
|
250
|
+
processCommands(process.argv.splice(2));
|
|
251
|
+
if (process.argv.length <= 2) return displayBanner();
|
|
252
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerema/cadriciel",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"npm": ">=8.0.0",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"adm-zip": "^0.5.10",
|
|
14
14
|
"axios": "^1.5.1",
|
|
15
|
+
"boxen": "5.1.2",
|
|
15
16
|
"chalk-v2": "^1.0.2",
|
|
16
17
|
"commander": "^10.0.0",
|
|
17
18
|
"express": "^4.18.2",
|