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.

Add ability to import, install & setup an external library into your project

See original GitHub issue

Background

Adding support for an external library (i.e. @angular/material) into your project can be a difficult task for a few reasons, most notably is the multiple steps to get things configured and setup properly. This could require going back and forth between documentation, blog posts and/or video tutorials.

Desired behavior

Add a command to the Angular CLI which would allow users to add functionality of a library to their project.

ng add [name of library]

An example would be to add support for @angular/material which could handle the following steps automatically:

  • add dependencies (@angular/material, @angular/cdk, @angular/animations)
  • import the necessary and/or most common modules to the root NgModule
    • BrowserAnimationsModule
    • MatButtonModule
  • add a theme
  • add gesture support
  • add material icons

Implementation Considerations

Determination of the library to be added: possibilities considered thus far:

  1. a pre-determined name which can resolve to a library/schematic (i.e. material -> @angular/material)
    • pros: simpler cognitive load on users
    • cons: maintaining a list of libraries is not practical
  2. a schematic path (i.e. `@angular/material:add)
    • pros: very explicit about what will be run
    • cons: could cause confusion and allow running of any schematic
  3. the package name (i.e. @angular/material) map to the schematic could live in the package’s package.json file
    • pros: clearly conveys what logic will be added, gives control/responsibility to the library owner
    • cons: no clear cons at this time

Additional/Future Features

Add an option to ng new to allow adding library support upon project creation ng new foo --add=[name of library]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
FriOnecommented, Feb 17, 2018

It would be great to be able to add libraries interactively. For example, if we ran ng add @angular/material a console start to asking us what we want to include, change, where we should place modifications, etc. It may store answers in variables that is passed then to schematics of a library (material in this case). So, in that way we need tools to make possible easily write own library with set of questions, variables and rules to apply changes that are needed to user.

0reactions
angular-automatic-lock-bot[bot]commented, Jun 26, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing an external library that is required by a contributed ...
Install the external library ... First you need to check if there is a libraries directory in one of three suitable spots. These...
Read more >
Working with External Libraries in Python - Datagy
We can use the pip tool to install external libraries; When using external libraries, we can import the entire library or only some...
Read more >
how to install libraries from zip in Platform IO - YouTube
It's time to move forward and import the external libraries we want ... Method 2:Platform IO Project Configuration File 00:03:48 Method...
Read more >
Adding External Library in Android Studio - YouTube
Explained three ways to add any kind of external library to the Android Studio project.1. Adding Gradle dependency.2. Adding .jar or .aar ...
Read more >
Using external libraries - Creative Coding - Allison Parrish
Locate the correct Javascript download of the library you want to install. · Download the library and make a copy in your sketch...
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