@hed-hog/cli 0.0.87 → 0.0.88

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/cli",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
4
4
  "description": "HedHog CLI tool",
5
5
  "author": "HedHog",
6
6
  "private": false,
@@ -13,6 +13,7 @@ export declare class DeveloperService {
13
13
  private readonly database;
14
14
  private readonly hedHogService;
15
15
  private verbose;
16
+ private readonly processedSharedWidgets;
16
17
  private readonly bootstrapIgnoredEntries;
17
18
  constructor(runner: RunnerService, fileSystem: FileSystemService, database: DatabaseService, hedHogService: HedHogService);
18
19
  log(...args: any[]): void;
@@ -35,6 +35,7 @@ let DeveloperService = class DeveloperService {
35
35
  database;
36
36
  hedHogService;
37
37
  verbose = false;
38
+ processedSharedWidgets = new Set();
38
39
  bootstrapIgnoredEntries = new Set([
39
40
  '.git',
40
41
  'node_modules',
@@ -3401,25 +3402,28 @@ temp
3401
3402
  else {
3402
3403
  this.log(chalk.yellow(`Frontend public assets folder not found at ${publicSourcePath}`));
3403
3404
  }
3404
- // Copy dashboard widgets for this library based on the filename prefix
3405
+ // Copy shared dashboard widgets back into the correct library by filename prefix
3405
3406
  const widgetsSourcePath = pathModule.join(cwd, 'apps', 'admin', 'src', 'app', '(app)', '(libraries)', 'core', 'dashboard', 'components', 'widgets');
3406
- const widgetsDestPath = pathModule.join(cwd, 'libraries', name, 'hedhog', 'frontend', 'widgets');
3407
+ const librariesRootPath = pathModule.join(cwd, 'libraries');
3407
3408
  if (await this.fileSystem.exists(widgetsSourcePath)) {
3408
- this.log(`Found shared widgets at ${widgetsSourcePath}, exporting files with prefix "${name}."...`);
3409
- try {
3410
- spinner.text = `Copying widgets for ${name}...`;
3411
- const copiedWidgetsCount = await this.fileSystem.copyDirectoryAddingEjsExtension(widgetsSourcePath, widgetsDestPath, name, true);
3412
- if (copiedWidgetsCount > 0) {
3413
- this.log(chalk.green(`${copiedWidgetsCount} widget(s) copied successfully to ${widgetsDestPath}`));
3409
+ if (!this.processedSharedWidgets.has(widgetsSourcePath)) {
3410
+ this.processedSharedWidgets.add(widgetsSourcePath);
3411
+ this.log(`Found shared widgets at ${widgetsSourcePath}, exporting files by prefix to each library...`);
3412
+ try {
3413
+ spinner.text = 'Copying shared widgets to libraries...';
3414
+ const copiedWidgetsCount = await this.fileSystem.copyPrefixedFilesToLibrariesWithEjsExtension(widgetsSourcePath, librariesRootPath, ['hedhog', 'frontend', 'widgets']);
3415
+ if (copiedWidgetsCount > 0) {
3416
+ this.log(chalk.green(`${copiedWidgetsCount} widget(s) copied successfully to their library frontend/widgets directories`));
3417
+ }
3418
+ else {
3419
+ this.log(chalk.yellow(`No prefixed widgets found to export from ${widgetsSourcePath}`));
3420
+ }
3414
3421
  }
3415
- else {
3416
- this.log(chalk.yellow(`No widgets found with prefix "${name}." at ${widgetsSourcePath}`));
3422
+ catch (error) {
3423
+ this.log(chalk.red(`Error copying widgets: ${error.message}`));
3424
+ throw error;
3417
3425
  }
3418
3426
  }
3419
- catch (error) {
3420
- this.log(chalk.red(`Error copying widgets: ${error.message}`));
3421
- throw error;
3422
- }
3423
3427
  }
3424
3428
  else {
3425
3429
  this.log(chalk.yellow(`Widgets folder not found at ${widgetsSourcePath}`));