@hed-hog/cli 0.0.40 → 0.0.42

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.40",
3
+ "version": "0.0.42",
4
4
  "description": "HedHog CLI tool",
5
5
  "author": "HedHog",
6
6
  "private": false,
@@ -10,6 +10,7 @@ exports.AppModule = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const add_command_1 = require("./commands/add.command");
12
12
  const dev_command_1 = require("./commands/dev.command");
13
+ const assets_to_library_subcommand_1 = require("./commands/dev.command/assets-to-library.subcommand");
13
14
  const backupdb_subcommand_1 = require("./commands/dev.command/backupdb.subcommand");
14
15
  const create_library_subcommand_1 = require("./commands/dev.command/create-library.subcommand");
15
16
  const deploy_config_subcommand_1 = require("./commands/dev.command/deploy-config.subcommand");
@@ -64,6 +65,7 @@ exports.AppModule = AppModule = __decorate([
64
65
  list_packages_subcommand_1.ListPackagesCommand,
65
66
  install_all_subcommand_1.InstallAllCommand,
66
67
  deploy_config_subcommand_1.DeployConfigCommand,
68
+ assets_to_library_subcommand_1.AssetsToLibraryCommand,
67
69
  ],
68
70
  })
69
71
  ], AppModule);
@@ -1 +1 @@
1
- {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,wDAAoD;AACpD,wDAAoD;AACpD,oFAA6E;AAC7E,gGAAwF;AACxF,8FAAsF;AACtF,gGAAwF;AACxF,gFAAyE;AACzE,0FAAkF;AAClF,kGAA0F;AAC1F,8FAAsF;AACtF,8EAAuE;AACvE,sFAA+E;AAC/E,8EAAuE;AACvE,4FAAoF;AACpF,oFAA6E;AAC7E,oGAA4F;AAC5F,wDAAoD;AACpD,wEAAoE;AACpE,2EAAuE;AACvE,yDAAqD;AACrD,kEAA8D;AAC9D,qEAAiE;AACjE,kEAA8D;AAC9D,6EAAwE;AAgCjE,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IA9BrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,8BAAa;YACb,sBAAS;YACT,4BAAY;YACZ,gCAAc;YACd,kCAAe;SAChB;QACD,SAAS,EAAE;YACT,wBAAU;YACV,wBAAU;YACV,2CAAmB;YACnB,wBAAU;YACV,qCAAe;YACf,gDAAoB;YACpB,gDAAoB;YACpB,+BAAY;YACZ,qCAAe;YACf,+BAAY;YACZ,iCAAa;YACb,uCAAgB;YAChB,oDAAsB;YACtB,kDAAqB;YACrB,4CAAkB;YAClB,8CAAmB;YACnB,0CAAiB;YACjB,8CAAmB;SACpB;KACF,CAAC;GACW,SAAS,CAAG"}
1
+ {"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,wDAAoD;AACpD,wDAAoD;AACpD,sGAA6F;AAC7F,oFAA6E;AAC7E,gGAAwF;AACxF,8FAAsF;AACtF,gGAAwF;AACxF,gFAAyE;AACzE,0FAAkF;AAClF,kGAA0F;AAC1F,8FAAsF;AACtF,8EAAuE;AACvE,sFAA+E;AAC/E,8EAAuE;AACvE,4FAAoF;AACpF,oFAA6E;AAC7E,oGAA4F;AAC5F,wDAAoD;AACpD,wEAAoE;AACpE,2EAAuE;AACvE,yDAAqD;AACrD,kEAA8D;AAC9D,qEAAiE;AACjE,kEAA8D;AAC9D,6EAAwE;AAiCjE,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,8BAAS;oBAAT,SAAS;IA/BrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,8BAAa;YACb,sBAAS;YACT,4BAAY;YACZ,gCAAc;YACd,kCAAe;SAChB;QACD,SAAS,EAAE;YACT,wBAAU;YACV,wBAAU;YACV,2CAAmB;YACnB,wBAAU;YACV,qCAAe;YACf,gDAAoB;YACpB,gDAAoB;YACpB,+BAAY;YACZ,qCAAe;YACf,+BAAY;YACZ,iCAAa;YACb,uCAAgB;YAChB,oDAAsB;YACtB,kDAAqB;YACrB,4CAAkB;YAClB,8CAAmB;YACnB,0CAAiB;YACjB,8CAAmB;YACnB,qDAAsB;SACvB;KACF,CAAC;GACW,SAAS,CAAG"}
@@ -0,0 +1,11 @@
1
+ import { CommandRunner } from 'nest-commander';
2
+ import { DeveloperService } from 'src/modules/developer/developer.service';
3
+ export declare class AssetsToLibraryCommand extends CommandRunner {
4
+ private readonly developer;
5
+ private verbose;
6
+ constructor(developer: DeveloperService);
7
+ run(args: string[], { verbose }: {
8
+ verbose: any;
9
+ }): Promise<void>;
10
+ parseVerboseOption(): boolean;
11
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AssetsToLibraryCommand = void 0;
13
+ const nest_commander_1 = require("nest-commander");
14
+ const developer_service_1 = require("../../modules/developer/developer.service");
15
+ let AssetsToLibraryCommand = class AssetsToLibraryCommand extends nest_commander_1.CommandRunner {
16
+ developer;
17
+ verbose = false;
18
+ constructor(developer) {
19
+ super();
20
+ this.developer = developer;
21
+ }
22
+ async run(args, { verbose }) {
23
+ this.verbose = verbose;
24
+ for (const arg of args) {
25
+ await this.developer.copyAssetsToLibrary(arg, process.cwd(), verbose);
26
+ }
27
+ }
28
+ parseVerboseOption() {
29
+ return true;
30
+ }
31
+ };
32
+ exports.AssetsToLibraryCommand = AssetsToLibraryCommand;
33
+ __decorate([
34
+ (0, nest_commander_1.Option)({
35
+ flags: '-v, --verbose',
36
+ description: 'Enable verbose output',
37
+ required: false,
38
+ }),
39
+ __metadata("design:type", Function),
40
+ __metadata("design:paramtypes", []),
41
+ __metadata("design:returntype", Boolean)
42
+ ], AssetsToLibraryCommand.prototype, "parseVerboseOption", null);
43
+ exports.AssetsToLibraryCommand = AssetsToLibraryCommand = __decorate([
44
+ (0, nest_commander_1.SubCommand)({
45
+ name: 'assets-to-library',
46
+ aliases: ['atl'],
47
+ description: 'Copy assets to the library',
48
+ arguments: '[...name]',
49
+ }),
50
+ __metadata("design:paramtypes", [developer_service_1.DeveloperService])
51
+ ], AssetsToLibraryCommand);
52
+ //# sourceMappingURL=assets-to-library.subcommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets-to-library.subcommand.js","sourceRoot":"","sources":["../../../../src/commands/dev.command/assets-to-library.subcommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAmE;AACnE,iFAA2E;AAQpE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,8BAAa;IAG1B;IAFrB,OAAO,GAAY,KAAK,CAAC;IAEjC,YAA6B,SAA2B;QACtD,KAAK,EAAE,CAAC;QADmB,cAAS,GAAT,SAAS,CAAkB;IAExD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAc,EAAE,EAAE,OAAO,EAAE;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAOD,kBAAkB;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAvBY,wDAAsB;AAoBjC;IALC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,KAAK;KAChB,CAAC;;;;gEAGD;iCAtBU,sBAAsB;IANlC,IAAA,2BAAU,EAAC;QACV,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,CAAC,KAAK,CAAC;QAChB,WAAW,EAAE,4BAA4B;QACzC,SAAS,EAAE,WAAW;KACvB,CAAC;qCAIwC,oCAAgB;GAH7C,sBAAsB,CAuBlC"}
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.DevCommand = void 0;
10
10
  const nest_commander_1 = require("nest-commander");
11
+ const assets_to_library_subcommand_1 = require("./dev.command/assets-to-library.subcommand");
11
12
  const backupdb_subcommand_1 = require("./dev.command/backupdb.subcommand");
12
13
  const create_library_subcommand_1 = require("./dev.command/create-library.subcommand");
13
14
  const deploy_config_subcommand_1 = require("./dev.command/deploy-config.subcommand");
@@ -46,6 +47,7 @@ exports.DevCommand = DevCommand = __decorate([
46
47
  list_packages_subcommand_1.ListPackagesCommand,
47
48
  install_all_subcommand_1.InstallAllCommand,
48
49
  deploy_config_subcommand_1.DeployConfigCommand,
50
+ assets_to_library_subcommand_1.AssetsToLibraryCommand,
49
51
  ],
50
52
  })
51
53
  ], DevCommand);
