Skip to main content

extra steps for Lerna Project

remove git from sub package dir: rm -f .git

doesn't work on windows?! use rmdir .git instead?

default CRA creates git tracking

use esbuild to bundle a package into a single js file

"scripts": {
"prepublishOnly": "esbuild src/index.ts --platform=node --outfile=dist/index.js --bundle --minify --define:process.NODE_ENV=\\\"production\\\""

process.NODE_ENV=\\"production\\"" is used to let esbuild replace all instances of process... with "production" string

cmd passed to esbuild

esbuild src/index.ts --platform=node --outfile=dist/index.js --bundle --minify --define:process.env.NODE_ENV=\"production\"

set outfile=dist/index.js to output cli pkg into single index.js via

local-client is served via express static middleware

local-client is not bundled since it is not imported into local-api

cli imports local-api so that will also get bundled

publish with lerna, from root dir: lerna publish --no-push add --no-push flag to tell lerna to not push to any remote git repo (if none set up)

References