@cerema/cadriciel 1.4.39 β 1.5.1
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/doc.js +1 -1
- package/cli/global/init.js +10 -11
- package/cli/global/load.js +31 -16
- package/cli.js +1 -1
- package/package.json +1 -1
package/cli/global/doc.js
CHANGED
package/cli/global/init.js
CHANGED
|
@@ -62,16 +62,15 @@ Host cadriciel
|
|
|
62
62
|
fs.mkdirSync(userHome + '/.ssh');
|
|
63
63
|
} catch (e) {}
|
|
64
64
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
65
|
+
var ssh = fs.readFileSync(userHome + '/.ssh/config', 'utf-8');
|
|
66
|
+
} catch (e) {
|
|
67
|
+
var ssh = '';
|
|
68
|
+
}
|
|
69
|
+
if (!ssh.includes('87c7dfbf-172a-4084-a862-4a23f35a5b79 ')) {
|
|
70
|
+
ssh += '\n\n' + sshtemplate;
|
|
71
|
+
fs.writeFileSync(userHome + '/.ssh/config', ssh, { flag: 'a' });
|
|
72
|
+
fs.chmodSync(userHome + '/.ssh/config', 0o600);
|
|
73
|
+
}
|
|
75
74
|
} catch (e) {
|
|
76
75
|
console.log(e);
|
|
77
76
|
error(
|
|
@@ -166,7 +165,7 @@ Host cadriciel
|
|
|
166
165
|
|
|
167
166
|
π» ${chalk.bold('Pour manager votre projet :')}
|
|
168
167
|
|
|
169
|
-
π ${link('studio.
|
|
168
|
+
π ${link('studio.cerema.dev', 'studio.cerema.dev')}
|
|
170
169
|
|
|
171
170
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);
|
|
172
171
|
console.log(' ');
|
package/cli/global/load.js
CHANGED
|
@@ -37,16 +37,15 @@ module.exports = (args) => {
|
|
|
37
37
|
fs.mkdirSync(userHome + '/.ssh');
|
|
38
38
|
} catch (e) {}
|
|
39
39
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
40
|
+
var ssh = fs.readFileSync(userHome + '/.ssh/config', 'utf-8');
|
|
41
|
+
} catch (e) {
|
|
42
|
+
var ssh = '';
|
|
43
|
+
}
|
|
44
|
+
if (!ssh.includes('87c7dfbf-172a-4084-a862-4a23f35a5b79 ')) {
|
|
45
|
+
ssh += '\n\n' + sshtemplate;
|
|
46
|
+
fs.writeFileSync(userHome + '/.ssh/config', ssh, { flag: 'a' });
|
|
47
|
+
fs.chmodSync(userHome + '/.ssh/config', 0o600);
|
|
48
|
+
}
|
|
50
49
|
} catch (e) {
|
|
51
50
|
console.log(e);
|
|
52
51
|
error(
|
|
@@ -64,7 +63,6 @@ Host cadriciel
|
|
|
64
63
|
# -----------------------------------------------------
|
|
65
64
|
`;
|
|
66
65
|
|
|
67
|
-
|
|
68
66
|
/** loading the project */
|
|
69
67
|
const load = async (uri, title) => {
|
|
70
68
|
console.log(' ');
|
|
@@ -103,12 +101,29 @@ Host cadriciel
|
|
|
103
101
|
.replace('git@', 'https://')
|
|
104
102
|
.replace('.git', '');
|
|
105
103
|
try {
|
|
104
|
+
const cwd = process.cwd() + '/' + title;
|
|
105
|
+
// Configurer l'utilisateur Git
|
|
106
106
|
await execPromise(
|
|
107
|
-
`git config --local user.email "${user.info.email}" && git config --local user.name "${user.info.name}"
|
|
108
|
-
{
|
|
109
|
-
cwd: process.cwd() + '/' + title,
|
|
110
|
-
}
|
|
107
|
+
`git config --local user.email "${user.info.email}" && git config --local user.name "${user.info.name}"`,
|
|
108
|
+
{ cwd }
|
|
111
109
|
);
|
|
110
|
+
|
|
111
|
+
// VΓ©rifier si la branche existe sur le serveur
|
|
112
|
+
try {
|
|
113
|
+
await execPromise(
|
|
114
|
+
`git fetch origin ${user.trigram}:${user.trigram}`,
|
|
115
|
+
{ cwd }
|
|
116
|
+
);
|
|
117
|
+
// La branche existe et a été créée localement, basculer dessus
|
|
118
|
+
await execPromise(`git checkout ${user.trigram}`, { cwd });
|
|
119
|
+
} catch (error) {
|
|
120
|
+
// La branche n'existe pas sur le serveur, la crΓ©er localement et la pousser
|
|
121
|
+
await execPromise(`git checkout -b ${user.trigram}`, { cwd });
|
|
122
|
+
await execPromise(`git push -u origin ${user.trigram}`, { cwd });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Configurer le rebase automatique pour les pulls
|
|
126
|
+
await execPromise('git config pull.rebase true', { cwd });
|
|
112
127
|
step2.succeed(
|
|
113
128
|
'π ' + chalk.bold('Votre projet a Γ©tΓ© correctement installΓ©')
|
|
114
129
|
);
|
|
@@ -132,7 +147,7 @@ Host cadriciel
|
|
|
132
147
|
|
|
133
148
|
π» ${chalk.bold('Pour manager votre projet :')}
|
|
134
149
|
|
|
135
|
-
π ${link('studio.
|
|
150
|
+
π ${link('studio.cerema.dev', 'studio.cerema.dev')}
|
|
136
151
|
|
|
137
152
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ`);
|
|
138
153
|
console.log(' ');
|
package/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ const boxen = require('boxen'); // For creating boxes in the console.
|
|
|
12
12
|
// Locating the '.cadriciel' directory starting from the current working directory.
|
|
13
13
|
const CADRICIEL_PATH = findCadricielDir(process.cwd());
|
|
14
14
|
const CADRICIEL_COMMAND = 'cad';
|
|
15
|
-
global.CADRICIEL_URI = 'https://cadriciel.
|
|
15
|
+
global.CADRICIEL_URI = 'https://cadriciel.cerema.dev/api';
|
|
16
16
|
//global.CADRICIEL_URI = 'http://localhost:3000/api';
|
|
17
17
|
|
|
18
18
|
// Initialize command storage objects.
|