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,7 +14,8 @@ const allowedKeys = ['ghost-api'];
|
||||||
* 2.0.0
|
* 2.0.0
|
||||||
* v2
|
* v2
|
||||||
* v0.1
|
* v0.1
|
||||||
*
|
* canary
|
||||||
|
*
|
||||||
* Goal: Extract major version from input.
|
* Goal: Extract major version from input.
|
||||||
*
|
*
|
||||||
* @param packageJson
|
* @param packageJson
|
||||||
|
@ -27,13 +28,16 @@ module.exports = (packageJson) => {
|
||||||
// CASE: validate
|
// CASE: validate
|
||||||
if (packageJson.engines['ghost-api']) {
|
if (packageJson.engines['ghost-api']) {
|
||||||
const availableApiVersions = {};
|
const availableApiVersions = {};
|
||||||
|
|
||||||
config.get('api:versions:all').forEach((version) => {
|
config.get('api:versions:all').forEach((version) => {
|
||||||
availableApiVersions[semver(semver.coerce(version).version).major] = version;
|
if (version === 'canary') {
|
||||||
|
availableApiVersions.canary = version;
|
||||||
|
} else {
|
||||||
|
availableApiVersions[semver(semver.coerce(version).version).major] = version;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const apiVersion = packageJson.engines['ghost-api'];
|
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]) {
|
if (availableApiVersions[apiVersionMajor]) {
|
||||||
packageJson.engines['ghost-api'] = availableApiVersions[apiVersionMajor];
|
packageJson.engines['ghost-api'] = availableApiVersions[apiVersionMajor];
|
||||||
|
|
Loading…
Reference in a new issue