Skip to content
This repository was archived by the owner on Feb 6, 2022. It is now read-only.

Commit b63f025

Browse files
Merge pull request #81 from NorthernOceanS/issue78
Don't rewrite plugins.json if it isn't modified and fix other bugs.
2 parents c6b1947 + 2c7cad5 commit b63f025

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

file-generation.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,21 @@ class AutoFileGenerationSupport {
111111
if(havePluginJsSync()) {
112112
return packDone();
113113
}
114-
let pluginJSON = getPluginsJSONSync() || {};
114+
let pluginJSON = getPluginsJSONSync();
115115
let pluginDirs = getPluginDirsSync();
116+
let isModified = false;
117+
if(pluginJSON === null) {
118+
pluginJSON = {};
119+
isModified = true;
120+
}
116121
for(let dirName of pluginDirs) {
117122
if(pluginJSON[dirName] === undefined) {
118123
console.log(`Add dir ${dirName}`);
119124
pluginJSON[dirName] = {
120125
type: "inner",
121126
enable: true
122127
};
128+
isModified = true;
123129
}
124130
}
125131
let pluginJs = `
@@ -149,15 +155,11 @@ class AutoFileGenerationSupport {
149155
break;
150156
}
151157
}).join('');
152-
if(this.writeBack) {
153-
console.log(path.join(
154-
sourceDir,
155-
'scripts/plugin/plugins.json'
156-
), JSON.stringify(pluginJSON, null, '\t'));
158+
if(this.writeBack && isModified) {
157159
fs.writeFileSync(path.join(
158160
sourceDir,
159161
'scripts/plugin/plugins.json'
160-
), JSON.stringify(pluginJSON, null, '\t'));
162+
), JSON.stringify(pluginJSON, null, '\t').concat('\n'));
161163
}
162164
fs.writeFileSync(path.join(
163165
destination,

packs/behaviors/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"version": [
88
0,
99
13,
10-
13
10+
14
1111
]
1212
},
1313
"modules": [

0 commit comments

Comments
 (0)