fix: correctly fetch package version
My team has a use case where we are attempting to bundle our Oclif command. This provides us some benefits:
- If there are fewer files that we need to call
chmodon, we can effectively reduce the install time for Homebrew, which needs to make the files executable. - We want to test any performance gains from tree-shaking and minification
We noticed that once we bundled a command, we encountered the error:
Error: Cannot find module '/Users/lshadler/Documents/personal-workspace/dev-cli/lib/package.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at checkNodeVersion (/dev/dev-cli/lib/commands/hello.js:156917:19)
at __commonJS (/dev/dev-cli/lib/commands/hello.js:156927:3)
at /dev/dev-cli/lib/commands/hello.js:11:5
at Object.<anonymous> (/dev/dev-cli/lib/commands/hello.js:156942:28)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
This change adjusts the package resolution to bubble up to the nearest package.json instead of short-circuiting to '..'
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Lucas Shadler <l***@i***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce.com Contributor License Agreement and this Pull Request will be revalidated.
Codecov Report
Merging #170 (b8c7b57) into master (44a9a7f) will not change coverage. The diff coverage is
0.00%.
@@ Coverage Diff @@
## master #170 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 1 1
Lines 10 10
Branches 2 3 +1
======================================
Misses 10 10
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/index.ts | 0.00% <0.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 44a9a7f...b8c7b57. Read the comment docs.
Thanks for the contribution! Before we can merge this, we need @lshadler to sign the Salesforce.com Contributor License Agreement.