Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

dist/hdkey.js (Maintainer Update: Critical bug in v0.6.1, now fixed with v0.6.2, please update!) #64

Closed
michaelsbradleyjr opened this issue Jul 29, 2018 · 18 comments

Comments

@michaelsbradleyjr
Copy link
Contributor

michaelsbradleyjr commented Jul 29, 2018

With the new 0.6.1 release, this:

const hdkey = require('ethereumjs-wallet/hdkey');

Must be changed to:

const hdkey = require('ethereumjs-wallet/dist/hdkey');

Maybe that's not what you intended? Even though your pkg.json main points at dist/, a module reference like 'ethereumjs-wallet/hdkey' only works if hdkey.js is at the top-level of the package.

In the published package, you could include an hdkey.js that's a one-liner:

module.exports = require('./dist/hdkey.js');

However, you would need to reorg the sources that get transpiled by babel under src/ and update the build:dist script accordingly.

@michaelsbradleyjr
Copy link
Contributor Author

Here's how to reproduce the problem:

cd $(mktemp -d) \
&& npm init -y \
&& npm i [email protected] \
&& node -e "const hdkey = require('ethereumjs-wallet/hdkey');"

There will be an error reported in the console: Error: Cannot find module 'ethereumjs-wallet/hdkey'.

If 0.6.1 is changed to 0.6.0, or if the module is specified as 'ethereumjs-wallet/dist/hdkey' then it works.

@axic
Copy link
Member

axic commented Jul 31, 2018

@holgerd77 can you have a look at this please?

@nickjuntilla
Copy link

Even if I downgrade my version to 0.6.0 I still get the same error when I try to deploy remotely. I think it has something to do when yarn maybe. I'm also not able to use /dist/hdkey with 0.6.1.

@ianhe8x
Copy link

ianhe8x commented Aug 1, 2018

this is quite annoying, a upgrade of patch version shouldn't break anything which 0.6.1 breaks.

@nickjuntilla
Copy link

Switching the package file from "^0.6.0" to "^0.6.0" without the caret worked for me.

@sohkai
Copy link

sohkai commented Aug 2, 2018

@axic @holgerd77 If a fix will be longer than a few days, it might be better to republish 0.6.0 as 0.6.2. This dependency breaking has been impacting a lot of packages.

@Dancia
Copy link

Dancia commented Aug 6, 2018

It's been not working for a while. Any appropriate fix soon?

@holgerd77
Copy link
Member

Sorry, I'm somewhat on a leave and won't find the time to fix this in the next 1-2 weeks. Can some of you guys submit a PR on this?

@holgerd77
Copy link
Member

(since this has already such a good error description, this should be a comprehensible amount of work to do)

@Mischi
Copy link

Mischi commented Aug 6, 2018

I think there is no easy solution to restore the old import path ('ethereumjs-wallet/hdkey'), now that you transpile the src.

Some projects publish only the contents of their dist directory by copying the package.json into the dist folder and doing an npm publish from within dist. This also has some disadvantages though - e.g. the original source will not be published.

I would suggest we follow @sohkai suggestion and just republish 0.6.0 as 0.6.2 and then republish 0.6.1 as 0.7.0. This at least should give dependent projects the chance to update explicitly.

@holgerd77
Copy link
Member

Just googling on this, it's really impressive that there seems to be no way to set dist/ as the new base/root directory in package.json. Am I right on this or did I miss something? This would be a pretty easy solution.

@holgerd77
Copy link
Member

Seems to be actively discussed, no help here though: nodejs/node#21787

@holgerd77
Copy link
Member

My current impulse is to put the original sources in a folder src/ and then transpile to the root directory and do a PR on this, I think there are not too many paths to be changed in this regard, and then release as v0.6.2.

Anything speaking against this solution?

@holgerd77
Copy link
Member

This should do it, have submitted a PR (see above). Can someone have a thorough look at this (better two opinions!), in my experience stuff like this is always a bit hairier than it appears at first glance.

I made sure that:

  • both src and build tests are working
  • linting is not running over the distribution files
  • distribution files are ignored from git
  • distribution files are included in the package

Nevertheless, a confirm of this would be really helpful.

@holgerd77
Copy link
Member

Ok, I now published this in the release above and tested the new release with the test script from Michael above. This is now working.

Will leave this open for some confirmation that this works and generally some more days for reference.

@holgerd77 holgerd77 changed the title dist/hdkey.js dist/hdkey.js (Maintainer Update: Critical bug in v0.6.1, now fixed with v0.6.2, please update!) Aug 8, 2018
@holgerd77
Copy link
Member

Also deprecated the old v0.6.1 release on npm.

@sohkai
Copy link

sohkai commented Aug 10, 2018

@holgerd77 Can confirm that this works, assuming no lock files have cached the 0.6.1 version.

@holgerd77
Copy link
Member

@sohkai Great, thanks!

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

No branches or pull requests

8 participants