Bonnes Pratiques Web & Cloud
58.8K views | +5 today
Follow
Bonnes Pratiques Web & Cloud
Administration cloud et développement web
Curated by Mickael Ruau
Your new post is loading...
Your new post is loading...

Popular Tags

Current selected tag: 'npm'. Clear
Scooped by Mickael Ruau
Scoop.it!

Les paquets npm malveillants font partie d'un "déferlement" de logiciels malveillants qui frappent les référentiels, la popularité des paquets en fait de parfaits vecteurs d'attaques

Les paquets npm malveillants font partie d'un "déferlement" de logiciels malveillants qui frappent les référentiels, la popularité des paquets en fait de parfaits vecteurs d'attaques | Bonnes Pratiques Web & Cloud | Scoop.it
Les paquets npm continuent d'être détournés pour être utilisés comme des vecteurs de logiciels malveillants par les pirates informatiques. Après les paquets "ua-parser-js", "rc" et "coa", la société de sécurité JFrog a découvert 17 nouveaux paquets malveillants dans le dépôt npm (le gestionnaire de paquets Node.js). Ces paquets corrompus cherchent intentionnellement à attaquer et à voler les informations d'identification du site d'un utilisateur. Les chercheurs ont rapporté que la plupart des paquets signalés volaient des informations d'identification ou d'autres informations pour les serveurs Discord.
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Des logiciels malveillants ont été découverts dans le très populaire paquet npm "ua-parser-js", notamment un mineur de cryptomonnaie et un cheval de Troie

Des logiciels malveillants ont été découverts dans le très populaire paquet npm "ua-parser-js", notamment un mineur de cryptomonnaie et un cheval de Troie | Bonnes Pratiques Web & Cloud | Scoop.it
Les paquets npm deviennent de plus en plus des vecteurs de logiciels malveillants. Les développeurs ont récemment découvert que plusieurs versions du paquet npm populaire "ua-parser-js", qui est téléchargé des millions de fois par semaine, contiennent du code malveillant.
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

NPM & left-pad: Have We Forgotten How To Program? - David Haney - Blogging my experiences as a developer and engineering manager.

Intro Okay developers, time to have a serious talk. As you are probably already aware, this week React, Babel, and a bunch of other high-profile packages on NPM broke. The reason they broke is rather astounding:
A simple NPM package called left-pad that was a dependency of their code.
left-pad, at the time of writing this, has 11 stars on GitHub. The entire package is 11 simple lines that implement a basic left-pad string function.
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Deno : le nouveau NodeJS ?

Deno : le nouveau NodeJS ? | Bonnes Pratiques Web & Cloud | Scoop.it
Le 2 juin 2018 le créateur de NodeJS a débarqué avec un maximum de stress sur la scène de la JSConf. Il ne supporte plus NodeJS et commence à parler de Deno.
Mickael Ruau's insight:

NodeJS et ses problèmes

1 : Promesses tuées dans l’oeuf

À la naissance de NodeJS Ryan a introduit les promesses, à la place des callbacks, pour les enlever aussitôt après. Du coup on se retrouve avec des callbacks partout dans l’API de base de NodeJS et ça vieillit mal. Surtout avec toutes les couches d’abstraction qui ont été faites par la suite pour pallier à ça.

2 : Sécurité faible

Même si le moteur Javascript utilisé par NodeJS (V8) est sécurisé, Node en lui même l’est pas. En fait quand tu lances un node tu as automatiquement accès aux fichiers, à des calls systèmes et la possibilité de lancer des scripts. Le runtime utilisé dans NodeJS ne devrait pas avoir des droits pareils sans restrictions.

3 : Le système de build (GYP) à la dérive

GYP est un outil qui va compiler des add-ons écrits en C ou C++ pour qu’ils puissent être utilisés comme n’importe quels add-ons avec un require dans le code. C’est indispensable au bon fonctionnement de NodeJS. Mais GYP c’est l’enfer. C’est tellement l’enfer que Chrome a arrêté de l’utiliser. Node est le seul utilisateur de GYP aujourd’hui.

