@cerema/cadriciel 1.5.0 → 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/load.js +21 -4
- package/package.json +1 -1
package/cli/global/load.js
CHANGED
|
@@ -101,12 +101,29 @@ Host cadriciel
|
|
|
101
101
|
.replace('git@', 'https://')
|
|
102
102
|
.replace('.git', '');
|
|
103
103
|
try {
|
|
104
|
+
const cwd = process.cwd() + '/' + title;
|
|
105
|
+
// Configurer l'utilisateur Git
|
|
104
106
|
await execPromise(
|
|
105
|
-
`git config --local user.email "${user.info.email}" && git config --local user.name "${user.info.name}"
|
|
106
|
-
{
|
|
107
|
-
cwd: process.cwd() + '/' + title,
|
|
108
|
-
}
|
|
107
|
+
`git config --local user.email "${user.info.email}" && git config --local user.name "${user.info.name}"`,
|
|
108
|
+
{ cwd }
|
|
109
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 });
|
|
110
127
|
step2.succeed(
|
|
111
128
|
'🎉 ' + chalk.bold('Votre projet a été correctement installé')
|
|
112
129
|
);
|