mango-cms 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/cli.js +19 -4
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -36,8 +36,8 @@ async function ensureSrcExists(mangoCmsRoot) {
36
36
 
37
37
  // Helper function to validate and prompt for license if needed
38
38
  async function ensureLicenseExists(configPath) {
39
- let settings = { license: null };
40
-
39
+ let settings = {};
40
+
41
41
  try {
42
42
  if (fs.existsSync(configPath)) {
43
43
  settings = JSON.parse(fs.readFileSync(configPath, 'utf8'));
@@ -60,7 +60,10 @@ async function ensureLicenseExists(configPath) {
60
60
  }
61
61
  ]);
62
62
 
63
- settings.license = answer.license;
63
+ settings = {
64
+ ...settings,
65
+ license: answer.license
66
+ };
64
67
  fs.mkdirSync(path.dirname(configPath), { recursive: true });
65
68
  fs.writeFileSync(configPath, JSON.stringify(settings, null, 2));
66
69
  }
@@ -118,9 +121,21 @@ program
118
121
 
119
122
  // Create or update settings.json
120
123
  const settingsPath = path.join(configDir, 'config/settings.json');
121
- const settings = {
124
+ let settings = {};
125
+
126
+ try {
127
+ if (fs.existsSync(settingsPath)) {
128
+ settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
129
+ }
130
+ } catch (error) {
131
+ console.log('Error reading settings file:', error.message);
132
+ }
133
+
134
+ settings = {
135
+ ...settings,
122
136
  license: answers.license
123
137
  };
138
+ fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
124
139
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
125
140
 
126
141
  console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mango-cms",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "main": "index.js",
5
5
  "author": "Colton Neifert",
6
6
  "license": "ISC",