Node-Utils
Node-Utils is a collection of day-to-day utility methods usable in node environments.
Installation
npm install @teclone/node-utils
getClosesetPackageDir(startPath: string = process.cwd())
This function returns the absolute path of the closest directory that contains a package.json file.
It will return startPath if startPath contains a package.json file as well.
import { getClosestPackageDir } from '@teclone/node-utils';
console.log(getClosestPackageDir());
mkdirSync(path: string)
Recursively creates the path given. If path points to a file, only the directories will be created.
import { mkdirSync } from '@teclone/node-utils';
mkdirSync('/projects/examples/test.ts');
// the directory path /projects/examples will be created