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

fix: Lazily import git-rev-sync in non-production #1972

Merged
merged 1 commit into from
Jul 24, 2020

Conversation

Rob--W
Copy link
Member

@Rob--W Rob--W commented Jul 24, 2020

A simple and effective way to fix #1916.

An equally valid way to fix this issue, without any runtime dependencies, is to inject the version with DefinePlugin in webpack.config.js, but refactoring the code and tests to fix that would take more effort (and ultimately, still need git-rev-sync or a replacement to determine the version), so I opted for the simplest way to fix this.

@coveralls
Copy link

coveralls commented Jul 24, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling 264a328 on Rob--W:issue-1916-git-rev-sync-logspam into fc91c36 on mozilla:master.

@rpl rpl self-requested a review July 24, 2020 15:22
Copy link
Member

@rpl rpl left a comment

Choose a reason for hiding this comment

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

Thanks for taking a look into how to fix this issue, the proposed fix looks reasonable to me but there is an additional small changes that I think we may want to apply in this PR:

I suspected that, with the current version of this PR, webpack is going to bundle git-rev-sync into the generated dist/web-ext.js and I confirmed locally that it is actually the case.

To avoid that we have to change the webpack.config.js file to add "devDependencies" to the excludeFromBundle array.

As an additional side note, I was also surprised that npm ci didn't complain in the travis job because the package-lock.json has not been updated based on the new package.json, but I guess that it may be because by moving the existing dependency from "dependencies" to "devDependencies" does only change some of the deps listed in the package-lock.json to be marked as dev: true, this is the diff that I see locally if I explicitly refresh the package-lock.json:

diff --git a/package-lock.json b/package-lock.json
index e00ec7f..ade9365 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8028,6 +8028,7 @@
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/git-rev-sync/-/git-rev-sync-2.0.0.tgz",
       "integrity": "sha512-vnHFv2eocTmt/wHqZm3ksxtVshK4vptT0cEoumk6hAYRFx3do6Qo7xHBTBCv29+r3ZZCQOQ1i328MUCsYF7AUw==",
+      "dev": true,
       "requires": {
         "escape-string-regexp": "1.0.5",
         "graceful-fs": "4.1.15",
@@ -8037,12 +8038,14 @@
         "graceful-fs": {
           "version": "4.1.15",
           "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
-          "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
+          "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
+          "dev": true
         },
         "shelljs": {
           "version": "0.7.7",
           "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.7.tgz",
           "integrity": "sha1-svXHfvlxSPS09uImguELuoZnz/E=",
+          "dev": true,
           "requires": {
             "glob": "^7.0.0",
             "interpret": "^1.0.0",
@@ -8370,7 +8373,8 @@
     "interpret": {
       "version": "1.2.0",
       "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
-      "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw=="
+      "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==",
+      "dev": true
     },
     "invariant": {
       "version": "2.2.4",
@@ -11096,7 +11100,8 @@
     "path-parse": {
       "version": "1.0.6",
       "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
-      "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
+      "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+      "dev": true
     },
     "path-to-regexp": {
       "version": "1.8.0",
@@ -11583,6 +11588,7 @@
       "version": "0.6.2",
       "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
       "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
+      "dev": true,
       "requires": {
         "resolve": "^1.1.6"
       }
@@ -11861,6 +11867,7 @@
       "version": "1.15.1",
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
       "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
+      "dev": true,
       "requires": {
         "path-parse": "^1.0.6"
       }

We may actually apply this changes in this PR, but I don't think is a big deal even if we don't (at some point renovatebot may likely do it for us when it creates the next PR for a new dependency update).

@Rob--W Rob--W force-pushed the issue-1916-git-rev-sync-logspam branch from 0c79c4b to 086739b Compare July 24, 2020 15:45
@Rob--W Rob--W force-pushed the issue-1916-git-rev-sync-logspam branch from 086739b to 264a328 Compare July 24, 2020 15:59
@rpl rpl merged commit a99313c into mozilla:master Jul 24, 2020
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.

Lots of Node warnings when using web-ext run
3 participants