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

Commit

Permalink
Merge pull request #81 from NorthernOceanS/issue78
Browse files Browse the repository at this point in the history
Don't rewrite plugins.json if it isn't modified and fix other bugs.
  • Loading branch information
callstackexceed committed Jul 27, 2021
2 parents c6b1947 + 2c7cad5 commit b63f025
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions file-generation.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,21 @@ class AutoFileGenerationSupport {
if(havePluginJsSync()) {
return packDone();
}
let pluginJSON = getPluginsJSONSync() || {};
let pluginJSON = getPluginsJSONSync();
let pluginDirs = getPluginDirsSync();
let isModified = false;
if(pluginJSON === null) {
pluginJSON = {};
isModified = true;
}
for(let dirName of pluginDirs) {
if(pluginJSON[dirName] === undefined) {
console.log(`Add dir ${dirName}`);
pluginJSON[dirName] = {
type: "inner",
enable: true
};
isModified = true;
}
}
let pluginJs = `
Expand Down Expand Up @@ -149,15 +155,11 @@ class AutoFileGenerationSupport {
break;
}
}).join('');
if(this.writeBack) {
console.log(path.join(
sourceDir,
'scripts/plugin/plugins.json'
), JSON.stringify(pluginJSON, null, '\t'));
if(this.writeBack && isModified) {
fs.writeFileSync(path.join(
sourceDir,
'scripts/plugin/plugins.json'
), JSON.stringify(pluginJSON, null, '\t'));
), JSON.stringify(pluginJSON, null, '\t').concat('\n'));
}
fs.writeFileSync(path.join(
destination,
Expand Down
2 changes: 1 addition & 1 deletion packs/behaviors/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"version": [
0,
13,
13
14
]
},
"modules": [
Expand Down

0 comments on commit b63f025

Please sign in to comment.