0.0.4 • Published 2 years ago

rrpf v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

rrpf

NPM version

Reliable relative path of the file

Why

When i use npx to execute a '.js' file that contains references to files in relative path, file had been looking for based on the path where the npx is executed.

That's certainly not what I wanted, the path that based on '.js' file is what I expected.

Install

npm i rrpf

Usage

// module
import rrpf from 'rrpf'
// or commonjs
const rrpf = require('rrpf')

rrpf('./path/to/file/foo.*')

Example

|-- project
    |-- a.js
    |-- b.js
// a.js
import rrpf from 'rrpf'

rrpf('./b.js') // /path/to/project/b.js

Sponsors

License

MIT License © 2022 Liam Shi