project-home
v1.0.0
Published
Being designed for nested projects, the packahe lets you easily point at home directories for project and subprojects (if any) accessing them from everywhere. Does not rely on package.json files.
Readme
Being designed for nested projects, the packahe lets you easily point at home directories for project and subprojects (if any) accessing them from everywhere. Does not rely on package.json files.
Install
$ npm i -S project-homeor
$ yarn add project-homeUse
file: /home/user/projects/current/main.js
----------
ProjectHome.set(__dirname)
file: /home/user/projects/current/config/default.js
----------
export const PROJECT_HOME = ProjectHome.get(__dirname)
console.log(PROJECT_HOME) // '/home/user/projects/current'
file: /home/user/projects/current/subproject/main.js
----------
ProjectHome.set(__dirname)
file: /home/user/projects/current/subproject/config/default.js
----------
export const PROJECT_HOME = ProjectHome.get(__dirname)
console.log(PROJECT_HOME) // '/home/user/projects/current/subproject'
file: /home/user/projects/current/subproject/some.js
----------
// subproject/some.js is on the same level as subproject/main.js and is related
// to subproject home.
console.log(ProjectHome.get(__dirname)) // '/home/user/projects/current/subproject' 