question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for a Working NPM Package

See original GitHub issue

The 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:

  1. The version deployed to NPM is not current (1.0.0-alpha.6 versus 1.0.3 in Github)
  2. 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:

  1. Checkout the latest CoreUI codebase from Github
  2. Add a prepublish lifecycle script to package.json
  3. Deploy the NPM package to our private NPM repository
  4. Add this private package as a dependency to our project
  5. Import all the compiled CSS in our main App.js
  6. 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
marrobinscommented, Oct 25, 2017

@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.

2reactions
webbertakkencommented, May 18, 2018

@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 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contact npm Support
Contact Us. You need to be signed in to get help with npm. Sign in for assistance. Can't sign in, or don't have...
Read more >
Best practices for creating a modern npm package - Snyk
In this tutorial, we're going to walk step by step through creating an npm package using modern best practices (as of 2022).
Read more >
How To Use Node.js Modules with npm and package.json
First, you will create a package.json file to store useful metadata about the project and help you manage the project's dependent Node.js ...
Read more >
Working with the npm registry - GitHub Docs
npmrc file in the project or using the publishConfig option in the package.json. GitHub Packages only supports scoped npm packages. Scoped packages have...
Read more >
Manage npm packages - Visual Studio (Windows)
Add npm support to a project (ASP.NET Core) · If you don't have Node.js installed, we recommend you install the LTS version from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found