3.0.33 • Published 2 months ago

rigjs v3.0.33

Weekly downloads
2
License
MIT
Repository
github
Last release
2 months ago

rig

中文文档

Get started

0.Prerequisites

Install yarn

yarn global add rigjs

Rigjs use yarn workspaces to achieve module-hoisting. About yarn workspaces.

NodeJS version >= 14

Use n to update NodeJS.

yarn global add n
#upgrade to lts
sudo n lts 
#or specify the version.
sudo n 14.19.1

1.Initialize rigjs configuration。

#in your project's root path(same level with package.json):
rig init

package.rig.json5 will be added in root path.

2.Use rigjs to install existing repos.

2.1 Method-one:rig add

rig add your-git-ssh-url

example:

rig add git@github.com:FlashHand/rig-demo-1.git 0.0.1

import or require the module.

const {hello} = require('rig-demo-1');
hello();

2.2 Method-two:change package.rig.json5

{
  dependencies: {
    'rig-demo-1': {
      source: 'git@github.com:FlashHand/rig-demo-1.git',
      version: '0.0.1',
    }
  }
}

then

yarn install

3.Use rigjs to develop an existing repo.

3.1 Method-one:rig dev

rig dev package's name|git-ssh-url

When package is already in package.rig.json5:

rig dev rig-demo-1

When package is not in package.rig.json5:

rig dev git@github.com:FlashHand/rig-demo-1.git

rig-demo-1 will be installed in rig_dev directory.And a symlink of the module will be created in node_modules.

3.1 Method-two:change package.rig.json5

{
  dependencies: {
    'rig-demo-1': {
      source: 'git@github.com:FlashHand/rig-demo-1.git',
      version: '0.0.1',
      dev: true //false by default
    }
  }
}

then

yarn install

4.Create and develop a new rigjs module。

4.1 Create a git repo。

get git-ssh url: git@github.com:FlashHand/rig-demo-1.git

4.2 Start developing your modules in rigjs dependencies

rig dev git@github.com:FlashHand/rig-demo-1.git

4.3 Initialize your module

cd your_project_path
cd rig_dev/rig-demo-1
yarn init 
echo "module.export={hello:()=>{console.log('hello')}}" > index.js

4.4 Use rigjs modules in your main project。

const {hello} = require('rig-demo-1');
hello();

4.5 Use rigjs module in production。

publish tag

cd rig_dev/rig-demo-1
git add .
git commit -m 'demo for rig'
git tag 0.0.1
git push origin your_branch --tag

Modify package.rig.json5

  • Change the module's version
  • Set dev to false.Don't use dev mode in production and should specify the version you need.
{
  dependencies: {
    'rig-demo-1': {
      source: 'git@github.com:FlashHand/rig-demo-1.git',
      version: '0.0.1',
//      dev:true//Don't use dev mode in production.
    }
  }
}

In Electron Project

In Vite Project

Advantages

  • 💡Rigjs only needs git.No need to publish packages to private registry.
  • ⚡️Instant code sharing between multiple projects and multiple developers.Packages can be easily installed by git-ssh-url and tag.
  • ⚙️Auto npm link in dev mode.Import or require packages just like normal node_modules with friendly code suggestion.
  • 🔍Easily develop packages within your projects.Packages in dev mode are all in rig_dev folder.
  • 💨Easily transform existing code into a sharable package for multiple projects.
  • 📏Large content scale.You can share from a simple js file to multiple files that contains many pages.
  • 🧹Flat dependencies.No need to worry complex packages' relationship.

Goals

Sharing codes or files.

  1. Reuse codes between different developers or different projects in most flexible and unobtrusive way.
  2. Easily turn modules into developing mode,no need to use npm link or change package.json.
  3. Also support sharing files between projects like '.eslintrc.js' or 'tsconfig.json'...
  4. Developing one website in multiple modules.

Serverless CI/CD

  1. Build multiple versions for different environments at same time.
  2. Support deploying and publishing(Only support ali-cloud's oss and cdn by now).

Remote modules' helper(in development)

  • Working with webpack5's module federation.
  • Easily active modules' developing mode.
  • Friendly Code suggestion.
  • Simple router that can brings you everywhere.
  • Sandbox,state sharing....

Current Limits

  • Rigjs packages can share source code directly in node_modules.So transpiling or compiling might be needed.
  • Rigjs can not remove redundant codes for remote modules.
  • Although rigjs supports developing one website in multiple repos, But they all need to be built together into one application package. So it wastes time to build those unchanged modules ,which seems wrong when your website has hundreds or thousands of pages.
  • CI/CD only supports ali-cloud's oss and cdn.I don't have plans to make it better for now.

I'm still developing new features in most flexible and unobtrusive way.So my team won't cost extra time to upgrade their applications' architecture.

Rigjs works great for my team in development of vue-apps,uni-apps,electron apps and nodejs apps.If you don't need many remote modules,it will work fine for you too.

3.0.32

2 months ago

3.0.33

2 months ago

3.0.30

2 months ago

3.0.31

2 months ago

3.0.26

7 months ago

3.0.23

10 months ago

3.0.24

9 months ago

3.0.22

10 months ago

3.0.25

9 months ago

3.0.12

1 year ago

3.0.13

1 year ago

3.0.10

1 year ago

3.0.16

1 year ago

3.0.17

1 year ago

3.0.14

1 year ago

3.0.15

1 year ago

3.0.3

1 year ago

3.0.2

1 year ago

3.0.8

1 year ago

3.0.7

1 year ago

3.0.6

1 year ago

3.0.21

1 year ago

3.0.20

1 year ago

3.0.18

1 year ago

3.0.19

1 year ago

3.0.9

1 year ago

2.1.27

2 years ago

2.1.28

2 years ago

2.1.29

2 years ago

3.0.1

2 years ago

3.0.0-alpha

2 years ago

3.0.1-alpha.2

2 years ago

3.0.1-alpha.1

2 years ago

2.1.16

2 years ago

2.1.17

2 years ago

2.1.15

2 years ago

2.1.12

2 years ago

2.1.13

2 years ago

2.1.11

2 years ago

2.1.18

2 years ago

2.1.19

2 years ago

2.1.25

2 years ago

2.1.26

2 years ago

2.1.23

2 years ago

2.1.24

2 years ago

2.1.21

2 years ago

2.1.22

2 years ago

2.1.20

2 years ago

2.0.0-alpha.7

2 years ago

2.0.0-alpha.8

2 years ago

2.0.0-alpha.9

2 years ago

2.0.3

2 years ago

2.0.0-alpha.11

2 years ago

2.0.0-alpha.3

2 years ago

2.0.2

2 years ago

2.0.0-alpha.10

2 years ago

2.0.0-alpha.4

2 years ago

2.0.5

2 years ago

2.0.0-alpha.5

2 years ago

2.0.4

2 years ago

2.0.0-alpha.6

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.0-alpha.0

2 years ago

2.0.9

2 years ago

2.0.0-alpha.1

2 years ago

2.0.0-alpha.2

2 years ago

2.0.0-alpha.18

2 years ago

2.0.0-alpha.17

2 years ago

2.0.0-alpha.16

2 years ago

2.0.0-alpha.15

2 years ago

2.0.0-alpha.14

2 years ago

2.0.1

2 years ago

2.0.0-alpha.13

2 years ago

2.0.0-alpha.12

2 years ago

2.1.9

2 years ago

2.1.10

2 years ago

2.0.19-alpha.4

2 years ago

2.0.19-alpha.3

2 years ago

2.0.19-alpha.2

2 years ago

2.0.19-alpha.1

2 years ago

2.0.0-alpha

2 years ago

2.1.2

2 years ago

2.0.15

2 years ago

2.1.1

2 years ago

2.0.16

2 years ago

2.1.4

2 years ago

2.0.13

2 years ago

2.1.3

2 years ago

2.1.6

2 years ago

2.0.11

2 years ago

2.1.5

2 years ago

2.0.12

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.0.10

2 years ago

2.1.0

2 years ago

2.0.19

2 years ago

2.0.17

2 years ago

2.0.18

2 years ago

2.0.0-alpha.22

2 years ago

2.0.0-alpha.21

2 years ago

2.0.0-alpha.20

2 years ago

2.0.0-alpha.23

2 years ago

1.0.29

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.34

2 years ago

1.0.28

2 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.6

4 years ago

1.0.12

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.9.30

4 years ago

0.9.31

4 years ago

0.9.32

4 years ago

0.9.33

4 years ago

0.9.29

4 years ago

0.9.28

4 years ago

0.9.27

4 years ago

0.9.25

4 years ago

0.9.23

4 years ago

0.9.24

4 years ago

0.9.21

4 years ago

0.9.22

4 years ago

0.9.20

4 years ago

0.9.17

4 years ago

0.9.16

4 years ago

0.9.15

4 years ago

0.9.14

4 years ago

0.9.12

4 years ago

0.9.11

4 years ago

0.9.9

4 years ago

0.9.10

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago