gscan 4.24.0 → 4.25.2

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
@@ -51,8 +51,8 @@ By default, GScan scans themes for the latest Ghost version compatibility. You c
51
51
  `--v1` or `-1`
52
52
  `--v2` or `-2`
53
53
  `--v3` or `-3`
54
- `--v4` or `-4`
55
- `--v5` or `-5` or `--canary`
54
+ `--v4` or `-4` or `--canary`
55
+ `--v5` or `-5`
56
56
 
57
57
  Use the `--canary` parameter to check for the upcoming Ghost version.
58
58
 
package/app/index.js CHANGED
@@ -4,7 +4,7 @@ const hbs = require('express-hbs');
4
4
  const multer = require('multer');
5
5
  const server = require('@tryghost/server');
6
6
  const config = require('@tryghost/config');
7
- const errors = require('@tryghost/ignition-errors');
7
+ const errors = require('@tryghost/errors');
8
8
  const gscan = require('../lib');
9
9
  const fs = require('fs-extra');
10
10
  const logRequest = require('./middlewares/log-request');
@@ -1,7 +1,7 @@
1
1
  // NOTE: this middleware was extracted from Ghost core validation for theme uploads
2
2
  // might be useful to unify this logic in the future if it's extracted to separate module
3
3
  const path = require('path');
4
- const errors = require('@tryghost/ignition-errors');
4
+ const errors = require('@tryghost/errors');
5
5
 
