1.0.0 • Published 7 years ago

project-home v1.0.0

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

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-home

or

$ yarn add project-home

Use

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'   
1.0.0

7 years ago