Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

find-rc

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-rc - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

.findrc.js

15

lib/index.js

@@ -11,4 +11,5 @@ 'use strict';

module.exports = function (appname, startDir) {
const dirPaths = internals.dirPaths(startDir || process.cwd(), `.${appname}rc`);
const homePaths = internals.homePaths(appname);
const filename = `.${appname}rc.js`;
const dirPaths = internals.dirPaths(startDir || process.cwd(), filename);
const homePaths = internals.homePaths(filename);

@@ -56,12 +57,8 @@ // Didn't find in the parent folders, try at home next

internals.homePaths = function (appname) {
internals.homePaths = function (filename) {
const home = process.env.USERPROFILE || process.env.HOME;
return [
Path.join(home, `.${appname}rc`),
Path.join(home, `.${appname}`, 'config'),
Path.join(home, '.config', appname),
Path.join(home, '.config', appname, 'config'),
Path.join('/etc', `${appname}rc`),
Path.join('/etc', `${appname}.rc`)
Path.join(home, filename),
Path.join(home, '.config', filename)
];
};

2

package.json
{
"name": "find-rc",
"version": "2.0.0",
"version": "3.0.0",
"description": "Find a .rc file given a name",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -7,2 +7,5 @@ # `npm install find-rc`

The rc file is assumed to be written in JavaScript, therefore the filename must
be `.${app}rc.js`. If your app is named 'lab' then the rc file must be named
`.labrc.js`.

@@ -13,8 +16,4 @@ Here is the order that folders will be searched:

2. Parent of current directory, until the root folder is encountered
3. $HOME/.${apprc}
4. $HOME/.${app}/config
5. $HOME/.config/${app}
6. $HOME/.config/${app}/config
7. /etc/${app}rc
8. /etc/${app}.rc
3. $HOME/.${app}rc.js
4. $HOME/.config/.${app}rc.js

@@ -24,3 +23,3 @@

- `appname` - name of file you are looking for. Example: `lab`. It will be formatted with `.{appname}rc`
- `appname` - name of file you are looking for. Example: `lab`. It will be formatted as `.{appname}rc.js`
- `startDir` - (optional) directory to start looking for the file. Defaults to `process.cwd`

@@ -27,0 +26,0 @@

@@ -16,3 +16,3 @@ 'use strict';

expect(filePath).to.exist();
expect(filePath).to.contain('.findrc');
expect(filePath).to.contain('.findrc.js');
done();

@@ -25,3 +25,3 @@ });

expect(filePath).to.exist();
expect(filePath).to.contain('.findrc');
expect(filePath).to.contain('.findrc.js');
done();

@@ -28,0 +28,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc