FIxes authz on some controllers, fixes js var paths for login providers, simplifies gulp so we aren't building 2x.

This commit is contained in:
Shannon
2020-12-01 00:19:08 +11:00
parent efff96f711
commit 47b4a4d234
14 changed files with 163 additions and 167 deletions

View File

@@ -78,7 +78,7 @@ module.exports = {
assets: "./src/assets/**"
}
},
roots: ["../Umbraco.Web.UI/", "../Umbraco.Web.UI.NetCore/wwwroot/"],
root: "../Umbraco.Web.UI.NetCore/wwwroot/",
targets: {
js: "umbraco/js/",
lib: "umbraco/lib/",

View File

@@ -21,7 +21,7 @@ function dependencies() {
const nodeModules = [
{
"name": "ace-builds",
"src": [
"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",
@@ -43,23 +43,23 @@ function dependencies() {
},
{
"name": "angular",
"src": ["./node_modules/angular/angular.js"],
"src": ["./node_modules/angular/angular.js"],
"base": "./node_modules/angular"
},
{
"name": "angular-aria",
"src": ["./node_modules/angular-aria/angular-aria.min.js",
"./node_modules/angular-aria/angular-aria.min.js.map"],
"src": ["./node_modules/angular-aria/angular-aria.min.js",
"./node_modules/angular-aria/angular-aria.min.js.map"],
"base": "./node_modules/angular-aria"
},
{
"name": "angular-cookies",
"src": ["./node_modules/angular-cookies/angular-cookies.js"],
"src": ["./node_modules/angular-cookies/angular-cookies.js"],
"base": "./node_modules/angular-cookies"
},
{
"name": "angular-dynamic-locale",
"src": [
"src": [
"./node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.min.js",
"./node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.min.js.map"
],
@@ -67,32 +67,32 @@ function dependencies() {
},
{
"name": "angular-sanitize",
"src": ["./node_modules/angular-sanitize/angular-sanitize.js"],
"src": ["./node_modules/angular-sanitize/angular-sanitize.js"],
"base": "./node_modules/angular-sanitize"
},
{
"name": "angular-touch",
"src": ["./node_modules/angular-touch/angular-touch.js"],
"src": ["./node_modules/angular-touch/angular-touch.js"],
"base": "./node_modules/angular-touch"
},
{
"name": "angular-ui-sortable",
"src": ["./node_modules/angular-ui-sortable/dist/sortable.js"],
"src": ["./node_modules/angular-ui-sortable/dist/sortable.js"],
"base": "./node_modules/angular-ui-sortable/dist"
},
{
"name": "angular-route",
"src": ["./node_modules/angular-route/angular-route.js"],
"src": ["./node_modules/angular-route/angular-route.js"],
"base": "./node_modules/angular-route"
},
{
"name": "angular-animate",
"src": ["./node_modules/angular-animate/angular-animate.js"],
"src": ["./node_modules/angular-animate/angular-animate.js"],
"base": "./node_modules/angular-animate"
},
{
"name": "angular-i18n",
"src": [
"src": [
"./node_modules/angular-i18n/angular-i18n.js",
"./node_modules/angular-i18n/angular-locale_*.js"
],
@@ -100,7 +100,7 @@ function dependencies() {
},
{
"name": "angular-local-storage",
"src": [
"src": [
"./node_modules/angular-local-storage/dist/angular-local-storage.min.js",
"./node_modules/angular-local-storage/dist/angular-local-storage.min.js.map"
],
@@ -108,48 +108,48 @@ function dependencies() {
},
{
"name": "angular-messages",
"src": ["./node_modules/angular-messages/angular-messages.js"],
"src": ["./node_modules/angular-messages/angular-messages.js"],
"base": "./node_modules/angular-messages"
},
},
{
"name": "angular-mocks",
"src": ["./node_modules/angular-mocks/angular-mocks.js"],
"src": ["./node_modules/angular-mocks/angular-mocks.js"],
"base": "./node_modules/angular-mocks"
},
{
"name": "animejs",
"src": ["./node_modules/animejs/anime.min.js"],
"src": ["./node_modules/animejs/anime.min.js"],
"base": "./node_modules/animejs"
},
{
"name": "bootstrap-social",
"src": ["./node_modules/bootstrap-social/bootstrap-social.css"],
"src": ["./node_modules/bootstrap-social/bootstrap-social.css"],
"base": "./node_modules/bootstrap-social"
},
{
"name": "angular-chart.js",
"src": ["./node_modules/angular-chart.js/dist/angular-chart.min.js"],
"src": ["./node_modules/angular-chart.js/dist/angular-chart.min.js"],
"base": "./node_modules/angular-chart.js/dist"
},
{
"name": "chart.js",
"src": ["./node_modules/chart.js/dist/Chart.min.js"],
"src": ["./node_modules/chart.js/dist/Chart.min.js"],
"base": "./node_modules/chart.js/dist"
},
{
"name": "clipboard",
"src": ["./node_modules/clipboard/dist/clipboard.min.js"],
"src": ["./node_modules/clipboard/dist/clipboard.min.js"],
"base": "./node_modules/clipboard/dist"
},
{
"name": "jsdiff",
"src": ["./node_modules/diff/dist/diff.min.js"],
"src": ["./node_modules/diff/dist/diff.min.js"],
"base": "./node_modules/diff/dist"
},
{
"name": "flatpickr",
"src": [
"src": [
"./node_modules/flatpickr/dist/flatpickr.js",
"./node_modules/flatpickr/dist/flatpickr.css",
"./node_modules/flatpickr/dist/l10n/*.js"
@@ -158,7 +158,7 @@ function dependencies() {
},
{
"name": "font-awesome",
"src": [
"src": [
"./node_modules/font-awesome/fonts/*",
"./node_modules/font-awesome/css/font-awesome.min.css"
],
@@ -166,7 +166,7 @@ function dependencies() {
},
{
"name": "jquery",
"src": [
"src": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/jquery/dist/jquery.min.map"
],
@@ -174,37 +174,37 @@ function dependencies() {
},
{
"name": "jquery-ui",
"src": ["./node_modules/jquery-ui-dist/jquery-ui.min.js"],
"src": ["./node_modules/jquery-ui-dist/jquery-ui.min.js"],
"base": "./node_modules/jquery-ui-dist"
},
{
"name": "jquery-ui-touch-punch",
"src": ["./node_modules/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"],
"src": ["./node_modules/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"],
"base": "./node_modules/jquery-ui-touch-punch"
},
{
"name": "lazyload-js",
"src": ["./node_modules/lazyload-js/LazyLoad.min.js"],
"src": ["./node_modules/lazyload-js/LazyLoad.min.js"],
"base": "./node_modules/lazyload-js"
},
{
"name": "moment",
"src": ["./node_modules/moment/min/moment.min.js"],
"src": ["./node_modules/moment/min/moment.min.js"],
"base": "./node_modules/moment/min"
},
{
"name": "moment",
"src": ["./node_modules/moment/locale/*.js"],
"src": ["./node_modules/moment/locale/*.js"],
"base": "./node_modules/moment/locale"
},
{
"name": "ng-file-upload",
"src": ["./node_modules/ng-file-upload/dist/ng-file-upload.min.js"],
"src": ["./node_modules/ng-file-upload/dist/ng-file-upload.min.js"],
"base": "./node_modules/ng-file-upload/dist"
},
{
"name": "nouislider",
"src": [
"src": [
"./node_modules/nouislider/distribute/nouislider.min.js",
"./node_modules/nouislider/distribute/nouislider.min.css"
],
@@ -212,14 +212,14 @@ function dependencies() {
},
{
"name": "signalr",
"src": [
"src": [
"./node_modules/@microsoft/signalr/dist/browser/signalr.min.js",
],
"base": "./node_modules/@microsoft/signalr/dist/browser"
},
{
"name": "spectrum",
"src": [
"src": [
"./node_modules/spectrum-colorpicker2/dist/spectrum.js",
"./node_modules/spectrum-colorpicker2/dist/spectrum.css"
],
@@ -227,7 +227,7 @@ function dependencies() {
},
{
"name": "tinymce",
"src": [
"src": [
"./node_modules/tinymce/tinymce.min.js",
"./node_modules/tinymce/plugins/**",
"./node_modules/tinymce/skins/**",
@@ -237,12 +237,12 @@ function dependencies() {
},
{
"name": "typeahead.js",
"src": ["./node_modules/typeahead.js/dist/typeahead.bundle.min.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"],
"src": ["node_modules/underscore/underscore-min.js"],
"base": "./node_modules/underscore"
},
{
@@ -257,71 +257,58 @@ function dependencies() {
// add streams for node modules
nodeModules.forEach(module => {
var task = gulp.src(module.src, { base: module.base, allowEmpty: true });
_.forEach(config.roots, function(root){
task = task.pipe(gulp.dest(root + config.targets.lib + "/" + module.name))
});
stream.add(task);
stream.add(
gulp.src(module.src,
{ base: module.base, allowEmpty: true })
.pipe(gulp.dest(config.root + config.targets.lib + "/" + module.name))
);
});
//copy over libs which are not on npm (/lib)
var libTask = gulp.src(config.sources.globs.lib, { allowEmpty: true });
_.forEach(config.roots, function(root){
libTask = libTask.pipe(gulp.dest(root + config.targets.lib))
});
stream.add(libTask);
stream.add(
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, { allowEmpty: true });
assetsTask = assetsTask.pipe(imagemin([
imagemin.gifsicle({interlaced: true}),
imagemin.mozjpeg({progressive: true}),
imagemin.optipng({optimizationLevel: 5}),
imagemin.gifsicle({ interlaced: true }),
imagemin.mozjpeg({ progressive: true }),
imagemin.optipng({ optimizationLevel: 5 }),
imagemin.svgo({
plugins: [
{removeViewBox: true},
{cleanupIDs: false}
{ removeViewBox: true },
{ cleanupIDs: false }
]
})
]));
_.forEach(config.roots, function(root){
assetsTask = assetsTask.pipe(gulp.dest(root + config.targets.assets));
});
assetsTask = assetsTask.pipe(gulp.dest(config.root + config.targets.assets));
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 compiler client side
var lessTask = gulp.src("src/canvasdesigner/editors/*.less", { allowEmpty: true });
stream.add(
gulp.src("src/canvasdesigner/editors/*.less", { allowEmpty: true })
.pipe(gulp.dest(config.root + config.targets.assets + "/less"))
);
_.forEach(config.roots, function(root){
lessTask = lessTask.pipe(gulp.dest(root + config.targets.assets + "/less"));
});
stream.add(lessTask);
// TODO: check if we need these fileSize
stream.add(
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", { allowEmpty: true })
.pipe(gulp.dest(config.root + config.targets.views + "/dashboard/default"))
);
// TODO: check if we need these fileSize
var configTask = gulp.src("src/views/propertyeditors/grid/config/*.*", { allowEmpty: true });
_.forEach(config.roots, function(root){
configTask = configTask.pipe(gulp.dest(root + config.targets.views + "/propertyeditors/grid/config"));
});
stream.add(configTask);
var dashboardTask = gulp.src("src/views/dashboard/default/*.jpg", { allowEmpty: true });
_.forEach(config.roots, function(root){
dashboardTask = dashboardTask .pipe(gulp.dest(root + config.targets.views + "/dashboard/default"));
});
stream.add(dashboardTask);
return stream;
};

View File

@@ -16,19 +16,17 @@ function js() {
//we run multiple streams, so merge them all together
var stream = new MergeStream();
var task = gulp.src(config.sources.globs.js);
_.forEach(config.roots, function(root){
task = task.pipe( gulp.dest(root + config.targets.js) )
})
stream.add(task);
stream.add(
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)
);
});
return stream;
return stream;
};
module.exports = { js: js };

View File

@@ -14,19 +14,17 @@ function views() {
_.forEach(config.sources.views, function (group) {
var task = gulp.src(group.files)
.pipe(rename(function(path) {
path.dirname = path.dirname.toLowerCase();
path.basename = path.basename.toLowerCase();
path.extname = path.extname.toLowerCase();
}));
.pipe(rename(function (path) {
path.dirname = path.dirname.toLowerCase();
path.basename = path.basename.toLowerCase();
path.extname = path.extname.toLowerCase();
}));
_.forEach(config.roots, function(root){
var destPath = root + config.targets.views + group.folder;
console.log("copying " + group.files + " to " + destPath)
task = task.pipe( gulp.dest(destPath));
})
var destPath = config.root + config.targets.views + group.folder;
console.log("copying " + group.files + " to " + destPath)
task = task.pipe(gulp.dest(destPath));
stream.add (task);
stream.add(task);
});

View File

@@ -1,7 +1,7 @@
'use strict';
const config = require('../config');
const {watch, series, parallel, dest, src} = require('gulp');
const { watch, series, parallel, dest, src } = require('gulp');
var _ = require('lodash');
var rename = require('gulp-rename');
@@ -10,7 +10,7 @@ var MergeStream = require('merge-stream');
var processJs = require('../util/processJs');
var processLess = require('../util/processLess');
var {js} = require('./js');
var { js } = require('./js');
function watchTask(cb) {
@@ -18,14 +18,14 @@ function watchTask(cb) {
//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);});
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) {
if (group.watch !== false) {
watch(group.watch, { ignoreInitial: true, interval: watchInterval }, function Less_Group_Compile() { return processLess(group.files, group.out); });
}
});
@@ -33,22 +33,21 @@ function watchTask(cb) {
//Setup a watcher for all groups of view files
var viewWatcher;
_.forEach(config.sources.views, function (group) {
if(group.watch !== false) {
if (group.watch !== false) {
viewWatcher = watch(group.files, { ignoreInitial: true, interval: watchInterval },
parallel(
function MoveViewsAndRegenerateJS() {
var task = src(group.files)
.pipe(rename(function(path) {
path.dirname = path.dirname.toLowerCase();
path.basename = path.basename.toLowerCase();
path.extname = path.extname.toLowerCase();
}));
_.forEach(config.roots, function(root){
var destPath = root + config.targets.views + group.folder;
console.log("copying " + group.files + " to " + destPath);
task = task.pipe( dest(destPath) );
});
var task = src(group.files)
.pipe(rename(function (path) {
path.dirname = path.dirname.toLowerCase();
path.basename = path.basename.toLowerCase();
path.extname = path.extname.toLowerCase();
}));
var destPath = config.root + config.targets.views + group.folder;
console.log("copying " + group.files + " to " + destPath);
task = task.pipe(dest(destPath));
},
js
)

View File

@@ -11,11 +11,9 @@ var embedTemplates = require('gulp-angular-embed-templates');
var _ = require('lodash');
module.exports = function (files, out) {
_.forEach(config.roots, function(root){
console.log("JS: ", files, " -> ", root + config.targets.js + out)
})
console.log("JS: ", files, " -> ", config.root + config.targets.js + out)
var task = gulp.src(files);
// check for js errors
@@ -31,13 +29,10 @@ module.exports = function (files, out) {
if(config.compile.current.embedtemplates === true) {
task = task.pipe(embedTemplates({ basePath: "./src/", minimize: { loose: true } }));
}
task = task.pipe(concat(out)).pipe(wrap('(function(){\n%= body %\n})();'))
_.forEach(config.roots, function(root){
task = task.pipe(gulp.dest(root + config.targets.js));
})
task = task.pipe(concat(out))
.pipe(wrap('(function(){\n%= body %\n})();'))
.pipe(gulp.dest(config.root + config.targets.js));
return task;

View File

@@ -17,10 +17,8 @@ module.exports = function(files, out) {
autoprefixer,
cssnano({zindex: false})
];
_.forEach(config.roots, function(root){
console.log("LESS: ", files, " -> ", root + config.targets.css + out);
})
console.log("LESS: ", files, " -> ", config.root + config.targets.css + out)
var task = gulp.src(files);
@@ -37,12 +35,7 @@ module.exports = function(files, out) {
task = task.pipe(sourcemaps.write('./maps'));
}
_.forEach(config.roots, function(root){
task = task.pipe(gulp.dest(root + config.targets.css));
})
task = task.pipe(gulp.dest(config.root + config.targets.css));
return task;