Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
filing-cabinet
Advanced tools
Get the file associated with a dependency/partial's path
npm install --save filing-cabinet
var cabinet = require('filing-cabinet');
var result = cabinet({
partial: 'somePartialPath',
directory: 'path/to/all/files',
filename: 'path/to/parent/file',
ast: {}, // an optional AST representation of `filename`
// Only for JavaScript files
config: 'path/to/requirejs/config',
webpackConfig: 'path/to/webpack/config',
nodeModulesConfig: {
entry: 'module'
},
tsConfig: 'path/to/typescript/config'
});
console.log(result); // /absolute/path/to/somePartialPath
partial
: the dependency pathdirectory
: the path to all filesfilename
: the path to the file containing the partial
ast
: (optional) the parsed AST for filename
.config
: (optional) requirejs config for resolving aliased JavaScript moduleswebpackConfig
: (optional) webpack config for resolving aliased JavaScript modulesnodeModulesConfig
: (optional) config for resolving entry file for node_modules. This value overrides the main
attribute in the package.json file; used in conjunction with the packageFilter of the resolve
package.tsConfig
: (optional) path to a typescript configuration. Could also be an object representing a pre-parsed typescript config.By default, filing-cabinet provides support for the following languages:
.scss
and .sass
), Stylus (.styl
), and Less (.less
)You can register resolvers for new languages via cabinet.register(extension, resolver)
.
extension
: the extension of the file that should use the custom resolver (ex: '.py', '.php')resolver
: a function that accepts the following (ordered) arguments that were given to cabinet:
partial
filename
directory
config
For examples of resolver implementations, take a look at the default language resolvers:
If a given extension does not have a registered resolver, cabinet will use
a generic file resolver which is basically require('path').join
with a bit of extension defaulting logic.
npm install -g filing-cabinet
filing-cabinet [options] <dependencyPath>
filing-cabinet --help
for details on the optionsFAQs
Find files based on partial paths
The npm package filing-cabinet receives a total of 0 weekly downloads. As such, filing-cabinet popularity was classified as not popular.
We found that filing-cabinet demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.