create-server-nodejs 1.0.0 ā 1.0.2
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/packages/index.js +17 -0
package/package.json
CHANGED
package/packages/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import fs from 'fs';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
|
+
import { execSync } from 'child_process';
|
|
7
8
|
|
|
8
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
10
|
const __dirname = path.dirname(__filename);
|
|
@@ -126,6 +127,22 @@ Object.keys(files).forEach(fileName => {
|
|
|
126
127
|
console.log(chalk.green(`File created: ${fileName}`));
|
|
127
128
|
});
|
|
128
129
|
|
|
130
|
+
// ==================== npm install ====================
|
|
131
|
+
|
|
132
|
+
console.log(chalk.yellow('\nš¦ Installing dependencies... (This may take a while)'));
|
|
133
|
+
try {
|
|
134
|
+
execSync('npm install', {
|
|
135
|
+
cwd: targetDir,
|
|
136
|
+
stdio: 'inherit'
|
|
137
|
+
});
|
|
138
|
+
console.log(chalk.green('ā
Dependencies installed successfully!'));
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.log(chalk.red('ā Error during npm install:'));
|
|
141
|
+
console.error(error.message);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ============================================================
|
|
145
|
+
|
|
129
146
|
console.log(chalk.bold.green('\n Project created successfully!'));
|
|
130
147
|
console.log(chalk.cyan(`\n cd ${projectName}`));
|
|
131
148
|
console.log(chalk.cyan(` npm install`));
|