Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

288
Visualizações
how do I use npm package or can I just use the code directly

This is a very generic question and I have been wondering this for a while.

I am working on an angular application, and I am using few open source npm packages. One way is to npm install these packages and then use the provided features in that way. But I think ( haven't try ) there is another way which is directly pull the source code from the open source project and then embed the code into my application. It should work. The benefit is that I can easily modify the open source code to fit my needs.

Is that true and feasible?

appreciate your andswer and thanks in advance!

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

There's a few reasons you might not want to take this approach:

  1. LEGAL: Open source code usually has rules about its reuse, stating that you must include a particular license or attribution; grabbing the code without doing your due diligence and making sure you are using it properly could wind you up in some sort of legal hot water.
  2. SECURITY/STABILITY: Open source code is generally being constantly iterated on to provide security patches, bug fixes, and other improvements. Grabbing wholesale chunks of code and hardcoding them into your site fully decouples you from this process.
  3. ORGANIZATION: Leveraging open source code with a package manager like npm gives you insight into all the packages you are using, the specific version you are using, and peer dependencies you might require. Separating yourself from this with hardcoding means much more mystery should things start to go wrong.

While grabbing a small snippet from a library and adjusting it for your needs might be feasible in certain cases that are limited in size and scope, I would not make a habit of doing so. Alternatives would be submitting a PR to the library in question to provide the behavior you require, or forking the library and maintaining a separate version (that way you could pull in upstream changes).

over 4 years ago · Santiago Trujillo Relatório

0

I really recommend using npm install to use it in your angular app. If you want to change the code source of that open source library, I suggest the following :

  1. First fork the library in your github
  2. perform your changes
  3. Publish the forked library as a new npm package
  4. npm install your new forked library

Note : Please be carefull to the liscence of open source project. You should be aware of the LEGAL rights that allow you to do that.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda