generator-jhipster-sentry-module 1.0.11 → 1.0.12

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,4 +1,3 @@
1
- const path = require('path');
2
1
  const fs = require('fs');
3
2
  const chalk = require('chalk');
4
3
  const semver = require('semver');
@@ -8,7 +7,6 @@ const packageJson = require('../../package.json');
8
7
  const JHIPSTER_CONFIG_KEY = 'generator-jhipster';
9
8
 
10
9
  const jhipsterConstants = {
11
- SERVER_MAIN_SRC_DIR: 'src/main/java/',
12
10
  SERVER_MAIN_RES_DIR: 'src/main/resources/',
13
11
  CLIENT_MAIN_SRC_DIR: 'src/main/webapp/'
14
12
  };
@@ -27,7 +25,7 @@ module.exports = class extends Generator {
27
25
  this.jhipsterAppConfig = yoRc[JHIPSTER_CONFIG_KEY];
28
26
 
29
27
  if (!this.jhipsterAppConfig) {
30
- this.log(chalk.red('❌ JHipster configuration missing inside .yo-rc.json'));
28
+ this.log(chalk.red('❌ JHipster config missing in .yo-rc.json'));
31
29
  process.exit(1);
32
30
  }
33
31
 
@@ -38,7 +36,6 @@ module.exports = class extends Generator {
38
36
  );
39
37
 
40
38
  const currentVersion = this.jhipsterAppConfig.jhipsterVersion;
41
-
42
39
  if (currentVersion && !semver.satisfies(currentVersion, '>=8.0.0')) {
43
40
  this.log(
44
41
  chalk.yellow(
@@ -74,11 +71,11 @@ module.exports = class extends Generator {
74
71
  const {
75
72
  baseName,
76
73
  packageName,
77
- packageFolder,
78
74
  clientFramework,
79
75
  buildTool
80
76
  } = this.jhipsterAppConfig;
81
77
 
78
+ const resourceDir = jhipsterConstants.SERVER_MAIN_RES_DIR;
82
79
  const webappDir = jhipsterConstants.CLIENT_MAIN_SRC_DIR;
83
80
 
84
81
  this.log('\n--- JHipster Config ---');
@@ -99,9 +96,24 @@ module.exports = class extends Generator {
99
96
  enabled: true,
100
97
  dsn: this.promptAnswers.sentryDsn
101
98
  };
102
-
103
99
  this.fs.writeJSON(yoRcPath, yoRc, null, 2);
104
100
 
101
+ /* ============================
102
+ Create sentry.yml
103
+ ============================= */
104
+
105
+ this.fs.copyTpl(
106
+ this.templatePath('server/sentry-application.yml.ejs'),
107
+ this.destinationPath(`${resourceDir}config/sentry.yml`),
108
+ {
109
+ jhipsterAppConfig: {
110
+ sentry: {
111
+ dsn: this.promptAnswers.sentryDsn
112
+ }
113
+ }
114
+ }
115
+ );
116
+
105
117
  /* ============================
106
118
  Backend Dependency Injection
107
119
  ============================= */
@@ -142,7 +154,7 @@ dependencies {
142
154
  }
143
155
 
144
156
  /* ============================
145
- Frontend Dependency Injection
157
+ Frontend Dependency + File
146
158
  ============================= */
147
159
 
148
160
  const packagePath = this.destinationPath('package.json');
@@ -177,17 +189,15 @@ dependencies {
177
189
  install() {
178
190
  if (!this.promptAnswers.enableSentry) return;
179
191
 
180
- const clientPackageManager =
192
+ const pkgManager =
181
193
  this.jhipsterAppConfig.clientPackageManager || 'npm';
182
194
 
183
195
  if (this.options['skip-install']) {
184
- this.log(
185
- `Run ${clientPackageManager} install manually to install dependencies`
186
- );
196
+ this.log(`Run ${pkgManager} install manually.`);
187
197
  return;
188
198
  }
189
199
 
190
- this.spawnCommandSync(clientPackageManager, ['install']);
200
+ this.spawnCommandSync(pkgManager, ['install']);
191
201
  }
192
202
 
193
203
  end() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-jhipster-sentry-module",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Adding Sentry integration to JHipster projects",
5
5
  "keywords": [
6
6
  "yeoman-generator",