Skip to content

Commit

Permalink
Merge branch 'dev' into email-after-hold
Browse files Browse the repository at this point in the history
  • Loading branch information
maccabeelevine committed Jan 29, 2025
2 parents 6efd83e + 83d4e80 commit f705c8d
Show file tree
Hide file tree
Showing 4,576 changed files with 31,980 additions and 111,724 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
114 changes: 114 additions & 0 deletions .eslintrc.jsdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* TODO: Temporary file for rules. Merge this file into eslintrc.js
* after all the ignored patterns under themes/bootstrap5/js are removed.
*/
module.exports = {
plugins: ["jsdoc"],
ignorePatterns: [
"themes/**/vendor/**",
"themes/**/node_modules/**",
"themes/bootstrap5/js/account_ajax.js",
"themes/bootstrap5/js/relais.js",
"themes/bootstrap5/js/search.js",
"themes/bootstrap5/js/requests.js",
"themes/bootstrap5/js/resultcount.js",
"themes/bootstrap5/js/map_tab_leaflet.js",
"themes/bootstrap5/js/check_item_statuses.js",
"themes/bootstrap5/js/combined-search.js",
"themes/bootstrap5/js/cart.js",
"themes/bootstrap5/js/pubdate_vis.js",
"themes/bootstrap5/js/map_selection_leaflet.js",
"themes/bootstrap5/js/common.js",
"themes/bootstrap5/js/bs3-compat.js",
"themes/bootstrap5/js/explain.js",
"themes/bootstrap5/js/list_item_selection.js",
"themes/bootstrap5/js/embedded_record.js",
"themes/bootstrap5/js/openurl.js",
"themes/bootstrap5/js/ill.js",
"themes/bootstrap5/js/record.js",
"themes/bootstrap5/js/doi.js",
"themes/bootstrap5/js/keep_alive.js",
"themes/bootstrap5/js/embedGBS.js",
"themes/bootstrap5/js/lib/ajax_request_queue.js",
"themes/bootstrap5/js/covers.js",
"themes/bootstrap5/js/trigger_print.js",
"themes/bootstrap5/js/visual_facets.js",
"themes/bootstrap5/js/preview.js",
"themes/bootstrap5/js/facets.js",
"themes/bootstrap5/js/searchbox_controls.js",
"themes/bootstrap5/js/lightbox.js",
"themes/bootstrap5/js/hierarchy_tree.js",
"themes/bootstrap5/js/cookie.js",
"themes/bootstrap5/js/record_versions.js",
"themes/bootstrap5/js/collection_record.js",
"themes/bootstrap5/js/sticky_elements.js",
"themes/bootstrap5/js/checkouts.js",
"themes/bootstrap5/js/advanced_search.js",
"themes/bootstrap5/js/check_save_statuses.js",
"themes/bootstrap5/js/hold.js",
"themes/bootstrap5/js/config.js",
"themes/bootstrap5/js/channels.js",
"themes/bootstrap5/js/truncate.js",
],
extends: [],
env: {
"browser": true,
"es6": true,
"jquery": true
},
rules: {
// Recommended
"jsdoc/check-access": 1,
"jsdoc/check-alignment": 1,
"jsdoc/check-param-names": 1,
"jsdoc/check-property-names": 1,
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/check-values": 1,
"jsdoc/empty-tags": 1,
"jsdoc/implements-on-classes": 1,
"jsdoc/multiline-blocks": 1,
"jsdoc/no-multi-asterisks": 1,
"jsdoc/no-undefined-types": 1,
"jsdoc/require-jsdoc": 1,
"jsdoc/require-param": 1,
"jsdoc/require-param-description": 1,
"jsdoc/require-param-name": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-property": 1,
"jsdoc/require-property-description": 1,
"jsdoc/require-property-name": 1,
"jsdoc/require-property-type": 1,
"jsdoc/require-returns": 1,
"jsdoc/require-returns-check": 1,
"jsdoc/require-returns-description": 1,
"jsdoc/require-returns-type": 1,
"jsdoc/require-yields": 1,
"jsdoc/require-yields-check": 1,
"jsdoc/tag-lines": 1,
"jsdoc/valid-types": 1
// Disabled
//"jsdoc/check-examples": 1,
//"jsdoc/check-indentation": 1,
//"jsdoc/check-line-alignment": 1,
//"jsdoc/check-template-names": 1,
//"jsdoc/check-syntax": 1,
//"jsdoc/informative-docs": 1,
//"jsdoc/match-description": 1,
//"jsdoc/no-bad-blocks": 1,
//"jsdoc/no-blank-block-descriptions": 1,
//"jsdoc/no-defaults": 1,
//"jsdoc/no-missing-syntax": 1,
//"jsdoc/no-restricted-syntax": 1,
//"jsdoc/no-types": 1,
//"jsdoc/require-asterisk-prefix": 1,
//"jsdoc/require-description": 1,
//"jsdoc/require-description-complete-sentence": 1,
//"jsdoc/require-example": 1,
//"jsdoc/require-file-overview": 1,
//"jsdoc/require-hyphen-before-param-description": 1,
//"jsdoc/require-template": 1,
//"jsdoc/require-throws": 1,
//"jsdoc/sort-tags": 1,
}
};
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Setup node
if: ${{ matrix.phing_tasks == 'qa-console' }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ themes/bootstrap5/scss/vendor/bootstrap
local/DirLocations.ini
local/config/vufind/*.ini
local/config/vufind/*.json
local/config/vufind/*.key
local/config/vufind/*.yaml
167 changes: 6 additions & 161 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = function(grunt) {
const fs = require("fs");
const os = require("node:os");

// Load dart-sass
grunt.loadNpmTasks('grunt-dart-sass');
Expand All @@ -16,7 +17,7 @@ module.exports = function(grunt) {
var parts = file.split('/');
parts.pop(); // eliminate filename

// initialize search path with directory containing the LESS or SCSS file
// initialize search path with directory containing the SCSS file
var retVal = [];
retVal.push(parts.join('/'));
retVal.push(parts.join('/') + '/vendor/');
Expand Down Expand Up @@ -54,36 +55,8 @@ module.exports = function(grunt) {
return retVal;
}

var fontAwesomePath = '"../../bootstrap3/css/fonts"';
var lessFileSettings = [{
expand: true,
src: "themes/*/less/compiled.less",
rename: function (dest, src) {
return src.replace('/less/', '/css/').replace('.less', '.css');
}
}];

