@codemoreira/esad 1.1.1 โ 1.1.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/bin/esad.js +1 -1
- package/package.json +1 -1
- package/src/cli/commands/createCdn.js +34 -3
package/bin/esad.js
CHANGED
|
@@ -10,7 +10,7 @@ const deployCommand = require('../src/cli/commands/deploy');
|
|
|
10
10
|
const devCommand = require('../src/cli/commands/dev');
|
|
11
11
|
|
|
12
12
|
program
|
|
13
|
-
.version('1.1.
|
|
13
|
+
.version('1.1.2')
|
|
14
14
|
.description('esad - Easy Super App Development Toolkit');
|
|
15
15
|
|
|
16
16
|
// --- COMMMAND: esad init ---
|
package/package.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
const { runProcess } = require('../utils/process');
|
|
1
2
|
const { getWorkspaceConfig } = require('../utils/config');
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
2
5
|
|
|
3
6
|
module.exports = async (cdnName) => {
|
|
4
7
|
const configObj = getWorkspaceConfig();
|
|
@@ -6,8 +9,36 @@ module.exports = async (cdnName) => {
|
|
|
6
9
|
console.error(`โ Error: Call this command from inside an ESAD workspace (esad.config.json not found).`);
|
|
7
10
|
return;
|
|
8
11
|
}
|
|
12
|
+
|
|
9
13
|
const finalCdnName = cdnName || `${configObj.data.projectName}-cdn`;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
const cdnPath = path.join(process.cwd(), finalCdnName);
|
|
15
|
+
|
|
16
|
+
if (fs.existsSync(cdnPath)) {
|
|
17
|
+
console.error(`โ Error: Directory ./${finalCdnName} already exists.`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
console.log(`\n๐ฆ Initializing Flux Registry & CDN: ${finalCdnName}...\n`);
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
// 1. Clone the template
|
|
25
|
+
console.log(`๐ก Cloning template from GitHub...`);
|
|
26
|
+
await runProcess('git', ['clone', 'https://github.com/CodeMoreira/simple-cdn.git', finalCdnName]);
|
|
27
|
+
|
|
28
|
+
// 2. Remove .git from template
|
|
29
|
+
console.log(`๐งน Cleaning up template metadata...`);
|
|
30
|
+
await fs.remove(path.join(cdnPath, '.git'));
|
|
31
|
+
|
|
32
|
+
// 3. Install dependencies
|
|
33
|
+
console.log(`\n๐ฅ Installing dependencies (this may take a minute)...`);
|
|
34
|
+
await runProcess('npm', ['install'], cdnPath);
|
|
35
|
+
|
|
36
|
+
console.log(`\nโ
CDN Registry created successfully in ./${finalCdnName}\n`);
|
|
37
|
+
console.log(`To start your CDN:`);
|
|
38
|
+
console.log(` cd ${finalCdnName}`);
|
|
39
|
+
console.log(` npm start\n`);
|
|
40
|
+
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(`\nโ Failed to create CDN: ${error.message}`);
|
|
43
|
+
}
|
|
13
44
|
};
|