@cerema/cadriciel 1.4.37 → 1.4.39
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/doctor.js +21 -15
- package/cli/global/init.js +10 -5
- package/cli/global/load.js +16 -8
- package/cli/global/upgrade.js +9 -2
- package/lib/cadriciel.js +6 -10
- package/package.json +1 -1
package/cli/global/doctor.js
CHANGED
|
@@ -15,13 +15,6 @@ module.exports = (args) => {
|
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
const extractLiquibaseVersion = (output) => {
|
|
20
|
-
const versionLine = output
|
|
21
|
-
.split('\n')
|
|
22
|
-
.find((line) => line.startsWith('Liquibase Version:'));
|
|
23
|
-
return versionLine ? versionLine.trim() : 'Version not found';
|
|
24
|
-
};
|
|
25
18
|
return {
|
|
26
19
|
info: {
|
|
27
20
|
title: 'doctor',
|
|
@@ -29,27 +22,29 @@ module.exports = (args) => {
|
|
|
29
22
|
},
|
|
30
23
|
start: () => {
|
|
31
24
|
console.log(' ');
|
|
25
|
+
|
|
32
26
|
console.log(' 🏥 ' + chalk.bold('Pré-requis globaux'));
|
|
33
27
|
console.log(' ');
|
|
34
28
|
const myTasks = [
|
|
35
29
|
{
|
|
36
30
|
title: 'Homebrew',
|
|
37
|
-
task: () =>
|
|
31
|
+
task: () => checkInstallation('brew --version'),
|
|
38
32
|
},
|
|
39
33
|
{
|
|
40
34
|
title: 'Pnpm',
|
|
41
|
-
task: () =>
|
|
35
|
+
task: () => checkInstallation('pnpm -v'),
|
|
42
36
|
},
|
|
43
37
|
{
|
|
44
38
|
title: 'Git',
|
|
45
|
-
task: () =>
|
|
39
|
+
task: () => checkInstallation('git --version'),
|
|
46
40
|
},
|
|
47
41
|
{
|
|
48
42
|
title: 'Java',
|
|
49
|
-
task: () =>
|
|
43
|
+
task: () => checkInstallation('java --version'),
|
|
50
44
|
},
|
|
51
45
|
];
|
|
52
46
|
if (platform === 'linux ') myTasks.splice(0, 1);
|
|
47
|
+
if (platform === 'win32') myTasks.splice(0, 1);
|
|
53
48
|
|
|
54
49
|
const tasks = new Listr(myTasks, {
|
|
55
50
|
concurrent: true,
|
|
@@ -60,11 +55,11 @@ module.exports = (args) => {
|
|
|
60
55
|
[
|
|
61
56
|
{
|
|
62
57
|
title: 'Docker',
|
|
63
|
-
task: () =>
|
|
58
|
+
task: () => checkInstallation('docker ps'),
|
|
64
59
|
},
|
|
65
60
|
{
|
|
66
61
|
title: 'Docker Compose',
|
|
67
|
-
task: () =>
|
|
62
|
+
task: () => checkInstallation('docker-compose --version'),
|
|
68
63
|
},
|
|
69
64
|
],
|
|
70
65
|
{ concurrent: true, exitOnError: false }
|
|
@@ -80,9 +75,20 @@ module.exports = (args) => {
|
|
|
80
75
|
' (si vous utilisez docker)'
|
|
81
76
|
);
|
|
82
77
|
console.log(' ');
|
|
83
|
-
dockerTasks.run().
|
|
78
|
+
dockerTasks.run().then(()=>{
|
|
79
|
+
}).catch((err) => {});
|
|
84
80
|
})
|
|
85
|
-
.catch((err) => {
|
|
81
|
+
.catch((err) => {
|
|
82
|
+
console.log(' ');
|
|
83
|
+
console.log(
|
|
84
|
+
' 📦 ' +
|
|
85
|
+
chalk.bold('Pré-requis Docker') +
|
|
86
|
+
' (si vous utilisez docker)'
|
|
87
|
+
);
|
|
88
|
+
console.log(' ');
|
|
89
|
+
dockerTasks.run().then(()=>{
|
|
90
|
+
}).catch((err) => {});
|
|
91
|
+
});
|
|
86
92
|
},
|
|
87
93
|
};
|
|
88
94
|
};
|
package/cli/global/init.js
CHANGED
|
@@ -61,12 +61,17 @@ Host cadriciel
|
|
|
61
61
|
try {
|
|
62
62
|
fs.mkdirSync(userHome + '/.ssh');
|
|
63
63
|
} catch (e) {}
|
|
64
|
+
try {
|
|
64
65
|
var ssh = fs.readFileSync(userHome + '/.ssh/config', 'utf-8');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
} catch(e) {
|
|
67
|
+
var ssh='';
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
if (!ssh.includes('87c7dfbf-172a-4084-a862-4a23f35a5b79 ')) {
|
|
71
|
+
ssh += '\n\n' + sshtemplate;
|
|
72
|
+
fs.writeFileSync(userHome + '/.ssh/config', ssh, { flag: 'a' });
|
|
73
|
+
fs.chmodSync(userHome + '/.ssh/config', 0o600);
|
|
74
|
+
}
|
|
70
75
|
} catch (e) {
|
|
71
76
|
console.log(e);
|
|
72
77
|
error(
|
package/cli/global/load.js
CHANGED
|
@@ -10,6 +10,11 @@ module.exports = (args) => {
|
|
|
10
10
|
const userHome = require('os').homedir();
|
|
11
11
|
const { error } = require(path.join('..', '..', 'lib', 'message'));
|
|
12
12
|
const { getTemplates } = require(path.join('..', '..', 'lib', 'util'));
|
|
13
|
+
|
|
14
|
+
const CadricielAPI = require(path.join('..', '..', 'lib', 'cadriciel'));
|
|
15
|
+
const cadriciel = new CadricielAPI();
|
|
16
|
+
var templates = [];
|
|
17
|
+
|
|
13
18
|
const link = (url, name) => {
|
|
14
19
|
if (!name) name = url;
|
|
15
20
|
if (url.includes('localhost')) url = 'http://' + url + '/';
|
|
@@ -31,12 +36,17 @@ module.exports = (args) => {
|
|
|
31
36
|
try {
|
|
32
37
|
fs.mkdirSync(userHome + '/.ssh');
|
|
33
38
|
} catch (e) {}
|
|
39
|
+
try {
|
|
34
40
|
var ssh = fs.readFileSync(userHome + '/.ssh/config', 'utf-8');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
} catch(e) {
|
|
42
|
+
var ssh='';
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
if (!ssh.includes('87c7dfbf-172a-4084-a862-4a23f35a5b79 ')) {
|
|
46
|
+
ssh += '\n\n' + sshtemplate;
|
|
47
|
+
fs.writeFileSync(userHome + '/.ssh/config', ssh, { flag: 'a' });
|
|
48
|
+
fs.chmodSync(userHome + '/.ssh/config', 0o600);
|
|
49
|
+
}
|
|
40
50
|
} catch (e) {
|
|
41
51
|
console.log(e);
|
|
42
52
|
error(
|
|
@@ -53,9 +63,7 @@ Host cadriciel
|
|
|
53
63
|
IdentitiesOnly yes
|
|
54
64
|
# -----------------------------------------------------
|
|
55
65
|
`;
|
|
56
|
-
|
|
57
|
-
const cadriciel = new CadricielAPI();
|
|
58
|
-
var templates = [];
|
|
66
|
+
|
|
59
67
|
|
|
60
68
|
/** loading the project */
|
|
61
69
|
const load = async (uri, title) => {
|
package/cli/global/upgrade.js
CHANGED
|
@@ -77,11 +77,18 @@ module.exports = (args) => {
|
|
|
77
77
|
description: 'upgrade cadriciel framework',
|
|
78
78
|
},
|
|
79
79
|
start: () => {
|
|
80
|
+
console.log(' ');
|
|
80
81
|
var spinner = ora('📥 Téléchargement du patch...').start();
|
|
81
82
|
try {
|
|
82
|
-
var info = require(
|
|
83
|
+
var info = require(path.join(process.cwd(),'.cadriciel','version.json'));
|
|
83
84
|
} catch (e) {
|
|
84
|
-
|
|
85
|
+
try {
|
|
86
|
+
var info = require(path.join(process.cwd(),'.cadriciel','bin','version.json'));
|
|
87
|
+
} catch (e) {
|
|
88
|
+
spinner.fail('upgrade doit être lancé à partir de votre projet.');
|
|
89
|
+
console.log(' ');
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
85
92
|
}
|
|
86
93
|
const title = 'cadriciel-' + info.name;
|
|
87
94
|
download(title, async () => {
|
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
|
|