A repository for trying a JS/TS npm library monorepo setup using pnpm as package manager and parcel as a build tool.
pnpm
& parcel
monorepo testA repository for trying a JS/TS npm library monorepo setup using pnpm
as package manager and parcel
as a build tool.
Development prerequisites:
This is an overview of the most important components of this monorepo's tech stack
ts-jest
-- Unit testing frameworktsc
-- TypeScript type checkingInstall the dependencies:
pnpm install
pnpm i
npm ci
-equivalent: pnpm i --frozen-lockfile
(automatically true in CI environment)You can also run pnpm install
when anything about your dependencies becomes out of date to fix it back up.
Run commands in the package's directory:
pnpm add [-D] @fliegwerk/logsemts
pnpm add [-D] --workspace [package-name]
--workspace
ensures that it is installed from the workspace directory.workspace:^[version]
. I recommend adjusting this to workspace:^
afterwards to make it an easier workflow for updates (this "version specifier" gets replaced automatically with the correct version on publish)In root directory:
pnpm add -D -w @parcel/core
-w
"enables" running this in the workspace root (otherwise forbidden to ensure that you don't accidentally install it in the workspace root)In root directory:
pnpm watch
Install all pacakges in the workspace root (like the development dependencies, but without the -D
argument).
Then, simply run node
in the root directory, and you can require()
all packages.
In root directory:
pnpm test
or
pnpm exec jest
In root directory:
pnpm lint
In root directory:
pnpm prettier:fix
In root directory:
pnpm prettier:check
In root directory:
pnpm build
In root directory:
pnpm docs
This builds a static documentation page to /docs
using fliegdoc
.
After adjusting package versions (TODO: find a way to automate this):
In root directory:
pnpm publish -r
package.json
files get replaced automatically in the published version