Should install yarn first.Rig is using yarn workspace to do hoisting.
1.init rig
npm i -g yarn
yarn global add rigjs
rig init
package.rig.json5 will be added to your project's root.
2.configuring package.rig.json5
//dev is false by default
[
// {
// name: 'r-a',//module's name
// source: '[email protected]:common/r-a.git',//module's source
// version: '1.0.0',//Notice:this used as tag.module's version ,
// },
{
name: 'r-b',
source: '[email protected]:common/r-b.git',
version: '1.0.0',
},
{
name: 'r-c',
source: '[email protected]:common/r-c.git',
version: '1.0.0',
dev: true
}
]
3.run install:
rig install
OR
yarn install
Result:
r-b will be installed in node_modules.
r-c will be cloned to rigs/
"rig install" equals to "yarn install". Because all functions are in preinstall and postinstall.
Rig is inspired by cocoapods. Not like those popular monorepo solutions,rig is a tool for organizing multi repos. So rig create a file named "package.rig.json5". Data in "package.rig.json5" can look like this:
//dev is false by default
//dev 默认为false
[
// {
// name: 'r-a',//module's name
// source: '[email protected]:common/r-a.git',//module's source
// version: '1.0.0',//Notice:this used as tag.module's version ,
// },
{
name: 'r-b',
source: '[email protected]:common/r-b.git',
version: '1.0.0',
},
{
name: 'r-c',
source: '[email protected]:common/r-c.git',
version: '1.0.0',
dev: true
}
]
package.rig.json5 has an array of modules.
So rig create a folder named "rigs".
When dev is true,the module will be cloned in rigs/(using master branch).
And it gets automatically linked in node_modules.
//Rig will insert these to package.json
//Rig won't cover your preinstall or postinstall's settings.Scripts and workspaces will be appended.
let inserted = {
private: true,
workspaces: [
"rigs/*",
"rigs_dev/*"
],
scripts:{
preinstall:"rig preinstall",
postinstall:"rig postinstall",
}
}
- Created for modular architecture.
- An organizer for multi repos.
- You can develop and test your module within your project.Just set dev to true.
- Using yarn workspace.
- Automatically link your developing modules in rigs/.
How to remove your modules
Remove your modules from both package.json and package.rig.json5 then run rig install or yarn install.
//TODO: rig check //if has dev:true then end shell rig tag //using package.json version
- create a "package.rig.json5" file
- insert config to package.json
- create "rigs" folder
- modify .gitignore
equals to "yarn install"
If a module's dev status is true in "package.rig.json5",the config will not be passed!
Make sure you are not using developing modules for production.
Using version in package.json to tag.
This command automatically reads the file named "env.rig.json5" in the root directory, and looks for the environment variable configuration in mode "fp_test", and eventually generates a file for you with a fixed name of ".env.rig". Warning: Like "fp_test" is a mandatory variable.
rig install不覆盖rigs下的文件 es5兼容文档 不能删除rigs下的文件