6
6
  const checkFileExists = function checkFileExists(fileData) {
7
7
  return !!(fileData.mimetype && fileData.path);
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="canary" selected>{{ghostVersions.canary.major}}</option>
26
- <option value="v4">{{ghostVersions.v4.major}}</option>
25
+ <option value="v5">{{ghostVersions.v5.major}}</option>
26
+ <option value="v4" selected>{{ghostVersions.v4.major}}</option>
27
27
  <option value="v3">{{ghostVersions.v3.major}}</option>
28
28
  <option value="v2">{{ghostVersions.v2.major}}</option>
29
29
  <option value="v1">{{ghostVersions.v1.major}}</option>
@@ -3,6 +3,9 @@ module.exports = {
3
3
  'GS090-NO-UNKNOWN-CUSTOM-THEME-SETTINGS': require('./lint-no-unknown-custom-theme-settings'),
4
4
  'GS090-NO-UNKNOWN-CUSTOM-THEME-SELECT-VALUE-IN-MATCH': require('./lint-no-unknown-custom-theme-select-value-in-match'),
5
5
  'GS090-NO-AUTHOR-HELPER-IN-POST-CONTEXT': require('./lint-no-author-helper-in-post-page-context'),
6
+ 'GS090-NO-PRODUCTS-HELPER': require('./lint-no-products-helper'),
7
+ 'GS090-NO-PRODUCT-DATA-HELPER': require('./lint-no-product-data-helper'),
8
+ 'GS090-NO-PRODUCTS-DATA-HELPER': require('./lint-no-products-data-helper'),
6
9
  'no-multi-param-conditionals': require('./lint-no-multi-param-conditionals'),
7
10
  'no-nested-async-helpers': require('./lint-no-nested-async-helpers'),
8
11
  'no-prev-next-post-outside-post-context': require('./lint-no-prev-next-post-outside-post-context'),
@@ -0,0 +1,24 @@
1
+ const Rule = require('./base');
2
+ const {getNodeName, logNode} = require('../helpers');
3
+
4
+ module.exports = class NoProductsHelper extends Rule {
5
+ _checkForHelerInPostContext(node) {
6
+ const nodeName = getNodeName(node);
7
+ const isProductsHelper = (nodeName === '@product');
8
+
9
+ if (isProductsHelper) {
10
+ this.log({
11
+ message: `${logNode(node)} should not be used`,
12
+ line: node.loc && node.loc.start.line,
13
+ column: node.loc && node.loc.start.column,
14
+ source: this.sourceForNode(node)
15
+ });
16
+ }
17
+ }
18
+
19
+ visitor() {
20
+ return {
21
+ MustacheStatement: this._checkForHelerInPostContext.bind(this)
22
+ };
23
+ }
24
+ };
@@ -0,0 +1,24 @@
1
+ const Rule = require('./base');
2
+ const {getNodeName, logNode} = require('../helpers');
3
+
4
+ module.exports = class NoProductsHelper extends Rule {
5
+ _checkForHelerInPostContext(node) {
6
+ const nodeName = getNodeName(node);
7
+ const isProductsHelper = (nodeName === '@products');
8
+
9
+ if (isProductsHelper) {
10
+ this.log({
11
+ message: `${logNode(node)} should not be used`,
12
+ line: node.loc && node.loc.start.line,
13
+ column: node.loc && node.loc.start.column,
14
+ source: this.sourceForNode(node)
15
+ });
16
+ }
17
+ }
18
+
19
+ visitor() {
20
+ return {
21
+ MustacheStatement: this._checkForHelerInPostContext.bind(this)
22
+ };
23
+ }
24
+ };
@@ -0,0 +1,24 @@
1
+ const Rule = require('./base');
2
+ const {getNodeName, logNode} = require('../helpers');
3
+
4
+ module.exports = class NoProductsHelper extends Rule {
5
+ _checkForHelerInPostContext(node) {
6
+ const nodeName = getNodeName(node);
7
+ const isProductsHelper = (nodeName === 'products');
8
+
9
+ if (isProductsHelper) {
10
+ this.log({
11
+ message: `${logNode(node)} should not be used`,
12
+ line: node.loc && node.loc.start.line,
13
+ column: node.loc && node.loc.start.column,
14
+ source: this.sourceForNode(node)
15
+ });
16
+ }
17
+ }
18
+
19
+ visitor() {
20
+ return {
21
+ MustacheStatement: this._checkForHelerInPostContext.bind(this)
22
+ };
23
+ }
24
+ };
package/lib/checker.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const Promise = require('bluebird');
2
2
  const _ = require('lodash');
3
3
  const requireDir = require('require-dir');
4
- const errors = require('@tryghost/ignition-errors');
4
+ const errors = require('@tryghost/errors');
5
5
  const versions = require('./utils').versions;
6
6
 
7
7
  // An object containing helpers as keys and their labs flag as values
@@ -27,8 +27,9 @@ const check = function checkAll(themePath, options = {}) {
27
27
  const passedVersion = _.get(options, 'checkVersion', versions.default);
28
28
  let version = passedVersion;
29
29
 
30
- if (passedVersion === 'v5') {
31
- version = 'canary';
30
+ if (passedVersion === 'canary') {
31
+ version = 'v4';
32
+ options.checkVersion = 'v4';
32
33
  }
33
34
 
34
35
  _.each(labsEnabledHelpers, (flag, helper) => {
@@ -91,7 +92,7 @@ const checkZip = async function checkZip(path, options) {
91
92
  return theme;
92
93
  }
93
94
  } catch (error) {
94
- if (!errors.utils.isIgnitionError(error)) {
95
+ if (!errors.utils.isGhostError(error)) {
95
96
  throw new errors.ValidationError({
96
97
  message: 'Failed to check zip file',
97
98
  help: 'Your zip file might be corrupted, try unzipping and zipping again.',
package/lib/read-zip.js CHANGED
@@ -4,7 +4,7 @@ const Promise = require('bluebird');
4
4
  const os = require('os');
5
5
  const glob = require('glob');
6
6
  const {extract} = require('@tryghost/zip');
7
- const errors = require('@tryghost/ignition-errors');
7
+ const errors = require('@tryghost/errors');
8
8
  const uuid = require('uuid');
9
9
  const _ = require('lodash');
10
10
 
@@ -3,7 +3,7 @@ const oneLineTrim = require('common-tags/lib/oneLineTrim');
3
3
  const previousSpec = require('./v4');
4
4
  const ghostVersions = require('../utils').versions;
5
5
  const docsBaseUrl = `https://ghost.org/docs/api/handlebars-themes/`;
6
- const prevDocsBaseUrl = `https://themes.ghost.org/v${ghostVersions.canary.docs}/docs/`;
6
+ const prevDocsBaseUrl = `https://themes.ghost.org/v${ghostVersions.v5.docs}/docs/`;
7
7
  const prevDocsBaseUrlRegEx = new RegExp(prevDocsBaseUrl, 'g');
8
8
 
9
9
  const previousKnownHelpers = previousSpec.knownHelpers;
@@ -28,9 +28,36 @@ let rules = {
28
28
  rule: 'The <code>{{author}}</code> helper should be replaces with <code>{{authors}}</code>',
29
29
  details: oneLineTrim`The <code>{{author}}</code> helper has been deprecated since Ghost 1.22.0 in favor of <code>{{<authors>}}</code><br>
30
30
  The <code>{{author}}</code> helper was removed in Ghost v5 and should not be used.
31
- Find more information about the <code>@site</code> property <a href="${docsBaseUrl}helpers/site/" target=_blank>here</a>.`,
31
+ Find more information about the <code>{{authors}}</code> property <a href="${docsBaseUrl}helpers/authors/" target=_blank>here</a>.`,
32
32
  helper: '{{author}}'
33
33
  },
34
+ 'GS090-NO-PRODUCTS-HELPER': {
35
+ level: 'error',
36
+ fatal: true,
37
+ rule: 'The <code>{{products}}</code> helper should be replaces with <code>{{tiers}}</code>',
38
+ details: oneLineTrim`The <code>{{products}}</code> helper has been deprecated in favor of <code>{{tiers}}</code><br>
39
+ The <code>{{products}}</code> helper was removed in Ghost v5 and should not be used.
40
+ Find more information about the <code>{{tiers}}</code> property <a href="${docsBaseUrl}helpers/tiers/" target=_blank>here</a>.`,
41
+ helper: '{{products}}'
42
+ },
43
+ 'GS090-NO-PRODUCT-DATA-HELPER': {
44
+ level: 'error',
45
+ fatal: true,
46
+ rule: 'The <code>{{@product}}</code> data helper should be replaces with <code>{{#get "tiers"}}</code>',
47
+ details: oneLineTrim`The <code>{{@product}}</code> data helper has been deprecated in favor of <code>{{#get "tiers"}}</code><br>
48
+ The <code>{{@product}}</code> data helper was removed in Ghost v5 and should not be used.
49
+ Find more information about the <code>{{#get "tiers"}}</code> property <a href="${docsBaseUrl}helpers/tiers/" target=_blank>here</a>.`,
50
+ helper: '{{@product}}'
51
+ },
52
+ 'GS090-NO-PRODUCTS-DATA-HELPER': {
53
+ level: 'error',
54
+ fatal: true,
55
+ rule: 'The <code>{{@products}}</code> data helper should be replaces with <code>{{#get "tiers"}}</code>',
56
+ details: oneLineTrim`The <code>{{@products}}</code> data helper has been deprecated in favor of <code>{{#get "tiers"}}</code><br>
57
+ The <code>{{@products}}</code> data helper was removed in Ghost v5 and should not be used.
58
+ Find more information about the <code>{{#get "tiers"}}</code> property <a href="${docsBaseUrl}helpers/tiers/" target=_blank>here</a>.`,
59
+ helper: '{{@products}}'
60
+ },
34
61
 
35
62
  // Updated v1 & v2 rules
36
63
  'GS001-DEPR-BLOG': {
package/lib/specs/v4.js CHANGED
@@ -180,6 +180,31 @@ let rules = {
180
180
  fatal: false,
181
181
  details: oneLineTrim`Custom theme settings of type <code>select</code> can only be compared to their defined <code>options</code> when used in a <code>match</code> block.`
182
182
  },
183
+ 'GS090-NO-PRODUCTS-HELPER': {
184
+ level: 'warning',
185
+ rule: 'The <code>{{products}}</code> helper should be replaces with <code>{{tiers}}</code>',
186
+ details: oneLineTrim`The <code>{{products}}</code> helper has been deprecated in favor of <code>{{tiers}}</code><br>
187
+ The <code>{{products}}</code> helper will be removed in Ghost v5 and should not be used.
188
+ Find more information about the <code>{{tiers}}</code> property <a href="${docsBaseUrl}helpers/tiers/" target=_blank>here</a>.`,
189
+ helper: '{{products}}'
190
+ },
191
+ 'GS090-NO-PRODUCT-DATA-HELPER': {
192
+ level: 'warning',
193
+ rule: 'The <code>{{@product}}</code> data helper should be replaces with <code>{{#get "tiers"}}</code>',
194
+ details: oneLineTrim`The <code>{{@product}}</code> data helper has been deprecated in favor of <code>{{#get "tiers"}}</code><br>
195
+ The <code>{{@product}}</code> data helper will be removed in Ghost v5 and should not be used.
196
+ Find more information about the <code>{{#get "tiers"}}</code> property <a href="${docsBaseUrl}helpers/tiers/" target=_blank>here</a>.`,
197
+ helper: '{{@product}}'
198
+ },
199
+ 'GS090-NO-PRODUCTS-DATA-HELPER': {
200
+ level: 'warning',
201
+ rule: 'The <code>{{@products}}</code> data helper should be replaces with <code>{{#get "tiers"}}</code>',
202
+ details: oneLineTrim`The <code>{{@products}}</code> data helper has been deprecated in favor of <code>{{#get "tiers"}}</code><br>
203
+ The <code>{{@products}}</code> data helper will be removed in Ghost v5 and should not be used.
204
+ Find more information about the <code>{{#get "tiers"}}</code> property <a href="${docsBaseUrl}helpers/tiers/" target=_blank>here</a>.`,
205
+ helper: '{{@products}}'
206
+ },
207
+
183
208
  'GS100-NO-UNUSED-CUSTOM-THEME-SETTING': {
184
209
  level: 'error',
185
210
  rule: 'A custom theme setting defined in <code>package.json</code> hasn\'t been used in any theme file.',
@@ -15,7 +15,7 @@
15
15
  "major": "4.x",
16
16
  "docs": "4.0.0"
17
17
  },
18
- "canary": {
18
+ "v5": {
19
19
  "major": "5.x",
20
20
  "docs": "5.0.0"
21
21
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "4.24.0",
3
+ "version": "4.25.2",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",
@@ -40,11 +40,11 @@
40
40
  "gscan": "./bin/cli.js"
41
41
  },
42
42
  "dependencies": {
43
- "@sentry/node": "6.19.1",
43
+ "@sentry/node": "6.19.2",
44
44
  "@tryghost/config": "0.2.2",
45
45
  "@tryghost/debug": "0.1.11",
46
- "@tryghost/ignition-errors": "0.1.8",
47
- "@tryghost/logging": "2.0.4",
46
+ "@tryghost/errors": "1.2.6",
47
+ "@tryghost/logging": "2.1.0",
48
48
  "@tryghost/pretty-cli": "1.2.24",
49
49
  "@tryghost/server": "0.1.4",
50
50
  "@tryghost/zip": "1.1.20",