gscan 4.48.0 → 4.49.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
@@ -43,21 +43,20 @@ To run a local zip file through the checks:
43
43
 
44
44
  `gscan /path/to/theme.zip -z`
45
45
 
46
- By default, GScan scans themes for the latest Ghost version compatibility. You can also specify a Ghost version by using the following parameters (for Ghost 1.0, 2.0, 3.0, 4.0 and 5.0):
46
+ By default, GScan scans themes for the latest Ghost version compatibility. You can also specify a Ghost version by using the following parameters (for Ghost 1.0, 2.0, 3.0, 4.0, 5.0 and 6.0):
47
47
 
48
48
  `--v1` or `-1`
49
49
  `--v2` or `-2`
50
50
  `--v3` or `-3`
51
- `--v4` or `-4` or `--canary`
52
- `--v5` or `-5`
53
-
54
- Use the `--canary` parameter to check for the upcoming Ghost version.
51
+ `--v4` or `-4`
52
+ `--v5` or `-5` (default)
53
+ `--v6` or `-6` or `--canary`
55
54
 
56
55
  Examples:
57
56
 
58
- `gscan /path/to/theme.zip -z1` - scan a theme in a zip file for Ghost 1.0 compatibility
57
+ `gscan /path/to/theme.zip -z -1` - scan a theme in a zip file for Ghost 1.0 compatibility
59
58
  `gscan /path/to/theme/directory --v2` - can a theme in a directory for Ghost 2.0 compatibility
60
- `gscan /path/to/theme/directory --canary` - scan a theme for the upcoming version of Ghost
59
+ `gscan /path/to/theme/directory` - scan a theme for Ghost 5.0 compatibility
61
60
 
62
61
  ### 4. Lib usage
63
62
 
@@ -68,11 +67,12 @@ var gscan = require('gscan');
68
67
 
