@lingui/conf
Advanced tools
Comparing version 2.1.2 to 2.2.0
21
index.js
@@ -6,7 +6,15 @@ "use strict"; | ||
}); | ||
var _assign = require("babel-runtime/core-js/object/assign"); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
exports.replaceRootDir = replaceRootDir; | ||
exports.getConfig = getConfig; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var path = require("path"); | ||
var chalk = require("chalk"); | ||
var pkgConf = require("pkg-conf"); | ||
var cosmiconfig = require("cosmiconfig"); | ||
@@ -64,7 +72,8 @@ var _require = require("jest-validate"), | ||
var raw = pkgConf.sync("lingui", { | ||
defaults: defaults, | ||
skipOnFalse: true, | ||
cwd: cwd || process.cwd() | ||
var defaultRootDir = cwd || process.cwd(); | ||
var configExplorer = cosmiconfig("lingui", { | ||
sync: true | ||
}); | ||
var result = configExplorer.load(defaultRootDir); | ||
var raw = (0, _assign2.default)({}, defaults, result ? result.config : null); | ||
@@ -75,4 +84,4 @@ validate(raw, configValidation); | ||
var rootDir = path.dirname(pkgConf.filepath(raw)); | ||
var rootDir = result ? path.dirname(result.filepath) : defaultRootDir; | ||
return replaceRootDir(raw, rootDir); | ||
} |
{ | ||
"name": "@lingui/conf", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Get lingui configuration from package.json", | ||
@@ -22,2 +22,3 @@ "keywords": [ | ||
"chalk": "^2.3.0", | ||
"cosmiconfig": "^4.0.0", | ||
"jest-regex-util": "^23.0.0", | ||
@@ -24,0 +25,0 @@ "jest-validate": "^23.0.1", |
@@ -5,3 +5,3 @@ [![License][Badge-License]][License] | ||
lingui-conf | ||
@lingui/conf | ||
=========== | ||
@@ -13,3 +13,3 @@ | ||
`lingui-conf` is part of [js-lingui][jsLingui]. See the [documentation][Documentation] for all information, tutorials and examples. | ||
`@lingui/conf` is part of [js-lingui][jsLingui]. See the [documentation][Documentation] for all information, tutorials and examples. | ||
@@ -21,3 +21,3 @@ Package finds nearest package.json starting from current directory, reads `lingui` configuration, provides defaults for all options and `<rootDir>` with current working directory. | ||
```js | ||
const getConfig = require('lingui-conf') | ||
const getConfig = require('@lingui/conf') | ||
@@ -24,0 +24,0 @@ const config = getConfig() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5729
65
5
+ Addedcosmiconfig@^4.0.0
+ Addedargparse@1.0.10(transitive)
+ Addedcosmiconfig@4.0.0(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedis-directory@0.3.1(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsprintf-js@1.0.3(transitive)