4 : Le package.json et NPM indispensable

Le fichier package.json est central au fonctionnement de n’importe quelle application Node. Un require a un accès direct au package.json le rendant d’autant plus indispensable. Et en incluant NPM dans l’équation Ryan a rendu ce fichier et NPM encore plus indispensable en réduisant par la même occasion la liberté des développeur(euse)s.

5 : Le système de modules et le fameux dossier node_modules

Et ce fonctionnement via package.json qui va télécharger des modules via le require amène un problème encore plus gros. L’extrême complexité de résolution des modules quand tu tapes npm install. C’est un espèce d’énorme algorithme qui va faire 1 milliards de calls pour te télécharger autant de modules et de dépendances de modules que tu vas stocker dans un dossier sans fond.

 

No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Tutoriel Vidéo NodeJS Yarn, un nouveau gestionnaire de dépendances

Tutoriel Vidéo NodeJS Yarn, un nouveau gestionnaire de dépendances | Bonnes Pratiques Web & Cloud | Scoop.it

Yarn est un nouveau gestionnaire de dépendances pour NodeJS qui propose une approche plus rapide et plus sécurisée que le gestionnaire historique npm.

Mickael Ruau's insight:

Qu'est ce qui ne va pas avec NPM ?

Avant de commencer à parler d'un nouvel outil il est important de comprendre les limitations de ce qui existe déjà.

Des dépendances non figées

Lors d'un npm install —save les dépendances sont récupérées avec un numéro de version "compatible avec". Par exemple un npm install jquery va ajouter la ligne suivante dans le fichier package.json ^3.1.1 qui indique à NPM de télécharger une version de jQuery >= 3.1.1 et < 4.0.0. Ainsi 2 personnes qui initialise le projet à un moment différent peuvent se retrouver avec des versions différentes et avoir des bugs différents malgré un fichier package.json identique.

Une installation lente

L'autre problème de npm est son extrème lenteur. En effet, à chaque nouveau npm install, il va récupérer les dépendances depuis les dépôts puis les dépendances de ces dépendances et ainsi de suite. Cette résolution en cascade peut rapidement prendre pas mal de temps suivant la taille de votre projet.

Yarn

Créé par Facebook yarn propose de régler ces différents problèmes tout en se reposant (pour le moment) sur l'écosystème déjà construit par npm.

No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Bundlephobia | Size of npm dependencies

Bundlephobia | Size of npm dependencies | Bonnes Pratiques Web & Cloud | Scoop.it
Bundlephobia helps you find the performance impact of npm packages. Find the size of any javascript package and its effect on your frontend bundle.
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Package management basics - Learn web development | MDN

Package management basics - Learn web development | MDN | Bonnes Pratiques Web & Cloud | Scoop.it
This brings us to the end of our tour of package managers. Our next move is to build up a sample toolchain, putting all that we've learnt so far into practice.

 

 

In this article we'll look at package managers in some detail to understand how we can use them in our own projects — to install project tool dependencies, keep them up-to-date, and more.

Mickael Ruau's insight:
 

What exactly is a package manager?

We've met npm already, but stepping back from npm itself, a package manager is a system that will manage your project dependencies.

The package manager will provide a method to install new dependencies (also referred to as "packages"), manage where packages are stored on your file system, and offer capabilities for you to publish your own packages.

In theory you may not need a package manager and you could manually download and store your project dependencies, but a package manager will seamlessly handle installing and uninstalling packages. If you didn't use one, you'd have to manually handle:

  • Finding all the correct package JavaScript files.
  • Checking them to make sure they don't have any known vulnerabilities.
  • Downloading them and putting them in the correct locations in your project.
  • Writing the code to include the package(s) in your application (this tends to be done using JavaScript modules, another subject that is worth reading up on and understanding).
  • Doing the same thing for all of the packages' sub-dependencies, of which there could be tens, or hundreds.
  • Removing all the files again if you want to remove the packages.

