mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add start script to default project package
This commit is contained in:
parent
838c7a5e89
commit
499d22daca
@ -279,6 +279,11 @@ Project.prototype.update = function (user, data) {
|
|||||||
if (data.hasOwnProperty('dependencies')) {
|
if (data.hasOwnProperty('dependencies')) {
|
||||||
savePackage = true;
|
savePackage = true;
|
||||||
this.package.dependencies = data.dependencies;
|
this.package.dependencies = data.dependencies;
|
||||||
|
if (this.package.dependencies.hasOwnProperty("node-red")) {
|
||||||
|
this.package.scripts = {"start":"node node_modules/node-red/red.js -u . " + this.package['node-red'].settings.flowFile};
|
||||||
|
} else {
|
||||||
|
delete(this.package.scripts.start);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (data.hasOwnProperty('summary')) {
|
if (data.hasOwnProperty('summary')) {
|
||||||
savePackage = true;
|
savePackage = true;
|
||||||
@ -332,6 +337,11 @@ Project.prototype.update = function (user, data) {
|
|||||||
if (data.files.hasOwnProperty('flow') && this.package['node-red'].settings.flowFile !== data.files.flow) {
|
if (data.files.hasOwnProperty('flow') && this.package['node-red'].settings.flowFile !== data.files.flow) {
|
||||||
this.paths.flowFile = data.files.flow;
|
this.paths.flowFile = data.files.flow;
|
||||||
this.package['node-red'].settings.flowFile = data.files.flow;
|
this.package['node-red'].settings.flowFile = data.files.flow;
|
||||||
|
if (this.package.dependencies.hasOwnProperty("node-red")) {
|
||||||
|
this.package.scripts = {"start":"node node_modules/node-red/red.js -u . " + data.files.flow};
|
||||||
|
} else {
|
||||||
|
delete(this.package.scripts.start);
|
||||||
|
}
|
||||||
savePackage = true;
|
savePackage = true;
|
||||||
flowFilesChanged = true;
|
flowFilesChanged = true;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@ module.exports = {
|
|||||||
"node-red": {
|
"node-red": {
|
||||||
"settings": {
|
"settings": {
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"scripts": {}
|
||||||
};
|
};
|
||||||
if (project.files) {
|
if (project.files) {
|
||||||
if (project.files.flow) {
|
if (project.files.flow) {
|
||||||
@ -43,5 +44,5 @@ module.exports = {
|
|||||||
|
|
||||||
return content;
|
return content;
|
||||||
},
|
},
|
||||||
".gitignore": function() { return "*.backup" ;}
|
".gitignore": function() { return "*.backup\n" ;}
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ module.exports = {
|
|||||||
writeFile: function(path,content,backupPath) {
|
writeFile: function(path,content,backupPath) {
|
||||||
if (backupPath) {
|
if (backupPath) {
|
||||||
try {
|
try {
|
||||||
console.log(path);
|
// console.log(path);
|
||||||
console.log(backupPath);
|
// console.log(backupPath);
|
||||||
fs.renameSync(path,backupPath);
|
fs.renameSync(path,backupPath);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user