@@ -1 +1 @@
1
- {"version":3,"file":"dev.command.js","sourceRoot":"","sources":["../../../src/commands/dev.command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAwD;AACxD,2EAAoE;AACpE,uFAA+E;AAC/E,qFAA6E;AAC7E,uFAA+E;AAC/E,uEAAgE;AAChE,iFAAyE;AACzE,yFAAiF;AACjF,qFAA6E;AAC7E,qEAA8D;AAC9D,6EAAsE;AACtE,qEAA8D;AAC9D,mFAA2E;AAC3E,2EAAoE;AACpE,2FAAmF;AAuB5E,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,8BAAa;IAC3C,KAAK,CAAC,GAAG,CAAC,EAAY,IAAkB,CAAC;CAC1C,CAAA;AAFY,gCAAU;qBAAV,UAAU;IArBtB,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EAAE;YACX,+BAAY;YACZ,qCAAe;YACf,gDAAoB;YACpB,gDAAoB;YACpB,+BAAY;YACZ,qCAAe;YACf,iCAAa;YACb,uCAAgB;YAChB,oDAAsB;YACtB,kDAAqB;YACrB,4CAAkB;YAClB,8CAAmB;YACnB,0CAAiB;YACjB,8CAAmB;SACpB;KACF,CAAC;GACW,UAAU,CAEtB"}
1
+ {"version":3,"file":"dev.command.js","sourceRoot":"","sources":["../../../src/commands/dev.command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAwD;AACxD,6FAAoF;AACpF,2EAAoE;AACpE,uFAA+E;AAC/E,qFAA6E;AAC7E,uFAA+E;AAC/E,uEAAgE;AAChE,iFAAyE;AACzE,yFAAiF;AACjF,qFAA6E;AAC7E,qEAA8D;AAC9D,6EAAsE;AACtE,qEAA8D;AAC9D,mFAA2E;AAC3E,2EAAoE;AACpE,2FAAmF;AAwB5E,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,8BAAa;IAC3C,KAAK,CAAC,GAAG,CAAC,EAAY,IAAkB,CAAC;CAC1C,CAAA;AAFY,gCAAU;qBAAV,UAAU;IAtBtB,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EAAE;YACX,+BAAY;YACZ,qCAAe;YACf,gDAAoB;YACpB,gDAAoB;YACpB,+BAAY;YACZ,qCAAe;YACf,iCAAa;YACb,uCAAgB;YAChB,oDAAsB;YACtB,kDAAqB;YACrB,4CAAkB;YAClB,8CAAmB;YACnB,0CAAiB;YACjB,8CAAmB;YACnB,qDAAsB;SACvB;KACF,CAAC;GACW,UAAU,CAEtB"}
@@ -81,4 +81,5 @@ export declare class DeveloperService {
81
81
  description: string;
82
82
  }>>;
83
83
  resetAndInstallAll(cwd: string, verbose?: boolean): Promise<void>;
84
+ copyAssetsToLibrary(name: string, cwd: string, verbose?: boolean): Promise<void>;
84
85
  }
@@ -2091,6 +2091,29 @@ ${config.setupSSL
2091
2091
  }, true);
