-
-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add commitizen support #122
Conversation
@@ -0,0 +1,22 @@ | |||
import path from 'path'; | |||
|
|||
export default function parseFerossStandard(content, filePath, deps, rootDir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the function name parseFerossStandard
to parseCommitizen
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops :) will fix
It seems ESLint is broken again. 😢 Could you try run Update: I get this:
|
I tried but it was broken locally as well :/ In addition, four unrelated tests are failing on my local machine:
|
const metadata = JSON.parse(content); | ||
|
||
if (metadata.config && metadata.config.commitizen && metadata.config.commitizen.path) { | ||
const {path} = metadata.config.commitizen; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you will get ESLint warnings here, because path
is already defined from import path from 'path'
. Could you please wait and rebase on my ESLint fix? We should ensure ESLint from CI build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, true.
Of course, no stress 👍
if (metadata.config && metadata.config.commitizen && metadata.config.commitizen.path) { | ||
const commitizenPath = metadata.config.commitizen.path; | ||
|
||
if (commitizenPath.startsWith('./node_modules/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The separator (/
) is OS specific and bad.
You could do this:
const resolvedPluginPath = require.resolve(commitizenPath); // full path
const relatedPluginPath = path.relative(rootDir, resolvedPluginPath); // *maybe* node_module relative path
if (relatedPluginPath.startsWith('node_module')) {
const normalizedPluginPath = relativePluginPath.substring('node_module/').replace(/\\/g, '/');
const pluginName = requirePackageName(normalizedPluginPath); // require-package-name will handle the scoped package
// finally, we get the plugin name here...
}
@LinusU Done. Could you please rebase your changes on the new master? Besides, with the default Thanks! :D |
Absolutely, I'm on it 👍 btw, I could install them locally, which modules is it? |
npm install typescript node-sass |
Current coverage is
|
Great, now the tests works! However, I'm having some problems with the code snippet you suggested. Maybe I'm missing something...
But if they write a full path, it's probably not a module? Maybe it would be best to just only support the plain syntax (only package name). We don't want to parse all possible values for the config, just find out wether or not it's a module that is used. Thoughts? |
For reference, when using
Also, won't |
Yes, we did the same thing for SASS parser. Production code is here. Simple test fixtures are created here.
Just create a simple package (with |
I don't see |
|
Sorry, you should not use I am not sure how to handle |
If the value starts with '.', |
Got it now :)
I think I have a awesome solution, submitting it now 🙌 |
Merged, thanks! 👍 |
Thank you 🎉 |
See #119