mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Refactored the gscan version check to use single variable
no issue - Just a small refactor as it was becoming painful to change the version in three places while experimenting with gscan - Also follows the "rule of 3"
This commit is contained in:
parent
955f1e8a2e
commit
fd14b7eaf6
1 changed files with 4 additions and 3 deletions
|
@ -22,26 +22,27 @@ const check = async function check(theme, isZip) {
|
||||||
debug('Begin: Check');
|
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');
|
||||||
|
const checkedVersion = 'v4';
|
||||||
let checkedTheme;
|
let checkedTheme;
|
||||||
|
|
||||||
if (isZip) {
|
if (isZip) {
|
||||||
debug('zip mode');
|
debug('zip mode');
|
||||||
checkedTheme = await gscan.checkZip(theme, {
|
checkedTheme = await gscan.checkZip(theme, {
|
||||||
keepExtractedDir: true,
|
keepExtractedDir: true,
|
||||||
checkVersion: 'v4',
|
checkVersion: checkedVersion,
|
||||||
labs: labs.getAll()
|
labs: labs.getAll()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
debug('non-zip mode');
|
debug('non-zip mode');
|
||||||
checkedTheme = await gscan.check(theme.path, {
|
checkedTheme = await gscan.check(theme.path, {
|
||||||
checkVersion: 'v4',
|
checkVersion: checkedVersion,
|
||||||
labs: labs.getAll()
|
labs: labs.getAll()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
checkedTheme = gscan.format(checkedTheme, {
|
checkedTheme = gscan.format(checkedTheme, {
|
||||||
onlyFatalErrors: config.get('env') === 'production',
|
onlyFatalErrors: config.get('env') === 'production',
|
||||||
checkVersion: 'v4'
|
checkVersion: checkedVersion
|
||||||
});
|
});
|
||||||
|
|
||||||
debug('End: Check');
|
debug('End: Check');
|
||||||
|
|
Loading…
Add table
Reference in a new issue