mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
15a600c763
commit
e34f4acb22
@ -34,11 +34,9 @@ function checkForConfigFile(dir) {
|
||||
}
|
||||
|
||||
var localfilesystem = {
|
||||
init: function(_settings, runtime) {
|
||||
init: async function(_settings, runtime) {
|
||||
settings = _settings;
|
||||
|
||||
var promises = [];
|
||||
|
||||
if (!settings.userDir) {
|
||||
if (checkForConfigFile(process.env.NODE_RED_HOME)) {
|
||||
settings.userDir = process.env.NODE_RED_HOME
|
||||
@ -49,33 +47,28 @@ var localfilesystem = {
|
||||
}
|
||||
}
|
||||
if (!settings.readOnly) {
|
||||
promises.push(fs.ensureDir(fspath.join(settings.userDir,"node_modules")));
|
||||
await fs.ensureDir(fspath.join(settings.userDir,"node_modules"));
|
||||
}
|
||||
sessions.init(settings);
|
||||
promises.push(runtimeSettings.init(settings));
|
||||
promises.push(library.init(settings));
|
||||
promises.push(projects.init(settings, runtime));
|
||||
await runtimeSettings.init(settings);
|
||||
await library.init(settings);
|
||||
await projects.init(settings, runtime);
|
||||
|
||||
var packageFile = fspath.join(settings.userDir,"package.json");
|
||||
var packagePromise = Promise.resolve();
|
||||
|
||||
if (!settings.readOnly) {
|
||||
packagePromise = function() {
|
||||
try {
|
||||
fs.statSync(packageFile);
|
||||
} catch(err) {
|
||||
var defaultPackage = {
|
||||
"name": "node-red-project",
|
||||
"description": "A Node-RED Project",
|
||||
"version": "0.0.1",
|
||||
"private": true
|
||||
};
|
||||
return util.writeFile(packageFile,JSON.stringify(defaultPackage,"",4));
|
||||
}
|
||||
return true;
|
||||
try {
|
||||
fs.statSync(packageFile);
|
||||
} catch(err) {
|
||||
var defaultPackage = {
|
||||
"name": "node-red-project",
|
||||
"description": "A Node-RED Project",
|
||||
"version": "0.0.1",
|
||||
"private": true
|
||||
};
|
||||
return util.writeFile(packageFile,JSON.stringify(defaultPackage,"",4));
|
||||
}
|
||||
}
|
||||
return Promise.all(promises).then(packagePromise);
|
||||
},
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user