From 4aaa3a988d587bfdc1ae972bc8f6836b06318b62 Mon Sep 17 00:00:00 2001 From: Damien Robert Date: Mon, 18 Dec 2017 20:06:34 +0100 Subject: [PATCH 1/3] Conform to browserslist api Commit a1bf895ecd48b5c4ba8e82227da3c33aaafc3a48 changed the browserslist request from browserslist(this.browsersRequest) to browserslist(this.browsersRequest, { from }) But in browserslist the option name for the path is 'path'. This commit corrects this. Note that this means that before, since 'path' was not specified, browserslist would fallback to the current working directory for the config file look up. With this commit, if no queries are specified, browserslist will look up for a config file up from the specified path rather than the current working directory. This conforms with autoprefixer behavior. Note that we only pass 'from' if it is not null, this allows browserslist to fallback to the current directory when no path is provided. --- src/browsers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browsers.js b/src/browsers.js index 5f197b3..64dae3a 100644 --- a/src/browsers.js +++ b/src/browsers.js @@ -4,7 +4,7 @@ var _ = require('lodash') module.exports = class BrowserSelection { constructor (query, from) { this.browsersRequest = query - this._list = browserslist(this.browsersRequest, { from }) + this._list = browserslist(this.browsersRequest, from ? { path: from } : {}) .map((s) => s.split(' ')) } From 8f831a4acc9e575932f6639e6af1cb79b6d02cfc Mon Sep 17 00:00:00 2001 From: Damien Robert Date: Tue, 19 Dec 2017 22:41:05 +0100 Subject: [PATCH 2/3] cli.js --browsers: default to null This let browserslist pick up a '.browserslistrc' if no browsers are provided. If such a file is not found it will default to browserslist.defaults anyway. --- cli.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli.js b/cli.js index aa57ff2..d5a6545 100755 --- a/cli.js +++ b/cli.js @@ -20,7 +20,7 @@ var yargs = require('yargs') .options('b', { alias: 'browsers', description: 'Autoprefixer-like browser criteria.', - default: browserslist.defaults.join(', ') + default: null // browserslist.defaults.join(', ') }) .string('b') .options('i', { @@ -73,7 +73,7 @@ if (argv.config) { } } -argv.browsers = argv.browsers.split(',').map(function (s) { return s.trim() }) +argv.browsers && (argv.browsers = argv.browsers.split(',').map(function (s) { return s.trim() })) argv.ignore = argv.ignore.split(',').map(function (s) { return s.trim() }) // Informational output if (argv.l) { argv.v = ++argv.verbose } From 89a1818743fd6b066805d27d9b8b44c938428857 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Fri, 23 Mar 2018 13:45:58 +0100 Subject: [PATCH 3/3] Update cli.js --- cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli.js b/cli.js index d5a6545..68e4801 100755 --- a/cli.js +++ b/cli.js @@ -20,7 +20,7 @@ var yargs = require('yargs') .options('b', { alias: 'browsers', description: 'Autoprefixer-like browser criteria.', - default: null // browserslist.defaults.join(', ') + default: null }) .string('b') .options('i', {