Giter Club home page Giter Club logo

tiny-package-manager's Introduction

Tiny Package Manager

A very very simple demo and guide for explaining package manager.

Introduction

As a JavaScript developer, you may use package manager like npm or Yarn frequently.

However, do you know how a package manager works? Or, you may be curious about how to build a package manager.

Well, the purpose of this guide is not to let you re-invent a new wheel. There is no need to do that because both npm and Yarn are mature and stable enough. The purpose is just to explain how a package manager works under the hood. You can read the code, and the comments will explain how it works.

Note: To simplify the guide and make it as simple as possible, this demo doesn't handle some edge cases and catch errors and exceptions. If you are really curious about that, it's recommended to read the source code of npm or Yarn.

Features

  • Download packages to node_modules directory.
  • Simple CLI.
  • Simply resolve dependency conflicts.
  • Flatten dependencies tree.
  • Support lock file. (Like yarn.lock or package-lock.json)
  • Add a new package through CLI. (Like yarn add or npm i <package> command)
  • Run lifecycle scripts. (preinstall and postinstall)
  • Symlink the bin files.

How to start?

Read the source code in the src directory. You can read the src/index.ts file in the beginning.

If you would like to try this simple package manager, just install it globally:

Via Yarn:

$ yarn global add tiny-package-manager

Via npm:

$ npm i -g tiny-package-manager

Then just go to a directory which contains valid package.json and run:

$ tiny-pm

License

MIT License (c) 2018-present Pig Fang

tiny-package-manager's People

Contributors

g-plane avatar voskresla avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.