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

Generate runtime api docs in runtime module

This commit is contained in:
Nick O'Leary 2018-11-16 10:04:53 +00:00
parent 8167608f04
commit bc02c9573c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
6 changed files with 20 additions and 14 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ nodes/core/locales/zz-ZZ
packages/node_modules/@node-red/editor-client/public packages/node_modules/@node-red/editor-client/public
!test/**/node_modules !test/**/node_modules
docs docs
!packages/node_modules/**/docs

View File

@ -450,7 +450,7 @@ module.exports = function(grunt) {
separators: true separators: true
}, },
src: 'packages/node_modules/@node-red/runtime/lib/api/*.js', src: 'packages/node_modules/@node-red/runtime/lib/api/*.js',
dest: 'docs/runtime-api.md' dest: 'packages/node_modules/@node-red/runtime/docs/api.md'
}, },
nodeREDUtil: { nodeREDUtil: {
options: { options: {

View File

@ -69,7 +69,7 @@ var api = module.exports = {
* @param {String} opts.key - the context key * @param {String} opts.key - the context key
* @return {Promise} - the node information * @return {Promise} - the node information
* @memberof RED.nodes * @memberof RED.context
*/ */
getValue: function(opts) { getValue: function(opts) {
return new Promise(function(resolve,reject) { return new Promise(function(resolve,reject) {
@ -163,7 +163,7 @@ var api = module.exports = {
* @param {String} opts.key - the context key * @param {String} opts.key - the context key
* @return {Promise} - the node information * @return {Promise} - the node information
* @memberof RED.nodes * @memberof RED.context
*/ */
delete: function(opts) { delete: function(opts) {
return new Promise(function(resolve,reject) { return new Promise(function(resolve,reject) {

View File

@ -1,4 +1,4 @@
/** /*!
* Copyright JS Foundation and other contributors, http://js.foundation * Copyright JS Foundation and other contributors, http://js.foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
**/ **/
/**
* A user accessing the API
* @typedef User
* @type {object}
*/
var runtime; var runtime;
/** /**
* This module provides the core runtime component of Node-RED.
* It does *not* include the Node-RED editor. All interaction with
* this module is done using the api provided.
*
* @namespace RED * @namespace RED
*/ */
var api = module.exports = { var api = module.exports = {
@ -66,3 +66,9 @@ var api = module.exports = {
return Promise.resolve(runtime.version()); return Promise.resolve(runtime.version());
} }
} }
/**
* A user accessing the API
* @typedef User
* @type {object}
*/

View File

@ -30,7 +30,7 @@ var path = require('path');
var fs = require("fs"); var fs = require("fs");
var os = require("os"); var os = require("os");
var redUtil; var redUtil = require("@node-red/util");
var log; var log;
var i18n; var i18n;
@ -57,8 +57,7 @@ var adminApi = {
var nodeApp; var nodeApp;
function init(userSettings,_redUtil,_adminApi) { function init(userSettings,_adminApi) {
redUtil = _redUtil;
log = redUtil.log; log = redUtil.log;
i18n = redUtil.i18n; i18n = redUtil.i18n;
userSettings.version = getVersion(); userSettings.version = getVersion();

View File

@ -54,14 +54,14 @@ module.exports = {
} }
redUtil.init(userSettings); redUtil.init(userSettings);
if (userSettings.httpAdminRoot !== false) { if (userSettings.httpAdminRoot !== false) {
runtime.init(userSettings,redUtil,api); runtime.init(userSettings,api);
api.init(httpServer,userSettings,runtime._.storage,runtime); api.init(httpServer,userSettings,runtime._.storage,runtime);
apiEnabled = true; apiEnabled = true;
server = runtime._.adminApi.server; server = runtime._.adminApi.server;
runtime._.server = runtime._.adminApi.server; runtime._.server = runtime._.adminApi.server;
} else { } else {
runtime.init(userSettings,redUtil); runtime.init(userSettings);
apiEnabled = false; apiEnabled = false;
if (httpServer){ if (httpServer){
server = httpServer; server = httpServer;