2092
2092
  this.log(chalk.green(`Dependencies installed for ${libraryName}.`));
2093
2093
  }
2094
+ const filesFrontend = [
2095
+ {
2096
+ template: 'page.tsx.ejs',
2097
+ destination: `/apps/admin/src/app/(app)/${vars.libraryNameKebabCase}/page.tsx`,
2098
+ },
2099
+ {
2100
+ template: 'en.json.ejs',
2101
+ destination: `/apps/admin/messages/${vars.libraryNameKebabCase}/en.json`,
2102
+ },
2103
+ {
2104
+ template: 'pt.json.ejs',
2105
+ destination: `/apps/admin/messages/${vars.libraryNameKebabCase}/pt.json`,
2106
+ },
2107
+ ];
2108
+ for (const file of filesFrontend) {
2109
+ const templatePath = pathModule.join(__dirname, '..', '..', 'templates', 'library', file.template);
2110
+ const destinationPath = pathModule.join(path, file.destination);
2111
+ this.log(chalk.blue(`Rendering template: ${file.template}`));
2112
+ const content = await (0, promises_1.readFile)(templatePath, 'utf8');
2113
+ const renderedContent = await (0, ejs_1.render)(content, vars);
2114
+ await (0, promises_1.writeFile)(destinationPath, renderedContent, 'utf8');
2115
+ this.log(chalk.blue(`Created file: ${destinationPath}`));
2116
+ }
2094
2117
  this.log(chalk.green(`Library ${libraryName} created successfully at ${libraryPath}.`));
