Coder Social home page Coder Social logo

rig's Introduction

rig

Getting started

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.

How it works

package.rig.json5

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.

How rig modifies package.json

//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",
      }
    }

Main Features

  1. Created for modular architecture.
  2. An organizer for multi repos.
  3. You can develop and test your module within your project.Just set dev to true.
  4. Using yarn workspace.
  5. 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

Command

rig init

  1. create a "package.rig.json5" file
  2. insert config to package.json
  3. create "rigs" folder
  4. modify .gitignore

rig install

equals to "yarn install"

rig check

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.

rig tag

Using version in package.json to tag.

rig --env fp_test

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.

TODO

rig install不覆盖rigs下的文件 es5兼容文档 不能删除rigs下的文件

rig's People

Contributors

flashhand avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.