Skip to content

Version in dist/ (used by bower and npmcdn) is out of date #111

Closed
@joepvl

Description

@joepvl

See title, I ran into this issue when trying to use v0.6.1 on jsbin through npmcdn.

TL;DR it looks like npm run bundle is bundling outdated files in lib/ to umd in dist/ during "preversion"; need to make sure npm run build is run before npm run bundle.


Before I go any further I just want to clarify that technically there's a difference between what's used by bower and npmcdn; bower uses the dist/ dir in the repo, which doesn't need to be there for npmcdn - instead, for npmcdn the files array in package.json can be used without actually including dist/ in the repo (just need to make sure it's there when you npm publish, which you can do using the "prebublish" script). That said, apparently this package still supports bower (at least for now), so it needs dist/ in the repo as well as on npm.

Anway, as far as I can tell this issue happens because the build:umd and build:umd:min commands depend on lib/ containing the right files to build into umd and minify. However, the "preversion" script (used to update dist/ in the repo when running npm version) doesn't include npm run build (which updates lib/ with the commonjs build), and the "prepublish" script doesn't include npm run bundle. So basically dist/ never gets updated unless you run the extra scripts manually 😭 .

One solution would be to change "preversion" to include npm run build before npm run bundle. That way, lib/ will be updated with the commonjs build before building to dist/, and you'll be able to get the latest build from both bower and npmcdn after git push and npm publish respectively.

When the time comes to drop bower support, you'd git rm dist/, add dist/ to .gitignore, add dist/ to the "clean" script, add npm run bundle to the end of "prepublish", and take "preversion" out entirely. That way, the repo will be free from derived code, but dist/ will still be published to npm so people can get react-tabs.min.js etc. from npmcdn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions