@cerema/cadriciel 1.4.6 → 1.4.9

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.
@@ -89,18 +89,18 @@ module.exports = (args) => {
89
89
  return {
90
90
  info: {
91
91
  title: 'install',
92
- description:
93
- 'Installation des dépendances (La première fois uniquement).)',
92
+ description: 'Installation des dépendances (La première fois uniquement)',
94
93
  },
95
94
  start: () => {
96
95
  addMapping();
97
96
  const dockerImagesToInstall = [
98
- 'cerema/postgres',
99
- 'cerema/cadriciel:1.0.0',
97
+ 'postgres:15',
98
+ 'cerema/cadriciel:1.1.0',
100
99
  'dpage/pgadmin4',
101
100
  'inbucket/inbucket:latest',
102
101
  'quay.io/keycloak/keycloak:legacy',
103
102
  'liquibase/liquibase',
103
+ 'cerema/angular',
104
104
  ];
105
105
  setupEnvironment(dockerImagesToInstall);
106
106
  },
package/cli.js CHANGED
@@ -145,10 +145,44 @@ const display = (commands) => {
145
145
  }
146
146
  };
147
147
 
148
+ const displaySub = (commands) => {
149
+ const maxWidth = 30;
150
+ const maxDescriptionLength = 50;
151
+
152
+ for (let el in commands) {
153
+ let title = el;
154
+
155
+ if (commands[el].info) {
156
+ let description = commands[el].info.description;
157
+ console.log(' ' + chalk.bold(commands[el].info.title));
158
+ console.log(' ' + chalk.cyan(description));
159
+ console.log(' ');
160
+
161
+ for (let i = 0; i < commands[el].info.sub.length; i++) {
162
+ let sub = commands[el].info.sub[i];
163
+ const formattedDesc = formatDescription(
164
+ sub.description,
165
+ maxDescriptionLength
166
+ );
167
+ const dots = '.'.repeat(maxWidth - sub.title.length);
168
+ console.log(
169
+ ' ' +
170
+ chalk.cyanBright(sub.title) +
171
+ ' ' +
172
+ chalk.grey(dots) +
173
+ ' ' +
174
+ label(sub.label) +
175
+ ' ' +
176
+ chalk.white(formattedDesc)
177
+ );
178
+ }
179
+ }
180
+ }
181
+ };
182
+
148
183
  const displayBanner = () => {
149
184
  figlet('Cadriciel', function (err, data) {
150
185
  if (err) {
151
- console.log(err);
152
186
  log.error('Something went wrong...');
153
187
  return;
154
188
  }
@@ -188,7 +222,7 @@ const displayBanner = () => {
188
222
  display(CADRICIEL_COMMANDS);
189
223
  console.log(' ');
190
224
  }
191
- console.log();
225
+ console.log(' ');
192
226
  });
193
227
  };
194
228
 
@@ -205,6 +239,9 @@ const processCommands = (args) => {
205
239
  console.log(' ');
206
240
  const cmd = `node`;
207
241
  const fullArgs = [`${CADRICIEL_PATH}/${command}`, ...args.splice(1)];
242
+ const unit = require(`${CADRICIEL_PATH}/../cli/${args[0]}`)();
243
+
244
+ if (unit.info.sub) return displaySub({ unit });
208
245
 
209
246
  const child = spawn(cmd, fullArgs, {
210
247
  stdio: 'inherit',
@@ -241,16 +278,22 @@ checkVersion()
241
278
 
242
279
  console.log(framedMessage);
243
280
  loadGlobalCommands();
244
- processCommands(process.argv.splice(2));
245
- if (process.argv.length <= 2) return displayBanner();
281
+ process.argv.shift();
282
+ process.argv.shift();
283
+ if (process.argv.length <= 0) return displayBanner();
284
+ processCommands(process.argv);
246
285
  } else {
247
286
  loadGlobalCommands();
248
- processCommands(process.argv.splice(2));
249
- if (process.argv.length <= 2) return displayBanner();
287
+ process.argv.shift();
288
+ process.argv.shift();
289
+ if (process.argv.length <= 0) return displayBanner();
290
+ processCommands(process.argv);
250
291
  }
251
292
  })
252
293
  .catch((error) => {
253
294
  loadGlobalCommands();
254
- processCommands(process.argv.splice(2));
295
+ process.argv.shift();
296
+ process.argv.shift();
255
297
  if (process.argv.length <= 2) return displayBanner();
298
+ processCommands(process.argv.splice(2));
256
299
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerema/cadriciel",
3
- "version": "1.4.6",
3
+ "version": "1.4.9",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "npm": ">=8.0.0",