@lingui/conf
Advanced tools
Comparing version 3.0.0-3 to 3.0.0-4
33
index.js
@@ -16,2 +16,4 @@ "use strict"; | ||
var fs = require("fs"); | ||
var chalk = require("chalk"); | ||
@@ -54,3 +56,3 @@ | ||
srcPathIgnorePatterns: [NODE_MODULES], | ||
format: "lingui", | ||
format: "po", | ||
rootDir: ".", | ||
@@ -66,2 +68,4 @@ extractBabelOptions: { | ||
extractBabelOptions: { | ||
extends: "babelconfig.js", | ||
rootMode: "rootmode", | ||
plugins: ["plugin"], | ||
@@ -82,15 +86,28 @@ presets: ["preset"] | ||
function configFilePathFromArgs() { | ||
var configIndex = process.argv.indexOf("--config"); | ||
if (configIndex >= 0 && process.argv.length > configIndex && fs.existsSync(process.argv[configIndex + 1])) { | ||
return process.argv[configIndex + 1]; | ||
} | ||
return null; | ||
} | ||
function getConfig() { | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { | ||
cwd: null | ||
}, | ||
cwd = _ref.cwd; | ||
var configExplorer = cosmiconfig("lingui"); | ||
var defaultRootDir = cwd || process.cwd(); | ||
var configExplorer = cosmiconfig("lingui"); | ||
var result = configExplorer.searchSync(defaultRootDir); | ||
var raw = (0, _objectSpread2.default)({}, defaultConfig, result ? result.config : {}); | ||
validate(raw, configValidation); // Use deprecated fallbackLanguage, if defined | ||
var configPath = configFilePathFromArgs(); | ||
var result = configPath == null ? configExplorer.searchSync(defaultRootDir) : configExplorer.loadSync(configPath); | ||
var config = (0, _objectSpread2.default)({}, defaultConfig, result ? result.config : {}); | ||
validate(config, configValidation); // Use deprecated fallbackLanguage, if defined | ||
raw.fallbackLocale = raw.fallbackLocale || raw.fallbackLanguage || ""; | ||
config.fallbackLocale = config.fallbackLocale || config.fallbackLanguage || ""; | ||
var rootDir = result ? path.dirname(result.filepath) : defaultRootDir; | ||
return replaceRootDir(raw, rootDir); | ||
return replaceRootDir(config, rootDir); | ||
} |
{ | ||
"name": "@lingui/conf", | ||
"version": "3.0.0-3", | ||
"version": "3.0.0-4", | ||
"description": "Get lingui configuration from package.json", | ||
@@ -22,6 +22,6 @@ "keywords": [ | ||
"chalk": "^2.3.0", | ||
"cosmiconfig": "^5.0.6", | ||
"jest-regex-util": "^23.3.0", | ||
"jest-validate": "^23.5.0", | ||
"pkg-conf": "^2.1.0" | ||
"cosmiconfig": "^5.2.1", | ||
"jest-regex-util": "^24.3.0", | ||
"jest-validate": "^24.8.0", | ||
"pkg-conf": "^3.1.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "files": [ |
@@ -1,7 +0,6 @@ | ||
[![License][Badge-License]][License] | ||
[![Version][Badge-Version]][Package] | ||
[![Downloads][Badge-Downloads]][Package] | ||
[![License][badge-license]][license] | ||
[![Version][badge-version]][package] | ||
[![Downloads][badge-downloads]][package] | ||
@lingui/conf | ||
=========== | ||
# @lingui/conf | ||
@@ -12,3 +11,3 @@ > Get lingui configuration from package.json | ||
`@lingui/conf` is part of [LinguiJS][LinguiJS]. See the [documentation][Documentation] for all information, tutorials and examples. | ||
`@lingui/conf` is part of [LinguiJS][linguijs]. See the [documentation][documentation] for all information, tutorials and examples. | ||
@@ -20,3 +19,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") | ||
@@ -29,15 +28,15 @@ const config = getConfig() | ||
See the [reference][Reference] documenation of `lingui-cli` for all options. | ||
See the [reference][reference] documenation of `lingui-cli` for all options. | ||
## License | ||
This package is licensed under [MIT][License] license. | ||
This package is licensed under [MIT][license] license. | ||
[License]: https://github.com/lingui/js-lingui/blob/master/LICENSE | ||
[LinguiJS]: https://github.com/lingui/js-lingui | ||
[Documentation]: https://lingui.js.org/ | ||
[Reference]: https://lingui.js.org/ref/conf.html | ||
[Package]: https://www.npmjs.com/package/@lingui/conf | ||
[Badge-Downloads]: https://img.shields.io/npm/dw/@lingui/conf.svg | ||
[Badge-Version]: https://img.shields.io/npm/v/@lingui/conf.svg | ||
[Badge-License]: https://img.shields.io/npm/l/@lingui/conf.svg | ||
[license]: https://github.com/lingui/js-lingui/blob/master/LICENSE | ||
[linguijs]: https://github.com/lingui/js-lingui | ||
[documentation]: https://lingui.js.org/ | ||
[reference]: https://lingui.js.org/ref/conf.html | ||
[package]: https://www.npmjs.com/package/@lingui/conf | ||
[badge-downloads]: https://img.shields.io/npm/dw/@lingui/conf.svg | ||
[badge-version]: https://img.shields.io/npm/v/@lingui/conf.svg | ||
[badge-license]: https://img.shields.io/npm/l/@lingui/conf.svg |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6556
89
40
2
+ Added@jest/types@24.9.0(transitive)
+ Added@types/istanbul-lib-coverage@2.0.6(transitive)
+ Added@types/istanbul-lib-report@3.0.3(transitive)
+ Added@types/istanbul-reports@1.1.2(transitive)
+ Added@types/yargs@13.0.12(transitive)
+ Added@types/yargs-parser@21.0.3(transitive)
+ Addedansi-regex@4.1.1(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedfind-up@3.0.0(transitive)
+ Addedjest-get-type@24.9.0(transitive)
+ Addedjest-regex-util@24.9.0(transitive)
+ Addedjest-validate@24.9.0(transitive)
+ Addedleven@3.1.0(transitive)
+ Addedload-json-file@5.3.0(transitive)
+ Addedlocate-path@3.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpify@4.0.1(transitive)
+ Addedpkg-conf@3.1.0(transitive)
+ Addedpretty-format@24.9.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedtype-fest@0.3.1(transitive)
- Removedansi-regex@3.0.1(transitive)
- Removedfind-up@2.1.0(transitive)
- Removedjest-get-type@22.4.3(transitive)
- Removedjest-regex-util@23.3.0(transitive)
- Removedjest-validate@23.6.0(transitive)
- Removedleven@2.1.0(transitive)
- Removedload-json-file@4.0.0(transitive)
- Removedlocate-path@2.0.0(transitive)
- Removedp-limit@1.3.0(transitive)
- Removedp-locate@2.0.0(transitive)
- Removedp-try@1.0.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedpkg-conf@2.1.0(transitive)
- Removedpretty-format@23.6.0(transitive)
Updatedcosmiconfig@^5.2.1
Updatedjest-regex-util@^24.3.0
Updatedjest-validate@^24.8.0
Updatedpkg-conf@^3.1.0