Comments (5)
You would like to find package.json somewhere between the current working
folder and the repo's root folder?
On Wed, Mar 11, 2015 at 4:24 PM, Tauren Mills [email protected]
wrote:
Do to a restriction outside of my control, we have a single git repo that
contains multiple node projects. The repo is structured like this:/.git
/project1
/project1/package.json
/project1/node_modules
/project2/package.json
/project2/node_modulesThe pre-git hooks assume that there is only one package.json and that it
is in the same directory as the .git folder. What would be involved in
getting the hook to walk up the directory tree and locate the first
package.json? This would allow me to run git commit in the /project1
directory and find its package.json instead of throwing an error that the
file doesn't exist.—
Reply to this email directly or view it on GitHub
#20.
from pre-git.
Yes. Either in the current working directory, or a parent of it, up to the repo's root folder.
I just noticed support for pre-git-cwd
and am messing with it.
from pre-git.
pre-git-cwd
won't work since it is a setting within package.json
, which is what I'm trying to locate and haven't loaded yet.
from pre-git.
https://github.com/indexzero/node-pkginfo is a popular package that will locate and load the package.json
file. Since I assume the hook scripts shouldn't have dependencies, the code could be borrowed from here:
https://github.com/indexzero/node-pkginfo/blob/master/lib/pkginfo.js#L90
If I implemented this, would you accept a PR?
from pre-git.
I think this works now, I released it as 0.2.0 and added you to the list of contributors in the package.json. Thank you for this feature.
from pre-git.
Related Issues (20)
- Cannot use pre-git when node_modules is not in the same folder as .git folder HOT 4
- rm -rf node modules?? HOT 1
- Does not find the package if a subfolder from git root HOT 1
- Find the right package.json with pre-git config
- Disable pre-commit hook for specific commit message
- added task to pre-commit and after success won't fire git commit. HOT 2
- upgrade simple-commit-message to 3.x.x HOT 1
- Setup next-update-travis
- post-checkout with no config present HOT 2
- Living on it's own! HOT 4
- why on discard some file pre-git execute post-checkout?
- Package validate-commit-msg is Deprecated HOT 1
- Set up renovate app
- Dependency deprecation warning: validate-commit-msg (npm)
- Dependency deprecation warning: travis-deploy-once (npm)
- Running grunt build tasks on pre-push hook HOT 1
- Can't remove dependency without breaking git
- Action Required: Fix Renovate Configuration
- Is this project still maintained? HOT 5
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pre-git.