mango-cms 0.1.14 → 0.1.15
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/cli.js +29 -0
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -195,6 +195,35 @@ Make sure MongoDB and Redis services are running before starting the application
|
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
|
|
198
|
+
program
|
|
199
|
+
.command('init')
|
|
200
|
+
.description('Initialize Mango CMS config in the current directory')
|
|
201
|
+
.action(async () => {
|
|
202
|
+
try {
|
|
203
|
+
const currentDir = process.cwd();
|
|
204
|
+
const templateConfigDir = path.join(__dirname, 'default/config');
|
|
205
|
+
const targetConfigDir = path.join(currentDir, 'config');
|
|
206
|
+
|
|
207
|
+
// Check if config directory already exists
|
|
208
|
+
if (fs.existsSync(targetConfigDir)) {
|
|
209
|
+
console.log('⚠️ Config directory already exists. Please remove or rename it first.');
|
|
210
|
+
process.exit(1);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
console.log('Initializing Mango CMS config...');
|
|
214
|
+
|
|
215
|
+
// Copy config directory
|
|
216
|
+
fs.copySync(templateConfigDir, targetConfigDir);
|
|
217
|
+
|
|
218
|
+
console.log(`
|
|
219
|
+
✨ Mango CMS config initialized successfully!
|
|
220
|
+
`);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error('Error initializing Mango CMS:', error.message);
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
198
227
|
program
|
|
199
228
|
.command('start')
|
|
200
229
|
.description('Start the Mango CMS in watch mode')
|