2014-06-28 22:40:46 +02:00
|
|
|
/**
|
2017-01-11 16:24:33 +01:00
|
|
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
2014-06-28 22:40:46 +02:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
**/
|
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
var path = require("path");
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2014-03-31 14:31:31 +02:00
|
|
|
module.exports = function(grunt) {
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-08-13 23:41:51 +02:00
|
|
|
var nodemonArgs = ["-v"];
|
|
|
|
var flowFile = grunt.option('flowFile');
|
|
|
|
if (flowFile) {
|
|
|
|
nodemonArgs.push(flowFile);
|
|
|
|
}
|
|
|
|
|
2018-07-10 13:42:56 +02:00
|
|
|
var nonHeadless = grunt.option('non-headless');
|
|
|
|
if (nonHeadless) {
|
|
|
|
process.env.NODE_RED_NON_HEADLESS = 'true';
|
|
|
|
}
|
2014-03-31 14:31:31 +02:00
|
|
|
grunt.initConfig({
|
2015-04-02 00:24:47 +02:00
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
paths: {
|
|
|
|
dist: ".dist"
|
|
|
|
},
|
|
|
|
simplemocha: {
|
|
|
|
options: {
|
|
|
|
globals: ['expect'],
|
|
|
|
timeout: 3000,
|
|
|
|
ignoreLeaks: false,
|
|
|
|
ui: 'bdd',
|
|
|
|
reporter: 'spec'
|
|
|
|
},
|
|
|
|
all: { src: ['test/**/*_spec.js'] },
|
|
|
|
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
|
|
|
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
|
|
|
},
|
2017-12-01 11:50:59 +01:00
|
|
|
webdriver: {
|
|
|
|
all: {
|
|
|
|
configFile: 'test/editor/wdio.conf.js'
|
|
|
|
}
|
|
|
|
},
|
2017-03-09 16:28:13 +01:00
|
|
|
mocha_istanbul: {
|
|
|
|
options: {
|
|
|
|
globals: ['expect'],
|
|
|
|
timeout: 3000,
|
|
|
|
ignoreLeaks: false,
|
|
|
|
ui: 'bdd',
|
2017-08-22 23:26:29 +02:00
|
|
|
reportFormats: ['lcov','html'],
|
2017-03-10 21:04:14 +01:00
|
|
|
print: 'both'
|
2017-03-09 16:28:13 +01:00
|
|
|
},
|
2018-05-25 12:36:17 +02:00
|
|
|
all: { src: ["test/_spec.js","test/red/**/*_spec.js","test/nodes/**/*_spec.js"] },
|
2017-08-22 23:26:29 +02:00
|
|
|
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
|
|
|
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
2017-03-09 16:28:13 +01:00
|
|
|
},
|
2015-04-02 00:24:47 +02:00
|
|
|
jshint: {
|
|
|
|
options: {
|
2015-04-16 12:53:39 +02:00
|
|
|
jshintrc:true
|
2015-04-02 00:24:47 +02:00
|
|
|
// http://www.jshint.com/docs/options/
|
2015-04-16 12:53:39 +02:00
|
|
|
//"asi": true, // allow missing semicolons
|
|
|
|
//"curly": true, // require braces
|
|
|
|
//"eqnull": true, // ignore ==null
|
|
|
|
//"forin": true, // require property filtering in "for in" loops
|
|
|
|
//"immed": true, // require immediate functions to be wrapped in ( )
|
|
|
|
//"nonbsp": true, // warn on unexpected whitespace breaking chars
|
|
|
|
////"strict": true, // commented out for now as it causes 100s of warnings, but want to get there eventually
|
|
|
|
//"loopfunc": true, // allow functions to be defined in loops
|
|
|
|
//"sub": true // don't warn that foo['bar'] should be written as foo.bar
|
2015-04-02 00:24:47 +02:00
|
|
|
},
|
|
|
|
all: [
|
|
|
|
'Gruntfile.js',
|
|
|
|
'red.js',
|
|
|
|
'red/**/*.js',
|
2015-06-15 21:38:40 +02:00
|
|
|
'nodes/core/*/*.js',
|
2015-04-02 00:24:47 +02:00
|
|
|
'editor/js/**/*.js'
|
|
|
|
],
|
|
|
|
core: {
|
|
|
|
files: {
|
|
|
|
src: [
|
|
|
|
'Gruntfile.js',
|
|
|
|
'red.js',
|
|
|
|
'red/**/*.js'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
nodes: {
|
|
|
|
files: {
|
2015-06-15 21:38:40 +02:00
|
|
|
src: [ 'nodes/core/*/*.js' ]
|
2015-04-02 00:24:47 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
editor: {
|
|
|
|
files: {
|
|
|
|
src: [ 'editor/js/**/*.js' ]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tests: {
|
|
|
|
files: {
|
|
|
|
src: ['test/**/*.js']
|
2014-03-31 14:31:31 +02:00
|
|
|
},
|
2015-04-02 00:24:47 +02:00
|
|
|
options: {
|
2016-05-18 12:11:59 +02:00
|
|
|
"expr": true
|
2015-04-02 00:24:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
concat: {
|
|
|
|
options: {
|
|
|
|
separator: ";",
|
2014-06-28 22:40:46 +02:00
|
|
|
},
|
2015-04-02 00:24:47 +02:00
|
|
|
build: {
|
2016-05-18 12:11:59 +02:00
|
|
|
src: [
|
|
|
|
// Ensure editor source files are concatenated in
|
|
|
|
// the right order
|
2016-11-02 23:53:18 +01:00
|
|
|
"editor/js/red.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/events.js",
|
|
|
|
"editor/js/i18n.js",
|
|
|
|
"editor/js/settings.js",
|
|
|
|
"editor/js/user.js",
|
|
|
|
"editor/js/comms.js",
|
2016-08-25 18:09:56 +02:00
|
|
|
"editor/js/text/bidi.js",
|
|
|
|
"editor/js/text/format.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/ui/state.js",
|
|
|
|
"editor/js/nodes.js",
|
|
|
|
"editor/js/history.js",
|
|
|
|
"editor/js/validators.js",
|
2017-01-06 12:23:19 +01:00
|
|
|
"editor/js/ui/utils.js",
|
2016-08-09 11:41:26 +02:00
|
|
|
"editor/js/ui/common/editableList.js",
|
2017-05-22 12:35:45 +02:00
|
|
|
"editor/js/ui/common/checkboxSet.js",
|
2016-08-09 11:41:26 +02:00
|
|
|
"editor/js/ui/common/menu.js",
|
2017-05-05 12:23:24 +02:00
|
|
|
"editor/js/ui/common/panels.js",
|
2016-08-09 11:41:26 +02:00
|
|
|
"editor/js/ui/common/popover.js",
|
|
|
|
"editor/js/ui/common/searchBox.js",
|
|
|
|
"editor/js/ui/common/tabs.js",
|
2017-01-31 00:47:18 +01:00
|
|
|
"editor/js/ui/common/stack.js",
|
2016-08-09 11:41:26 +02:00
|
|
|
"editor/js/ui/common/typedInput.js",
|
2016-12-04 23:59:43 +01:00
|
|
|
"editor/js/ui/actions.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/ui/deploy.js",
|
2016-12-06 23:37:21 +01:00
|
|
|
"editor/js/ui/diff.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/ui/keyboard.js",
|
|
|
|
"editor/js/ui/workspaces.js",
|
|
|
|
"editor/js/ui/view.js",
|
2018-06-09 00:32:17 +02:00
|
|
|
"editor/js/ui/view-navigator.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/ui/sidebar.js",
|
|
|
|
"editor/js/ui/palette.js",
|
|
|
|
"editor/js/ui/tab-info.js",
|
|
|
|
"editor/js/ui/tab-config.js",
|
2018-06-21 11:31:27 +02:00
|
|
|
"editor/js/ui/tab-context.js",
|
2016-08-04 17:49:36 +02:00
|
|
|
"editor/js/ui/palette-editor.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/ui/editor.js",
|
2018-04-26 18:53:45 +02:00
|
|
|
"editor/js/ui/editors/*.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/ui/tray.js",
|
|
|
|
"editor/js/ui/clipboard.js",
|
|
|
|
"editor/js/ui/library.js",
|
|
|
|
"editor/js/ui/notifications.js",
|
2016-09-30 00:46:29 +02:00
|
|
|
"editor/js/ui/search.js",
|
2016-11-07 22:25:09 +01:00
|
|
|
"editor/js/ui/typeSearch.js",
|
2016-05-18 12:11:59 +02:00
|
|
|
"editor/js/ui/subflow.js",
|
2017-04-25 14:43:59 +02:00
|
|
|
"editor/js/ui/userSettings.js",
|
2018-01-09 00:14:37 +01:00
|
|
|
"editor/js/ui/projects/projects.js",
|
|
|
|
"editor/js/ui/projects/projectSettings.js",
|
|
|
|
"editor/js/ui/projects/projectUserSettings.js",
|
|
|
|
"editor/js/ui/projects/tab-versionControl.js",
|
2016-08-09 11:41:26 +02:00
|
|
|
"editor/js/ui/touch/radialMenu.js"
|
2016-05-18 12:11:59 +02:00
|
|
|
],
|
|
|
|
dest: "public/red/red.js"
|
2015-04-13 01:10:10 +02:00
|
|
|
},
|
|
|
|
vendor: {
|
|
|
|
files: {
|
|
|
|
"public/vendor/vendor.js": [
|
2016-01-08 15:41:37 +01:00
|
|
|
"editor/vendor/jquery/js/jquery-1.11.3.min.js",
|
2015-04-13 01:10:10 +02:00
|
|
|
"editor/vendor/bootstrap/js/bootstrap.min.js",
|
|
|
|
"editor/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js",
|
|
|
|
"editor/vendor/jquery/js/jquery.ui.touch-punch.min.js",
|
|
|
|
"editor/vendor/marked/marked.min.js",
|
2015-04-15 21:59:39 +02:00
|
|
|
"editor/vendor/d3/d3.v3.min.js",
|
|
|
|
"editor/vendor/i18next/i18next.min.js"
|
2015-04-13 01:10:10 +02:00
|
|
|
],
|
|
|
|
"public/vendor/vendor.css": [
|
|
|
|
// TODO: resolve relative resource paths in
|
|
|
|
// bootstrap/FA/jquery
|
2016-11-16 00:22:25 +01:00
|
|
|
],
|
2017-05-03 16:48:30 +02:00
|
|
|
"public/vendor/jsonata/jsonata.min.js": [
|
2017-06-26 14:55:22 +02:00
|
|
|
"node_modules/jsonata/jsonata-es5.min.js",
|
2016-11-16 00:22:25 +01:00
|
|
|
"editor/vendor/jsonata/formatter.js"
|
2017-06-26 14:55:22 +02:00
|
|
|
],
|
|
|
|
"public/vendor/ace/worker-jsonata.js": [
|
|
|
|
"node_modules/jsonata/jsonata-es5.min.js",
|
|
|
|
"editor/vendor/jsonata/worker-jsonata.js"
|
2015-04-13 01:10:10 +02:00
|
|
|
]
|
|
|
|
}
|
2015-04-02 00:24:47 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
build: {
|
|
|
|
files: {
|
2016-11-02 23:53:18 +01:00
|
|
|
'public/red/red.min.js': 'public/red/red.js',
|
2016-11-11 00:58:34 +01:00
|
|
|
'public/red/main.min.js': 'public/red/main.js',
|
2016-11-15 01:19:04 +01:00
|
|
|
'public/vendor/ace/mode-jsonata.js': 'editor/vendor/jsonata/mode-jsonata.js',
|
2016-11-16 15:54:51 +01:00
|
|
|
'public/vendor/ace/snippets/jsonata.js': 'editor/vendor/jsonata/snippets-jsonata.js'
|
2015-04-02 00:24:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sass: {
|
|
|
|
build: {
|
2014-06-28 22:40:46 +02:00
|
|
|
options: {
|
2015-04-02 00:24:47 +02:00
|
|
|
outputStyle: 'compressed'
|
2014-06-28 22:40:46 +02:00
|
|
|
},
|
2015-04-02 00:24:47 +02:00
|
|
|
files: [{
|
|
|
|
dest: 'public/red/style.min.css',
|
|
|
|
src: 'editor/sass/style.scss'
|
2015-07-13 12:26:29 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
dest: 'public/vendor/bootstrap/css/bootstrap.min.css',
|
|
|
|
src: 'editor/vendor/bootstrap/css/bootstrap.css'
|
2015-04-02 00:24:47 +02:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
2015-05-28 16:28:17 +02:00
|
|
|
jsonlint: {
|
|
|
|
messages: {
|
|
|
|
src: [
|
|
|
|
'nodes/core/locales/en-US/messages.json',
|
2015-11-22 00:12:39 +01:00
|
|
|
'red/api/locales/en-US/editor.json',
|
|
|
|
'red/runtime/locales/en-US/runtime.json'
|
2015-05-28 16:28:17 +02:00
|
|
|
]
|
2016-12-04 23:59:43 +01:00
|
|
|
},
|
|
|
|
keymaps: {
|
|
|
|
src: [
|
|
|
|
'editor/js/keymap.json'
|
|
|
|
]
|
2015-05-28 16:28:17 +02:00
|
|
|
}
|
|
|
|
},
|
2015-04-09 22:12:39 +02:00
|
|
|
attachCopyright: {
|
|
|
|
js: {
|
|
|
|
src: [
|
2016-11-02 23:53:18 +01:00
|
|
|
'public/red/red.min.js',
|
|
|
|
'public/red/main.min.js'
|
2015-04-09 22:12:39 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
src: [
|
|
|
|
'public/red/style.min.css'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2015-04-02 00:24:47 +02:00
|
|
|
clean: {
|
|
|
|
build: {
|
|
|
|
src: [
|
|
|
|
"public/red",
|
|
|
|
"public/index.html",
|
|
|
|
"public/favicon.ico",
|
|
|
|
"public/icons",
|
|
|
|
"public/vendor"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
release: {
|
|
|
|
src: [
|
|
|
|
'<%= paths.dist %>'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
js: {
|
|
|
|
files: [
|
|
|
|
'editor/js/**/*.js'
|
2014-06-28 22:40:46 +02:00
|
|
|
],
|
2016-12-04 23:59:43 +01:00
|
|
|
tasks: ['copy:build','concat','uglify','attachCopyright:js']
|
2015-04-02 00:24:47 +02:00
|
|
|
},
|
|
|
|
sass: {
|
|
|
|
files: [
|
|
|
|
'editor/sass/**/*.scss'
|
|
|
|
],
|
2015-04-09 22:12:39 +02:00
|
|
|
tasks: ['sass','attachCopyright:css']
|
2015-05-28 16:28:17 +02:00
|
|
|
},
|
|
|
|
json: {
|
|
|
|
files: [
|
|
|
|
'nodes/core/locales/en-US/messages.json',
|
2015-11-22 00:12:39 +01:00
|
|
|
'red/api/locales/en-US/editor.json',
|
|
|
|
'red/runtime/locales/en-US/runtime.json'
|
2015-05-28 16:28:17 +02:00
|
|
|
],
|
|
|
|
tasks: ['jsonlint:messages']
|
2016-06-08 17:18:24 +02:00
|
|
|
},
|
2016-12-04 23:59:43 +01:00
|
|
|
keymaps: {
|
|
|
|
files: [
|
|
|
|
'editor/js/keymap.json'
|
|
|
|
],
|
|
|
|
tasks: ['jsonlint:keymaps','copy:build']
|
|
|
|
},
|
2016-06-08 17:18:24 +02:00
|
|
|
misc: {
|
|
|
|
files: [
|
|
|
|
'CHANGELOG.md'
|
|
|
|
],
|
|
|
|
tasks: ['copy:build']
|
2015-04-02 00:24:47 +02:00
|
|
|
}
|
|
|
|
},
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
nodemon: {
|
|
|
|
/* uses .nodemonignore */
|
|
|
|
dev: {
|
|
|
|
script: 'red.js',
|
|
|
|
options: {
|
2015-08-13 23:41:51 +02:00
|
|
|
args: nodemonArgs,
|
2015-05-28 16:28:17 +02:00
|
|
|
ext: 'js,html,json',
|
2015-04-09 23:18:37 +02:00
|
|
|
watch: [
|
2015-11-22 00:12:39 +01:00
|
|
|
'red','nodes'
|
2015-04-09 23:18:37 +02:00
|
|
|
]
|
2015-04-02 00:24:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
concurrent: {
|
|
|
|
dev: {
|
|
|
|
tasks: ['nodemon', 'watch'],
|
|
|
|
options: {
|
|
|
|
logConcurrentOutput: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
copy: {
|
|
|
|
build: {
|
2016-11-02 23:53:18 +01:00
|
|
|
files:[
|
|
|
|
{
|
|
|
|
src: 'editor/js/main.js',
|
|
|
|
dest: 'public/red/main.js'
|
|
|
|
},
|
2016-12-04 23:59:43 +01:00
|
|
|
{
|
|
|
|
src: 'editor/js/keymap.json',
|
|
|
|
dest: 'public/red/keymap.json'
|
|
|
|
},
|
2016-11-02 23:53:18 +01:00
|
|
|
{
|
|
|
|
cwd: 'editor/images',
|
|
|
|
src: '**',
|
|
|
|
expand: true,
|
|
|
|
dest: 'public/red/images/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
cwd: 'editor/vendor',
|
|
|
|
src: [
|
|
|
|
'ace/**',
|
|
|
|
//'bootstrap/css/**',
|
|
|
|
'bootstrap/img/**',
|
|
|
|
'jquery/css/**',
|
|
|
|
'font-awesome/**'
|
|
|
|
],
|
|
|
|
expand: true,
|
|
|
|
dest: 'public/vendor/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
cwd: 'editor/icons',
|
|
|
|
src: '**',
|
|
|
|
expand: true,
|
|
|
|
dest: 'public/icons/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
src: ['editor/index.html','editor/favicon.ico'],
|
|
|
|
dest: 'public/',
|
|
|
|
flatten: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
src: 'CHANGELOG.md',
|
|
|
|
dest: 'public/red/about'
|
|
|
|
}
|
2016-06-08 17:18:24 +02:00
|
|
|
]
|
2015-04-02 00:24:47 +02:00
|
|
|
},
|
|
|
|
release: {
|
|
|
|
files: [{
|
2015-06-17 14:38:49 +02:00
|
|
|
mode: true,
|
2015-04-02 00:24:47 +02:00
|
|
|
expand: true,
|
|
|
|
src: [
|
|
|
|
'*.md',
|
|
|
|
'LICENSE',
|
|
|
|
'package.json',
|
|
|
|
'settings.js',
|
|
|
|
'red.js',
|
|
|
|
'lib/.gitignore',
|
|
|
|
'nodes/*.demo',
|
|
|
|
'nodes/core/**',
|
|
|
|
'red/**',
|
2015-04-13 01:10:10 +02:00
|
|
|
'public/**',
|
2015-06-17 00:39:33 +02:00
|
|
|
'editor/templates/**',
|
2015-11-22 00:12:39 +01:00
|
|
|
'bin/**'
|
2015-04-02 00:24:47 +02:00
|
|
|
],
|
|
|
|
dest: path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>')
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},
|
2015-06-17 14:38:49 +02:00
|
|
|
chmod: {
|
|
|
|
options: {
|
|
|
|
mode: '755'
|
|
|
|
},
|
|
|
|
release: {
|
|
|
|
src: [
|
2018-02-07 11:50:32 +01:00
|
|
|
path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/nodes/core/hardware/nrgpio*'),
|
|
|
|
path.resolve('<%= paths.dist %>/node-red-<%= pkg.version %>/red/runtime/storage/localfilesystem/projects/git/node-red-*sh')
|
2015-06-17 14:38:49 +02:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2015-04-02 00:24:47 +02:00
|
|
|
compress: {
|
|
|
|
release: {
|
|
|
|
options: {
|
|
|
|
archive: '<%= paths.dist %>/node-red-<%= pkg.version %>.zip'
|
|
|
|
},
|
|
|
|
expand: true,
|
|
|
|
cwd: '<%= paths.dist %>/',
|
|
|
|
src: ['node-red-<%= pkg.version %>/**']
|
2014-03-31 14:31:31 +02:00
|
|
|
}
|
2018-04-24 17:48:32 +02:00
|
|
|
},
|
|
|
|
jsdoc : {
|
|
|
|
runtimeAPI: {
|
|
|
|
src: 'red/runtime-api/*.js',
|
|
|
|
options: {
|
|
|
|
destination: 'docs',
|
|
|
|
configure: './jsdoc.json'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
jsdoc2md: {
|
|
|
|
runtimeAPI: {
|
|
|
|
options: {
|
|
|
|
separators: true
|
|
|
|
},
|
|
|
|
src: 'red/runtime-api/*.js',
|
|
|
|
dest: 'docs/runtime-api.md'
|
|
|
|
}
|
2015-04-02 00:24:47 +02:00
|
|
|
}
|
2014-03-31 14:31:31 +02:00
|
|
|
});
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2014-03-31 14:31:31 +02:00
|
|
|
grunt.loadNpmTasks('grunt-simple-mocha');
|
2014-06-28 22:40:46 +02:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-concurrent');
|
|
|
|
grunt.loadNpmTasks('grunt-sass');
|
|
|
|
grunt.loadNpmTasks('grunt-nodemon');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-compress');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
2015-06-17 14:38:49 +02:00
|
|
|
grunt.loadNpmTasks('grunt-chmod');
|
2015-05-28 16:28:17 +02:00
|
|
|
grunt.loadNpmTasks('grunt-jsonlint');
|
2017-03-09 16:28:13 +01:00
|
|
|
grunt.loadNpmTasks('grunt-mocha-istanbul');
|
2017-12-01 11:50:59 +01:00
|
|
|
grunt.loadNpmTasks('grunt-webdriver');
|
2018-04-24 17:48:32 +02:00
|
|
|
grunt.loadNpmTasks('grunt-jsdoc');
|
|
|
|
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
|
2015-07-10 20:49:31 +02:00
|
|
|
|
2015-04-09 22:12:39 +02:00
|
|
|
grunt.registerMultiTask('attachCopyright', function() {
|
|
|
|
var files = this.data.src;
|
|
|
|
var copyright = "/**\n"+
|
2017-01-11 16:24:33 +01:00
|
|
|
" * Copyright JS Foundation and other contributors, http://js.foundation\n"+
|
2015-04-09 22:12:39 +02:00
|
|
|
" *\n"+
|
|
|
|
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"+
|
|
|
|
" * you may not use this file except in compliance with the License.\n"+
|
|
|
|
" * You may obtain a copy of the License at\n"+
|
|
|
|
" *\n"+
|
|
|
|
" * http://www.apache.org/licenses/LICENSE-2.0\n"+
|
|
|
|
" *\n"+
|
|
|
|
" * Unless required by applicable law or agreed to in writing, software\n"+
|
|
|
|
" * distributed under the License is distributed on an \"AS IS\" BASIS,\n"+
|
|
|
|
" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"+
|
|
|
|
" * See the License for the specific language governing permissions and\n"+
|
|
|
|
" * limitations under the License.\n"+
|
|
|
|
" **/\n";
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-09 22:12:39 +02:00
|
|
|
if (files) {
|
2017-03-10 21:04:14 +01:00
|
|
|
for (var i=0; i<files.length; i++) {
|
2015-04-09 22:12:39 +02:00
|
|
|
var file = files[i];
|
|
|
|
if (!grunt.file.exists(file)) {
|
|
|
|
grunt.log.warn('File '+ file + ' not found');
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
var content = grunt.file.read(file);
|
|
|
|
if (content.indexOf(copyright) == -1) {
|
|
|
|
content = copyright+content;
|
|
|
|
if (!grunt.file.write(file, content)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
grunt.log.writeln("Attached copyright to "+file);
|
|
|
|
} else {
|
|
|
|
grunt.log.writeln("Copyright already on "+file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-06-15 21:38:40 +02:00
|
|
|
|
2015-05-11 21:24:15 +02:00
|
|
|
grunt.registerTask('setDevEnv',
|
2015-06-15 21:38:40 +02:00
|
|
|
'Sets NODE_ENV=development so non-minified assets are used',
|
2015-05-11 21:24:15 +02:00
|
|
|
function () {
|
|
|
|
process.env.NODE_ENV = 'development';
|
|
|
|
});
|
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.registerTask('default',
|
|
|
|
'Builds editor content then runs code style checks and unit tests on all components',
|
2018-05-25 12:36:17 +02:00
|
|
|
['build','jshint:editor','mocha_istanbul:all']);
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.registerTask('test-core',
|
|
|
|
'Runs code style check and unit tests on core runtime code',
|
2017-08-22 23:26:29 +02:00
|
|
|
['build','mocha_istanbul:core']);
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.registerTask('test-editor',
|
|
|
|
'Runs code style check on editor code',
|
|
|
|
['jshint:editor']);
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2017-12-01 11:50:59 +01:00
|
|
|
grunt.registerTask('test-ui',
|
|
|
|
'Builds editor content then runs unit tests on editor ui',
|
|
|
|
['build','jshint:editor','webdriver:all']);
|
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.registerTask('test-nodes',
|
|
|
|
'Runs unit tests on core nodes',
|
2017-08-22 23:26:29 +02:00
|
|
|
['build','mocha_istanbul:nodes']);
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.registerTask('build',
|
|
|
|
'Builds editor content',
|
2016-12-04 23:59:43 +01:00
|
|
|
['clean:build','jsonlint','concat:build','concat:vendor','copy:build','uglify:build','sass:build','attachCopyright']);
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.registerTask('dev',
|
|
|
|
'Developer mode: run node-red, watch for source changes and build/restart',
|
2015-05-11 21:24:15 +02:00
|
|
|
['build','setDevEnv','concurrent:dev']);
|
2015-04-16 12:53:39 +02:00
|
|
|
|
2015-04-02 00:24:47 +02:00
|
|
|
grunt.registerTask('release',
|
|
|
|
'Create distribution zip file',
|
2015-06-17 14:38:49 +02:00
|
|
|
['build','clean:release','copy:release','chmod:release','compress:release']);
|
2015-04-02 00:24:47 +02:00
|
|
|
|
2017-03-10 21:04:14 +01:00
|
|
|
grunt.registerTask('coverage',
|
|
|
|
'Run Istanbul code test coverage task',
|
2017-08-22 23:26:29 +02:00
|
|
|
['build','mocha_istanbul:all']);
|
2018-04-24 17:48:32 +02:00
|
|
|
|
|
|
|
grunt.registerTask('docs',
|
|
|
|
'Generates API documentation',
|
|
|
|
['jsdoc','jsdoc2md']);
|
2014-03-31 14:31:31 +02:00
|
|
|
};
|