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

Should eleventy --version process any files or just output the version to console? #1792

Closed
tannerdolby opened this issue May 24, 2021 · 4 comments
Labels

Comments

@tannerdolby
Copy link
Contributor

Describe the bug
When I run eleventy --version, it seems that my global data file github.js is executing. I guess it is an anonymous async function being exported for use but I didn't expect eleventy --version to process any files.

tannerdolby:11ty-portfolio TannerDolby$ eleventy --version
(node:21199) ExperimentalWarning: The fs.promises API is experimental
Caching: https://api.github.com/repos/tannerdolby/eleventy-photo-gallery
Caching: https://api.github.com/repos/tannerdolby/eleventy-plugin-metagen
Caching: https://api.github.com/repos/tannerdolby/eleventy-plugin-sharp-respimg
Caching: https://api.github.com/repos/tannerdolby/what-to-watch
0.11.1

To Reproduce
Steps to reproduce the behavior:

  1. Check version with eleventy --version
  2. See console output from code being run in a global data file

Expected behavior
I expected eleventy --version to not run any code or process files but simply to log the version number to the console.

Screenshots
Screen Shot 2021-05-24 at 12 01 13 AM

Environment:

  • OS and Version: [MacOS High Sierra v10.13.6]
  • Eleventy Version [v0.11.1]
@pdehaan
Copy link
Contributor

pdehaan commented May 25, 2021

Possibly a dupe of #1313

@tannerdolby
Copy link
Contributor Author

tannerdolby commented May 25, 2021

@pdehaan Yeah it seems like possible dupe where eleventy --version is running a build. I had a look at your comment in that issue and saw:

I wonder if explicitly checking for --version and --help and aborting early would speed things up. .... to see if the expensive part is the elev.init() call on L64 which is possibly unneeded for reporting a version or help string (or maybe not, what do I know)

I think you might be onto something here. It looks like the elev.init() call is whats running a build or processing files (not entirely sure what is being "initialized" but it seems to be the Eleventy instance from new Eleventy()). If we could just log the version or help console output without running elev.init() like you mentioned that should do it, I think.

@zachleat zachleat added bug and removed needs-triage labels Jun 2, 2021
@zachleat
Copy link
Member

Yeah let’s move to #1313 for this one! It’s the same issue I think. Thanks for the report!

zachleat added a commit that referenced this issue Jun 15, 2021
@tannerdolby
Copy link
Contributor Author

Yeah let’s move to #1313 for this one! It’s the same issue I think. Thanks for the report!

Your welcome! It looks like your commit fixes things. Nice work @zachleat !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants