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

Updated Design: Projects (markdown)

Nick O'Leary 2017-10-25 22:02:44 +01:00
parent 6b2b2f3fb8
commit c6258e74d2

@ -1,5 +1,9 @@
_**This is a work in progress - I'm trying to capture the design as it evolves.**_
Last Update: 25th October.
Working code in the `projects` branch.
- [Description](#description)
- [Project files](#project-files)
- [Design](#design)
@ -27,6 +31,7 @@ Projects exist in the directory `~/.node-red/projects/`
├── projects
│   └── my-project
│   ├── .git
| ├── .gitignore
│   ├── flow.json
│   ├── flow_cred.json
│   ├── package.json
@ -41,6 +46,7 @@ Projects exist in the directory `~/.node-red/projects/`
- README.md documentation for the flow
- settings.json project specific settings
- The name of the flow file (default `flow.json`) will be customisable
- The editor will provide facilities to edit each of these files in the appropriate context.
- TBD: A project could contain other files (such as public/html content). Should NR allows you to edit/manage them as well? We dont want to become a generic IDE.
@ -50,9 +56,12 @@ Projects exist in the directory `~/.node-red/projects/`
- The package.json file is the standard npm format.
- It lists the npm dependencies and any other project metadata.
- The dependencies do not get installed in the project directory they get installed at the top level of the user directory (as they would today).
- It includes a `node-red` section, under which there is a `settings` section
### `settings.json`
25-Oct: The purpose of the `settings.json` file is not fully defined yet.
- The settings.json file contains project specific settings. They are a subset of those available in the top-level settings.js file. TBD: exactly what settings are supported.
- The settings file is strictly JSON. It cannot contain code as it must be reloadable without side-effects and be writeable by the runtime.
- Introduces the concept of flow-variables:
@ -89,12 +98,21 @@ The storage api will be extended to include the basic projects api. Not all stor
```
StorageModule.projects = {
init: init,
listProjects: listProjects,
init: init,
listProjects: Projects.list,
getActiveProject: getActiveProject,
setActiveProject: setActiveProject,
getProject: getProject,
createProject: createProject,
updateProject: updateProject,
getFiles: getFiles,
getFile: getFile,
stageFile: stageFile,
unstageFile: unstageFile,
commit: commit,
getFileDiff: getFileDiff,
getCommits: getCommits,
getCommit: getCommit,
}
```
@ -106,6 +124,24 @@ _Note:_ this api will grow as the feature is developed - this isn't the final AP
This API is subject to change as the implementation evolves.
- `GET /` - List projects
- `POST /` - Create project
- `PUT /:id` - Update project
- `GET /:id` - Get project
- `DELETE /:id` - Delete project (TODO)
- `GET /:id/files` - Get a projects file listing
- `GET /:id/files/:treeish/:filePath` - Get a file for a given treeish description,
- `POST /:id/stage/:filePath` - Stage a file from the working dir to index
- `POST /:id/stage` - Stage multiple files from the working dir to index
- `POST /:id/commit` - Commit the current index
- `DELETE /:id/stage/:filePath` - Unstage a file from the index
- `DELETE /:id/stage` - Unstage multiple files from the index
- `GET /:id/diff/:type/:filePath` - Get a file diff (type = tree | index)
- `GET /:id/commits` - Get the project commits
- `GET /:id/commits/:sha` - Get an individual commit
### `GET /projects`
Returns a list of all projects available in the editor.