@mintlify/previewing 4.0.367 → 4.0.369

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.
@@ -124,8 +124,11 @@ const onUnlinkEvent = (filename) => __awaiter(void 0, void 0, void 0, function*
124
124
  break;
125
125
  case 'mintConfig':
126
126
  console.error('⚠️ mint.json has been deleted.');
127
+ yield validateConfigFiles();
128
+ break;
127
129
  case 'docsConfig':
128
130
  console.error('⚠️ docs.json has been deleted.');
131
+ yield validateConfigFiles();
129
132
  break;
130
133
  case 'potentialJsonOpenApiSpec':
131
134
  case 'potentialYamlOpenApiSpec':
@@ -168,6 +171,21 @@ const getTargetPath = (potentialCategory, filePath) => {
168
171
  throw new Error('Invalid category');
169
172
  }
170
173
  };
174
+ const validateConfigFiles = () => __awaiter(void 0, void 0, void 0, function* () {
175
+ try {
176
+ const mintConfigPath = pathUtil.join(CMD_EXEC_PATH, 'mint.json');
177
+ const docsConfigPath = pathUtil.join(CMD_EXEC_PATH, 'docs.json');
178
+ const mintConfigExists = yield fse.pathExists(mintConfigPath);
179
+ const docsConfigExists = yield fse.pathExists(docsConfigPath);
180
+ if (!mintConfigExists && !docsConfigExists) {
181
+ console.error('⚠️ Error: Neither mint.json nor docs.json found in the directory');
182
+ process.exit(1);
183
+ }
184
+ }
185
+ catch (error) {
186
+ console.error('⚠️ Error validating configuration files:', error);
187
+ }
188
+ });
171
189
  /**
172
190
  * This function is called when a file is added or changed
173
191
  * @param filename