const gruntConfig = {
// LESS compilation
less: {
compile: {
files: lessFileSettings,
options: {
paths: getLoadPaths,
compress: true,
modifyVars: {
'fa-font-path': fontAwesomePath
}
}
}
},
// Less with maps
lessdev: {
less: {
}
},
// SASS compilation
// 'scss' is also mapped to 'scssonly' below
'scss': {
'dart-sass': {
options: {
Expand All @@ -100,145 +73,23 @@ module.exports = function(grunt) {
}
},

// Convert LESS to SASS, mostly for development team use
lessToSass: {
convert: {
files: [
{
expand: true,
cwd: 'themes/bootstrap3/less',
src: ['*.less', 'components/**/*.less', 'mixins/**/*.less'],
ext: '.scss',
dest: 'themes/bootstrap3/scss'
},
{
expand: true,
cwd: 'themes/bootprint3/less',
src: ['*.less'],
ext: '.scss',
dest: 'themes/bootprint3/scss'
},
{
expand: true,
cwd: 'themes/sandal/less',
src: ['*.less'],
ext: '.scss',
dest: 'themes/sandal/scss'
}
],
options: {
replacements: [
// Activate SCSS
{
pattern: /\/\* #SCSS>/gi,
replacement: "/* #SCSS> */",
order: -1 // Do before anything else
},
{
pattern: /<#SCSS \*\//gi,
replacement: "/* <#SCSS */",
order: -1
},
// Deactivate LESS
{
pattern: /\/\* #LESS> \*\//gi,
replacement: "/* #LESS>",
order: -1
},
{
pattern: /\/\* <#LESS \*\//gi,
replacement: "<#LESS */",
order: -1
},
{ // Change separator in @include statements
pattern: /@include ([^\(]+)\(([^\)]+)\);/gi,
replacement: function mixinCommas(match, $1, $2) {
return '@include ' + $1 + '(' + $2.replace(/;/g, ',') + ');';
},
order: 4 // after defaults included in less-to-sass
},
{ // Remove unquote
pattern: /unquote\("([^"]+)"\)/gi,
replacement: function ununquote(match, $1) {
return $1;
},
order: 4
},
{ // Inline &:extends converted
pattern: /&:extend\(([^\)]+?)( all)?\)/gi,
replacement: '@extend $1',
order: 4
},
{ // Wrap variables in calcs with #{}
pattern: /calc\([^;]+/gi,
replacement: function calcVariables(match) {
return match.replace(/(\$[\w\-]+)/gi, '#{$1}');
},
order: 4
},
{ // Wrap variables set to css variables with #{}
pattern: /(--[\w-:]+:\s*)((\$|darken\(|lighten\()[^;]+)/gi,
replacement: '$1#{$2}',
order: 5
},
{ // Remove !default from extends (icons.scss)
pattern: /@extend ([^;}]+) !default;/gi,
replacement: '@extend $1;',
order: 6
}
]
}
}
},

watch: {
options: {
atBegin: true
},
less: {
files: 'themes/*/less/**/*.less',
tasks: ['less']
},
lessdev: {
files: 'themes/*/less/**/*.less',
tasks: ['lessdev']
},
scss: {
files: 'themes/*/scss/**/*.scss',
tasks: ['scss']
}
}
};
// scssonly compiles scss files for themes that don't use less
gruntConfig.scssonly = gruntConfig.scss;

grunt.initConfig(gruntConfig);

grunt.registerMultiTask('lessdev', function lessWithMaps() {
grunt.config.set('less', {
dev: {
files: lessFileSettings,
options: {
paths: getLoadPaths,
sourceMap: true,
sourceMapFileInline: true,
modifyVars: {
'fa-font-path': fontAwesomePath
}
}
}
});
grunt.task.run('less');
});

grunt.registerMultiTask('scss', function sassScan() {
grunt.config.set('dart-sass', getSassConfig(this.data.options, false));
grunt.task.run('dart-sass');
});
grunt.registerMultiTask('scssonly', function sassScan() {
grunt.config.set('dart-sass', getSassConfig(this.data.options, false, false));
grunt.task.run('dart-sass');
});

grunt.registerMultiTask('check:scss', function sassCheck() {
grunt.config.set('dart-sass', getSassConfig(this.data.options, true, true));
Expand All @@ -248,23 +99,17 @@ module.exports = function(grunt) {
grunt.registerTask('default', function help() {
grunt.log.writeln(`\nHello! Here are your grunt command options:
- grunt less = compile and compress all themes' LESS files to css.
- grunt scss = compile and map all themes' SASS files to css.
- grunt lessdev = compile and map all themes' LESS files to css.
- grunt check:scss = check all themes' SASS files.
- grunt watch:[cmd] = continuous monitor source files and run command when changes are detected.
- grunt watch:less
- grunt watch:scss
- grunt watch:lessdev
- grunt lessToSass = transpile all LESS files to SASS.`);
- grunt watch:scss`);
});

function getSassConfig(additionalOptions, checkOnly, themesWithLess = null) {
function getSassConfig(additionalOptions, checkOnly) {
var sassConfig = {},
path = require('path'),
themeList = fs.readdirSync(path.resolve('themes')).filter(function (theme) {
return fs.existsSync(path.resolve('themes/' + theme + '/scss/compiled.scss'))
&& (null === themesWithLess || themesWithLess === fs.existsSync(path.resolve('themes/' + theme + '/less/compiled.less')));
return fs.existsSync(path.resolve('themes/' + theme + '/scss/compiled.scss'));
});

for (var i in themeList) {
Expand All @@ -275,7 +120,7 @@ module.exports = function(grunt) {
expand: true,
cwd: path.join('themes', themeList[i], 'scss'),
src: ['compiled.scss'],
dest: checkOnly ? null : path.join('themes', themeList[i], 'css'),
dest: path.join(checkOnly ? os.tmpdir() : 'themes', themeList[i], 'css'),
ext: '.css'
}]
};
Expand Down
Loading

0 comments on commit f705c8d

Please sign in to comment.