rootpath
rootpath copied to clipboard
New param: mk requires rel to a project subfolder
Set up filePath parameter to let users specify a subfolder (relative to project root) within the project as the new project root. Kept backwards compatibility with previous use of filePath as an absolute path that could be set as the project root.
If filePath is 1) an object, 2) contains an 'isRelative' property which is equal to true; and 3) contains a 'path' property that is a string - then the root path will become [actual project root]/filePath.path. E.g. require('rootpath')({ isRelative: true, path: "build"}); ... results in the root (for require calls) being set to [project root]/build.
I also documented the function :)