@cerema/cadriciel 1.2.3 → 1.2.5

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.
@@ -1,24 +1,25 @@
1
1
  module.exports = (args) => {
2
2
  const chalk = require('chalk-v2');
3
3
  const ora = require('ora');
4
+ const os = require('os');
4
5
  const fs = require('fs');
5
6
  const { spawn } = require('child_process');
6
7
  const HOSTS_PATH = '/etc/hosts';
7
8
  const MAPPING_ENTRY = '127.0.0.1 keycloak';
8
9
 
9
10
  function addMapping() {
10
- const hostsContent = fs.readFileSync(HOSTS_PATH, 'utf8');
11
- if (!hostsContent.includes(MAPPING_ENTRY)) {
12
- try {
11
+ try {
12
+ const hostsContent = fs.readFileSync(HOSTS_PATH, 'utf8');
13
+ if (!hostsContent.includes(MAPPING_ENTRY)) {
13
14
  fs.appendFileSync(HOSTS_PATH, os.EOL + MAPPING_ENTRY);
14
- } catch (e) {
15
- console.error(
16
- chalk.red.bold(
17
- "\nVous devez lancer la commande en tant qu'administrateur.\n"
18
- )
19
- );
20
- return process.exit(0);
21
15
  }
16
+ } catch (e) {
17
+ console.error(
18
+ chalk.red.bold(
19
+ "\nVous devez lancer la commande en tant qu'administrateur.\n"
20
+ )
21
+ );
22
+ return process.exit(0);
22
23
  }
23
24
  }
24
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerema/cadriciel",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "npm": ">=8.0.0",