0.0.7 • Published 3 years ago

node-rootdir v0.0.7

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

node-rootdir

If you are a author of open source repository, you may want to support both commonjs and es-module for users since it's a confused period. It's hard to use __dirname and import.meta.url in one file specially for typescript project.

Installation

yarn add node-rootdir

Usage

import { getRootDir } from 'node-rootdir';

const rootDir = getRootDir('YOUR_NODE_MODULES_PACKAGE_NAME', {
  source: './src',
  esmodule: './es',
  commonjs: './lib',
});

For development or testing, you will get /xxx/yyy/zzz/YOUR_NODE_MODULES_PACKAGE_NAME/src. After publish to npm, you will get /xxx/yyy/zzz/YOUR_NODE_MODULES_PACKAGE_NAME/{es|lib}, es or lib, it depends on user.

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago