From 389e4d2605693856385a9b335c21264820b94a7b Mon Sep 17 00:00:00 2001 From: Joe Tagliaferro Date: Thu, 4 Jan 2018 11:04:02 -0500 Subject: [PATCH] Adds `.avarc` meta file support. --- lib/cli.js | 3 ++- profile.js | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index 0c2c2f82f..e03e0dc5d 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -6,6 +6,7 @@ const arrify = require('arrify'); const meow = require('meow'); const Promise = require('bluebird'); const pkgConf = require('pkg-conf'); +const fs = require('fs'); const isCi = require('is-ci'); const hasFlag = require('has-flag'); const Api = require('../api'); @@ -21,7 +22,7 @@ const babelConfigHelper = require('./babel-config'); Promise.longStackTraces(); exports.run = () => { - const conf = pkgConf.sync('ava'); + const conf = (fs.exists('.avarc') ? JSON.parse(fs.readFileSync('.avarc')) : pkgConf.sync('ava')); const filepath = pkgConf.filepath(conf); const projectDir = filepath === null ? process.cwd() : path.dirname(filepath); diff --git a/profile.js b/profile.js index 3067e663a..849431bfb 100644 --- a/profile.js +++ b/profile.js @@ -9,6 +9,7 @@ const EventEmitter = require('events'); const meow = require('meow'); const Promise = require('bluebird'); const pkgConf = require('pkg-conf'); +const fs = require('pkg-conf'); const findCacheDir = require('find-cache-dir'); const uniqueTempDir = require('unique-temp-dir'); const arrify = require('arrify'); @@ -35,11 +36,10 @@ globals.clearTimeout = clearTimeout.bind(null); Promise.longStackTraces(); -const conf = pkgConf.sync('ava', { - defaults: { - babel: 'default' - } -}); +const conf = Object.assign( + { babel: 'default' }, + (fs.exists('.avarc') ? JSON.parse(fs.readFileSync('.avarc')) : pkgConf.sync('ava')) +); // Define a minimal set of options from the main CLI const cli = meow(`