mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-30 22:18:46 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67b2394c16 | |||
| 269d08a35f |
@@ -2,6 +2,9 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 2.5.0-beta.2
|
||||
- Fix support for pre-releases
|
||||
|
||||
## 2.5.0-beta.1
|
||||
- Font settings, sharing and search are externalized as default plugins
|
||||
- Plugins can define a configuration schema in the manifest, this schema will be used to validate configuration during build
|
||||
|
||||
@@ -5,6 +5,7 @@ var semver = require('semver');
|
||||
|
||||
var pkg = require('../package.json');
|
||||
var i18n = require('./utils/i18n');
|
||||
var version = require('./version');
|
||||
|
||||
var DEFAULT_CONFIG = require('./config_default');
|
||||
|
||||
@@ -139,7 +140,7 @@ Configuration.prototype.load = function() {
|
||||
})
|
||||
.then(function() {
|
||||
if (!that.book.isSubBook()) {
|
||||
if (!semver.satisfies(pkg.version, that.options.gitbook)) {
|
||||
if (!version.satisfies(that.options.gitbook)) {
|
||||
throw new Error('GitBook version doesn\'t satisfy version required by the book: '+that.options.gitbook);
|
||||
}
|
||||
if (that.options.gitbook != '*' && !semver.satisfies(semver.inc(pkg.version, 'patch'), that.options.gitbook)) {
|
||||
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
var _ = require('lodash');
|
||||
var Q = require('q');
|
||||
var semver = require('semver');
|
||||
var path = require('path');
|
||||
var url = require('url');
|
||||
var fs = require('./utils/fs');
|
||||
@@ -9,7 +8,7 @@ var mergeDefaults = require('merge-defaults');
|
||||
var jsonschema = require('jsonschema');
|
||||
var jsonSchemaDefaults = require('json-schema-defaults');
|
||||
|
||||
var pkg = require('../package.json');
|
||||
var version = require('./version');
|
||||
|
||||
var PLUGIN_PREFIX = 'gitbook-plugin-';
|
||||
|
||||
@@ -145,7 +144,7 @@ Plugin.prototype.isValid = function() {
|
||||
this.packageInfos.name &&
|
||||
this.packageInfos.engines &&
|
||||
this.packageInfos.engines.gitbook &&
|
||||
semver.satisfies(pkg.version, this.packageInfos.engines.gitbook)
|
||||
version.satisfies(this.packageInfos.engines.gitbook)
|
||||
);
|
||||
|
||||
// Valid hooks
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
var semver = require('semver');
|
||||
var pkg = require('../package.json');
|
||||
|
||||
var VERSION = pkg.version;
|
||||
var VERSION_STABLE = VERSION.replace(/\-(\S+)/g, '');
|
||||
|
||||
// Test if current current gitbook version satisfies a condition
|
||||
// We can't directly use samver.satisfies since it will break all plugins when gitbook version is a prerelease (beta, alpha)
|
||||
function satisfies(condition) {
|
||||
// Test with real version
|
||||
if (semver.satisfies(VERSION, condition)) return true;
|
||||
|
||||
// Test with future stable release
|
||||
return semver.satisfies(VERSION_STABLE, condition);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
satisfies: satisfies
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gitbook",
|
||||
"version": "2.5.0-beta.1",
|
||||
"version": "2.5.0-beta.2",
|
||||
"homepage": "https://www.gitbook.com",
|
||||
"description": "Library and cmd utility to generate GitBooks",
|
||||
"main": "lib/index.js",
|
||||
|
||||
Reference in New Issue
Block a user