
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@homer0/root-file
Advanced tools
Import or require a file for the project root.
⚠️ This package is only for Node.
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');
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',
}),
);
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',
},
}),
);
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
.
Task | Description |
---|---|
lint | Lints the package. |
test | Runs the unit tests. |
build | Transpiles the project. |
types:check | Validates the TypeScript types. |
FAQs
Import or require a file for the project root
We found that @homer0/root-file demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.