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 = {
|
var localfilesystem = {
|
||||||
init: function(_settings, runtime) {
|
init: async function(_settings, runtime) {
|
||||||
settings = _settings;
|
settings = _settings;
|
||||||
|
|
||||||
var promises = [];
|
|
||||||
|
|
||||||
if (!settings.userDir) {
|
if (!settings.userDir) {
|
||||||
if (checkForConfigFile(process.env.NODE_RED_HOME)) {
|
if (checkForConfigFile(process.env.NODE_RED_HOME)) {
|
||||||
settings.userDir = process.env.NODE_RED_HOME
|
settings.userDir = process.env.NODE_RED_HOME
|
||||||
@ -49,33 +47,28 @@ var localfilesystem = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!settings.readOnly) {
|
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);
|
sessions.init(settings);
|
||||||
promises.push(runtimeSettings.init(settings));
|
await runtimeSettings.init(settings);
|
||||||
promises.push(library.init(settings));
|
await library.init(settings);
|
||||||
promises.push(projects.init(settings, runtime));
|
await projects.init(settings, runtime);
|
||||||
|
|
||||||
var packageFile = fspath.join(settings.userDir,"package.json");
|
var packageFile = fspath.join(settings.userDir,"package.json");
|
||||||
var packagePromise = Promise.resolve();
|
|
||||||
|
|
||||||
if (!settings.readOnly) {
|
if (!settings.readOnly) {
|
||||||
packagePromise = function() {
|
try {
|
||||||
try {
|
fs.statSync(packageFile);
|
||||||
fs.statSync(packageFile);
|
} catch(err) {
|
||||||
} catch(err) {
|
var defaultPackage = {
|
||||||
var defaultPackage = {
|
"name": "node-red-project",
|
||||||
"name": "node-red-project",
|
"description": "A Node-RED Project",
|
||||||
"description": "A Node-RED Project",
|
"version": "0.0.1",
|
||||||
"version": "0.0.1",
|
"private": true
|
||||||
"private": true
|
};
|
||||||
};
|
return util.writeFile(packageFile,JSON.stringify(defaultPackage,"",4));
|
||||||
return util.writeFile(packageFile,JSON.stringify(defaultPackage,"",4));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.all(promises).then(packagePromise);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user