gscan 4.45.0 → 4.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const _ = require('lodash');
|
|
2
|
+
const spec = require('../specs');
|
|
3
|
+
const versions = require('../utils').versions;
|
|
4
|
+
|
|
5
|
+
const checkCustomFontsCssProperties = function checkCustomFontsCssProperties(theme, options) {
|
|
6
|
+
const checkVersion = _.get(options, 'checkVersion', versions.default);
|
|
7
|
+
let ruleSet = spec.get([checkVersion]);
|
|
8
|
+
|
|
9
|
+
// CASE: 051-custom-fonts-css-properties checks only needs `rules` that start with `GS051-`
|
|
10
|
+
const ruleRegex = /GS051-.*/g;
|
|
11
|
+
|
|
12
|
+
ruleSet = _.pickBy(ruleSet.rules, function (rule, ruleCode) {
|
|
13
|
+
if (ruleCode.match(ruleRegex)) {
|
|
14
|
+
return rule;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
_.each(ruleSet, function (check, ruleCode) {
|
|
19
|
+
if (theme.files) {
|
|
20
|
+
// Check CSS files and HBS files for presence of the classes
|
|
21
|
+
_.each(theme.files, function (themeFile) {
|
|
22
|
+
if (!['.css', '.hbs'].includes(themeFile.ext)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
let cssPresent = themeFile.content.match(check.regex);
|
|
28
|
+
|
|
29
|
+
if (cssPresent && theme.results.pass.indexOf(ruleCode) === -1) {
|
|
30
|
+
theme.results.pass.push(ruleCode);
|
|
31
|
+
}
|
|
32
|
+
} catch (err) {
|
|
33
|
+
// ignore for now
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!theme.files || (theme.results.pass.indexOf(ruleCode) === -1 && !Object.prototype.hasOwnProperty.call(theme.results.fail, ruleCode))) {
|
|
39
|
+
theme.results.fail[ruleCode] = {};
|
|
40
|
+
theme.results.fail[ruleCode].failures = [
|
|
41
|
+
{
|
|
42
|
+
ref: 'styles'
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return theme;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
module.exports = checkCustomFontsCssProperties;
|
package/lib/specs/canary.js
CHANGED
|
@@ -750,6 +750,12 @@ let rules = {
|
|
|
750
750
|
rule: 'Add a string to translate to the <code>{{t}}</code> helper',
|
|
751
751
|
regex: /{{\s*t\s*(["'“”]?)\s*\1?\s*}}/g,
|
|
752
752
|
details: oneLineTrim`Translate helper <code>{{t}}</code> expects a string. Example: <code>{{ t "Hello world" }}</code>. Find more information about the translate helper <a href="${docsBaseUrl}helpers/translate" target=_blank>here</a>.`
|
|
753
|
+
},
|
|
754
|
+
'GS051-CUSTOM-FONTS': {
|
|
755
|
+
level: 'warning',
|
|
756
|
+
rule: `Missing support for custom fonts`,
|
|
757
|
+
details: oneLineTrim`CSS variables for Ghost font settings are not present: <code>--gh-font-heading</code>, <code>--gh-font-body</code>`,
|
|
758
|
+
regex: /^(?=[\s\S]*--gh-font-heading)(?=[\s\S]*--gh-font-body)/
|
|
753
759
|
}
|
|
754
760
|
};
|
|
755
761
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gscan",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.46.0",
|
|
4
4
|
"description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ghost",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"eslint": "8.1.0",
|
|
73
73
|
"eslint-plugin-ghost": "2.1.0",
|
|
74
74
|
"istanbul": "0.4.5",
|
|
75
|
-
"mocha": "10.
|
|
75
|
+
"mocha": "10.8.2",
|
|
76
76
|
"node-fetch": "3.3.2",
|
|
77
77
|
"nodemon": "2.0.7",
|
|
78
78
|
"rewire": "6.0.0",
|