devtools-config
Advanced tools
Comparing version 0.0.12 to 0.0.13
{ | ||
"name": "devtools-config", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Devtools Local Configuration System", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
## Configuration | ||
[![Npm version](https://img.shields.io/npm/v/devtools-config.svg)](https://npmjs.org/package/devtools-config) | ||
All default config values are in [`config/development.json`](./development.json), to override these values you need to [create a local config file](#create-a-local-config-file). | ||
@@ -4,0 +6,0 @@ |
@@ -23,9 +23,16 @@ const pick = require("lodash/get"); | ||
function isEnabled(key) { | ||
return config.features && | ||
typeof config.features[key] == "object" ? | ||
config.features[key].enabled : | ||
config.features[key]; | ||
return config.features && typeof config.features[key] == "object" | ||
? config.features[key].enabled | ||
: config.features[key]; | ||
} | ||
function isDevelopment() { | ||
if (typeof window == "object") { | ||
if (process.env.NODE_ENV === "production") { | ||
return true; | ||
} | ||
const href = window.location ? window.location.href : ""; | ||
return href.match(/^file:/) || href.match(/localhost:/); | ||
} | ||
if (isFirefoxPanel()) { | ||
@@ -64,9 +71,5 @@ // Default to production if compiling for the Firefox panel | ||
const localConfigPath = path.resolve(relativePath, "../configs/local.json"); | ||
try { | ||
const output = JSON.stringify(config, null, 2); | ||
fs.writeFileSync(localConfigPath, output); | ||
return output; | ||
} catch (err) { | ||
return "{}"; | ||
} | ||
const output = JSON.stringify(config, null, 2); | ||
fs.writeFileSync(localConfigPath, output, { flag: "w" }); | ||
return output; | ||
} | ||
@@ -85,3 +88,3 @@ | ||
setConfig, | ||
updateLocalConfig | ||
updateLocalConfig, | ||
}; |
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
7053
128
43
7