1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Shuffle promises for creating default package.json

This commit is contained in:
Nick O'Leary 2017-01-28 14:21:22 +00:00
parent 50017c28da
commit f2235dacdc
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -231,22 +231,24 @@ var localfilesystem = {
globalSettingsFile = fspath.join(settings.userDir,".config.json"); globalSettingsFile = fspath.join(settings.userDir,".config.json");
var packageFile = fspath.join(settings.userDir,"package.json"); var packageFile = fspath.join(settings.userDir,"package.json");
var packagePromise = when.resolve();
if (!settings.readOnly) { if (!settings.readOnly) {
promises.push(promiseDir(libFlowsDir)); promises.push(promiseDir(libFlowsDir));
try { packagePromise = function() {
fs.statSync(packageFile); try {
} catch(err) { fs.statSync(packageFile);
var defaultPackage = { } catch(err) {
"name": "node-red-project", var defaultPackage = {
"description": "A Node-RED Project", "name": "node-red-project",
"version": "0.0.1" "description": "A Node-RED Project",
}; "version": "0.0.1"
promises.push(writeFile(packageFile,JSON.stringify(defaultPackage,"",4))); };
return writeFile(packageFile,JSON.stringify(defaultPackage,"",4));
}
return true;
} }
} }
return when.all(promises).then(packagePromise);
return when.all(promises);
}, },
getFlows: function() { getFlows: function() {