2017-01-07 01:26:13 +01:00
|
|
|
|
var gulp = require('gulp');
|
2017-01-09 15:26:05 +01:00
|
|
|
|
var watch = require('gulp-watch');
|
|
|
|
|
|
var concat = require('gulp-concat');
|
|
|
|
|
|
var rename = require('gulp-rename');
|
2017-06-27 17:00:00 +02:00
|
|
|
|
var wrap = require("gulp-wrap-js");
|
|
|
|
|
|
var sort = require('gulp-sort');
|
2017-08-25 14:22:42 +02:00
|
|
|
|
var connect = require('gulp-connect');
|
|
|
|
|
|
var open = require('gulp-open');
|
2018-10-07 20:01:20 +02:00
|
|
|
|
const babel = require("gulp-babel");
|
2017-08-25 14:22:42 +02:00
|
|
|
|
var runSequence = require('run-sequence');
|
2018-05-31 13:37:24 +01:00
|
|
|
|
const imagemin = require('gulp-imagemin');
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
|
|
|
|
|
var _ = require('lodash');
|
|
|
|
|
|
var MergeStream = require('merge-stream');
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
2018-08-08 19:52:00 +02:00
|
|
|
|
// js
|
|
|
|
|
|
const eslint = require('gulp-eslint');
|
|
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
//Less + css
|
|
|
|
|
|
var postcss = require('gulp-postcss');
|
|
|
|
|
|
var less = require('gulp-less');
|
|
|
|
|
|
var autoprefixer = require('autoprefixer');
|
|
|
|
|
|
var cssnano = require('cssnano');
|
|
|
|
|
|
|
2017-08-25 14:22:42 +02:00
|
|
|
|
// Documentation
|
|
|
|
|
|
var gulpDocs = require('gulp-ngdocs');
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
2017-08-28 14:41:54 +02:00
|
|
|
|
// Testing
|
|
|
|
|
|
var karmaServer = require('karma').Server;
|
|
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
/***************************************************************
|
|
|
|
|
|
Helper functions
|
|
|
|
|
|
***************************************************************/
|
2017-08-29 14:17:41 +02:00
|
|
|
|
function processJs(files, out) {
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
return gulp.src(files)
|
2018-10-07 20:01:20 +02:00
|
|
|
|
// check for js errors
|
|
|
|
|
|
.pipe(eslint())
|
|
|
|
|
|
// outputs the lint results to the console
|
|
|
|
|
|
.pipe(eslint.format())
|
|
|
|
|
|
// sort files in stream by path or any custom sort comparator
|
|
|
|
|
|
.pipe(babel())
|
|
|
|
|
|
.pipe(sort())
|
|
|
|
|
|
.pipe(concat(out))
|
|
|
|
|
|
.pipe(wrap('(function(){\n%= body %\n})();'))
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.js));
|
|
|
|
|
|
|
|
|
|
|
|
console.log(out + " compiled");
|
2017-01-07 01:26:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function processLess(files, out) {
|
2017-09-08 13:13:26 +02:00
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
var processors = [
|
|
|
|
|
|
autoprefixer,
|
2017-09-14 11:04:34 +02:00
|
|
|
|
cssnano({zindex: false}),
|
2017-01-07 01:26:13 +01:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
return gulp.src(files)
|
|
|
|
|
|
.pipe(less())
|
|
|
|
|
|
.pipe(postcss(processors))
|
|
|
|
|
|
.pipe(rename(out))
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.css));
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
|
|
|
|
|
console.log(out + " compiled");
|
2017-01-07 01:26:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************
|
|
|
|
|
|
Paths and destinations
|
|
|
|
|
|
Each group is iterated automatically in the setup tasks below
|
|
|
|
|
|
***************************************************************/
|
|
|
|
|
|
var sources = {
|
|
|
|
|
|
|
|
|
|
|
|
//less files used by backoffice and preview
|
|
|
|
|
|
//processed in the less task
|
|
|
|
|
|
less: {
|
|
|
|
|
|
installer: { files: ["src/less/installer.less"], out: "installer.css" },
|
2017-05-05 13:10:40 +02:00
|
|
|
|
nonodes: { files: ["src/less/pages/nonodes.less"], out: "nonodes.style.min.css"},
|
2017-09-08 13:13:26 +02:00
|
|
|
|
preview: { files: ["src/less/canvas-designer.less"], out: "canvasdesigner.css" },
|
2017-01-07 01:26:13 +01:00
|
|
|
|
umbraco: { files: ["src/less/belle.less"], out: "umbraco.css" }
|
|
|
|
|
|
},
|
2017-05-05 13:10:40 +02:00
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
//js files for backoffie
|
|
|
|
|
|
//processed in the js task
|
|
|
|
|
|
js: {
|
2018-09-14 00:14:03 +10:00
|
|
|
|
preview: { files: ["src/preview/**/*.js"], out: "umbraco.preview.js" },
|
2017-01-07 01:26:13 +01:00
|
|
|
|
installer: { files: ["src/installer/**/*.js"], out: "umbraco.installer.js" },
|
2017-01-09 15:26:05 +01:00
|
|
|
|
controllers: { files: ["src/{views,controllers}/**/*.controller.js"], out: "umbraco.controllers.js" },
|
2017-01-07 01:26:13 +01:00
|
|
|
|
directives: { files: ["src/common/directives/**/*.js"], out: "umbraco.directives.js" },
|
|
|
|
|
|
filters: { files: ["src/common/filters/**/*.js"], out: "umbraco.filters.js" },
|
|
|
|
|
|
resources: { files: ["src/common/resources/**/*.js"], out: "umbraco.resources.js" },
|
|
|
|
|
|
services: { files: ["src/common/services/**/*.js"], out: "umbraco.services.js" },
|
2018-06-15 10:33:16 +10:00
|
|
|
|
security: { files: ["src/common/interceptors/**/*.js"], out: "umbraco.interceptors.js" }
|
2017-01-07 01:26:13 +01:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//selectors for copying all views into the build
|
|
|
|
|
|
//processed in the views task
|
|
|
|
|
|
views:{
|
2018-02-28 08:58:16 +01:00
|
|
|
|
umbraco: {files: ["src/views/**/*.html"], folder: ""},
|
2017-09-08 14:58:50 +02:00
|
|
|
|
installer: {files: ["src/installer/steps/*.html"], folder: "install"}
|
2017-01-07 01:26:13 +01:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//globs for file-watching
|
|
|
|
|
|
globs:{
|
2017-01-16 14:53:07 +01:00
|
|
|
|
views: "./src/views/**/*.html",
|
|
|
|
|
|
less: "./src/less/**/*.less",
|
|
|
|
|
|
js: "./src/*.js",
|
|
|
|
|
|
lib: "./lib/**/*",
|
|
|
|
|
|
assets: "./src/assets/**"
|
2017-01-07 01:26:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2017-01-16 14:53:07 +01:00
|
|
|
|
var root = "../Umbraco.Web.UI/Umbraco/";
|
2017-01-07 01:26:13 +01:00
|
|
|
|
var targets = {
|
2017-01-16 14:53:07 +01:00
|
|
|
|
js: "js/",
|
|
|
|
|
|
lib: "lib/",
|
|
|
|
|
|
views: "views/",
|
|
|
|
|
|
css: "assets/css/",
|
|
|
|
|
|
assets: "assets/"
|
2017-01-07 01:26:13 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************
|
2017-08-28 15:42:31 +02:00
|
|
|
|
* Main tasks for the project to prepare backoffice files
|
2017-01-07 01:26:13 +01:00
|
|
|
|
**************************/
|
|
|
|
|
|
|
2017-08-28 15:42:31 +02:00
|
|
|
|
// Build - build the files ready for production
|
|
|
|
|
|
gulp.task('build', function(cb) {
|
2018-09-07 11:34:55 +02:00
|
|
|
|
runSequence(["dependencies", "js", "less", "views"], cb);
|
2017-08-28 15:42:31 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Dev - build the files ready for development and start watchers
|
|
|
|
|
|
gulp.task('dev', function(cb) {
|
2017-08-29 14:17:41 +02:00
|
|
|
|
runSequence(["dependencies", "js", "less", "views"], "watch", cb);
|
2017-08-28 15:42:31 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Docserve - build and open the back office documentation
|
|
|
|
|
|
gulp.task('docserve', function(cb) {
|
|
|
|
|
|
runSequence('docs', 'connect:docs', 'open:docs', cb);
|
|
|
|
|
|
});
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
|
|
|
|
|
/**************************
|
|
|
|
|
|
* Task processes and copies all dependencies, either installed by bower, npm or stored locally in the project
|
|
|
|
|
|
**************************/
|
|
|
|
|
|
gulp.task('dependencies', function () {
|
|
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
//as we do multiple things in this task, we merge the multiple streams
|
|
|
|
|
|
var stream = new MergeStream();
|
|
|
|
|
|
|
2018-10-11 10:44:14 +02:00
|
|
|
|
// Pick the dependencies we need from each package
|
|
|
|
|
|
// so we don't just ship with a lot of files that aren't needed
|
2018-10-09 20:48:20 +02:00
|
|
|
|
const nodeModules = [
|
2018-10-11 10:44:14 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "ace-builds",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/ace.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/ext-language_tools.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/ext-searchbox.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/ext-settings_menu.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/snippets/text.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/snippets/javascript.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/theme-chrome.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/mode-razor.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/mode-javascript.js",
|
|
|
|
|
|
"./node_modules/ace-builds/src-min-noconflict/worker-javascript.js"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/ace-builds"
|
|
|
|
|
|
},
|
2018-10-09 20:48:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular",
|
|
|
|
|
|
"src": ["./node_modules/angular/angular.js"],
|
|
|
|
|
|
"base": "./node_modules/angular"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-cookies",
|
|
|
|
|
|
"src": ["./node_modules/angular-cookies/angular-cookies.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-cookies"
|
|
|
|
|
|
},
|
2018-10-11 09:46:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-dynamic-locale",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.min.js",
|
|
|
|
|
|
"./node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.min.js.map"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/angular-dynamic-locale/dist"
|
|
|
|
|
|
},
|
2018-10-09 20:48:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-sanitize",
|
|
|
|
|
|
"src": ["./node_modules/angular-sanitize/angular-sanitize.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-sanitize"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-touch",
|
|
|
|
|
|
"src": ["./node_modules/angular-touch/angular-touch.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-touch"
|
|
|
|
|
|
},
|
2018-10-11 10:44:14 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-ui-sortable",
|
|
|
|
|
|
"src": ["./node_modules/angular-ui-sortable/dist/sortable.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-ui-sortable/dist"
|
|
|
|
|
|
},
|
2018-10-09 20:48:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-route",
|
|
|
|
|
|
"src": ["./node_modules/angular-route/angular-route.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-route"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-animate",
|
|
|
|
|
|
"src": ["./node_modules/angular-animate/angular-animate.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-animate"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-i18n",
|
2018-10-10 20:58:35 +02:00
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/angular-i18n/angular-i18n.js",
|
|
|
|
|
|
"./node_modules/angular-i18n/angular-locale_*.js"
|
|
|
|
|
|
],
|
2018-10-09 20:48:20 +02:00
|
|
|
|
"base": "./node_modules/angular-i18n"
|
|
|
|
|
|
},
|
2018-10-11 10:44:14 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-local-storage",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/angular-local-storage/dist/angular-local-storage.min.js",
|
|
|
|
|
|
"./node_modules/angular-local-storage/dist/angular-local-storage.min.js.map"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/angular-local-storage/dist"
|
|
|
|
|
|
},
|
2018-10-09 20:48:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-messages",
|
|
|
|
|
|
"src": ["./node_modules/angular-messages/angular-messages.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-messages"
|
|
|
|
|
|
},
|
2018-10-11 12:16:09 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "angular-mocks",
|
|
|
|
|
|
"src": ["./node_modules/angular/angular-mocks.js"],
|
|
|
|
|
|
"base": "./node_modules/angular-mocks"
|
|
|
|
|
|
},
|
2018-10-09 21:29:50 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "animejs",
|
|
|
|
|
|
"src": ["./node_modules/animejs/anime.min.js"],
|
|
|
|
|
|
"base": "./node_modules/animejs"
|
|
|
|
|
|
},
|
2018-10-10 21:29:42 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "bootstrap-social",
|
|
|
|
|
|
"src": ["./node_modules/bootstrap-social/bootstrap-social.css"],
|
|
|
|
|
|
"base": "./node_modules/bootstrap-social"
|
|
|
|
|
|
},
|
2018-10-09 21:29:50 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "clipboard",
|
|
|
|
|
|
"src": ["./node_modules/clipboard/dist/clipboard.min.js"],
|
|
|
|
|
|
"base": "./node_modules/clipboard/dist"
|
|
|
|
|
|
},
|
2018-10-11 10:44:14 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "codemirror",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/codemirror/lib/codemirror.js",
|
|
|
|
|
|
"./node_modules/codemirror/lib/codemirror.css",
|
|
|
|
|
|
|
2018-10-11 13:12:10 +02:00
|
|
|
|
"./node_modules/codemirror/mode/css/css.js",
|
|
|
|
|
|
"./node_modules/codemirror/mode/javascript/javascript.js",
|
|
|
|
|
|
"./node_modules/codemirror/mode/xml/xml.js",
|
|
|
|
|
|
"./node_modules/codemirror/mode/htmlmixed/htmlmixed.js",
|
2018-10-11 10:44:14 +02:00
|
|
|
|
|
|
|
|
|
|
"./node_modules/codemirror/addon/search/*",
|
|
|
|
|
|
"./node_modules/codemirror/addon/edit/*",
|
|
|
|
|
|
"./node_modules/codemirror/addon/selection/*",
|
|
|
|
|
|
"./node_modules/codemirror/addon/dialog/*"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/codemirror"
|
|
|
|
|
|
},
|
2018-10-09 21:29:50 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "jsdiff",
|
|
|
|
|
|
"src": ["./node_modules/diff/dist/diff.min.js"],
|
|
|
|
|
|
"base": "./node_modules/diff/dist"
|
|
|
|
|
|
},
|
2018-10-09 20:48:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "flatpickr",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/flatpickr/dist/flatpickr.js",
|
|
|
|
|
|
"./node_modules/flatpickr/dist/flatpickr.css"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/flatpickr/dist"
|
|
|
|
|
|
},
|
2018-10-10 21:29:42 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "font-awesome",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/font-awesome/fonts/*",
|
|
|
|
|
|
"./node_modules/font-awesome/css/font-awesome.min.css"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/font-awesome"
|
|
|
|
|
|
},
|
2018-10-10 20:58:35 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "jquery",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/jquery/dist/jquery.min.js",
|
|
|
|
|
|
"./node_modules/jquery/dist/jquery.min.map"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/jquery/dist"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "jquery-migrate",
|
2018-10-11 13:12:10 +02:00
|
|
|
|
"src": ["./node_modules/jquery-migrate/dist/jquery-migrate.min.js"],
|
|
|
|
|
|
"base": "./node_modules/jquery-migrate/dist"
|
2018-10-10 20:58:35 +02:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "jquery-ui",
|
2018-10-11 13:12:10 +02:00
|
|
|
|
"src": ["./node_modules/jquery-ui/ui/widget.js"],
|
2018-10-10 21:29:42 +02:00
|
|
|
|
"base": "./node_modules/jquery-ui"
|
2018-10-10 20:58:35 +02:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "jquery-validate",
|
|
|
|
|
|
"src": ["./node_modules/jquery-validation/dist/jquery.validate.min.js"],
|
|
|
|
|
|
"base": "./node_modules/jquery-validation/dist"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "jquery-validation-unobtrusive",
|
|
|
|
|
|
"src": ["./node_modules/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.min.js"],
|
|
|
|
|
|
"base": "./node_modules/jquery-validation-unobtrusive/dist"
|
|
|
|
|
|
},
|
2018-10-11 12:16:09 +02:00
|
|
|
|
{
|
2018-10-11 13:26:21 +02:00
|
|
|
|
"name": "lazyload-js",
|
|
|
|
|
|
"src": ["./node_modules/lazyload-js/lazyload-min.js"],
|
2018-10-11 12:16:09 +02:00
|
|
|
|
"base": "./node_modules/lazyload-js"
|
|
|
|
|
|
},
|
2018-10-11 09:46:23 +02:00
|
|
|
|
// TODO: We can optimize here:
|
|
|
|
|
|
// we don't have to ship with the moment-with-locales libraries
|
|
|
|
|
|
// we lazyload the user locale
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "moment",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/moment/min/moment.min.js",
|
|
|
|
|
|
"./node_modules/moment/min/moment-with-locales.js",
|
|
|
|
|
|
"./node_modules/moment/min/moment-with-locales.min.js",
|
2018-10-11 13:12:10 +02:00
|
|
|
|
"./node_modules/moment/locale/*.js"
|
2018-10-11 09:46:23 +02:00
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/moment/min"
|
|
|
|
|
|
},
|
2018-10-10 21:29:42 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "ng-file-upload",
|
|
|
|
|
|
"src": ["./node_modules/ng-file-upload/dist/ng-file-upload.min.js"],
|
|
|
|
|
|
"base": "./node_modules/ng-file-upload/dist"
|
|
|
|
|
|
},
|
2018-10-09 20:48:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "signalr",
|
|
|
|
|
|
"src": ["./node_modules/signalr/jquery.signalR.js"],
|
|
|
|
|
|
"base": "./node_modules/signalr"
|
|
|
|
|
|
},
|
2018-10-11 10:44:14 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "tinymce",
|
|
|
|
|
|
"src": [
|
|
|
|
|
|
"./node_modules/tinymce/tinymce.min.js",
|
|
|
|
|
|
"./node_modules/tinymce/plugins/**",
|
|
|
|
|
|
"./node_modules/tinymce/themes/**"
|
|
|
|
|
|
],
|
|
|
|
|
|
"base": "./node_modules/tinymce"
|
|
|
|
|
|
},
|
2018-10-09 20:48:20 +02:00
|
|
|
|
{
|
|
|
|
|
|
"name": "typeahead.js",
|
|
|
|
|
|
"src": ["./node_modules/typeahead.js/dist/typeahead.bundle.min.js"],
|
|
|
|
|
|
"base": "./node_modules/typeahead.js/dist"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"name": "underscore",
|
|
|
|
|
|
"src": ["node_modules/underscore/underscore-min.js"],
|
|
|
|
|
|
"base": "./node_modules/underscore"
|
|
|
|
|
|
}
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
// add streams for node modules
|
|
|
|
|
|
nodeModules.forEach(module => {
|
|
|
|
|
|
stream.add(
|
|
|
|
|
|
gulp.src(module.src,
|
|
|
|
|
|
{ base: module.base })
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.lib + "/" + module.name))
|
|
|
|
|
|
);
|
|
|
|
|
|
});
|
2018-10-07 15:29:24 +02:00
|
|
|
|
|
2018-10-11 13:26:21 +02:00
|
|
|
|
//copy over libs which are not on npm (/lib)
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add(
|
|
|
|
|
|
gulp.src(sources.globs.lib)
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.lib))
|
|
|
|
|
|
);
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
|
|
|
|
|
//Copies all static assets into /root / assets folder
|
|
|
|
|
|
//css, fonts and image files
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add(
|
|
|
|
|
|
gulp.src(sources.globs.assets)
|
2018-05-31 13:37:24 +01:00
|
|
|
|
.pipe(imagemin([
|
|
|
|
|
|
imagemin.gifsicle({interlaced: true}),
|
|
|
|
|
|
imagemin.jpegtran({progressive: true}),
|
|
|
|
|
|
imagemin.optipng({optimizationLevel: 5}),
|
|
|
|
|
|
imagemin.svgo({
|
|
|
|
|
|
plugins: [
|
|
|
|
|
|
{removeViewBox: true},
|
|
|
|
|
|
{cleanupIDs: false}
|
|
|
|
|
|
]
|
|
|
|
|
|
})
|
|
|
|
|
|
]))
|
2017-01-09 15:26:05 +01:00
|
|
|
|
.pipe(gulp.dest(root + targets.assets))
|
|
|
|
|
|
);
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
|
|
|
|
|
// Copies all the less files related to the preview into their folder
|
|
|
|
|
|
//these are not pre-processed as preview has its own less combiler client side
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add(
|
|
|
|
|
|
gulp.src("src/canvasdesigner/editors/*.less")
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.assets + "/less"))
|
|
|
|
|
|
);
|
2017-09-18 16:52:43 +02:00
|
|
|
|
|
|
|
|
|
|
// Todo: check if we need these fileSize
|
|
|
|
|
|
stream.add(
|
|
|
|
|
|
gulp.src("src/views/propertyeditors/grid/config/*.*")
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.views + "/propertyeditors/grid/config"))
|
|
|
|
|
|
);
|
|
|
|
|
|
stream.add(
|
|
|
|
|
|
gulp.src("src/views/dashboard/default/*.jpg")
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.views + "/dashboard/default"))
|
2018-10-09 20:48:20 +02:00
|
|
|
|
);
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
|
|
|
|
|
return stream;
|
2017-01-07 01:26:13 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************
|
|
|
|
|
|
* Copies all angular JS files into their seperate umbraco.*.js file
|
|
|
|
|
|
**************************/
|
2017-08-29 14:17:41 +02:00
|
|
|
|
gulp.task('js', function () {
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
|
|
|
|
|
//we run multiple streams, so merge them all together
|
|
|
|
|
|
var stream = new MergeStream();
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add(
|
|
|
|
|
|
gulp.src(sources.globs.js)
|
|
|
|
|
|
.pipe(gulp.dest(root + targets.js))
|
|
|
|
|
|
);
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
_.forEach(sources.js, function (group) {
|
2017-08-29 14:17:41 +02:00
|
|
|
|
stream.add (processJs(group.files, group.out) );
|
2017-01-09 15:26:05 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return stream;
|
2017-01-07 01:26:13 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('less', function () {
|
|
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
var stream = new MergeStream();
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
_.forEach(sources.less, function (group) {
|
|
|
|
|
|
stream.add( processLess(group.files, group.out) );
|
2017-01-07 01:26:13 +01:00
|
|
|
|
});
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
|
|
|
|
|
return stream;
|
2017-01-07 01:26:13 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('views', function () {
|
|
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
var stream = new MergeStream();
|
|
|
|
|
|
|
|
|
|
|
|
_.forEach(sources.views, function (group) {
|
|
|
|
|
|
|
2017-01-16 14:53:07 +01:00
|
|
|
|
console.log("copying " + group.files + " to " + root + targets.views + group.folder)
|
|
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add (
|
|
|
|
|
|
gulp.src(group.files)
|
2017-01-16 14:53:07 +01:00
|
|
|
|
.pipe( gulp.dest(root + targets.views + group.folder) )
|
2017-01-09 15:26:05 +01:00
|
|
|
|
);
|
|
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
return stream;
|
2017-01-07 01:26:13 +01:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-28 15:42:31 +02:00
|
|
|
|
gulp.task('watch', function () {
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
var stream = new MergeStream();
|
2017-08-29 14:35:54 +02:00
|
|
|
|
var watchInterval = 500;
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
//Setup a watcher for all groups of javascript files
|
|
|
|
|
|
_.forEach(sources.js, function (group) {
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
if(group.watch !== false){
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
|
|
|
|
|
stream.add(
|
|
|
|
|
|
|
2017-08-29 14:35:54 +02:00
|
|
|
|
watch(group.files, { ignoreInitial: true, interval: watchInterval }, function (file) {
|
2017-01-09 15:26:05 +01:00
|
|
|
|
|
|
|
|
|
|
console.info(file.path + " has changed, added to: " + group.out);
|
|
|
|
|
|
processJs(group.files, group.out);
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add(
|
|
|
|
|
|
//watch all less files and trigger the less task
|
2017-08-29 14:35:54 +02:00
|
|
|
|
watch(sources.globs.less, { ignoreInitial: true, interval: watchInterval }, function () {
|
2017-01-09 15:26:05 +01:00
|
|
|
|
gulp.run(['less']);
|
|
|
|
|
|
})
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2017-01-07 01:26:13 +01:00
|
|
|
|
//watch all views - copy single file changes
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add(
|
2017-08-29 14:35:54 +02:00
|
|
|
|
watch(sources.globs.views, { interval: watchInterval })
|
2017-01-09 15:26:05 +01:00
|
|
|
|
.pipe(gulp.dest(root + targets.views))
|
|
|
|
|
|
);
|
2017-01-07 01:26:13 +01:00
|
|
|
|
|
|
|
|
|
|
//watch all app js files that will not be merged - copy single file changes
|
2017-01-09 15:26:05 +01:00
|
|
|
|
stream.add(
|
2017-08-29 14:35:54 +02:00
|
|
|
|
watch(sources.globs.js, { interval: watchInterval })
|
2017-01-09 15:26:05 +01:00
|
|
|
|
.pipe(gulp.dest(root + targets.js))
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2017-08-28 15:42:31 +02:00
|
|
|
|
return stream;
|
2017-08-25 14:22:42 +02:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/**************************
|
|
|
|
|
|
* Build Backoffice UI API documentation
|
|
|
|
|
|
**************************/
|
|
|
|
|
|
gulp.task('docs', [], function (cb) {
|
|
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
|
|
html5Mode: false,
|
|
|
|
|
|
startPage: '/api',
|
|
|
|
|
|
title: "Umbraco Backoffice UI API Documentation",
|
|
|
|
|
|
dest: 'docs/api',
|
|
|
|
|
|
styles: ['docs/umb-docs.css'],
|
2018-07-27 16:41:57 +01:00
|
|
|
|
image: "https://our.umbraco.com/assets/images/logo.svg"
|
2017-08-25 14:22:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return gulpDocs.sections({
|
|
|
|
|
|
api: {
|
|
|
|
|
|
glob: ['src/common/**/*.js', 'docs/src/api/**/*.ngdoc'],
|
|
|
|
|
|
api: true,
|
|
|
|
|
|
title: 'API Documentation'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.pipe(gulpDocs.process(options))
|
|
|
|
|
|
.pipe(gulp.dest('docs/api'));
|
|
|
|
|
|
cb();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('connect:docs', function (cb) {
|
|
|
|
|
|
connect.server({
|
|
|
|
|
|
root: 'docs/api',
|
|
|
|
|
|
livereload: true,
|
|
|
|
|
|
fallback: 'docs/api/index.html',
|
|
|
|
|
|
port: 8880
|
|
|
|
|
|
});
|
|
|
|
|
|
cb();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('open:docs', function (cb) {
|
|
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
|
|
uri: 'http://localhost:8880/index.html'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
gulp.src(__filename)
|
|
|
|
|
|
.pipe(open(options));
|
|
|
|
|
|
cb();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2017-08-28 14:41:54 +02:00
|
|
|
|
/**************************
|
|
|
|
|
|
* Build tests
|
|
|
|
|
|
**************************/
|
|
|
|
|
|
|
|
|
|
|
|
// Karma test
|
|
|
|
|
|
gulp.task('test:unit', function() {
|
|
|
|
|
|
new karmaServer({
|
|
|
|
|
|
configFile: __dirname + "/test/config/karma.conf.js",
|
2017-08-28 15:42:31 +02:00
|
|
|
|
keepalive: true
|
2017-08-28 14:41:54 +02:00
|
|
|
|
})
|
|
|
|
|
|
.start();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('test:e2e', function() {
|
|
|
|
|
|
new karmaServer({
|
|
|
|
|
|
configFile: __dirname + "/test/config/e2e.js",
|
2017-08-28 15:42:31 +02:00
|
|
|
|
keepalive: true
|
2017-08-28 14:41:54 +02:00
|
|
|
|
})
|
|
|
|
|
|
.start();
|
2018-06-15 10:33:16 +10:00
|
|
|
|
});
|