Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

fix: correctly fetch package version #170

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sumwatshade
Copy link

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 chmod on, 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 '..'

@salesforce-cla
Copy link

salesforce-cla bot commented Nov 7, 2020

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
Copy link

codecov bot commented Nov 7, 2020

Codecov Report

Merging #170 (b8c7b57) into master (44a9a7f) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@          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 data
Powered by Codecov. Last update 44a9a7f...b8c7b57. Read the comment docs.

@salesforce-cla
Copy link

salesforce-cla bot commented Nov 9, 2020

Thanks for the contribution! Before we can merge this, we need @lshadler to sign the Salesforce.com Contributor License Agreement.

src/index.ts Outdated Show resolved Hide resolved
Co-authored-by: RasPhilCo <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants