@appxdigital/appx-core-cli 1.0.7 → 1.0.8
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 +1 -1
- package/wizard.js +1 -56
package/package.json
CHANGED
package/wizard.js
CHANGED
|
@@ -24,7 +24,6 @@ const phaseDurations = {
|
|
|
24
24
|
installDependencies: 80,
|
|
25
25
|
installCore: 120,
|
|
26
26
|
prismaSetup: 10,
|
|
27
|
-
adminSetup: 40,
|
|
28
27
|
setupConcluded: 5,
|
|
29
28
|
end: 5
|
|
30
29
|
};
|
|
@@ -37,9 +36,6 @@ const calculateTotalETA = (includeBackoffice) => {
|
|
|
37
36
|
phaseDurations.prismaSetup +
|
|
38
37
|
phaseDurations.setupConcluded
|
|
39
38
|
+ phaseDurations.end;
|
|
40
|
-
if (includeBackoffice) {
|
|
41
|
-
totalTime += phaseDurations.adminSetup;
|
|
42
|
-
}
|
|
43
39
|
return totalTime;
|
|
44
40
|
};
|
|
45
41
|
|
|
@@ -315,13 +311,8 @@ function setupProjectStructure(projectPath, answers) {
|
|
|
315
311
|
incrementProgress(answers?.showOutput, "prismaSetup");
|
|
316
312
|
createPrismaModule(projectPath);
|
|
317
313
|
createPermissionsConfig(projectPath);
|
|
314
|
+
createAdminConfig(projectPath);
|
|
318
315
|
addScriptsToPackageJson(projectPath);
|
|
319
|
-
|
|
320
|
-
if (includeBackoffice) {
|
|
321
|
-
executeCommand('npm install adminjs @adminjs/express @adminjs/import-export @adminjs/nestjs @adminjs/prisma @prisma/sdk react express-formidable @adminjs/passwords', answers?.showOutput);
|
|
322
|
-
setupAdminJS(projectPath);
|
|
323
|
-
incrementProgress(answers?.showOutput, "adminSetup");
|
|
324
|
-
}
|
|
325
316
|
}
|
|
326
317
|
|
|
327
318
|
function ensureAndRunNestCli(projectPath, showOutput = false) {
|
|
@@ -355,52 +346,6 @@ function getAppModuleTemplate() {
|
|
|
355
346
|
return fs.readFileSync(appModuleTemplatePath, 'utf8');
|
|
356
347
|
}
|
|
357
348
|
|
|
358
|
-
function setupAdminJS(projectPath) {
|
|
359
|
-
const backoffice = path.join(projectPath, 'src/backoffice');
|
|
360
|
-
fs.ensureDirSync(backoffice);
|
|
361
|
-
|
|
362
|
-
const backofficeComponents = path.join(backoffice, 'components');
|
|
363
|
-
fs.ensureDirSync(backofficeComponents);
|
|
364
|
-
|
|
365
|
-
const componentLoaderContent = getComponentLoaderTemplate();
|
|
366
|
-
fs.writeFileSync(path.join(backoffice, 'component-loader.ts'), componentLoaderContent);
|
|
367
|
-
|
|
368
|
-
const dashboardContent = getDashboardTemplate();
|
|
369
|
-
fs.writeFileSync(path.join(backofficeComponents, 'dashboard.tsx'), dashboardContent);
|
|
370
|
-
|
|
371
|
-
const utilsContent = getUtilsTemplate();
|
|
372
|
-
fs.writeFileSync(path.join(backoffice, 'utils.ts'), utilsContent);
|
|
373
|
-
|
|
374
|
-
const adminContent = getAdminTemplate();
|
|
375
|
-
fs.writeFileSync(path.join(backoffice, 'admin.ts'), adminContent);
|
|
376
|
-
|
|
377
|
-
const tsConfigPath = path.join(projectPath, 'tsconfig.json');
|
|
378
|
-
const tsConfig = fs.readJsonSync(tsConfigPath);
|
|
379
|
-
|
|
380
|
-
tsConfig.compilerOptions.jsx = 'react';
|
|
381
|
-
fs.writeJsonSync(tsConfigPath, tsConfig, { spaces: 2 });
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function getComponentLoaderTemplate() {
|
|
385
|
-
const template = path.join(__dirname, 'templates', 'adminjs', 'component-loader.template.js');
|
|
386
|
-
return fs.readFileSync(template, 'utf8');
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
function getDashboardTemplate() {
|
|
390
|
-
const template = path.join(__dirname, 'templates', 'adminjs', 'dashboard.template.js');
|
|
391
|
-
return fs.readFileSync(template, 'utf8');
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
function getUtilsTemplate() {
|
|
395
|
-
const template = path.join(__dirname, 'templates', 'adminjs', 'utils.template.js');
|
|
396
|
-
return fs.readFileSync(template, 'utf8');
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
function getAdminTemplate() {
|
|
400
|
-
const template = path.join(__dirname, 'templates', 'adminjs', 'admin.template.js');
|
|
401
|
-
return fs.readFileSync(template, 'utf8');
|
|
402
|
-
}
|
|
403
|
-
|
|
404
349
|
function createPermissionsConfig(projectPath) {
|
|
405
350
|
const configDir = path.join(projectPath, 'src/config');
|
|
406
351
|
fs.ensureDirSync(configDir);
|