0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Added debug to gscan checks for timings

- added a couple of extra debug calls to see how long gscan checks take in the boot process
This commit is contained in:
Hannah Wolfe 2021-05-18 15:22:02 +01:00
parent ae98bf5a6d
commit d9367f5b20
No known key found for this signature in database
GPG key ID: 9F8C7532D0A6BA55

View file

@ -1,3 +1,4 @@
const debug = require('ghost-ignition').debug('theme:validate');
const _ = require('lodash'); const _ = require('lodash');
const Promise = require('bluebird'); const Promise = require('bluebird');
const fs = require('fs-extra'); const fs = require('fs-extra');
@ -12,16 +13,19 @@ const canActivate = function canActivate(checkedTheme) {
}; };
const check = function check(theme, isZip) { const check = function check(theme, isZip) {
debug('Begin: Check');
// gscan can slow down boot time if we require on boot, for now nest the require. // gscan can slow down boot time if we require on boot, for now nest the require.
const gscan = require('gscan'); const gscan = require('gscan');
let checkPromise; let checkPromise;
if (isZip) { if (isZip) {
debug('zip mode');
checkPromise = gscan.checkZip(theme, { checkPromise = gscan.checkZip(theme, {
keepExtractedDir: true, keepExtractedDir: true,
checkVersion: 'canary' checkVersion: 'canary'
}); });
} else { } else {
debug('non-zip mode');
checkPromise = gscan.check(theme.path, { checkPromise = gscan.check(theme.path, {
checkVersion: 'canary' checkVersion: 'canary'
}); });
@ -34,6 +38,7 @@ const check = function check(theme, isZip) {
checkVersion: 'canary' checkVersion: 'canary'
}); });
debug('End: Check');
return checkedTheme; return checkedTheme;
}); });
}; };