Sorting packages for monorepos production

栏目: IT技术 · 发布时间: 5年前

内容简介:When you have projects depend on each other. You have to build core first, then the project depends on it and so on. You probably want this step to be automated so you can use:This project is licensed under the

Package Sorter

A function used for monorepos production build.

When you have projects depend on each other. You have to build core first, then the project depends on it and so on. You probably want this step to be automated so you can use: package-sorter(unsortedPackages, coreDependency) .

npm install package-sorter

Example:

import packageSorter from "package-sorter";

// packages in your monorepo:

const pkg0 = {
  name: "@folo/withcontext",
  dependencies: {}
};

const pkg1 = {
  name: "@folo/values",
  dependencies: {
    "@folo/withcontext": "^0.1.5"
  }
};

const pkg2 = {
  name: "@folo/utils",
  dependencies: {}
};

const pkg3 = {
  name: "@folo/layout",
  dependencies: {
    "@folo/withcontext": "^0.1.5"
  }
};

const pkg4 = {
  name: "@folo/forms",
  dependencies: {
    "@folo/layout": "^0.1.4",
    "@folo/values": "^0.1.4"
  }
};

const unsortedPackages = [pkg1, pkg2, pkg3, pkg0, pkg4];

// our core dependency in this case is: @folo.
const sorted = sortPackages(unsortedPackages, "@folo");

//=> [pkg2, pkg0, pkg1, pkg4, pkg3]

Tests

npm test

License

This project is licensed under the GPL-3.0 License


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

村落效应

村落效应

[加] 苏珊·平克(Susan Pinker) / 青涂 / 浙江人民出版社 / 2017-3-1 / CNY 69.90

 面对面的接触是作为社会性动物的人类最古老、深刻的需求。在互联网时代,社交媒体已经成为人际沟通的主体,人际关系的维系越来越被社交媒体上的点赞、转发、评论代替,在冰冷的互动中,我们失去了真实与温度。面对面的人际关系与接触能让人感受到如村落生活般的归属感,它是一个人免疫力、复原力和影响力的真正来源。虽然互联网拥有毋庸置疑的优势,但是如果我们渴望快乐、健康、长寿……没错,还有智慧,我们就需要想方设法腾......一起来看看 《村落效应》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具