Upgrade Gulp to v4 (#6809)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
01ddc97e25
commit
cc3ef9de0c
@@ -3,26 +3,26 @@
|
||||
module.exports = {
|
||||
sources: {
|
||||
|
||||
//less files used by backoffice and preview
|
||||
//processed in the less task
|
||||
// less files used by backoffice and preview
|
||||
// processed in the less task
|
||||
less: {
|
||||
installer: { files: ["./src/less/installer.less"], out: "installer.css" },
|
||||
nonodes: { files: ["./src/less/pages/nonodes.less"], out: "nonodes.style.min.css"},
|
||||
preview: { files: ["./src/less/canvas-designer.less"], out: "canvasdesigner.css" },
|
||||
umbraco: { files: ["./src/less/belle.less"], out: "umbraco.css" },
|
||||
rteContent: { files: ["./src/less/rte-content.less"], out: "rte-content.css" }
|
||||
installer: { files: "./src/less/installer.less", watch: "./src/less/**/*.less", out: "installer.css" },
|
||||
nonodes: { files: "./src/less/pages/nonodes.less", watch: "./src/less/**/*.less", out: "nonodes.style.min.css"},
|
||||
preview: { files: "./src/less/canvas-designer.less", watch: "./src/less/**/*.less", out: "canvasdesigner.css" },
|
||||
umbraco: { files: "./src/less/belle.less", watch: "./src/less/**/*.less", out: "umbraco.css" },
|
||||
rteContent: { files: "./src/less/rte-content.less", watch: "./src/less/**/*.less", out: "rte-content.css" }
|
||||
},
|
||||
|
||||
//js files for backoffie
|
||||
//processed in the js task
|
||||
// js files for backoffice
|
||||
// processed in the js task
|
||||
js: {
|
||||
preview: { files: ["./src/preview/**/*.js"], out: "umbraco.preview.js" },
|
||||
installer: { files: ["./src/installer/**/*.js"], out: "umbraco.installer.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" },
|
||||
security: { files: ["./src/common/interceptors/**/*.js"], out: "umbraco.interceptors.js" },
|
||||
|
||||
preview: { files: "./src/preview/**/*.js", out: "umbraco.preview.js" },
|
||||
installer: { files: "./src/installer/**/*.js", out: "umbraco.installer.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" },
|
||||
security: { files: "./src/common/interceptors/**/*.js", out: "umbraco.interceptors.js" },
|
||||
|
||||
//the controllers for views
|
||||
controllers: {
|
||||
files: [
|
||||
@@ -42,13 +42,16 @@ module.exports = {
|
||||
],
|
||||
out: "umbraco.directives.js"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//selectors for copying all views into the build
|
||||
//processed in the views task
|
||||
views:{
|
||||
umbraco: {files: ["./src/views/**/*.html"], folder: ""},
|
||||
installer: {files: ["./src/installer/steps/*.html"], folder: "install/"}
|
||||
views: {files: "./src/views/**/*.html", folder: ""},
|
||||
directives: {files: "./src/common/directives/**/*.html", folder: ""},
|
||||
components: {files: "./src/common/components/**/*.html", folder: ""},
|
||||
installer: {files: "./src/installer/steps/*.html", folder: "install/"}
|
||||
},
|
||||
|
||||
//globs for file-watching
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
var onlyScripts = require('./util/scriptFilter');
|
||||
var tasks = fs.readdirSync('./gulp/tasks/').filter(onlyScripts);
|
||||
|
||||
tasks.forEach(function(task) {
|
||||
require('./tasks/' + task);
|
||||
});
|
||||
@@ -1,10 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('../config');
|
||||
var gulp = require('gulp');
|
||||
var runSequence = require('run-sequence');
|
||||
|
||||
// Build - build the files ready for production
|
||||
gulp.task('build', function(cb) {
|
||||
runSequence(["js", "dependencies", "less", "views"], "test:unit", cb);
|
||||
});
|
||||
@@ -10,7 +10,7 @@ var imagemin = require('gulp-imagemin');
|
||||
/**************************
|
||||
* Task processes and copies all dependencies, either installed by npm or stored locally in the project
|
||||
**************************/
|
||||
gulp.task('dependencies', function () {
|
||||
function dependencies() {
|
||||
|
||||
//as we do multiple things in this task, we merge the multiple streams
|
||||
var stream = new MergeStream();
|
||||
@@ -244,21 +244,21 @@ gulp.task('dependencies', function () {
|
||||
nodeModules.forEach(module => {
|
||||
stream.add(
|
||||
gulp.src(module.src,
|
||||
{ base: module.base })
|
||||
{ base: module.base, allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.lib + "/" + module.name))
|
||||
);
|
||||
});
|
||||
|
||||
//copy over libs which are not on npm (/lib)
|
||||
stream.add(
|
||||
gulp.src(config.sources.globs.lib)
|
||||
gulp.src(config.sources.globs.lib, { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.lib))
|
||||
);
|
||||
|
||||
//Copies all static assets into /root / assets folder
|
||||
//css, fonts and image files
|
||||
|
||||
var assetsTask = gulp.src(config.sources.globs.assets);
|
||||
var assetsTask = gulp.src(config.sources.globs.assets, { allowEmpty: true });
|
||||
if (global.isProd === true) {
|
||||
assetsTask = assetsTask.pipe(imagemin([
|
||||
imagemin.gifsicle({interlaced: true}),
|
||||
@@ -277,21 +277,23 @@ gulp.task('dependencies', function () {
|
||||
stream.add(assetsTask);
|
||||
|
||||
// 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
|
||||
//these are not pre-processed as preview has its own less compiler client side
|
||||
stream.add(
|
||||
gulp.src("src/canvasdesigner/editors/*.less")
|
||||
gulp.src("src/canvasdesigner/editors/*.less", { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.assets + "/less"))
|
||||
);
|
||||
|
||||
// Todo: check if we need these fileSize
|
||||
// TODO: check if we need these fileSize
|
||||
stream.add(
|
||||
gulp.src("src/views/propertyeditors/grid/config/*.*")
|
||||
gulp.src("src/views/propertyeditors/grid/config/*.*", { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.views + "/propertyeditors/grid/config"))
|
||||
);
|
||||
stream.add(
|
||||
gulp.src("src/views/dashboard/default/*.jpg")
|
||||
gulp.src("src/views/dashboard/default/*.jpg", { allowEmpty: true })
|
||||
.pipe(gulp.dest(config.root + config.targets.views + "/dashboard/default"))
|
||||
);
|
||||
|
||||
return stream;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { dependencies: dependencies };
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('../config');
|
||||
var gulp = require('gulp');
|
||||
var runSequence = require('run-sequence');
|
||||
|
||||
// Dev - build the files ready for development and start watchers
|
||||
gulp.task('dev', function (cb) {
|
||||
|
||||
global.isProd = false;
|
||||
|
||||
runSequence(["dependencies", "js", "less", "views"], "watch", cb);
|
||||
});
|
||||
@@ -9,21 +9,24 @@ var MergeStream = require('merge-stream');
|
||||
var processJs = require('../util/processJs');
|
||||
|
||||
/**************************
|
||||
* Copies all angular JS files into their seperate umbraco.*.js file
|
||||
* Copies all angular JS files into their separate umbraco.*.js file
|
||||
**************************/
|
||||
gulp.task('js', function () {
|
||||
function js() {
|
||||
|
||||
//we run multiple streams, so merge them all together
|
||||
var stream = new MergeStream();
|
||||
|
||||
stream.add(
|
||||
gulp.src(config.sources.globs.js)
|
||||
.pipe(gulp.dest(config.root + config.targets.js))
|
||||
);
|
||||
gulp.src(config.sources.globs.js).pipe( gulp.dest(config.root + config.targets.js) )
|
||||
);
|
||||
|
||||
_.forEach(config.sources.js, function (group) {
|
||||
stream.add (processJs(group.files, group.out) );
|
||||
});
|
||||
_.forEach(config.sources.js, function (group) {
|
||||
stream.add(
|
||||
processJs(group.files, group.out)
|
||||
);
|
||||
});
|
||||
|
||||
return stream;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { js: js };
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('../config');
|
||||
var gulp = require('gulp');
|
||||
|
||||
var _ = require('lodash');
|
||||
var MergeStream = require('merge-stream');
|
||||
|
||||
var processLess = require('../util/processLess');
|
||||
|
||||
gulp.task('less', function () {
|
||||
function less() {
|
||||
|
||||
var stream = new MergeStream();
|
||||
|
||||
@@ -17,4 +16,6 @@ gulp.task('less', function () {
|
||||
});
|
||||
|
||||
return stream;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { less: less };
|
||||
|
||||
22
src/Umbraco.Web.UI.Client/gulp/tasks/removeProductionMode.js
Normal file
22
src/Umbraco.Web.UI.Client/gulp/tasks/removeProductionMode.js
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var through2 = require('through2');
|
||||
|
||||
function createEmptyStream() {
|
||||
var pass = through2.obj();
|
||||
process.nextTick(pass.end.bind(pass));
|
||||
return pass;
|
||||
}
|
||||
|
||||
/**************************
|
||||
* Copies all angular JS files into their separate umbraco.*.js file
|
||||
**************************/
|
||||
function removeProductionMode() {
|
||||
|
||||
global.isProd = false;
|
||||
|
||||
return createEmptyStream();
|
||||
};
|
||||
|
||||
module.exports = { removeProductionMode: removeProductionMode };
|
||||
@@ -1,32 +1,27 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('../config');
|
||||
var gulp = require('gulp');
|
||||
var karmaServer = require('karma').Server;
|
||||
var runSequence = require('run-sequence');
|
||||
|
||||
/**************************
|
||||
* Build tests
|
||||
**************************/
|
||||
|
||||
// Karma test
|
||||
gulp.task('runTests', function(cb) {
|
||||
runSequence("js", "test:unit", cb);
|
||||
});
|
||||
function testUnit() {
|
||||
|
||||
gulp.task('test:unit', function () {
|
||||
|
||||
new karmaServer({
|
||||
return new karmaServer({
|
||||
configFile: __dirname + "/../../test/config/karma.conf.js",
|
||||
keepalive: true
|
||||
})
|
||||
.start();
|
||||
});
|
||||
};
|
||||
|
||||
gulp.task('test:e2e', function() {
|
||||
new karmaServer({
|
||||
function testE2e() {
|
||||
return new karmaServer({
|
||||
configFile: __dirname + "/../../test/config/e2e.js",
|
||||
keepalive: true
|
||||
})
|
||||
.start();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { testUnit: testUnit, testE2e: testE2e };
|
||||
|
||||
@@ -6,7 +6,7 @@ var gulp = require('gulp');
|
||||
var _ = require('lodash');
|
||||
var MergeStream = require('merge-stream');
|
||||
|
||||
gulp.task('views', function () {
|
||||
function views() {
|
||||
|
||||
var stream = new MergeStream();
|
||||
|
||||
@@ -22,4 +22,7 @@ gulp.task('views', function () {
|
||||
});
|
||||
|
||||
return stream;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { views: views };
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('../config');
|
||||
var gulp = require('gulp');
|
||||
|
||||
var _ = require('lodash');
|
||||
var MergeStream = require('merge-stream');
|
||||
|
||||
var processJs = require('../util/processJs');
|
||||
|
||||
var watch = require('gulp-watch');
|
||||
|
||||
gulp.task('watch', function () {
|
||||
|
||||
var stream = new MergeStream();
|
||||
var watchInterval = 500;
|
||||
|
||||
//Setup a watcher for all groups of javascript files
|
||||
_.forEach(config.sources.js, function (group) {
|
||||
|
||||
if(group.watch !== false){
|
||||
|
||||
stream.add(
|
||||
|
||||
watch(group.files, { ignoreInitial: true, interval: watchInterval }, function (file) {
|
||||
|
||||
console.info(file.path + " has changed, added to: " + group.out);
|
||||
processJs(group.files, group.out);
|
||||
|
||||
})
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
stream.add(
|
||||
//watch all less files and trigger the less task
|
||||
watch(config.sources.globs.less, { ignoreInitial: true, interval: watchInterval }, function () {
|
||||
gulp.run(['less']);
|
||||
})
|
||||
);
|
||||
|
||||
//watch all views - copy single file changes
|
||||
stream.add(
|
||||
watch(config.sources.globs.views, { interval: watchInterval })
|
||||
.pipe(gulp.dest(config.root + config.targets.views))
|
||||
);
|
||||
|
||||
//watch all app js files that will not be merged - copy single file changes
|
||||
stream.add(
|
||||
watch(config.sources.globs.js, { interval: watchInterval })
|
||||
.pipe(gulp.dest(config.root + config.targets.js))
|
||||
);
|
||||
|
||||
return stream;
|
||||
});
|
||||
44
src/Umbraco.Web.UI.Client/gulp/tasks/watchTask.js
Normal file
44
src/Umbraco.Web.UI.Client/gulp/tasks/watchTask.js
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
const config = require('../config');
|
||||
const {watch, parallel, dest, src} = require('gulp');
|
||||
|
||||
var _ = require('lodash');
|
||||
var MergeStream = require('merge-stream');
|
||||
|
||||
var processJs = require('../util/processJs');
|
||||
var processLess = require('../util/processLess');
|
||||
|
||||
//const { less } = require('./less');
|
||||
//const { views } = require('./views');
|
||||
|
||||
|
||||
function watchTask(cb) {
|
||||
|
||||
var watchInterval = 500;
|
||||
|
||||
//Setup a watcher for all groups of JS files
|
||||
_.forEach(config.sources.js, function (group) {
|
||||
if(group.watch !== false) {
|
||||
watch(group.files, { ignoreInitial: true, interval: watchInterval }, function JS_Group_Compile() { return processJs(group.files, group.out) })
|
||||
}
|
||||
});
|
||||
|
||||
//Setup a watcher for all groups of LESS files
|
||||
_.forEach(config.sources.less, function (group) {
|
||||
if(group.watch !== false) {
|
||||
watch(group.watch, { ignoreInitial: true, interval: watchInterval }, function Less_Group_Compile() { processLess(group.files, group.out) })
|
||||
}
|
||||
});
|
||||
|
||||
//Setup a watcher for all groups of view files
|
||||
_.forEach(config.sources.views, function (group) {
|
||||
if(group.watch !== false) {
|
||||
watch(group.files, { ignoreInitial: true, interval: watchInterval }, function View_Group_Compile() { processLess(group.files, group.out) })
|
||||
}
|
||||
});
|
||||
|
||||
return cb();
|
||||
};
|
||||
|
||||
module.exports = { watchTask: watchTask };
|
||||
@@ -11,6 +11,8 @@ var embedTemplates = require('gulp-angular-embed-templates');
|
||||
|
||||
module.exports = function (files, out) {
|
||||
|
||||
console.log("JS: ", files, " -> ", config.root + config.targets.js + out)
|
||||
|
||||
var task = gulp.src(files);
|
||||
|
||||
// check for js errors
|
||||
|
||||
@@ -15,7 +15,9 @@ module.exports = function(files, out) {
|
||||
autoprefixer,
|
||||
cssnano({zindex: false})
|
||||
];
|
||||
|
||||
|
||||
console.log("LESS: ", files, " -> ", config.root + config.targets.js + out)
|
||||
|
||||
var task = gulp.src(files)
|
||||
.pipe(less())
|
||||
.pipe(cleanCss())
|
||||
|
||||
@@ -1,16 +1,49 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* gulpfile.js
|
||||
* ===========
|
||||
* Rather than manage one giant configuration file responsible
|
||||
* for creating multiple tasks, each task has been broken out into
|
||||
* its own file in gulp/tasks. Any file in that folder gets automatically
|
||||
* required by the loop in ./gulp/index.js (required below).
|
||||
*
|
||||
* To add a new task, simply add a new task file to gulp/tasks.
|
||||
*/
|
||||
* gulpfile.js
|
||||
* ===========
|
||||
* This is now using Gulp 4, each child task is now a child function in its own corresponding file.
|
||||
*
|
||||
* To add a new task, simply add a new task file to gulp/tasks folder, add a require statement below to include the one or more methods
|
||||
* and then add the exports command to add the new item into the task menu.
|
||||
*/
|
||||
|
||||
global.isProd = true;
|
||||
|
||||
require('./gulp');
|
||||
const { src, dest, series, parallel, lastRun } = require('gulp');
|
||||
|
||||
const { dependencies } = require('./gulp/tasks/dependencies');
|
||||
const { js } = require('./gulp/tasks/js');
|
||||
const { less } = require('./gulp/tasks/less');
|
||||
const { testE2e, testUnit } = require('./gulp/tasks/test');
|
||||
const { views } = require('./gulp/tasks/views');
|
||||
const { watchTask } = require('./gulp/tasks/watchTask');
|
||||
const { removeProductionMode } = require('./gulp/tasks/removeProductionMode');
|
||||
|
||||
// Load local overwrites, can be used to overwrite paths in your local setup.
|
||||
var fs = require('fs');
|
||||
var onlyScripts = require('./gulp/util/scriptFilter');
|
||||
try {
|
||||
if (fs.existsSync('./gulp/overwrites/')) {
|
||||
var overwrites = fs.readdirSync('./gulp/overwrites/').filter(onlyScripts);
|
||||
overwrites.forEach(function(overwrite) {
|
||||
require('./gulp/overwrites/' + overwrite);
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
// ***********************************************************
|
||||
// These Exports are the new way of defining Tasks in Gulp 4.x
|
||||
// ***********************************************************
|
||||
exports.build = series(parallel(dependencies, js, less, views), testUnit);
|
||||
exports.dev = series(parallel(dependencies, js, less, views), watchTask);
|
||||
exports.fastdev = series(removeProductionMode, parallel(dependencies, js, less, views), watchTask);
|
||||
exports.watch = series(watchTask);
|
||||
//
|
||||
exports.runTests = series(js, testUnit);
|
||||
exports.testUnit = series(testUnit);
|
||||
exports.testE2e = series(testE2e);
|
||||
|
||||
5346
src/Umbraco.Web.UI.Client/package-lock.json
generated
5346
src/Umbraco.Web.UI.Client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,80 +1,84 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "karma start test/config/karma.conf.js --singlerun",
|
||||
"build": "gulp build",
|
||||
"dev": "gulp dev",
|
||||
"fastdev": "gulp fastdev"
|
||||
},
|
||||
"dependencies": {
|
||||
"ace-builds": "1.4.2",
|
||||
"angular": "1.7.5",
|
||||
"angular-animate": "1.7.5",
|
||||
"angular-aria": "1.7.5",
|
||||
"angular-chart.js": "^1.1.1",
|
||||
"angular-cookies": "1.7.5",
|
||||
"angular-dynamic-locale": "0.1.37",
|
||||
"angular-i18n": "1.7.5",
|
||||
"angular-local-storage": "0.7.1",
|
||||
"angular-messages": "1.7.5",
|
||||
"angular-mocks": "1.7.5",
|
||||
"angular-route": "1.7.5",
|
||||
"angular-sanitize": "1.7.5",
|
||||
"angular-touch": "1.7.5",
|
||||
"angular-ui-sortable": "0.19.0",
|
||||
"animejs": "2.2.0",
|
||||
"bootstrap-social": "5.1.1",
|
||||
"chart.js": "^2.7.3",
|
||||
"clipboard": "2.0.4",
|
||||
"diff": "3.5.0",
|
||||
"flatpickr": "4.5.2",
|
||||
"font-awesome": "4.7.0",
|
||||
"jquery": "^3.4.0",
|
||||
"jquery-ui-dist": "1.12.1",
|
||||
"jquery-ui-touch-punch": "0.2.3",
|
||||
"lazyload-js": "1.0.0",
|
||||
"moment": "2.22.2",
|
||||
"ng-file-upload": "12.2.13",
|
||||
"nouislider": "14.0.2",
|
||||
"npm": "^6.4.1",
|
||||
"signalr": "2.4.0",
|
||||
"spectrum-colorpicker": "1.8.0",
|
||||
"tinymce": "4.9.2",
|
||||
"typeahead.js": "0.11.1",
|
||||
"underscore": "1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.1.6",
|
||||
"@babel/preset-env": "7.1.6",
|
||||
"autoprefixer": "9.3.1",
|
||||
"cssnano": "4.1.7",
|
||||
"fs": "0.0.2",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-angular-embed-templates": "^2.3.0",
|
||||
"gulp-babel": "8.0.0",
|
||||
"gulp-clean-css": "4.0.0",
|
||||
"gulp-cli": "^2.0.1",
|
||||
"gulp-concat": "2.6.1",
|
||||
"gulp-eslint": "^5.0.0",
|
||||
"gulp-imagemin": "^4.1.0",
|
||||
"gulp-less": "4.0.1",
|
||||
"gulp-notify": "^3.0.0",
|
||||
"gulp-postcss": "8.0.0",
|
||||
"gulp-rename": "1.4.0",
|
||||
"gulp-sort": "2.0.0",
|
||||
"gulp-watch": "5.0.1",
|
||||
"gulp-wrap": "0.14.0",
|
||||
"gulp-wrap-js": "0.4.1",
|
||||
"jasmine-core": "3.3.0",
|
||||
"karma": "3.1.1",
|
||||
"karma-jasmine": "2.0.1",
|
||||
"karma-junit-reporter": "^1.2.0",
|
||||
"karma-phantomjs-launcher": "1.0.4",
|
||||
"less": "3.9.0",
|
||||
"lodash": "4.17.13",
|
||||
"marked": "^0.6.1",
|
||||
"merge-stream": "1.0.1",
|
||||
"run-sequence": "2.2.1",
|
||||
"caniuse-lite": "^1.0.30000966"
|
||||
}
|
||||
}
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "gulp runTests",
|
||||
"unit": "gulp testUnit",
|
||||
"e2e": "gulp testE2e",
|
||||
"build": "gulp build",
|
||||
"dev": "gulp dev",
|
||||
"fastdev": "gulp fastdev",
|
||||
"watch": "gulp watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"ace-builds": "1.4.2",
|
||||
"angular": "1.7.5",
|
||||
"angular-animate": "1.7.5",
|
||||
"angular-aria": "1.7.5",
|
||||
"angular-chart.js": "^1.1.1",
|
||||
"angular-cookies": "1.7.5",
|
||||
"angular-dynamic-locale": "0.1.37",
|
||||
"angular-i18n": "1.7.5",
|
||||
"angular-local-storage": "0.7.1",
|
||||
"angular-messages": "1.7.5",
|
||||
"angular-mocks": "1.7.5",
|
||||
"angular-route": "1.7.5",
|
||||
"angular-sanitize": "1.7.5",
|
||||
"angular-touch": "1.7.5",
|
||||
"angular-ui-sortable": "0.19.0",
|
||||
"animejs": "2.2.0",
|
||||
"bootstrap-social": "5.1.1",
|
||||
"chart.js": "^2.8.0",
|
||||
"clipboard": "2.0.4",
|
||||
"diff": "3.5.0",
|
||||
"flatpickr": "4.5.2",
|
||||
"font-awesome": "4.7.0",
|
||||
"jquery": "^3.4.1",
|
||||
"jquery-ui-dist": "1.12.1",
|
||||
"jquery-ui-touch-punch": "0.2.3",
|
||||
"lazyload-js": "1.0.0",
|
||||
"moment": "2.22.2",
|
||||
"ng-file-upload": "12.2.13",
|
||||
"nouislider": "14.0.2",
|
||||
"npm": "6.12.0",
|
||||
"signalr": "2.4.0",
|
||||
"spectrum-colorpicker": "1.8.0",
|
||||
"tinymce": "4.9.2",
|
||||
"typeahead.js": "0.11.1",
|
||||
"underscore": "1.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.6.4",
|
||||
"@babel/preset-env": "7.6.3",
|
||||
"autoprefixer": "9.6.5",
|
||||
"caniuse-lite": "^1.0.30001002",
|
||||
"cssnano": "4.1.10",
|
||||
"fs": "0.0.2",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-angular-embed-templates": "^2.3.0",
|
||||
"gulp-babel": "8.0.0",
|
||||
"gulp-clean-css": "4.2.0",
|
||||
"gulp-cli": "^2.2.0",
|
||||
"gulp-concat": "2.6.1",
|
||||
"gulp-eslint": "6.0.0",
|
||||
"gulp-imagemin": "6.1.1",
|
||||
"gulp-less": "4.0.1",
|
||||
"gulp-notify": "^3.0.0",
|
||||
"gulp-postcss": "8.0.0",
|
||||
"gulp-rename": "1.4.0",
|
||||
"gulp-sort": "2.0.0",
|
||||
"gulp-watch": "5.0.1",
|
||||
"gulp-wrap": "0.15.0",
|
||||
"gulp-wrap-js": "0.4.1",
|
||||
"jasmine-core": "3.5.0",
|
||||
"karma": "4.4.1",
|
||||
"karma-jasmine": "2.0.1",
|
||||
"karma-junit-reporter": "2.0.1",
|
||||
"karma-phantomjs-launcher": "1.0.4",
|
||||
"karma-spec-reporter": "0.0.32",
|
||||
"less": "3.10.3",
|
||||
"lodash": "4.17.15",
|
||||
"marked": "^0.7.0",
|
||||
"merge-stream": "2.0.0",
|
||||
"run-sequence": "2.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/**
|
||||
@ngdoc directive
|
||||
@name umbraco.directives.directive:umbOverlay*
|
||||
@deprecated
|
||||
@restrict E
|
||||
|
||||
@@ -13,7 +13,7 @@ var app = angular.module('umbraco', [
|
||||
'ngSanitize',
|
||||
|
||||
//'ngMessages',
|
||||
'tmh.dynamicLocale',
|
||||
'tmh.dynamicLocale'
|
||||
//'ngFileUpload',
|
||||
//'LocalStorageModule',
|
||||
//'chart.js'
|
||||
|
||||
@@ -51,9 +51,23 @@ module.exports = function (config) {
|
||||
exclude: [],
|
||||
|
||||
// use dolts reporter, as travis terminal does not support escaping sequences
|
||||
// possible values: 'dots', 'progress', 'junit', 'teamcity'
|
||||
// possible values: 'dots', 'progress', 'junit', 'spec'
|
||||
// ***
|
||||
// progress: Outputs a simple list like: "Executed 128 of 144 SUCCESS (0 secs / 0.814 secs)"
|
||||
// spec: Outputs a more verbose report which is more useful for debugging if one of the tests fails.
|
||||
// ***
|
||||
// CLI --reporters progress
|
||||
reporters: ['progress', 'junit'],
|
||||
|
||||
reporters: ['spec', 'junit'],
|
||||
specReporter: {
|
||||
maxLogLines: 5, // limit number of lines logged per test
|
||||
suppressErrorSummary: true, // do not print error summary
|
||||
suppressFailed: false, // do not print information about failed tests
|
||||
suppressPassed: false, // do not print information about passed tests
|
||||
suppressSkipped: true, // do not print information about skipped tests
|
||||
showSpecTiming: false // print the time elapsed for each spec
|
||||
},
|
||||
|
||||
|
||||
// web server port
|
||||
// CLI --port 9876
|
||||
@@ -102,7 +116,9 @@ module.exports = function (config) {
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-phantomjs-launcher'),
|
||||
require('karma-junit-reporter')
|
||||
require('karma-junit-reporter'),
|
||||
require('karma-spec-reporter')
|
||||
|
||||
],
|
||||
|
||||
// the default configuration
|
||||
|
||||
@@ -37,7 +37,7 @@ describe('Drop down controller tests', function () {
|
||||
$routeParams: routeParams
|
||||
});
|
||||
|
||||
//this should be the expected format based on the changes made to the sortable prevalues
|
||||
// this should be the expected format based on the changes made to the sortable prevalues
|
||||
expect(scope.model.config.items[0].value).toBe("value0");
|
||||
expect(scope.model.config.items[1].value).toBe("value1");
|
||||
expect(scope.model.config.items[2].value).toBe("value2");
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
(function () {
|
||||
|
||||
describe('truncate filter', function() {
|
||||
var $truncate;
|
||||
|
||||
var testCases = [
|
||||
{input:'test', noOfChars:5, appendDots:true, expectedResult: 'test'},
|
||||
{input:'test ', noOfChars:4, appendDots:true, expectedResult: 'test…'},
|
||||
{input:'test a long text with space', noOfChars:5, appendDots:true, expectedResult: 'test …'},
|
||||
{input:'scenarios is a long word', noOfChars:5, appendDots:true, expectedResult: 'scena…'},
|
||||
{input:'scenarios is a long word', noOfChars:10, appendDots:true, expectedResult: 'scenarios …'},
|
||||
{input:'test', noOfChars:5, appendDots:false, expectedResult: 'test'},
|
||||
{input:'test a long text with space', noOfChars:5, appendDots:false, expectedResult: 'test '},
|
||||
{input:'scenarios is a long word', noOfChars:5, appendDots:false, expectedResult: 'scena'},
|
||||
{input:'scenarios is a long word', noOfChars:10, appendDots:false, expectedResult: 'scenarios '}
|
||||
];
|
||||
|
||||
var testCasesNew = [
|
||||
{value:'test', wordwise:false, max:20, tail:'...', expectedResult: 'test'},
|
||||
{value:'LoremIpsumLoremIpsumLoremIpsum',wordwise:false, max:20, tail:null, expectedResult: 'LoremIpsumLoremIpsum…'}
|
||||
];
|
||||
|
||||
beforeEach(module('umbraco'));
|
||||
|
||||
beforeEach(inject(function($filter) {
|
||||
$truncate = $filter('truncate');
|
||||
}));
|
||||
|
||||
it('empty string as input is expected to give an empty string', function() {
|
||||
expect($truncate('', 5, true)).toBe('');
|
||||
});
|
||||
|
||||
it('null as input is expected to give an empty string', function() {
|
||||
expect($truncate(null, 5, true)).toBe('');
|
||||
});
|
||||
|
||||
it('undefined as input is expected to give an empty string', function() {
|
||||
expect($truncate(undefined, 5, true)).toBe('');
|
||||
});
|
||||
|
||||
it('null as noOfChars to result in \'test\'', function() {
|
||||
expect($truncate('test', null, true)).toBe('test');
|
||||
});
|
||||
|
||||
it('undefined as noOfChars to result in \'test\'', function() {
|
||||
expect($truncate('test', undefined, true)).toBe('test');
|
||||
});
|
||||
|
||||
it('null as appendDots to behave as false', function() {
|
||||
expect($truncate('test', 5, null)).toBe('test');
|
||||
});
|
||||
|
||||
testCases.forEach(function(test){
|
||||
|
||||
it('Expects \'' + test.input + '\' to be truncated as \''+ test.expectedResult + '\', when noOfChars=' + test.noOfChars + ', and appendDots=' + test.appendDots, function() {
|
||||
console.log($truncate(test.input, test.noOfChars, test.appendDots));
|
||||
expect($truncate(test.input, test.noOfChars, test.appendDots)).toBe(test.expectedResult);
|
||||
});
|
||||
});
|
||||
|
||||
testCasesNew.forEach(function(test){
|
||||
it('Expects \'' + test.value + '\' to be truncated as \''+ test.expectedResult + '\', when wordwise=' + test.wordwise + ', and max=' + test.max + ', and tail=' + test.tail, function() {
|
||||
expect($truncate(test.value, test.wordwise, test.max, test.tail)).toBe(test.expectedResult);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}());
|
||||
@@ -53,4 +53,4 @@ gulp.task('open:docs', function (cb) {
|
||||
gulp.src(__filename)
|
||||
.pipe(open(options));
|
||||
cb();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user