@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 CHANGED
@@ -6,7 +6,7 @@ module.exports = (args) => {
6
6
  description: `Documentation du cadriciel`,
7
7
  },
8
8
  start: async () => {
9
- var url = 'https://docs.k8-dev.cerema.fr/';
9
+ var url = 'https://docs.cerema.dev/';
10
10
  var start =
11
11
  process.platform == 'darwin'
12
12
  ? 'open'
@@ -62,16 +62,15 @@ Host cadriciel
62
62
  fs.mkdirSync(userHome + '/.ssh');
63
63
  } catch (e) {}
64
64
  try {
65
- var ssh = fs.readFileSync(userHome + '/.ssh/config', 'utf-8');
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
- }
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.k8-dev.cerema.fr', 'studio.k8-dev.cerema.fr')}
168
+ πŸ‘‰ ${link('studio.cerema.dev', 'studio.cerema.dev')}
170
169
 
171
170
  ──────────────────────────────────────────────────────────────`);
172
171
  console.log(' ');
@@ -37,16 +37,15 @@ module.exports = (args) => {
37
37
  fs.mkdirSync(userHome + '/.ssh');
38
38
  } catch (e) {}
39
39
  try {
40
- var ssh = fs.readFileSync(userHome + '/.ssh/config', 'utf-8');
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
+ 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}" && git add --all && git checkout -b ${user.trigram} && git config pull.rebase true`,
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.k8-dev.cerema.fr', 'studio.k8-dev.cerema.fr')}
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.k8-dev.cerema.fr/api';
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerema/cadriciel",
3
- "version": "1.4.39",
3
+ "version": "1.5.1",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "npm": ">=8.0.0",