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

@homer0/root-file

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@homer0/root-file

Import or require a file for the project root

  • 3.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-20%
Maintainers
0
Weekly downloads
 
Created
Source

⚓️ Root file

Import or require a file for the project root.

🍿 Usage

⚠️ This package is only for Node.

  • ⚙️ Examples
  • 🤘 Development

⚙️ Example

import { rootFile } from '@homer0/root-file';

const root = rootFile();

// ...

const info = await root.import('some-file.js');
// or
const info = root.require('some-file.js');
Jimple provider

If your app uses a Jimple container, you can register RootFile as the rootFile service by using its provider:

import { rootFileProvider } from '@homer0/root-file';

// ...

container.register(rootFileProvider);

// ...

const env = container.get('rootFile');

And since the provider is a "provider creator" (created with my custom version of Jimple), you can customize its service name:

container.register(
  rootFileProvider({
    serviceName: 'myRootFile',
  }),
);
Dependencies

RootFile depends on the following services, and when used with Jimple, it will try to find them in the container, otherwise, it will create new instances:

  • @homer0/path-utils, with the name pathUtils. Used to generate the paths relative to the project root.

If you already implement the dependencies, but with a different name, you can specify them in the provider:

container.register(
  rootFileProvider({
    services: {
      pathUtils: 'myPathUtils',
    },
  }),
);

🤘 Development

As this project is part of the packages monorepo, some of the tooling, like lint-staged and husky, are installed on the root's package.json.

Tasks
TaskDescription
lintLints the package.
testRuns the unit tests.
buildTranspiles the project.
types:checkValidates the TypeScript types.

Keywords

FAQs

Package last updated on 09 Nov 2024

Did you know?

Socket

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.

Install

Related posts

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