mm_config 2.2.3 → 2.2.5

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/index.js +6 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -287,14 +287,10 @@ Config.prototype.destroy = function () {
287
287
  */
288
288
  function create(file, options = {}, config = {}) {
289
289
  let f = file.fullname();
290
- // 检查是否已存在配置
291
- if (dict[f]) {
292
- // 如果配置已存在,更新options并返回代理
293
- dict[f].setOptions(options);
294
- return dict[f].getProxy();
295
- }
296
290
  let cfg = new Config({ file: f, ...config }, options);
297
- cfg.saveSync(); // 确保文件存在
291
+ if (!file.hasFile()) {
292
+ cfg.saveSync(); // 确保文件存在
293
+ }
298
294
  // 注册配置字典
299
295
  dict[f] = cfg;
300
296
  return dict[f].getProxy();
@@ -309,14 +305,10 @@ function create(file, options = {}, config = {}) {
309
305
  */
310
306
  async function createAsync(file, options = {}, config = {}) {
311
307
  let f = file.fullname();
312
- // 检查是否已存在配置
313
- if (dict[f]) {
314
- // 如果配置已存在,更新options并返回异步代理
315
- dict[f].setOptions(options);
316
- return dict[f].getAsyncProxy();
317
- }
318
308
  let cfg = new Config({ file: f, ...config }, options);
319
- await cfg.saveAsync(); // 确保文件存在
309
+ if (!file.hasFile()) {
310
+ await cfg.saveAsync(); // 确保文件存在
311
+ }
320
312
  // 注册配置字典
321
313
  dict[f] = cfg;
322
314
  return dict[f].getAsyncProxy();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_config",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "Super Meimei Configuration Synchronizer - Automatically sync configuration changes to JSON files",
5
5
  "main": "index.js",
6
6
  "scripts": {