2095
2118
  }
2096
2119
  async hashDirectory(path) {
@@ -2853,6 +2876,47 @@ ${config.setupSSL
2853
2876
  spinner.stop();
2854
2877
  }
2855
2878
  }
2879
+ async copyAssetsToLibrary(name, cwd, verbose = false) {
2880
+ this.verbose = verbose;
2881
+ this.log(`Copying assets for library ${name}...`);
2882
+ // Copy messages folder if it exists
2883
+ const messagesSourcePath = pathModule.join(cwd, 'apps', 'admin', 'messages', name);
2884
+ const messagesDestPath = pathModule.join(cwd, 'libraries', name, 'hedhog', 'frontend', 'messages');
2885
+ if (await this.fileSystem.exists(messagesSourcePath)) {
2886
+ this.log(`Found frontend messages at ${messagesSourcePath}, copying with .ejs extension...`);
2887
+ try {
2888
+ await this.fileSystem.createDirectory(messagesDestPath);
2889
+ await this.fileSystem.copyDirectory(messagesSourcePath, messagesDestPath);
2890
+ this.log(chalk.green(`Frontend messages copied successfully to ${messagesDestPath}`));
2891
+ }
2892
+ catch (error) {
2893
+ this.log(chalk.red(`Error copying frontend messages: ${error.message}`));
2894
+ throw error;
2895
+ }
2896
+ }
2897
+ else {
2898
+ this.log(chalk.yellow(`Frontend messages folder not found at ${messagesSourcePath}`));
2899
+ }
2900
+ // Copy app folder if it exists
2901
+ const appSourcePath = pathModule.join(cwd, 'apps', 'admin', 'src', 'app', '(app)', '(libraries)', name);
2902
+ const appDestPath = pathModule.join(cwd, 'libraries', name, 'hedhog', 'frontend', 'app');
2903
+ if (await this.fileSystem.exists(appSourcePath)) {
2904
+ this.log(`Found frontend app at ${appSourcePath}, copying with .ejs extension...`);
2905
+ try {
2906
+ await this.fileSystem.createDirectory(appDestPath);
2907
+ await this.fileSystem.copyDirectoryAddingEjsExtension(appSourcePath, appDestPath);
2908
+ this.log(chalk.green(`Frontend app copied successfully to ${appDestPath}`));
2909
+ }
2910
+ catch (error) {
2911
+ this.log(chalk.red(`Error copying frontend app: ${error.message}`));
2912
+ throw error;
2913
+ }
2914
+ }
2915
+ else {
2916
+ this.log(chalk.yellow(`Frontend app folder not found at ${appSourcePath}`));
2917
+ }
2918
+ this.log(chalk.green(`Assets copied successfully for library ${name}`));
2919
+ }
2856
2920
  };
2857
2921
  exports.DeveloperService = DeveloperService;
2858
2922
  exports.DeveloperService = DeveloperService = __decorate([