mm_config 2.2.4 → 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 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -288,7 +288,9 @@ Config.prototype.destroy = function () {
288
288
  function create(file, options = {}, config = {}) {
289
289
  let f = file.fullname();
290
290
  let cfg = new Config({ file: f, ...config }, options);
291
- cfg.saveSync(); // 确保文件存在
291
+ if (!file.hasFile()) {
292
+ cfg.saveSync(); // 确保文件存在
293
+ }
292
294
  // 注册配置字典
293
295
  dict[f] = cfg;
294
296
  return dict[f].getProxy();
@@ -304,7 +306,9 @@ function create(file, options = {}, config = {}) {
304
306
  async function createAsync(file, options = {}, config = {}) {
305
307
  let f = file.fullname();
306
308
  let cfg = new Config({ file: f, ...config }, options);
307
- await cfg.saveAsync(); // 确保文件存在
309
+ if (!file.hasFile()) {
310
+ await cfg.saveAsync(); // 确保文件存在
311
+ }
308
312
  // 注册配置字典
309
313
  dict[f] = cfg;
310
314
  return dict[f].getAsyncProxy();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_config",
3
- "version": "2.2.4",
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": {