generator-jhipster-yellowbricks 1.2.0 → 1.2.2

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,6 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { createRequire } from 'node:module';
3
- import { join } from 'node:path';
3
+ import { dirname, join } from 'node:path';
4
4
 
5
5
  import BaseApplicationGenerator from 'generator-jhipster/generators/base-application';
6
6
  import stripJsonComments from 'strip-json-comments';
@@ -30,31 +30,31 @@ export default class extends BaseApplicationGenerator {
30
30
  get [BaseApplicationGenerator.COMPOSING]() {
31
31
  return this.asComposingTaskGroup({
32
32
  async composeBricks() {
33
- this.log.info('');
34
- this.log.info('========================================');
35
- this.log.info(' YellowBricks blueprint ');
36
- this.log.info('========================================');
37
- this.log.info('');
33
+ console.log('');
34
+ console.log('========================================');
35
+ console.log(' YellowBricks blueprint ');
36
+ console.log('========================================');
37
+ console.log('');
38
38
 
39
39
  let useList = this.blueprintConfig.use ?? [];
40
40
 
41
41
  const jsoncPath = join(this.destinationRoot(), '.yellowbricks.jsonc');
42
42
  try {
43
43
  const raw = await readFile(jsoncPath, 'utf8');
44
- this.log.info('[yellowbricks] reading config from .yellowbricks.jsonc');
44
+ console.log('[yellowbricks] reading config from .yellowbricks.jsonc');
45
45
 
46
46
  let parsed;
47
47
  try {
48
48
  // strip-json-comments removes // and /* */ but leaves trailing commas — strip those too
49
49
  parsed = JSON.parse(stripJsonComments(raw).replace(/,(?=\s*[}\]])/g, ''));
50
50
  } catch (e) {
51
- this.log.error(`[yellowbricks] failed to parse .yellowbricks.jsonc: ${e.message}`);
51
+ console.error(`[yellowbricks] failed to parse .yellowbricks.jsonc: ${e.message}`);
52
52
  parsed = {};
53
53
  }
54
54
 
55
55
  if (Array.isArray(parsed.use)) {
56
56
  useList = parsed.use;
57
- this.log.info(`[yellowbricks] found ${useList.length} brick(s) to activate`);
57
+ console.log(`[yellowbricks] found ${useList.length} brick(s) to activate`);
58
58
  }
59
59
 
60
60
  // Merge brick configs into .yo-rc.json so child generators can read them
@@ -69,9 +69,9 @@ export default class extends BaseApplicationGenerator {
69
69
  this.fs.writeJSON(yorcPath, yorc);
70
70
  } catch (e) {
71
71
  if (e.code === 'ENOENT') {
72
- this.log.info('[yellowbricks] no .yellowbricks.jsonc found, falling back to .yo-rc.json');
72
+ console.log('[yellowbricks] no .yellowbricks.jsonc found, falling back to .yo-rc.json');
73
73
  } else {
74
- this.log.error(`[yellowbricks] error reading .yellowbricks.jsonc: ${e.message}`);
74
+ console.error(`[yellowbricks] error reading .yellowbricks.jsonc: ${e.message}`);
75
75
  }
76
76
  }
77
77
 
@@ -80,14 +80,17 @@ export default class extends BaseApplicationGenerator {
80
80
  for (const pkgName of requested) {
81
81
  const gen = getGen(pkgName);
82
82
  if (!KNOWN_BRICKS.has(pkgName)) {
83
- this.log.info(`[yellowbricks] unofficial brick "${pkgName}", trying to run for generator=${gen}`);
83
+ console.log(`[yellowbricks] unofficial brick "${pkgName}", trying to run for generator=${gen}`);
84
84
  }
85
85
  try {
86
86
  const resolved = require.resolve(`${pkgName}/generators/${gen}`);
87
- await this.composeWith(resolved);
88
- this.log.info(`[yellowbricks] activated brick: ${pkgName}`);
87
+ const packagePath = dirname(require.resolve(`${pkgName}/package.json`));
88
+ const namespace = `${pkgName}:${gen}`;
89
+ this.env.register(resolved, { namespace, packagePath });
90
+ await this.composeWith(namespace);
91
+ console.log(`[yellowbricks] activated brick: ${pkgName}`);
89
92
  } catch {
90
- this.log.error(
93
+ console.error(
91
94
  `[yellowbricks] could not load brick "${pkgName}" — check it is installed and has a generators/${gen} entry point`,
92
95
  );
93
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-jhipster-yellowbricks",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Yellowbricks main blueprint — orchestrates all yellowbricks in a single JHipster blueprint",
5
5
  "keywords": [
6
6
  "yeoman-generator",