gscan 4.36.3 → 4.37.1

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.
package/lib/checker.js CHANGED
@@ -1,6 +1,8 @@
1
1
  const Promise = require('bluebird');
2
2
  const _ = require('lodash');
3
3
  const requireDir = require('require-dir');
4
+ const debug = require('@tryghost/debug')('checker');
5
+
4
6
  const errors = require('@tryghost/errors');
5
7
  const versions = require('./utils').versions;
6
8
 
@@ -48,8 +50,11 @@ const check = function checkAll(themePath, options = {}) {
48
50
  // set the major version to check
49
51
  theme.checkedVersion = versions[version].major;
50
52
 
51
- return Promise.reduce(_.values(checks), function (themeToCheck, checkFunction) {
52
- return checkFunction(themeToCheck, options, themePath);
53
+ return Promise.reduce(_.values(checks), async function (themeToCheck, checkFunction) {
54
+ const now = Date.now();
55
+ const result = await checkFunction(themeToCheck, options, themePath);
56
+ debug(checkFunction.name, 'took', Date.now() - now, 'ms');
57
+ return result;
53
58
  }, theme);
54
59
  })
55
60
  .catch((error) => {
@@ -57,6 +57,7 @@ const v4PackageJSONValidationRules = _.extend({},
57
57
  const canaryPackageJSONConditionalRules = {};
58
58
  const canaryPackageJSONValidationRules = _.extend({},
59
59
  {isNotPresentCardAssets: 'GS010-PJ-GHOST-CARD-ASSETS-NOT-PRESENT'},
60
+ {invalidCustomThemeSettingDescriptionLength: 'GS010-PJ-CUST-THEME-SETTINGS-DESCRIPTION-LENGTH'},
60
61
  canaryPackageJSONConditionalRules
61
62
  );
62
63
 
@@ -103,7 +104,7 @@ _private.validatePackageJSONFields = function validatePackageJSONFields(packageJ
103
104
  markFailed('nameIsLowerCase');
104
105
  }
105
106
 
106
- if (packageJSON.name && !packageJSON.name.match(/^[a-z0-9]+(-?[a-z0-9]+)*$/gi)) {
107
+ if (packageJSON.name && !packageJSON.name.match(/^([a-z0-9]+-)*[a-z0-9]+$/gi)) {
107
108
  markFailed('nameIsHyphenated');
108
109
  }
109
110
 
@@ -197,6 +198,10 @@ _private.validatePackageJSONFields = function validatePackageJSONFields(packageJ
197
198
  default:
198
199
  //do nothing here
199
200
  }
201
+
202
+ if (entry.description && entry.description.length > 100) {
203
+ markFailed('invalidCustomThemeSettingDescriptionLength');
204
+ }
200
205
  }
201
206
  }
202
207
 
@@ -48,7 +48,7 @@ function getCustomThemeSettings(theme) {
48
48
  return customThemeSettingsConfig;
49
49
  }
50
50
 
51
- const checkTemplatesCompile = function checkTemplatesCompile(theme, options) {
51
+ const checkTemplateSyntax = function checkTemplateSyntax(theme, options) {
52
52
  const checkVersion = _.get(options, 'checkVersion', versions.default);
53
53
  const ruleSet = spec.get([checkVersion]);
54
54
  const customThemeSettings = getCustomThemeSettings(theme);
@@ -95,4 +95,4 @@ const checkTemplatesCompile = function checkTemplatesCompile(theme, options) {
95
95
  return theme;
96
96
  };
97
97
 
98
- module.exports = checkTemplatesCompile;
98
+ module.exports = checkTemplateSyntax;
@@ -706,6 +706,12 @@ let rules = {
706
706
  Find more information about the updated <code>{{price}}</code> helper <a href="${docsBaseUrl}helpers/price/" target=_blank>here</a>.`,
707
707
  helper: '{{[#].currency_symbol}}',
708
708
  regex: /currency_symbol/g
709
+ },
710
+ 'GS010-PJ-CUST-THEME-SETTINGS-DESCRIPTION-LENGTH': {
711
+ level: 'warning',
712
+ rule: '<code>package.json</code> property <code>config.custom</code> contains an entry with a <code>description</code> that is too long',
713
+ details: oneLineTrim`<code>config.custom</code> entry <code>description</code> should be less than <code>100</code> characters so that it is displayed correctly.<br />
714
+ Check the <a href="${docsBaseUrl}custom-settings" target=_blank><code>config.custom</code> documentation</a> for further information.`
709
715
  }
710
716
  };
711
717
 
@@ -8,7 +8,7 @@ module.exports = {
8
8
  version = 'canary';
9
9
  }
10
10
 
11
- debug('Checking against version: ', version);
11
+ debug('Checking against version:', version);
12
12
 
13
13
  return require(`./${[version]}`);
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "4.36.3",
3
+ "version": "4.37.1",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",
@@ -40,9 +40,9 @@
40
40
  "gscan": "./bin/cli.js"
41
41
  },
42
42
  "dependencies": {
43
- "@sentry/node": "7.51.2",
43
+ "@sentry/node": "7.56.0",
44
44
  "@tryghost/config": "0.2.17",
45
- "@tryghost/debug": "0.1.21",
45
+ "@tryghost/debug": "0.1.25",
46
46
  "@tryghost/errors": "1.2.25",
47
47
  "@tryghost/logging": "2.4.5",
48
48
  "@tryghost/pretty-cli": "1.2.37",
@@ -59,7 +59,7 @@
59
59
  "multer": "1.4.4",
60
60
  "pluralize": "8.0.0",
61
61
  "require-dir": "1.2.0",
62
- "semver": "7.5.0",
62
+ "semver": "7.5.3",
63
63
  "uuid": "9.0.0",
64
64
  "validator": "13.0.0"
65
65
  },