gscan 4.49.6 → 5.0.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.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  GScan is a tool for validating Ghost themes. It produces detailed reports of issues where themes need to be modified in order to be compatible with a specific version.
8
8
 
9
- It is actively capable of dealing with the current and last major versions of Ghost (so at the time of writing v4, v3, v2 and v1).
9
+ It is actively capable of dealing with the current and last major versions of Ghost (v1-v6).
10
10
 
11
11
  GScan works on a system of rules. Each rule has a way to check whether it passes or fails and has help content which describes how to fix it. Each rule is also marked with an error level:
12
12
 
@@ -49,14 +49,14 @@ By default, GScan scans themes for the latest Ghost version compatibility. You c
49
49
  `--v2` or `-2`
50
50
  `--v3` or `-3`
51
51
  `--v4` or `-4`
52
- `--v5` or `-5` (default)
53
- `--v6` or `-6` or `--canary`
52
+ `--v5` or `-5`
53
+ `--v6` or `-6` (default) or `--canary`
54
54
 
55
55
  Examples:
56
56
 
57
57
  `gscan /path/to/theme.zip -z -1` - scan a theme in a zip file for Ghost 1.0 compatibility
58
58
  `gscan /path/to/theme/directory --v2` - can a theme in a directory for Ghost 2.0 compatibility
59
- `gscan /path/to/theme/directory` - scan a theme for Ghost 5.0 compatibility
59
+ `gscan /path/to/theme/directory` - scan a theme for Ghost 6.0 compatibility
60
60
 
61
61
  ### 4. Lib usage
62
62
 
@@ -71,8 +71,8 @@ gscan.checkZip({
71
71
  // if you need to check the theme for a different
72
72
  // major Ghost version, you can pass it. Currently
73
73
  // v1, v2, v3, v4, v5 and v6 are supported. Default is
74
- // the latest Ghost version 5.0:
75
- // checkVersion: 'v5',
74
+ // the latest Ghost version 6.0:
75
+ // checkVersion: 'v6',
76
76
  name: 'my-theme'
77
77
  }).then(function (result) {
78
78
  console.log(result);
package/app/tpl/index.hbs CHANGED
@@ -22,8 +22,8 @@
22
22
  <span class="gh-input-icon select-arrow">{{> icon-arrow-up}}</span>
23
23
  <span class="gh-input-icon select-arrow active">{{> icon-arrow-down}}</span>
24
24
  <select class="gh-input gh-select" name="version" id="version">
25
- <option value="v6">{{ghostVersions.v6.major}}</option>
26
- <option value="v5" selected>{{ghostVersions.v5.major}}</option>
25
+ <option value="v6" selected>{{ghostVersions.v6.major}}</option>
26
+ <option value="v5">{{ghostVersions.v5.major}}</option>
27
27
  <option value="v4">{{ghostVersions.v4.major}}</option>
28
28
  <option value="v3">{{ghostVersions.v3.major}}</option>
29
29
  <option value="v2">{{ghostVersions.v2.major}}</option>
@@ -13,6 +13,7 @@ module.exports = {
13
13
  'GS090-NO-PRICE-DATA-CURRENCY-CONTEXT': require('./lint-no-price-data-currency-context'),
14
14
  'GS090-NO-PRICE-DATA-MONTHLY-YEARLY': require('./lint-no-price-data-monthly-yearly'),
15
15
  'GS090-NO-LIMIT-ALL-IN-GET-HELPER': require('./lint-no-limit-all-in-get-helper'),
16
+ 'GS090-NO-LIMIT-OVER-100-IN-GET-HELPER': require('./lint-no-limit-over-100-in-get-helper'),
16
17
  'GS110-NO-UNKNOWN-PAGE-BUILDER-USAGE': require('./lint-no-unknown-page-properties'),
17
18
  'GS120-NO-UNKNOWN-GLOBALS': require('./lint-no-unknown-globals'),
18
19
  'no-multi-param-conditionals': require('./lint-no-multi-param-conditionals'),
@@ -0,0 +1,34 @@
1
+ const Rule = require('./base');
2
+ const {getNodeName} = require('../helpers');
3
+
4
+ module.exports = class NoLimitOver100InGetHelper extends Rule {
5
+ _checkForLimitOver100(node) {
6
+ const nodeName = getNodeName(node);
7
+
8
+ if (nodeName === 'get' && node.hash && node.hash.pairs && node.hash.pairs.length > 0) {
9
+ const limitPair = node.hash.pairs.find(pair => pair.key === 'limit');
10
+
11
+ if (limitPair && limitPair.value) {
12
+ // Handle both string literals and quoted values
13
+ const limitValue = limitPair.value.value || limitPair.value.original;
14
+
15
+ // Parse the limit value as a number
16
+ const numericLimit = parseInt(limitValue, 10);
17
+
18
+ if (!isNaN(numericLimit) && numericLimit > 100) {
19
+ this.log({
20
+ line: node.loc && node.loc.start.line,
21
+ column: node.loc && node.loc.start.column,
22
+ source: this.sourceForNode(node)
23
+ });
24
+ }
25
+ }
26
+ }
27
+ }
28
+
29
+ visitor() {
30
+ return {
31
+ BlockStatement: this._checkForLimitOver100.bind(this)
32
+ };
33
+ }
34
+ };
package/lib/specs/v6.js CHANGED
@@ -18,12 +18,20 @@ let rules = {
18
18
  Find more information about the <code>{{#get}}</code> helper <a href="${docsBaseUrl}helpers/get/" target=_blank>here</a>.`,
19
19
  helper: '{{#get}}'
20
20
  },
21
+ 'GS090-NO-LIMIT-OVER-100-IN-GET-HELPER': {
22
+ level: 'warning',
23
+ rule: 'Using <code>limit</code> values greater than 100 in <code>{{#get}}</code> helper is not supported',
24
+ details: oneLineTrim`Ghost automatically caps <code>limit</code> values at 100, so using higher values will not return more results.
25
+ Consider using pagination or setting the limit to 100 or lower.<br>
26
+ Find more information about the <code>{{#get}}</code> helper <a href="${docsBaseUrl}helpers/get/" target=_blank>here</a>.`,
27
+ helper: '{{#get}}'
28
+ },
21
29
  'GS001-DEPR-AMP-TEMPLATE': {
22
30
  level: 'warning',
23
31
  rule: 'AMP templates are no longer supported in Ghost 6.0',
24
32
  details: 'AMP support was removed in Ghost 6.0. Remove AMP templates and use responsive design instead.',
25
33
  // Matches <html amp> or <html ⚡>, with or without other attributes mixed in
26
- regex: /<html\s+(?:amp|⚡)(?:\s|>)|<html\s+[^>]*\s(?:amp|⚡)(?:\s|>)/i
34
+ regex: /<html\s+(?:amp|⚡)(?:\s|>)|<html\s+[^>]*\s(?:amp|⚡)(?:\s|>)/i
27
35
  }
28
36
  };
29
37
 
@@ -23,6 +23,6 @@
23
23
  "major": "6.x",
24
24
  "docs": "6.0.0"
25
25
  },
26
- "default": "v5",
26
+ "default": "v6",
27
27
  "canary": "v6"
28
- }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "4.49.6",
3
+ "version": "5.0.0",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",