0.0.3 • Published 3 years ago

all-build v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

All-Build

This script helps you build all related projects when you have package depending on other local packages.

{
  "name": "abc-project",
  "dependencies": {
    "bcd-project": "file:../bcd-project",
    "cde-project": "file:../cde-project"
  }
}

For the above package.json, all three projects abc-project, bcd-project and cde-project will be built by using the following command at abc-project.

npx all-build

And they will be built in order according to the dependency tree. So, bcd-project and cde-project will be built first; and abc-project, last.

If bcd-project or cde-project as well depends on other local packages, those local packages will be built as well. Eventually, the whole tree of dependency will be built automatically.

Command

By default, typescript compilation npx --yes tsc is used for every project. But you can use whatever command as long as the first argument is provided.

For example, npm run build can be used to run the build script in every package.json.

npx all-build "npm run build"

For another example, npm i can be also used to install all projects the first time after pulling your projects.

npx all-build "npm i"

Exports

If the basic function does not fulfill your need, you can import this npm package and use the following exported functions directly.

functiondescription
readProjectread name and dependencies from the package.json of a project
readProjectsread package.json of project and all the depending local projects
getLayersgroup projects into layers according to the dependency tree
executeexecute a command and throw error if the command does not end properly
buildthe core function of this package
0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago