• Stars
    star
    344
  • Rank 123,066 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Learn how npm or Yarn v1 works.

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

More Repositories

1

typed-query-selector

Better typed `querySelector` and `querySelectorAll`.
TypeScript
718
star
2

zsh-yarn-autocompletions

Zsh plugin for Yarn autocompletions.
Rust
578
star
3

type-gymnastics

Collection of wonderful TypeScript type gymnastics code snippets.
TypeScript
362
star
4

rize

High-level, fluent and chainable API provided library for puppeteer.
TypeScript
176
star
5

pnpm-shell-completion

Complete your pnpm command fastly.
Shell
107
star
6

swc-plugin-vue-jsx

SWC plugin for transforming Vue JSX.
Rust
91
star
7

markup_fmt

Configurable HTML, Vue, Svelte, Astro, Angular, Jinja, Twig, Nunjucks and Vento formatter with dprint integration.
Rust
90
star
8

malva

Configurable, smart and fast CSS, SCSS, Sass and Less formatter with dprint integration.
Rust
70
star
9

TypeCake

TypeCake is a language that compiles to TypeScript types. (WIP)
TypeScript
50
star
10

raffia

CSS, Sass, SCSS and Less parser, all in one.
Rust
49
star
11

swc-css-playground

Playground for SWC CSS.
Svelte
29
star
12

icd

Powerful `cd` command with fuzzy-search tool.
Shell
27
star
13

pnpm-docker

Docker images that includes pnpm.
Dockerfile
17
star
14

flac.wasm

Run official FLAC tools `flac` and `metaflac` as WebAssembly, on browsers or Deno.
TypeScript
17
star
15

node-green

Check Node.js ECMAScript compatibility.
TypeScript
17
star
16

swc-playground

Repository has been transferred to swc-project/swc-playground.
TypeScript
16
star
17

pretty_yaml

Semi-tolerant and configurable YAML formatter with dprint integration.
Rust
16
star
18

node-green-cli

CLI for "node-green" module.
TypeScript
12
star
19

swc-plugin-react-remove-properties

SWC plugin for removing React properties.
Rust
12
star
20

pluggable-babel-eslint

Pluggable babel-eslint.
JavaScript
8
star
21

pazza

Parser combinators library which works on browsers, Deno and Node.js.
TypeScript
7
star
22

eslint-playground

Creating an ESLint rule instantly.
TypeScript
7
star
23

dgut-network-login

自动登录 DGUT 的校园网。
JavaScript
5
star
24

matchable

`matchable` provides a convenient enum for checking if a piece of text is matching a string or a regex.
Rust
5
star
25

id3

Library for manipulating ID3 tag.
TypeScript
4
star
26

acorn-typescript

Acorn plugin for parsing TypeScript.
JavaScript
3
star
27

simple-base

A simple base36/base58 converter.
TypeScript
3
star
28

hexo-theme-straight

Clean and simple Hexo theme.
Jinja
3
star
29

pretty_graphql

Configurable GraphQL formatter.
Rust
3
star
30

web-guessing-game

Guess logos of JavaScript/CSS libraries.
Svelte
2
star
31

cue-splitter

Split audio into different tracks with Cue Sheet in comprehensive UI.
TypeScript
2
star
32

eslint-formatter-beauty

Beautiful ESLint formatter.
TypeScript
1
star
33

css_dataset

Collections of CSS dataset about functions, properties, etc.
Rust
1
star
34

bs-plugin-kumiko-stickers

PHP
1
star
35

eslint-config-gplane

Shareable ESLint config for Pig Fang's projects
JavaScript
1
star
36

raffia-playground

AST viewer for Raffia.
TypeScript
1
star
37

rollup-on-deno

Run Rollup on Deno.
TypeScript
1
star
38

tiny_pretty

Tiny implementation of Wadler-style pretty printer.
Rust
1
star
39

blog

1
star
40

vscode-beefweb

Control your foobar2000 or deadbeef via beefweb server.
TypeScript
1
star
41

malva-playground

Format CSS/Sass/SCSS/Less code with Malva on browsers.
Svelte
1
star