@appxdigital/appx-core-cli 1.0.9 → 1.0.10

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@appxdigital/appx-core-cli",
4
- "version": "1.0.9",
4
+ "version": "1.0.10",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "npm:publish": "npm publish --access public",
@@ -1,5 +1,5 @@
1
- import { AdminConfigType } from '@appxdigital/appx-core';
2
- import { ComponentLoader } from 'adminjs';
1
+ import {AdminConfigType} from '@appxdigital/appx-core';
2
+ import {ComponentLoader} from 'adminjs';
3
3
 
4
4
  const componentLoader = new ComponentLoader();
5
5
 
@@ -14,7 +14,7 @@ export const PermissionsConfig: PermissionsConfigType = {
14
14
  },
15
15
  CLIENT: {
16
16
  findFirst: {
17
- conditions: { id: PermissionPlaceholder.USER_ID },
17
+ conditions: {id: PermissionPlaceholder.USER_ID},
18
18
  },
19
19
  }
20
20
  },
package/wizard.js CHANGED
@@ -306,6 +306,7 @@ function setupProjectStructure(projectPath, answers) {
306
306
  incrementProgress(answers?.showOutput, "prismaSetup");
307
307
  createPrismaModule(projectPath);
308
308
  createPermissionsConfig(projectPath);
309
+ setupAdminJS(projectPath);
309
310
  createAdminConfig(projectPath);
310
311
  addScriptsToPackageJson(projectPath);
311
312
  }
@@ -341,6 +342,42 @@ function getAppModuleTemplate() {
341
342
  return fs.readFileSync(appModuleTemplatePath, 'utf8');
342
343
  }
343
344
 
345
+ function setupAdminJS(projectPath) {
346
+ const backoffice = path.join(projectPath, 'src/backoffice');
347
+ fs.ensureDirSync(backoffice);
348
+
349
+ const backofficeComponents = path.join(backoffice, 'components');
350
+ fs.ensureDirSync(backofficeComponents);
351
+
352
+ const dashboardContent = getDashboardTemplate();
353
+ fs.writeFileSync(path.join(backofficeComponents, 'dashboard.tsx'), dashboardContent);
354
+ }
355
+
356
+ function getComponentLoaderTemplate() {
357
+ const template = path.join(__dirname, 'templates', 'adminjs', 'component-loader.template.js');
358
+ return fs.readFileSync(template, 'utf8');
359
+ }
360
+
361
+ function getDashboardTemplate() {
362
+ const template = path.join(__dirname, 'templates', 'adminjs', 'dashboard.template.js');
363
+ return fs.readFileSync(template, 'utf8');
364
+ }
365
+
366
+ function getUtilsTemplate() {
367
+ const template = path.join(__dirname, 'templates', 'adminjs', 'utils.template.js');
368
+ return fs.readFileSync(template, 'utf8');
369
+ }
370
+
371
+ function getAdminTemplate() {
372
+ const template = path.join(__dirname, 'templates', 'adminjs', 'admin.template.js');
373
+ return fs.readFileSync(template, 'utf8');
374
+ }
375
+
376
+ function getAdminAppModuleTemplate() {
377
+ const appModuleTemplatePath = path.join(__dirname, 'templates', 'adminjs', 'adminjs-app.module.template.js');
378
+ return fs.readFileSync(appModuleTemplatePath, 'utf8');
379
+ }
380
+
344
381
  function createPermissionsConfig(projectPath) {
345
382
  const configDir = path.join(projectPath, 'src/config');
346
383
  fs.ensureDirSync(configDir);
@@ -351,7 +388,7 @@ function createPermissionsConfig(projectPath) {
351
388
  fs.writeFileSync(path.join(configDir, 'permissions.config.ts'), permissionsConfigContent);
352
389
  }
353
390
 
354
- function createAdminConfig(projectPath) {
391
+ function createAdminConfig (projectPath) {
355
392
  const configDir = path.join(projectPath, 'src/config');
356
393
  fs.ensureDirSync(configDir);
357
394