@cerema/cadriciel 1.4.36 → 1.4.38

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.
@@ -103,9 +103,15 @@ Host cadriciel
103
103
  const step1 = ora('📥 Téléchargement du projet en cours...').start();
104
104
  try {
105
105
  await updatePK();
106
- const git = await execPromise('git clone ' + response.prj.uri, {
107
- cwd: process.cwd(),
108
- });
106
+ try {
107
+ const git = await execPromise('git clone ' + response.prj.uri, {
108
+ cwd: process.cwd(),
109
+ });
110
+ } catch (e) {
111
+ step1.fail(chalk.red.bold(e.message.split('fatal :')[1]));
112
+ process.exit(1);
113
+ }
114
+
109
115
  step1.succeed(chalk.bold('Téléchargement OK.'));
110
116
  console.log(' ');
111
117
  const step2 = ora('📦 Installation des dépendances...').start();
@@ -61,9 +61,14 @@ Host cadriciel
61
61
  const load = async (uri, title) => {
62
62
  console.log(' ');
63
63
  const step1 = ora('📥 Téléchargement du projet en cours...').start();
64
- const git = await execPromise('git clone ' + uri, {
65
- cwd: process.cwd(),
66
- });
64
+ try {
65
+ const git = await execPromise('git clone ' + uri, {
66
+ cwd: process.cwd(),
67
+ });
68
+ } catch (e) {
69
+ step1.fail(chalk.red.bold(e.message.split('fatal :')[1]));
70
+ process.exit(1);
71
+ }
67
72
  step1.succeed(chalk.bold('Téléchargement OK.'));
68
73
  console.log(' ');
69
74
  const step2 = ora('📦 Installation des dépendances...').start();
package/lib/cadriciel.js CHANGED
@@ -5,28 +5,24 @@ const fs = require('fs');
5
5
  const os = require('os');
6
6
  const HomeDir = os.homedir() + '/.cadriciel';
7
7
  const { error } = require('./message');
8
+ const https = require('https');
8
9
  var baseURL = global.CADRICIEL_URI;
9
10
  class CadricielAPI {
10
11
  constructor(token) {
12
+ const httpsAgent = new https.Agent({
13
+ rejectUnauthorized: false,
14
+ });
11
15
  if (!token) {
12
16
  try {
13
17
  token = fs.readFileSync(HomeDir + '/account', 'utf-8');
14
18
  token = token.replace(/\n/g, '');
15
- } catch (e) {
16
- /*console.log(e);
17
- console.log(
18
- chalk.bold(' [AUTH] ') +
19
- chalk.red(
20
- ' Vous devez être authentifié pour utiliser cette fonctionnalité.'
21
- )
22
- );
23
- return process.exit(1);*/
24
- }
19
+ } catch (e) {}
25
20
  }
26
21
  this.client = axios.create({
27
22
  baseURL: baseURL,
28
23
  timeout: 10000,
29
24
  headers: { Authorization: 'Bearer ' + token },
25
+ httpsAgent: httpsAgent,
30
26
  });
31
27
  }
32
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerema/cadriciel",
3
- "version": "1.4.36",
3
+ "version": "1.4.38",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "npm": ">=8.0.0",