- Init a Javascript/typescript/nodejs monorepo
npm install -g json
yarn config set workspaces-experimental true
mkdir -p monorepo/packages && cd monorepo && yarn init -y
# Config package.json
# root of monorepo is not meant to be publish
json -I -f package.json -e 'this.private=true'
json -I -f package.json -e 'this.version=undefined'
json -I -f package.json -e 'this.scripts={"lerna": "lerna"}'
json -I -f package.json -e 'this.scripts={"clean": "lerna run clean --stream --parallel"}'
json -I -f package.json -e 'this.scripts={"build": "lerna run build --stream --parallel"}'
json -I -f package.json -e 'this.scripts={"lint": "lerna run lint --stream --parallel"}'
json -I -f package.json -e 'this.scripts={"test": "lerna run test --stream --parallel"}'
# set workspaces directory
json -I -f package.json -e 'this.workspaces=["packages/*"]'
yarn add lerna -D -W
# config lerna.json
echo "{}" >> lerna.json
json -I -f lerna.json -e 'this.packages=["packages/*"]'
json -I -f lerna.json -e 'this.version="independant"'
json -I -f lerna.json -e 'this.npmClient="yarn"'
json -I -f lerna.json -e 'this.useWorkspaces=true'