In addition, package managers handle duplicate dependencies (something that becomes important and common in front-end development).

In the case of npm (and JavaScript- and Node-based package managers) you have two options for where you install your dependencies. As we touched on in the previous article, dependencies can be installed globally or locally to your project. Although there tend to be more pros for installing globally, the pros for installing locally are more important — such as code portability and version locking.

For example, if your project relied on Webpack with a certain configuration, you'd want to ensure that if you installed that project on another machine or returned to it much later on, the configuration would still work. If a different version of Webpack was installed, it may not be compatible. To mitigate this dependencies are installed locally to a project.

To see local dependencies really shine, all you need to do is try to download and run an existing project — if it works and all the dependencies work right out of the box, then you have local dependencies to thank for the fact that the code is portable.

Note: npm is not the only package manager available. A successful and popular alternative package manager is Yarn. Yarn resolves the dependencies using a different algorithm that can mean a faster user experience. There are also a number of other emerging clients, such as pnpm.

Package registries

For a package manager to work, it needs to know where to install packages from, and this comes in the form of a package registry. The registry is a central place that a package is published to and thus can be installed from. npm, as well as being a package manager, is also the name of the most commonly-used package registry for JavaScript packages. The npm registry exists at npmjs.com.

npm is not the only option. You could manage your own package registry — products like Microsoft Azure allow you to create proxies to the npm registry (so you can override or lock certain packages), GitHub also offers a package registry service, and there will be likely more options appearing as time goes on.

What is important is that you ensure you've chosen the best registry for you. Many projects will use npm, and we’ll stick to this in our examples throughout the rest of the module.

Using the package ecosystem

Let’s run through an example to get you started with using a package manager and registry to install a command line utility.

Parcel is a(nother) tool that developers commonly use in their development process. Parcel is clever in that it can watch the contents of our code for calls to dependencies and automatically installs any dependencies it sees that our code needs. It can also automatically build our code.

In our previous chapter we installed Prettier as a global tool. Here however, let’s use npm to install Parcel as a local tool, as best practices dictate. We'll install it as part of an experimental app.

No comment yet.
Scooped by Mickael Ruau
Scoop.it!

voidcosmos/npkill: List any node_modules directories in your system, as well as the space they take up. You can then select which ones you want to erase to free up space.

List any node_modules directories in your system, as well as the space they take up. You can then select which ones you want to erase to free up space. - voidcosmos/npkill
No comment yet.
Scooped by Mickael Ruau
Scoop.it!

Angular 6 tutorial - create your own Angular Bootstrap app, step by step

Angular 6 tutorial - create your own Angular Bootstrap app, step by step | Bonnes Pratiques Web & Cloud | Scoop.it
Learn the most powerful JavaScript framework by creating your own app. We'll guide you step by step from basic to advanced concepts of Angular technology.
Mickael Ruau's insight:

Along this course you will also learn many powerful and useful technologies such as:

Angular 6

The newest Angular 6 including most recent features. Technology used by Google, Wix, weather.com and Forbes.

Angular CLI

Angular Command Line Interface which allows speeds up your development. Creation of projects, classes, services have never been easier.

Typescript

Typescript is a superset of JavaScript which allows you to use extended functionalities which were reserved till now to more advanced languages like Java or C++.

NPM

Within this tutorial you will also learn how to use Node Package Manager to easily install and maintain your project dependencies.

Cross-platform

Regardless whether you are using Windows, macOS or Unix - this tutorial show you how to use Angular on each operating system.

SPA

If you have ever wonder why some websites are blazing fast you should continue reading. This tutorial will guide you how to build Single Page Application, which works without reloading.

RWD

Within this tutorial you will learn about Responsive Web Development - in other words, how to build a website which looks awesome on each device. Regardless whether it's 30-inch monitor or smartphone screen.

MDB

This tutorial will also teach you how to combine 2 powerful tools - Bootstrap and Material Design to achieve an outstanding effect on your website or an application.

No comment yet.