Support for a Working NPM Package
See original GitHub issueThe React CoreUI.io project is built as scaffolding to start a new app (not as an importable React component library that you can add to an existing project). There will likely be high-value changes made to the CoreUI project in the future that others want to incorporate (e.g bug fixes and support for Twitter Bootstrap 4 final release), so we don’t want to use CoreUI.io as merely scaffolding, as this will make upgrades fragile and time consuming.
Ideally, we would use CoreUI as any other JavaScript dependency and install it via NPM as this makes upgrades to new versions more straight-forward and predictable. There is an official version of CoreUI deployed to NPM that can be added as a dependency to an existing project, but there are problems with the official NPM package:
- The version deployed to NPM is not current (1.0.0-alpha.6 versus 1.0.3 in Github)
- The project was never created to work as an NPM package (i.e it doesn’t have a
prepublish
lifecycle script defined to compile components).
This rules out using the official NPM package, so we need a way to easily convert the most recent version from Github into a working NPM package that we can add as a dependency to our project. This requires the following steps:
- Checkout the latest CoreUI codebase from Github
- Add a
prepublish
lifecycle script to package.json - Deploy the NPM package to our private NPM repository
- Add this private package as a dependency to our project
- Import all the compiled CSS in our main App.js
- Import components on an as-needed basis
This is not very convenient. Is support for a working NPM package on the horizon? If not, would you consider a pull-request that achieves this?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:16 (1 by maintainers)
Top GitHub Comments
@morloy thanks for clarifying. That is helpful to know the latest version is deployed to NPM, but the core problem remains. The project is still not easily imported as a dependency into an existing project.
@vpn1997 Looks like a big part is working already. At least you got it to compile. I think your styles aren’t loaded.
Probably you’re missing a style tag in your markup.
You should include the styles so it comes along during transpiring with babel. When it enters your build folder you still have to reference it in your markup. Also make sure it resides in a public folder.
Also make sure you have version 2.x.x of the package not the 1.x.x version.
It would be nice if you addressed the community rather than me personally next time 😃