mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Updated theme engine check for canary
no issue Theme engine check only worked with v[NUMBER] API format, added exception for canary
This commit is contained in:
parent
e1c7c3ebe2
commit
bc415504f7
1 changed files with 8 additions and 4 deletions
|
@ -14,6 +14,7 @@ const allowedKeys = ['ghost-api'];
|
|||
* 2.0.0
|
||||
* v2
|
||||
* v0.1
|
||||
* canary
|
||||
*
|
||||
* Goal: Extract major version from input.
|
||||
*
|
||||
|
@ -27,13 +28,16 @@ module.exports = (packageJson) => {
|
|||
// CASE: validate
|
||||
if (packageJson.engines['ghost-api']) {
|
||||
const availableApiVersions = {};
|
||||
|
||||
config.get('api:versions:all').forEach((version) => {
|
||||
if (version === 'canary') {
|
||||
availableApiVersions.canary = version;
|
||||
} else {
|
||||
availableApiVersions[semver(semver.coerce(version).version).major] = version;
|
||||
}
|
||||
});
|
||||
|
||||
const apiVersion = packageJson.engines['ghost-api'];
|
||||
const apiVersionMajor = semver(semver.coerce(apiVersion).version).major;
|
||||
const apiVersionMajor = apiVersion === 'canary' ? 'canary' : semver(semver.coerce(apiVersion).version).major;
|
||||
|
||||
if (availableApiVersions[apiVersionMajor]) {
|
||||
packageJson.engines['ghost-api'] = availableApiVersions[apiVersionMajor];
|
||||
|
|
Loading…
Reference in a new issue