config 1.30.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.31.0 / 2018-05-22
2
+ ===================
3
+
4
+ * Load new coffeescript module instead of coffee-script - bastbijl
5
+
1
6
  1.30.0 / 2018-02-26
2
7
  ===================
3
8
 
package/README.md CHANGED
@@ -155,15 +155,15 @@ Contributors
155
155
  </tr><tr><td><img src=https://avatars2.githubusercontent.com/u/1246875?v=4><a href="https://github.com/jaylynch">jaylynch</a></td>
156
156
  <td><img src=https://avatars1.githubusercontent.com/u/145742?v=4><a href="https://github.com/jberrisch">jberrisch</a></td>
157
157
  <td><img src=https://avatars1.githubusercontent.com/u/9355665?v=4><a href="https://github.com/kgoerlitz">kgoerlitz</a></td>
158
+ <td><img src=https://avatars3.githubusercontent.com/u/8650543?v=4><a href="https://github.com/leonardovillela">leonardovillela</a></td>
158
159
  <td><img src=https://avatars3.githubusercontent.com/u/1918551?v=4><a href="https://github.com/nitzan-shaked">nitzan-shaked</a></td>
159
160
  <td><img src=https://avatars3.githubusercontent.com/u/3058150?v=4><a href="https://github.com/robertrossmann">robertrossmann</a></td>
160
- <td><img src=https://avatars2.githubusercontent.com/u/498929?v=4><a href="https://github.com/roncli">roncli</a></td>
161
- </tr><tr><td><img src=https://avatars2.githubusercontent.com/u/1355559?v=4><a href="https://github.com/superoven">superoven</a></td>
161
+ </tr><tr><td><img src=https://avatars2.githubusercontent.com/u/498929?v=4><a href="https://github.com/roncli">roncli</a></td>
162
+ <td><img src=https://avatars2.githubusercontent.com/u/1355559?v=4><a href="https://github.com/superoven">superoven</a></td>
162
163
  <td><img src=https://avatars2.githubusercontent.com/u/54934?v=4><a href="https://github.com/wmertens">wmertens</a></td>
163
164
  <td><img src=https://avatars3.githubusercontent.com/u/2842176?v=4><a href="https://github.com/XadillaX">XadillaX</a></td>
164
165
  <td><img src=https://avatars1.githubusercontent.com/u/4425455?v=4><a href="https://github.com/ncuillery">ncuillery</a></td>
165
166
  <td><img src=https://avatars0.githubusercontent.com/u/2015295?v=4><a href="https://github.com/patrickpilch">patrickpilch</a></td>
166
- <td><img src=https://avatars1.githubusercontent.com/u/618330?v=4><a href="https://github.com/adityabansod">adityabansod</a></td>
167
167
  </tr></table>
168
168
 
169
169
  License
package/lib/config.js CHANGED
@@ -33,7 +33,8 @@ var DEFAULT_CLONE_DEPTH = 20,
33
33
  gitCryptTestRegex = /^.GITCRYPT/; // regular expression to test for gitcrypt files.
34
34
 
35
35
  // Define soft dependencies so transpilers don't include everything
36
- var COFFEE_DEP = "coffee-script",
36
+ var COFFEE_2_DEP = "coffeescript",
37
+ COFFEE_DEP = "coffee-script",
37
38
  ICED_DEP = "iced-coffee-script",
38
39
  JS_YAML_DEP = "js-yaml",
39
40
  YAML_DEP = "yaml",
