@enfyra/create 0.1.1 → 0.1.3

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.
@@ -8,6 +8,7 @@ const { generateEnvFiles } = require('./env-builder');
8
8
  const {
9
9
  getInstallCommand,
10
10
  getPackageExecCommand,
11
+ getPackageRunCommand,
11
12
  getWorkspaceRunCommand,
12
13
  } = require('./package-managers');
13
14
 
@@ -66,6 +67,8 @@ async function updateWorkspacePackageJson(projectPath, config) {
66
67
  const packageName = toPackageName(config.projectName);
67
68
  const packageManager = config.packageManager;
68
69
  const resolutions = await collectTemplateResolutions(projectPath);
70
+ const serverReadyTarget = `tcp:localhost:${config.serverPort}`;
71
+ const waitForServerCommand = getPackageExecCommand(packageManager, 'wait-on', [serverReadyTarget]);
69
72
  const packageJson = {
70
73
  name: packageName,
71
74
  version: '0.1.0',
@@ -75,13 +78,17 @@ async function updateWorkspacePackageJson(projectPath, config) {
75
78
  'server',
76
79
  ],
77
80
  scripts: {
78
- dev: `concurrently -k -n server,app -c cyan,green "${getWorkspaceRunCommand(packageManager, 'server', 'dev')}" "${getPackageExecCommand(packageManager, 'wait-on', [`http://localhost:${config.serverPort}`])} && ${getWorkspaceRunCommand(packageManager, 'app', 'dev')}"`,
81
+ dev: `concurrently -k -n server,app -c cyan,green "${getWorkspaceRunCommand(packageManager, 'server', 'dev')}" "${waitForServerCommand} && ${getWorkspaceRunCommand(packageManager, 'app', 'dev')}"`,
79
82
  'dev:app': getWorkspaceRunCommand(packageManager, 'app', 'dev'),
80
83
  'dev:server': getWorkspaceRunCommand(packageManager, 'server', 'dev'),
81
84
  build: `${getWorkspaceRunCommand(packageManager, 'server', 'build')} && ${getWorkspaceRunCommand(packageManager, 'app', 'build')}`,
82
85
  'build:app': getWorkspaceRunCommand(packageManager, 'app', 'build'),
83
86
  'build:server': getWorkspaceRunCommand(packageManager, 'server', 'build'),
84
- start: getWorkspaceRunCommand(packageManager, 'server', 'start'),
87
+ start: `concurrently -k -n server,app -c cyan,green "${getWorkspaceRunCommand(packageManager, 'server', 'start')}" "${waitForServerCommand} && ${getWorkspaceRunCommand(packageManager, 'app', 'start')}"`,
88
+ 'start:app': getWorkspaceRunCommand(packageManager, 'app', 'start'),
89
+ 'start:server': getWorkspaceRunCommand(packageManager, 'server', 'start'),
90
+ serve: getPackageRunCommand(packageManager, 'start'),
91
+ 'preview:app': getWorkspaceRunCommand(packageManager, 'app', 'preview'),
85
92
  },
86
93
  devDependencies: {
87
94
  concurrently: '^9.2.1',
package/index.js CHANGED
@@ -14,13 +14,24 @@ const { createProject } = require('./components/project-setup');
14
14
  const { detectPackageManagers, getWorkspaceRunCommand, getPackageRunCommand } = require('./components/package-managers');
15
15
 
16
16
  const SERVER_PORT = 1105;
17
+ const BANNER_WIDTH = 42;
18
+
19
+ function renderBanner() {
20
+ const border = chalk.cyan.bold(`+${'-'.repeat(BANNER_WIDTH)}+`);
21
+ return [
22
+ '',
23
+ border,
24
+ renderBannerLine('Create Enfyra', chalk.white.bold),
25
+ renderBannerLine('App + Server in one workspace', chalk.gray),
26
+ border,
27
+ '',
28
+ ].join('\n');
29
+ }
17
30
 
18
- const banner = `
19
- ${chalk.cyan.bold('╔═══════════════════════════════════════╗')}
20
- ${chalk.cyan.bold('')} ${chalk.white.bold('Create Enfyra')} ${chalk.cyan.bold('')}
21
- ${chalk.cyan.bold('║')} ${chalk.gray('App + Server in one workspace')} ${chalk.cyan.bold('║')}
22
- ${chalk.cyan.bold('╚═══════════════════════════════════════╝')}
23
- `;
31
+ function renderBannerLine(text, format = (value) => value) {
32
+ const padding = Math.max(0, BANNER_WIDTH - text.length - 2);
33
+ return `${chalk.cyan.bold('|')} ${format(text)}${' '.repeat(padding)} ${chalk.cyan.bold('|')}`;
34
+ }
24
35
 
25
36
  async function main() {
26
37
  const program = new Command();
@@ -33,7 +44,7 @@ async function main() {
33
44
  .option('--skip-connection-check', 'Skip database and Redis connection checks')
34
45
  .parse();
35
46
 
36
- console.log(banner);
47
+ console.log(renderBanner());
37
48
  checkNodeVersion();
38
49
  const packageManagers = detectPackageManagers();
39
50
  if (packageManagers.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/create",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Create a complete Enfyra app with frontend and server workspaces",
5
5
  "main": "index.js",
6
6
  "bin": {