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

Ensure existing files are migrated to first project

This commit is contained in:
Nick O'Leary 2018-01-25 10:13:07 +00:00
parent 5498c6f87d
commit 6d02e70025
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 8 additions and 8 deletions

View File

@ -58,6 +58,10 @@
"mqtt": "2.15.1", "mqtt": "2.15.1",
"multer": "1.3.0", "multer": "1.3.0",
"mustache": "2.3.0", "mustache": "2.3.0",
"node-red-node-email": "0.1.*",
"node-red-node-feedparser": "0.1.*",
"node-red-node-rbe": "0.1.*",
"node-red-node-twitter": "0.1.*",
"nopt": "4.0.1", "nopt": "4.0.1",
"oauth2orize": "1.11.0", "oauth2orize": "1.11.0",
"on-headers": "1.0.1", "on-headers": "1.0.1",
@ -70,11 +74,7 @@
"uglify-js": "3.3.6", "uglify-js": "3.3.6",
"when": "3.7.8", "when": "3.7.8",
"ws": "1.1.5", "ws": "1.1.5",
"xml2js": "0.4.19", "xml2js": "0.4.19"
"node-red-node-feedparser": "0.1.*",
"node-red-node-email": "0.1.*",
"node-red-node-twitter": "0.1.*",
"node-red-node-rbe": "0.1.*"
}, },
"optionalDependencies": { "optionalDependencies": {
"bcrypt": "~1.0.3" "bcrypt": "~1.0.3"

View File

@ -770,7 +770,7 @@ function createDefaultProject(user, project) {
var flowFilePath; var flowFilePath;
var credsFilePath; var credsFilePath;
if (project.files.migrateFiles) { if (project.migrateFiles) {
var baseFlowFileName = project.files.flow || fspath.basename(project.files.oldFlow); var baseFlowFileName = project.files.flow || fspath.basename(project.files.oldFlow);
var baseCredentialFileName = project.files.credentials || fspath.basename(project.files.oldCredentials); var baseCredentialFileName = project.files.credentials || fspath.basename(project.files.oldCredentials);
files.push(baseFlowFileName); files.push(baseFlowFileName);
@ -790,7 +790,7 @@ function createDefaultProject(user, project) {
} }
return util.writeFile(credsFilePath,credentialData); return util.writeFile(credsFilePath,credentialData);
})); }));
delete project.files.migrateFiles; delete project.migrateFiles;
project.files.flow = baseFlowFileName; project.files.flow = baseFlowFileName;
project.files.credentials = baseCredentialFileName; project.files.credentials = baseCredentialFileName;
} else { } else {

View File

@ -307,7 +307,7 @@ function reloadActiveProject(action) {
} }
function createProject(user, metadata) { function createProject(user, metadata) {
// var userSettings = getUserGitSettings(user); // var userSettings = getUserGitSettings(user);
if (metadata.files && metadata.files.migrateFiles) { if (metadata.files && metadata.migrateFiles) {
// We expect there to be no active project in this scenario // We expect there to be no active project in this scenario
if (activeProject) { if (activeProject) {
throw new Error("Cannot migrate as there is an active project"); throw new Error("Cannot migrate as there is an active project");