Skip to content
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

Dependencies #3

Merged
merged 3 commits into from
Jul 27, 2022
Merged

Dependencies #3

merged 3 commits into from
Jul 27, 2022

Conversation

OliverFriedrich
Copy link
Contributor

Add dependency injection around existing code to make in usable in Laravel/Vue.js projects

@OliverFriedrich
Copy link
Contributor Author

Would be great, if you could update the npm package. Than i just need to update my dependencies instead of replacing the package ...

Copy link
Owner

@xavierog xavierog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to integrate your changes. Especially, the CommonJS/AMD integration is something I completely ditched when writing this mode (and others) so your contribution on this matter is welcome.
However I have highlighted a series of details that must be fixed beforehand.

When you submit a pull request, the changes you made to the code will of course be reviewed and discussed. But the way you push these changes will equally be reviewed and discussed: number of commits + what each commit contains: is each change atomic? Are commit messages relevant and well written?
This makes sense considering Git enables you to completely rewrite history (git rebase is your friend) whenever needed. In the end, it is customary to submit an artificial history with perfect/elegant commits.

src/pcre.js Outdated
/* global CodeMirror, define */

(function (mod) {
if (typeof exports === "object" && typeof module === "object") // CommonJS
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pcre.js is indented using tabs therefore I would appreciate if you could use tabs for these few extra lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem, have copied these lines from some existing mode script, so the spaces where already used there. But that can be changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indention of the file corrected. This leads to a complete replace of the original code as each line gets an additional tab in front of it...

src/pcre.js Show resolved Hide resolved
src/pcre.js Show resolved Hide resolved
src/pcre.js Outdated

(function (mod) {
if (typeof exports === "object" && typeof module === "object") // CommonJS
mod(require("codemirror/lib/codemirror"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it not be ../../lib/codemirror instead of codemirror/lib/codemirror ? The idea here is to remain consistent with upstream CodeMirror modes, e.g. https://github.com/codemirror/codemirror5/blob/fc0440bc7563aead662492b0f1b0512637545442/mode/asn.1/asn.1.js#L6

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be true if this mode script would be part of the package "codemirror", but it isn't. So it is not possible/useful to use relative paths to access the elements in codemirror package.

So it is accessed by package name and path. CommonJS handles the loading ...

@xavierog
Copy link
Owner

Would be great, if you could update the npm package. Than i just need to update my dependencies instead of replacing the package ...

Ok -- once your pull request is accepted, I intend to:

  • "rebase & merge" your commits,
  • tag a new version
  • update the npm package

@xavierog xavierog merged commit 4a89440 into xavierog:master Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants