zikkurat v0.3.8
You own package manager
Install
npm install zikkurat -g #as admin
#You need to specify the path to an empty folder that you will use as a package store
zikkurat configure <packages>
What is Zikkurat?
Zikkurat is a local package manager that will help you begin projects faster. You can create packages from the code you used earlier and quickly connect them to your projects.
Note! Zikkurat is still in development, but you can already use it. In the near future, all the features of modern package managers will be added to it
Powered by listr
All graphic effects are drawn by listr:
Usage
Creating package
In the folder with zikkurat packages create a new folder and run zikkurat init
mkdir bootstrap
cd bootstrap
zikkurat init
Zikkurat will generate a file in this directory with the following contents:
{
"name":"bootsrap",
"version":"0.0.1",
"dependencies":[]
}
Note! The package name must match the folder name!
Next, add the files to be copied during the installation package. In our case these are bootstrap files:
packages
├── bootstrap
│ ├── css
│ │ ├── bootstrap.css
│ │ └── bootstrap.min.css
│ ├── js
│ │ ├── bootstrap.js
│ │ └── bootstrap.min.js
│ └── zikkurat.json
└── lockfile.json
Note! Files will be copied relative to the root of the target directory. You must resolve the conflicts between the packages that will be installed in one directory!
Updating lockfile
Lockfile is a special file in the root of the package directory, which tells the zikkurat which files to copy and delete when installing (removing) the package. You do not need to update it manually, you just have to do zikkurat update
after changing the packages.
Installing package
When our package is ready and the lockfile is generated, we can install our package in the directory of our new project.
mkdir NewBootstrapProject
cd NewBootstrapProject
zikkurat install bootstrap
And we get the following:
NewBootstrapProject
├── css
│ ├── bootstrap.css
│ └── bootstrap.min.css
└── js
├── bootstrap.js
└── bootstrap.min.js
When we decide that we no longer need the bootstrap, we can remove it:
zikkurat remove bootstrap
Dependencies
{
"name":"html",
"version":"0.0.1",
"dependencies":["bootstrap"]
}
Note! When you remove a package, all its dependencies will also be removed!
Programmatic usage
Zikkurat uses promises instead of callbacks, because it allows you to build a chain of calls and get rid of the third argument(callback).
const Zikkurat = require("zikkurat");
//Creating zikkurat instance with path to packages directory
let zikkurat = new Zikkurat("./packages");
//Install package
zikkurat.install("./", "bootstrap").then(err => {
if (!err) {
//do something
}
});
//Api
Promise zikkurat.install(context, package);
Promise zikkurat.remove(context, package);
Promise zikkurat.update();
Promise zikkurat.init(context);
Promise zikkurat.configure(folder);
For example, a test for travis:
zikkurat.configure("./test/packages")
.then(err => zikkurat.init("./test/packages/bootstrap"))
.then(err => zikkurat.update())
.then(err => zikkurat.install("./test/dist", "bootstrap"))
.then(err => zikkurat.remove("./test/dist", "bootstrap"));