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

tools: eliminate intermediate module in doctools #20701

Closed
wants to merge 1 commit into from
Closed

tools: eliminate intermediate module in doctools #20701

wants to merge 1 commit into from

Conversation

vsemozhetbyt
Copy link
Contributor

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Fixes: #20685

We already check this path in doctools tests, so why not to require this module directly without unneeded overhead:

// The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree.
try {
require('../../tools/node_modules/eslint/node_modules/js-yaml');
} catch (e) {
common.skip('missing js-yaml (eslint not present)');
}

// The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree.
try {
require('../../tools/node_modules/eslint/node_modules/js-yaml');
} catch (e) {
common.skip('missing js-yaml (eslint not present)');
}

It seems we can leave this block unchanged, as this package.json is more informational than functional:

"devDependencies": {
"js-yaml": "^3.5.2"
},

@vsemozhetbyt vsemozhetbyt added the fast-track PRs that do not need to wait for 48 hours to land. label May 13, 2018
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory. labels May 13, 2018
@vsemozhetbyt
Copy link
Contributor Author

@vsemozhetbyt

This comment has been minimized.

@Trott
Copy link
Member

Trott commented May 13, 2018

This depending-on-a-module-in-an-unrelated-source-tree seems like a code smell to me. Wouldn't it be better to simply remove the checks from the tests (after making sure that the code doesn't use the version in eslint someplace else)?

@Trott
Copy link
Member

Trott commented May 13, 2018

I'm opposed to fast-tracking because I don't think this is the right approach, at least based on the context I have. It's possible that I don't fully understand the situation.

@Trott Trott removed the fast-track PRs that do not need to wait for 48 hours to land. label May 13, 2018
@vsemozhetbyt
Copy link
Contributor Author

TBH, I do not understand why we need tools/doc/package.json at all: doctools is not an outer installed package now, just a bunch of our internal scripts.

So I am not sure how to proceed. Doctools only require js-yaml in tools/doc/common.js, but use it in both MD-2-HTML and MD-2-JSON converters.

Can we have cases when we build docs or run doctools tests without ESLint in the tree?

@Trott
Copy link
Member

Trott commented May 13, 2018

Oh...I see. The js-yaml in doc/tools just loads the one from eslint anyway. /ping @addaleax who set it up that way partly (or entirely?) to avoid bloat in the repo.

I don't oppose this change. No objection from me. I do think we shouldn't fast-track it. Let's give @addaleax and anyone else who may have set things up this way a chance to look at it.

@addaleax
Copy link
Member

Hi! 👋 I don’t have any strong feelings over this. It kind of trades one hack for another. :)

I think that ideally, what we’ll have at some point is just a global package.json and node_modules at the top level of our repository, for all npm dependencies that we have somewhere in the source tree. But I’m not sure how everybody else would feel about that. 😄

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 15, 2018
@vsemozhetbyt
Copy link
Contributor Author

Landed in 01e2f48
Thank you for the reviews.

@vsemozhetbyt vsemozhetbyt deleted the tools-js-yaml-direct branch May 16, 2018 15:46
vsemozhetbyt added a commit that referenced this pull request May 16, 2018
PR-URL: #20701
Fixes: #20685
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request May 22, 2018
PR-URL: #20701
Fixes: #20685
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@addaleax addaleax mentioned this pull request May 22, 2018
@Trott Trott mentioned this pull request Feb 12, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants