generator-jhipster-sentry-module 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -30,6 +30,34 @@ To update this module:
30
30
  npm update -g generator-jhipster-sentry-module
31
31
  ```
32
32
 
33
+ **Required:** Install JHipster globally so the module can find it when run from any directory:
34
+
35
+ ```bash
36
+ npm install -g generator-jhipster
37
+ ```
38
+
39
+ ## Publish and use globally (maintainers)
40
+
41
+ To publish this module to npm so anyone can install and use it globally:
42
+
43
+ 1. **From the module repo** – bump version and publish:
44
+ ```bash
45
+ cd /path/to/generator-jhipster-sentry-module
46
+ npm version patch -m "Release %s"
47
+ npm publish
48
+ ```
49
+ 2. **Install globally** (on any machine):
50
+ ```bash
51
+ npm install -g generator-jhipster-sentry-module
52
+ npm install -g generator-jhipster
53
+ ```
54
+ 3. **Run from any directory** (e.g. a JHipster app or empty folder):
55
+ ```bash
56
+ yo jhipster-sentry-module
57
+ ```
58
+
59
+ The module resolves `generator-jhipster` from the current directory’s `node_modules` or from the global npm install, so it works after a global install.
60
+
33
61
  ## With Yarn
34
62
 
35
63
  To install this module:
@@ -24,8 +24,21 @@ function resolveGeneratorJhipster() {
24
24
  }
25
25
 
26
26
  const jhipsterRoot = resolveGeneratorJhipster();
27
- const GeneratorBase = require(path.join(jhipsterRoot, 'generators', 'generator-base'));
28
- const jhipsterConstants = require(path.join(jhipsterRoot, 'generators', 'generator-constants'));
27
+ // v8+ publishes built files under dist/generators/<name>/index.js; older versions use generators/<name>.js
28
+ function requireJhipsterSubpath(subpath) {
29
+ const distPath = path.join(jhipsterRoot, 'dist', 'generators', subpath, 'index.js');
30
+ const legacyPath = path.join(jhipsterRoot, 'generators', subpath);
31
+ const fs = require('fs');
32
+ if (fs.existsSync(distPath)) {
33
+ return require(distPath);
34
+ }
35
+ if (fs.existsSync(legacyPath) || fs.existsSync(`${legacyPath}.js`)) {
36
+ return require(legacyPath);
37
+ }
38
+ throw new Error(`Could not find generator-jhipster subpath: ${subpath}`);
39
+ }
40
+ const GeneratorBase = requireJhipsterSubpath('generator-base');
41
+ const jhipsterConstants = requireJhipsterSubpath('generator-constants');
29
42
  const packageJson = require('../../package.json');
30
43
 
31
44
  module.exports = class extends GeneratorBase {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-jhipster-sentry-module",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Adding Sentry integration to JHipster projects",
5
5
  "keywords": [
6
6
  "yeoman-generator",