From 9acbb223db6079e66bb5943cfcfc5278fd93f9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Mon, 18 Apr 2016 14:16:21 +0200 Subject: [PATCH] Add generator and output property as deprecated in config --- lib/book.js | 11 +---------- lib/config/index.js | 4 ++++ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/book.js b/lib/book.js index 82f44405d..e7f8013fd 100644 --- a/lib/book.js +++ b/lib/book.js @@ -97,16 +97,7 @@ function Book(opts) { Object.defineProperty(this, 'options', { get: function () { this.log.warn.ln('"options" property is deprecated, use config.get(key) instead'); - var cfg = this.config.dump(); - error.deprecateField(cfg, 'book', (this.output? this.output.name : null), '"options.generator" property is deprecated, use "output.name" instead'); - - // options.generator - cfg.generator = this.output? this.output.name : null; - - // options.output - cfg.output = this.output? this.output.root() : null; - - return cfg; + return this.options; } }); diff --git a/lib/config/index.js b/lib/config/index.js index edc048c3b..a59cbd773 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -3,6 +3,7 @@ var semver = require('semver'); var gitbook = require('../gitbook'); var Promise = require('../utils/promise'); +var error = require('../utils/error'); var validator = require('./validator'); var plugins = require('./plugins'); @@ -90,6 +91,9 @@ Config.prototype.replace = function(options) { return that.book.parent? that.book.parent.root : undefined; } }); + + error.deprecateField(this.options, 'generator', (this.book.output? this.book.output.name : null), '"options.generator" property is deprecated, use "output.name" instead'); + error.deprecateField(this.options, 'output', (this.book.output? this.book.output.root() : null), '"options.output" property is deprecated, use "output.root()" instead'); }; // Return true if book has a configuration file