Servant"> Servant builder API
What is it?
Servant builder is simple build runner that can provide simple building modularized large projects. With Servant you have control for used libraries, building, publishing. You can control version, manage and keep single version of libraries across your modules. Servant is able to build single module and replace local dependencies for global. Servant is tool that's try to teach the best way of multi modules large project can be maintained. It's try to be simple but powerful tool and good servant :wink:
- less (
*.less): You can use less in your module. Servant automatically build it and add to folder for distribution. Servant also make automatically conversion from .less to .d.ts typescript definition for usage in your project.
- css (
*.css): You can use css in your module. Servant automatically build it and add to folder for distribution. Servant also make automatically conversion from .css to .d.ts typescript definition for usage in your project.
- typescript (
*.tsx): Servant is primary use for Typescript and in current version it's only supported language. Use .ts files and Servant do the rest.
Servant used these technologies for building and creating the best developer experience for developing in supported technologies.
- webpack: Webpack is used for building and bundling. Servant automatically generate config file for webpack so is not necessary to do something.
- typed-css-modules: Module for building
*.d.tsdefinitions from less or css files.
Installation and start!
You need latest version of nodejs and then run
npm install @servant/servant-cli
This install cli with servant api. Now you can use it with calling command in current directory:
You can use
npm install @servant/servant-cli -gcommand to install Servant globally. Now you can use simple
servant cleancommand instead presented. But installing globally is not recommended. You can can read about caveats when running servant from different script here.
Servant will be complaining about missing
servant.json. We will create it.
Servant has special flag to init main project or submodule. We will create main project now with using
--init flag and answer all questions that servant give us.
In next chapter there is described project structure and properties and structure of
You can use playground that is used for trying Servant in real project. Servant playground has it's own repo and can be accessed on link https://gitlab.com/stanislavhacker/servant-playground. More info is inside this repo!
Servant project structure
If you want to use Servant, you must create the right folder structure for right behaviour. Servant needs it and for working with it. This is the best approach to your project and for Servant of course.
. ├── module.one # Example module (folder) │ ├── package.json # Package json for module one │ ├── servant.json # Servant config file for module one │ └── (tsconfig.json) # OPTIONAL: Typescript config for module one ├── ... ├── module.two # Example module (folder) │ ├── package.json # Package json for module two │ ├── servant.json # Servant config file for module two │ └── (tsconfig.json) # OPTIONAL: Typescript config for module two ├── ... ├── package.json # Required file for dependencies resolving ├── (tsconfig.json) # OPTIONAL: Only use it if you want to do typescript module └── servant.json # Main config file of servant
Main configuration file for Servant. It's described in separate section "Config 'servant.json'".
Servant NodeJs api
Servant can also be used from node js process. For this there is available simple Servant api that can provide all necessary information and can be used inside your integration module or another runtime. It's described in separate section "Servant NodeJs api".
Servant command line api
Servant is primary used for calling from command line. Can be used many ways with lot's of predefined commands and options. It's designed for fast creating and managing large projects composed from independent modules. Command line api is described in separate section "Servant command line api".
Donate me 😉