Comments (14)
I could get commitizen
and cz-conventional-changelog
work for non-node-git-repo
with global installation.
Here are the steps that I have followed.
$ npm i -g commitizen cz-conventional-changelog
$ echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
; create.czrc
$ cd non-node-git-repo
$ touch foo
git cz -a
Hope it will be helpful.
from cz-cli.
Huh, ok I'll have to dig in more. Perhaps it is a bug. Thanks for working
on it w/me.
On Wed, Nov 25, 2015 at 6:32 PM Sébastien Barré [email protected]
wrote:
I'm afraid neither the above, nor a resolved path did the trick...
{
"path": "/Volumes/Users/barre/.npm-packages/lib/node_modules/cz-conventional-changelog"
}still getting
$ git cz -a
Error: Could not locate node_modules in your project's root directory. Did you forget to npm init or npm install?
path.js:481
throw new TypeError('Arguments to path.join must be strings');
^
TypeError: Arguments to path.join must be strings
at Object.posix.join (path.js:481:13)
at getNearestProjectRootDirectory (/Volumes/Users/barre/.npm-packages/lib/node_modules/commitizen/dist/commitizen/adapter.js:138:28)—
Reply to this email directly or view it on GitHub
#83 (comment).
from cz-cli.
@sarbbottam That would be great if you could put in a README PR! 👍
@sebastienbarre Yes this was a nice PR from someone that replace how I was using require and instead using .resolve which is much more consistent behavior with how other node modules typically let you provide input. Cheers to the contributors. :)
from cz-cli.
@sebastienbarre Sorry I was a bit slow to reply. Good question, though!
Our config loader actually allows for this. You can use either .cz.json
or .czrc
. Just throw your config in there and we'll pick up the config. 👍
Hopefully that works!
from cz-cli.
Thanks. Interesting! Failing for me:
$ git cz -a
Error: Could not locate node_modules in your project's root directory. Did you forget to npm init or npm install?
path.js:481
throw new TypeError('Arguments to path.join must be strings');
^
TypeError: Arguments to path.join must be strings
at Object.posix.join (path.js:481:13)
at getNearestProjectRootDirectory (/Volumes/Users/barre/.npm-packages/lib/node_modules/commitizen/dist/commitizen/adapter.js:138:28)
at gitCz (/Volumes/Users/barre/.npm-packages/lib/node_modules/commitizen/dist/cli/strategies/git-cz.js:74:58)
at Object.bootstrap (/Volumes/Users/barre/.npm-packages/lib/node_modules/commitizen/dist/cli/git-cz.js:29:27)
Maybe I'm not using it properly, here is my ~/.czrc
:
{
"config": {
"commitizen": {
"path": node_modules/cz-conventional-changelog"
}
}
}
I also tried
"path": "~/.npm-packages/lib/node_modules/cz-conventional-changelog"
from cz-cli.
Ah yes, can you try:
{
"path": "~/.npm-packages/lib/node_modules/cz-conventional-changelog"
}
I've also not actually tried using the ~ in the path but hopefully it would work. If not we could probably implement some kind of way to resolve ~ to a homedir.
from cz-cli.
I'm afraid neither the above, nor a resolved path did the trick...
{
"path": "/Volumes/Users/barre/.npm-packages/lib/node_modules/cz-conventional-changelog"
}
still getting
$ git cz -a
Error: Could not locate node_modules in your project's root directory. Did you forget to npm init or npm install?
path.js:481
throw new TypeError('Arguments to path.join must be strings');
^
TypeError: Arguments to path.join must be strings
at Object.posix.join (path.js:481:13)
at getNearestProjectRootDirectory (/Volumes/Users/barre/.npm-packages/lib/node_modules/commitizen/dist/commitizen/adapter.js:138:28)
from cz-cli.
I have this resolved, just working on fixing some tests it broke as a result. Will be in the next release.
from cz-cli.
Sweet, thanks
from cz-cli.
Ok so this was supposed to be simple but my tests alerted me to the fact that it isn't as simple as I'd hoped. This is due to two special places that the config loader is used in:
- Our test suite
- the
commitizen init
command, which attempts to make sure that it doesn't overwrite any existing adapter configs that might be up the tree.
So why are these two cases special? Well, simply put, the config loader needs two different traversal modes to handle them:
- Unbounded mode (the current default) - In this mode the config loader can traverse up the tree all the way to the drive root.
- Upper bounded mode - In this mode the config loader can only traverse up the tree to a certain directory. Once it gets to that directory it will stop the traversal. We need this mode specifically for tests because commitizen actually uses commitizen itself and we don't want the tests to detect our own config as valid. For
commitizen init
we need to allow people to choose if they want unbounded traversal (the default) or if they want to add an upper boundary during init.
Just wanted to give an update. 👍
from cz-cli.
Thanks @jimthedev ; can you point me to the traversal code, out of curiosity?
from cz-cli.
I create symbolic link to solve this problem.
node_modules
is in the /Users/yuyuxuan
.
Suppose my git repository is /Volumes/Transcend/Study/English/New_concept/New_concept_dictation
I use ln -sf ~/node_modules .
at the location /Volumes/Transcend/
from cz-cli.
@sarbbottam the scenario you described didn't work when I created the issue, but it seems to have been fixed by @jimthedev since then. Which is great. Thanks to all.
from cz-cli.
@jimthedev let me know if you would prefer a PR to update the README with
$ npm i -g commitizen cz-conventional-changelog
$ echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
; create.czrc
$ cd non-node-git-repo
$ touch foo
git cz -a
from cz-cli.
Related Issues (20)
- Can not write sentence case in when writing short description for change. HOT 2
- Vulnerability: Prototype Pollution via the main (merge) function HOT 2
- NPM warning breaks `cz` prompts when using `scripts` entry
- commitizen produces empty commit message after answering prompts HOT 3
- Showing timing (progress) during commit cli
- Text alignment issues in smaller terminal windows on Mac HOT 2
- bug: issue with LRU cache, cannot execute `git-cz`
- [Config loader] check if config key is in package.json before accepting it as a config file HOT 1
- Weird behaviour when using cz cli (global) outside a git repo
- pathspec 'git' did not match any file(s) known to git HOT 2
- Feature request: Submit on the command line: Is there a way to return to the previous field? HOT 1
- Feature request: Whether to support multiple types of commits in one submission HOT 1
- commit npm script actually works
- husky hook does not work HOT 2
- Nestor David Sánchez
- Behaves the same as git commit HOT 1
- Provide a way to prompt to amend commit message only
- cz commit error
- Question: Is it possible to write an adapter in ES6?
- Cannot create release version after creating a pre-release version
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 cz-cli.