69
68
  gscan.checkZip({
70
69
  path: 'path-to-zip',
70
+ // Pass in a folder to check
71
71
  // if you need to check the theme for a different
72
72
  // major Ghost version, you can pass it. Currently
73
- // v1, v2, v3, v4 and canary (v5) are supported. Default is
74
- // the latest Ghost version 4.0:
75
- // checkVersion: 'v4',
73
+ // v1, v2, v3, v4, v5 and v6 are supported. Default is
74
+ // the latest Ghost version 5.0:
75
+ // checkVersion: 'v5',
76
76
  name: 'my-theme'
77
77
  }).then(function (result) {
78
78
  console.log(result);
package/bin/cli.js CHANGED
@@ -56,8 +56,11 @@ prettyCLI
56
56
  .boolean('-5, --v5', {
57
57
  desc: 'Check theme for Ghost 5.0 compatibility'
58
58
  })
59
+ .boolean('-6, --v6', {
60
+ desc: 'Check theme for Ghost 6.0 compatibility'
61
+ })
59
62
  .boolean('-c, --canary', {
60
- desc: 'Check theme for upcoming Ghost version compatibility'
63
+ desc: 'Check theme for Ghost 6.0 compatibility (alias for --v6)'
61
64
  })
62
65
  .boolean('-f, --fatal', {
63
66
  desc: 'Only show fatal errors that prevent upgrading Ghost'
@@ -80,8 +83,10 @@ prettyCLI
80
83
  cliOptions.checkVersion = 'v4';
81
84
  } else if (argv.v5) {
82
85
  cliOptions.checkVersion = 'v5';
86
+ } else if (argv.v6) {
87
+ cliOptions.checkVersion = 'v6';
83
88
  } else if (argv.canary) {
84
- cliOptions.checkVersion = 'canary';
89
+ cliOptions.checkVersion = ghostVersions.canary;
85
90
  } else {
86
91
  cliOptions.checkVersion = ghostVersions.default;
87
92
  }
package/lib/checker.js CHANGED
@@ -30,8 +30,8 @@ const check = async function checkAll(themePath, options = {}) {
30
30
  let version = passedVersion;
31
31
 
32
32
  if (passedVersion === 'canary') {
33
- version = 'v4';
34
- options.checkVersion = 'v4';
33
+ version = versions.canary;
34
+ options.checkVersion = versions.canary;
35
35
  }
36
36
 
37
37
  _.each(labsEnabledHelpers, (flag, helper) => {
@@ -55,14 +55,19 @@ const v4PackageJSONValidationRules = _.extend({},
55
55
  v4PackageJSONConditionalRules
56
56
  );
57
57
 
58
- const canaryPackageJSONConditionalRules = {
58
+ const v5PackageJSONConditionalRules = {
59
59
  invalidCustomThemeSettingVisibilitySyntax: 'GS010-PJ-CUST-THEME-SETTINGS-VISIBILITY-SYNTAX',
60
60
  invalidCustomThemeSettingVisibilityValue: 'GS010-PJ-CUST-THEME-SETTINGS-VISIBILITY-VALUE'
61
61
  };
62
- const canaryPackageJSONValidationRules = _.extend({},
62
+ const v5PackageJSONValidationRules = _.extend({},
63
63
  {isNotPresentCardAssets: 'GS010-PJ-GHOST-CARD-ASSETS-NOT-PRESENT'},
64
64
  {invalidCustomThemeSettingDescriptionLength: 'GS010-PJ-CUST-THEME-SETTINGS-DESCRIPTION-LENGTH'},
65
- canaryPackageJSONConditionalRules
65
+ v5PackageJSONConditionalRules
66
+ );
67
+
68
+ const v6PackageJSONConditionalRules = {};
69
+ const v6PackageJSONValidationRules = _.extend({},
70
+ v6PackageJSONConditionalRules
66
71
  );
67
72
 
68
73
  _private.validatePackageJSONFields = function validatePackageJSONFields(packageJSON, theme, packageJSONValidationRules) {
@@ -294,7 +299,30 @@ module.exports = function checkPackageJSON(theme, options) {
294
299
  v2PackageJSONValidationRules,
295
300
  v3PackageJSONValidationRules,
296
301
  v4PackageJSONValidationRules,
297
- canaryPackageJSONValidationRules
302
+ v5PackageJSONValidationRules
303
+ );
304
+ // Make these delete more declarative as the list grows
305
+ delete packageJSONValidationRules.isNotPresentEngineGhostAPI;
306
+ delete packageJSONValidationRules.isv01EngineGhostAPI;
307
+ delete packageJSONValidationRules.isv2EngineGhostAPI;
308
+
309
+ packageJSONConditionalRules = _.merge(
310
+ {},
311
+ v1PackageJSONConditionalRules,
312
+ v2PackageJSONConditionalRules,
313
+ v3PackageJSONConditionalRules,
314
+ v4PackageJSONConditionalRules,
315
+ v5PackageJSONConditionalRules
316
+ );
317
+ } else if (checkVersion === 'v6') {
318
+ packageJSONValidationRules = _.merge(
319
+ {},
320
+ v1PackageJSONValidationRules,
321
+ v2PackageJSONValidationRules,
322
+ v3PackageJSONValidationRules,
323
+ v4PackageJSONValidationRules,
324
+ v5PackageJSONValidationRules,
325
+ v6PackageJSONValidationRules
298
326
  );
299
327
  // Make these delete more declarative as the list grows
300
328
  delete packageJSONValidationRules.isNotPresentEngineGhostAPI;
@@ -307,7 +335,8 @@ module.exports = function checkPackageJSON(theme, options) {
307
335
  v2PackageJSONConditionalRules,
308
336
  v3PackageJSONConditionalRules,
309
337
  v4PackageJSONConditionalRules,
310
- canaryPackageJSONConditionalRules
338
+ v5PackageJSONConditionalRules,
339
+ v6PackageJSONConditionalRules
311
340
  );
312
341
  } else {
313
342
  // default check for current version 'v4' rules
@@ -4,10 +4,6 @@ module.exports = {
4
4
  get: function get(key) {
5
5
  let [version] = key;
6
6
 
7
- if (version === 'v5') {
8
- version = 'canary';
9
- }
10
-
11
7
  debug('Checking against version:', version);
12
8
 
13
9
  return require(`./${[version]}`);
@@ -0,0 +1,25 @@
1
+ const _ = require('lodash');
2
+ const previousSpec = require('./v5');
3
+
4
+ const previousKnownHelpers = previousSpec.knownHelpers;
5
+ const previousTemplates = previousSpec.templates;
6
+ const previousRules = previousSpec.rules;
7
+
8
+ // assign new or overwrite existing knownHelpers, templates, or rules here:
9
+ // Currently no new rules for v6
10
+ let knownHelpers = [];
11
+ let templates = [];
12
+ let rules = {};
13
+
14
+ knownHelpers = _.union(previousKnownHelpers, knownHelpers);
15
+ templates = _.union(previousTemplates, templates);
16
+
17
+ // Merge the previous rules into the new rules
18
+ rules = _.merge({}, previousRules, rules);
19
+
20
+ module.exports = {
21
+ knownHelpers: knownHelpers,
22
+ templates: templates,
23
+ rules: rules,
24
+ defaultPackageJSON: previousSpec.defaultPackageJSON
25
+ };
@@ -19,5 +19,10 @@
19
19
  "major": "5.x",
20
20
  "docs": "5.0.0"
21
21
  },
22
- "default": "v5"
22
+ "v6": {
23
+ "major": "6.x",
24
+ "docs": "6.0.0"
25
+ },
26
+ "default": "v5",
27
+ "canary": "v6"
23
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "4.48.0",
3
+ "version": "4.49.0",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",
@@ -33,9 +33,8 @@
33
33
  "start": "node app/index.js",
34
34
  "dev": "NODE_ENV=development DEBUG=gscan:* nodemon",
35
35
  "lint": "eslint . --ext .js --cache",
36
- "test": "NODE_ENV=testing mocha -- $(find test -name '*.test.js')",
36
+ "test": "NODE_ENV=testing c8 mocha test/*.test.js",
37
37
  "posttest": "yarn lint",
38
- "coverage": "NODE_ENV=testing istanbul cover --dir test/coverage _mocha -- $(find test -name '*.test.js')",
39
38
  "preship": "yarn test",
40
39
  "ship": "pro-ship",
41
40
  "postship": "npm publish"
@@ -44,7 +43,7 @@
44
43
  "gscan": "./bin/cli.js"
45
44
  },
46
45
  "dependencies": {
47
- "@sentry/node": "^7.73.0",
46
+ "@sentry/node": "^9.0.0",
48
47
  "@tryghost/config": "^0.2.18",
49
48
  "@tryghost/debug": "^0.1.26",
50
49
  "@tryghost/errors": "^1.2.26",
@@ -60,7 +59,7 @@
60
59
  "fs-extra": "^11.1.1",
61
60
  "glob": "^8.1.0",
62
61
  "lodash": "^4.17.21",
63
- "multer": "^1.4.4",
62
+ "multer": "^2.0.0",
64
63
  "pluralize": "^8.0.0",
65
64
  "require-dir": "^1.2.0",
66
65
  "semver": "^7.5.4",
@@ -69,10 +68,10 @@
69
68
  },
70
69
  "devDependencies": {
71
70
  "@tryghost/pro-ship": "1.0.7",
71
+ "c8": "8.0.1",
72
72
  "eslint": "8.1.0",
73
73
  "eslint-plugin-ghost": "2.1.0",
74
- "istanbul": "0.4.5",
75
- "mocha": "11.1.0",
74
+ "mocha": "11.5.0",
76
75
  "node-fetch": "3.3.2",
77
76
  "nodemon": "2.0.7",
78
77
  "rewire": "6.0.0",
File without changes