@@ -661,6 +662,9 @@ util.loadFileConfigs = function(configDir) {
661
662
  // Override, NODE_ENV if NODE_CONFIG_ENV is specified.
662
663
  NODE_ENV = util.initParam('NODE_CONFIG_ENV', NODE_ENV);
663
664
 
665
+ // Split files name, for loading multiple files.
666
+ NODE_ENV = NODE_ENV.split(',');
667
+
664
668
  CONFIG_DIR = configDir || util.initParam('NODE_CONFIG_DIR', Path.join( process.cwd(), 'config') );
665
669
  if (CONFIG_DIR.indexOf('.') === 0) {
666
670
  CONFIG_DIR = Path.join(process.cwd() , CONFIG_DIR);
@@ -691,22 +695,26 @@ util.loadFileConfigs = function(configDir) {
691
695
  env.HOSTNAME = hostName;
692
696
 
693
697
  // Read each file in turn
694
- var baseNames = ['default', NODE_ENV];
698
+ var baseNames = ['default'].concat(NODE_ENV);
695
699
 
696
700
  // #236: Also add full hostname when they are different.
697
701
  if ( hostName ) {
698
702
  var firstDomain = hostName.split('.')[0];
699
703
 
700
- // Backward compatibility
701
- baseNames.push(firstDomain, firstDomain + '-' + NODE_ENV);
704
+ NODE_ENV.forEach(function(env) {
705
+ // Backward compatibility
706
+ baseNames.push(firstDomain, firstDomain + '-' + env);
702
707
 
703
- // Add full hostname when it is not the same
704
- if ( hostName != firstDomain ) {
705
- baseNames.push(hostName, hostName + '-' + NODE_ENV);
706
- }
708
+ // Add full hostname when it is not the same
709
+ if ( hostName != firstDomain ) {
710
+ baseNames.push(hostName, hostName + '-' + env);
711
+ }
712
+ });
707
713
  }
708
714
 
709
- baseNames.push('local', 'local-' + NODE_ENV);
715
+ NODE_ENV.forEach(function(env) {
716
+ baseNames.push('local', 'local-' + env);
717
+ });
710
718
 
711
719
  var extNames = ['js', 'ts', 'json', 'json5', 'hjson', 'toml', 'coffee', 'iced', 'yaml', 'yml', 'cson', 'properties', 'xml'];
712
720
  baseNames.forEach(function(baseName) {
@@ -919,7 +927,14 @@ util.parseFile = function(fullFilename) {
919
927
  // Coffee = require("coffee-script");
920
928
  //}
921
929
 
922
- Coffee = require(COFFEE_DEP);
930
+ try {
931
+ // Try to load coffeescript
932
+ Coffee = require(COFFEE_2_DEP);
933
+ }
934
+ catch (e) {
935
+ // If it doesn't exist, try to load it using the deprecated module name
936
+ Coffee = require(COFFEE_DEP);
937
+ }
923
938
 
924
939
  // coffee-script >= 1.7.0 requires explicit registration for require() to work
925
940
  if (Coffee.register) {
@@ -1711,15 +1726,20 @@ util.runStrictnessChecks = function (config) {
1711
1726
  return Path.basename(src.name);
1712
1727
  });
1713
1728
 
1714
-
1715
- // Throw an exception if there's no explicit config file for NODE_ENV
1716
- var anyFilesMatchEnv = sourceFilenames.some(function (filename) {
1717
- return filename.match(NODE_ENV);
1729
+ NODE_ENV.forEach(function(env) {
1730
+ // Throw an exception if there's no explicit config file for NODE_ENV
1731
+ var anyFilesMatchEnv = sourceFilenames.some(function (filename) {
1732
+ return filename.match(env);
1733
+ });
1734
+ // development is special-cased because it's the default value
1735
+ if (env && (env !== 'development') && !anyFilesMatchEnv) {
1736
+ _warnOrThrow("NODE_ENV value of '"+env+"' did not match any deployment config file names.");
1737
+ }
1738
+ // Throw if NODE_ENV matches' default' or 'local'
1739
+ if ((env === 'default') || (env === 'local')) {
1740
+ _warnOrThrow("NODE_ENV value of '"+env+"' is ambiguous.");
1741
+ }
1718
1742
  });
1719
- // development is special-cased because it's the default value
1720
- if (NODE_ENV && (NODE_ENV !== 'development') && !anyFilesMatchEnv) {
1721
- _warnOrThrow("NODE_ENV value of '"+NODE_ENV+"' did not match any deployment config file names.");
1722
- }
1723
1743
 
1724
1744
  // Throw an exception if there's no explict config file for NODE_APP_INSTANCE
1725
1745
  var anyFilesMatchInstance = sourceFilenames.some(function (filename) {
@@ -1729,11 +1749,6 @@ util.runStrictnessChecks = function (config) {
1729
1749
  _warnOrThrow("NODE_APP_INSTANCE value of '"+APP_INSTANCE+"' did not match any instance config file names.");
1730
1750
  }
1731
1751
 
1732
- // Throw if NODE_ENV matches' default' or 'local'
1733
- if ((NODE_ENV === 'default') || (NODE_ENV === 'local')) {
1734
- _warnOrThrow("NODE_ENV value of '"+NODE_ENV+"' is ambiguous.");
1735
- }
1736
-
1737
1752
  function _warnOrThrow (msg) {
1738
1753
  var beStrict = process.env.NODE_CONFIG_STRICT_MODE;
1739
1754
  var prefix = beStrict ? 'FATAL: ' : 'WARNING: ';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "config",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "main": "./lib/config.js",
5
5
  "description": "Configuration control for production node deployments",
6
6
  "author": "Loren West <open_source@lorenwest.com>",
@@ -19,12 +19,11 @@
19
19
  },
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "json5": "0.4.0",
23
- "os-homedir": "1.0.2"
22
+ "json5": "^1.0.1"
24
23
  },
25
24
  "devDependencies": {
26
25
  "@types/node": "^7.0.8",
27
- "coffee-script": ">=1.7.0",
26
+ "coffeescript": "2.2.4",
28
27
  "cson": "^3.0.1",
29
28
  "hjson": "^1.2.0",
30
29
  "js-yaml": "^3.2.2",
package/ISSUE_TEMPLATE.md DELETED
@@ -1,24 +0,0 @@
1
- **Note: for support questions, please use [StackOverflow](https://stackoverflow.com/questions/tagged/node-config) and tag your question with `node-config`**. *This repository's issues are reserved for feature requests and bug reports.*
2
-
3
- Before submitting a bug report, please search the issue tracker the wiki first. Many issues have already been discussed.
4
-
5
- The wiki is located at: https://github.com/lorenwest/node-config/wiki
6
-
7
- ### I'm submitting a ...
8
- - [ ] bug report
9
- - [ ] feature request
10
- - [ ] support request or question => Please do not submit support request or questions here, see note at the top of this template.
11
-
12
- ### What is the current behavior?
13
- *If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem*:
14
-
15
- ### What is the expected behavior?
16
-
17
- ### Please tell us about your environment:
18
-
19
- - node-config version: x.x.x
20
- - node-version: x.x.x
21
-
22
- ### Other information
23
-
24
- (e.g. are you using an environment besides Node.js?)