@cerema/cadriciel 1.3.0 → 1.3.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/cli/global/init.js +2 -1
- package/cli/global/login.js +17 -0
- package/cli/global/update.js +2 -1
- package/cli.js +5 -6
- package/lib/cadriciel.js +0 -5
- package/package.json +1 -2
- package/cli/cadriciel/build.js +0 -8
- package/cli/cadriciel/dev.js +0 -8
- package/cli/cadriciel/gen.js +0 -34
- package/cli/cadriciel/logs.js +0 -8
- package/cli/cadriciel/project.js +0 -14
- package/cli/cadriciel/reset.js +0 -8
- package/cli/cadriciel/restart.js +0 -8
- package/cli/cadriciel/rm.js +0 -34
- package/cli/cadriciel/start.js +0 -8
- package/cli/cadriciel/stop.js +0 -8
package/cli/global/init.js
CHANGED
|
@@ -96,7 +96,7 @@ module.exports = (args) => {
|
|
|
96
96
|
|
|
97
97
|
const install_dependencies = (name) => {
|
|
98
98
|
console.log(' ');
|
|
99
|
-
const spinner = ora('Installation des dépendances
|
|
99
|
+
const spinner = ora('Installation des dépendances').start();
|
|
100
100
|
const projectPath = `${process.cwd()}/${name}`;
|
|
101
101
|
|
|
102
102
|
// Check if directory exists
|
|
@@ -206,6 +206,7 @@ module.exports = (args) => {
|
|
|
206
206
|
start: async () => {
|
|
207
207
|
const templates = await getTemplates();
|
|
208
208
|
var tpl = [];
|
|
209
|
+
if (!templates) return process.exit(1);
|
|
209
210
|
for (let i = 0; i < templates.length; i++) tpl.push(templates[i].title);
|
|
210
211
|
console.log(
|
|
211
212
|
'\n😃 ' + chalk.bold('Tout grand projet commence par un nom !\n')
|
package/cli/global/login.js
CHANGED
|
@@ -87,10 +87,27 @@ module.exports = (args) => {
|
|
|
87
87
|
async (err) => {
|
|
88
88
|
const CadricielAPI = require('../../lib/cadriciel');
|
|
89
89
|
const cadriciel = new CadricielAPI(accessToken);
|
|
90
|
+
try {
|
|
91
|
+
const response = await cadriciel.get('/login');
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.log(' ');
|
|
94
|
+
console.log(
|
|
95
|
+
chalk.red(' [AUTH]') +
|
|
96
|
+
chalk.red(
|
|
97
|
+
" Vous avez bien été authentifié mais vous n'avez pas accès au cadriciel."
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
try {
|
|
101
|
+
fs.unlinkSync(`${userHomeDir}/.cadriciel/account`);
|
|
102
|
+
fs.rmdirSync(`${userHomeDir}/.cadriciel`);
|
|
103
|
+
} catch (e) {}
|
|
104
|
+
return process.exit(1);
|
|
105
|
+
}
|
|
90
106
|
await cadriciel.downloadFile(
|
|
91
107
|
'/update',
|
|
92
108
|
userHomeDir + '/.cadriciel/template.json'
|
|
93
109
|
);
|
|
110
|
+
|
|
94
111
|
setTimeout(() => {
|
|
95
112
|
console.log(' ');
|
|
96
113
|
console.log(
|
package/cli/global/update.js
CHANGED
|
@@ -3,6 +3,7 @@ module.exports = (args) => {
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const os = require('os');
|
|
5
5
|
const userHomeDir = os.homedir();
|
|
6
|
+
const chalk = require('chalk-v2');
|
|
6
7
|
|
|
7
8
|
return {
|
|
8
9
|
info: {
|
|
@@ -16,7 +17,7 @@ module.exports = (args) => {
|
|
|
16
17
|
'utf-8'
|
|
17
18
|
);
|
|
18
19
|
} catch (e) {
|
|
19
|
-
return
|
|
20
|
+
return log.error("Vous n'êtes pas authentifié.");
|
|
20
21
|
}
|
|
21
22
|
const CadricielAPI = require('../../lib/cadriciel');
|
|
22
23
|
const cadriciel = new CadricielAPI(token);
|
package/cli.js
CHANGED
|
@@ -52,12 +52,10 @@ const loadGlobalCommands = () => {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const loadCadricielCommands = () => {
|
|
56
|
-
let dir = fs.readdirSync(
|
|
55
|
+
const loadCadricielCommands = (path) => {
|
|
56
|
+
let dir = fs.readdirSync(path);
|
|
57
57
|
for (let i = 0; i < dir.length; i++) {
|
|
58
|
-
CADRICIEL_COMMANDS[dir[i].split('.')[0]] = require(
|
|
59
|
-
'/cli/cadriciel/' +
|
|
60
|
-
dir[i])();
|
|
58
|
+
CADRICIEL_COMMANDS[dir[i].split('.')[0]] = require(path + dir[i])();
|
|
61
59
|
}
|
|
62
60
|
};
|
|
63
61
|
|
|
@@ -147,6 +145,7 @@ const displayBanner = () => {
|
|
|
147
145
|
console.log(`\n Vous n'êtes pas à l'intérieur d'un projet. `);
|
|
148
146
|
console.log(' ');
|
|
149
147
|
} else {
|
|
148
|
+
loadCadricielCommands(CADRICIEL_PATH + '/../cli/');
|
|
150
149
|
console.log(' ');
|
|
151
150
|
display(CADRICIEL_COMMANDS);
|
|
152
151
|
console.log(' ');
|
|
@@ -157,6 +156,7 @@ const displayBanner = () => {
|
|
|
157
156
|
|
|
158
157
|
const processCommands = (args) => {
|
|
159
158
|
const command = args[0];
|
|
159
|
+
loadCadricielCommands(CADRICIEL_PATH + '/../cli/');
|
|
160
160
|
if (!CADRICIEL_COMMANDS[command]) {
|
|
161
161
|
if (!CADRICIEL_GLOBAL_COMMANDS[command]) {
|
|
162
162
|
log.error('Commande inconnue : ' + command);
|
|
@@ -177,7 +177,6 @@ const processCommands = (args) => {
|
|
|
177
177
|
};
|
|
178
178
|
|
|
179
179
|
loadGlobalCommands();
|
|
180
|
-
loadCadricielCommands();
|
|
181
180
|
|
|
182
181
|
if (process.argv.length <= 2) return displayBanner();
|
|
183
182
|
|
package/lib/cadriciel.js
CHANGED
|
@@ -18,7 +18,6 @@ class CadricielAPI {
|
|
|
18
18
|
const response = await this.client.get(url, { params });
|
|
19
19
|
return response.data;
|
|
20
20
|
} catch (error) {
|
|
21
|
-
console.error("Erreur lors de l'appel GET:", error);
|
|
22
21
|
throw error;
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -28,7 +27,6 @@ class CadricielAPI {
|
|
|
28
27
|
const response = await this.client.post(url, data);
|
|
29
28
|
return response.data;
|
|
30
29
|
} catch (error) {
|
|
31
|
-
console.error("Erreur lors de l'appel POST:", error);
|
|
32
30
|
throw error;
|
|
33
31
|
}
|
|
34
32
|
}
|
|
@@ -37,7 +35,6 @@ class CadricielAPI {
|
|
|
37
35
|
const response = await this.client.put(url, data);
|
|
38
36
|
return response.data;
|
|
39
37
|
} catch (error) {
|
|
40
|
-
console.error("Erreur lors de l'appel PUT:", error);
|
|
41
38
|
throw error;
|
|
42
39
|
}
|
|
43
40
|
}
|
|
@@ -47,7 +44,6 @@ class CadricielAPI {
|
|
|
47
44
|
const response = await this.client.patch(url, data);
|
|
48
45
|
return response.data;
|
|
49
46
|
} catch (error) {
|
|
50
|
-
console.error("Erreur lors de l'appel PATCH:", error);
|
|
51
47
|
throw error;
|
|
52
48
|
}
|
|
53
49
|
}
|
|
@@ -57,7 +53,6 @@ class CadricielAPI {
|
|
|
57
53
|
const response = await this.client.delete(url, { data });
|
|
58
54
|
return response.data;
|
|
59
55
|
} catch (error) {
|
|
60
|
-
console.error("Erreur lors de l'appel DELETE:", error);
|
|
61
56
|
throw error;
|
|
62
57
|
}
|
|
63
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerema/cadriciel",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"npm": ">=8.0.0",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"isbinaryfile": "^5.0.0",
|
|
21
21
|
"jsonwebtoken": "^9.0.2",
|
|
22
22
|
"log-beautify": "^1.2.0",
|
|
23
|
-
"minio": "^7.0.32",
|
|
24
23
|
"nanoid": "^3.3.6",
|
|
25
24
|
"ora": "^5.4.1",
|
|
26
25
|
"prompts": "^2.4.2",
|
package/cli/cadriciel/build.js
DELETED
package/cli/cadriciel/dev.js
DELETED
package/cli/cadriciel/gen.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
module.exports = (args) => {
|
|
2
|
-
return {
|
|
3
|
-
info: {
|
|
4
|
-
title: 'gen',
|
|
5
|
-
description: `Génération automatique des éléments clés pour votre projet`,
|
|
6
|
-
sub: [
|
|
7
|
-
{
|
|
8
|
-
title: 'api',
|
|
9
|
-
description: `Génération des API`,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
title: 'component',
|
|
13
|
-
description: `Génération de composant angular`,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
title: 'db',
|
|
17
|
-
description: `Gestion de base de données`,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
title: 'page',
|
|
21
|
-
description: `Génération de pages angular`,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
title: 'project',
|
|
25
|
-
description: `Gestion de projet`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
title: 'service',
|
|
29
|
-
description: `Génération de services angular`,
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
};
|
package/cli/cadriciel/logs.js
DELETED
package/cli/cadriciel/project.js
DELETED
package/cli/cadriciel/reset.js
DELETED
package/cli/cadriciel/restart.js
DELETED
package/cli/cadriciel/rm.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
module.exports = (args) => {
|
|
2
|
-
return {
|
|
3
|
-
info: {
|
|
4
|
-
title: 'rm',
|
|
5
|
-
description: `Suppression automatique des éléments clés pour votre projet`,
|
|
6
|
-
sub: [
|
|
7
|
-
{
|
|
8
|
-
title: 'api',
|
|
9
|
-
description: `Suppression d'une API`,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
title: 'component',
|
|
13
|
-
description: `Suppression de composant angular`,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
title: 'db',
|
|
17
|
-
description: `Suppression de base de données`,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
title: 'page',
|
|
21
|
-
description: `Suppression de pages angular`,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
title: 'project',
|
|
25
|
-
description: `Suppression de projet`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
title: 'service',
|
|
29
|
-
description: `Suppression de services angular`,
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
};
|
package/cli/cadriciel/start.js
DELETED