Monorepo that I use for a bunch of stuff, managed with npm workspaces (requires npm 7.x or later).
📦 ESM only:
All libraries of this monorepo are published to npmjs as ECMAScript modules.
At the moment none of these packages has a CommonJS build.
Clone the repo:
git clone git@github.com:jackdbd/calderone.git
cd calderone
Install all dependencies from npm.js and setup git hooks with husky:
npm install --include dev
Note
The flag --include dev
is just to make sure dev dependencies get installed even if you have set the environment variable NODE_ENV=production
on your machine.
This monorepo uses Typescript project references to build all of its libraries.
Documentation is built by TypeDoc.
API docs are built by api-extractor + api-documenter.
Build all libraries and their documentation (code to <package-root>/lib
, TypeDoc docs to <monorepo-root>/docs
, api-documenter API docs to <package-root>/api-docs
):
npm run build
Build all libraries, but with no docs (much faster, since building docs takes some time):
npm run build:libs
Build all development scripts in watch mode and all libraries in watch mode (useful for developing new scripts in TypeScript):
npm dev:scripts
Build all applications:
npm run build -w packages/telegram-bot
npm run build -w packages/wasm-news
npm run build -w packages/webhooks
Run all tests on all packages:
npm run test
The documentation for all libraries in this monorepo is built by TypeDoc.
API docs are built by api-extractor + api-documenter.
Whenever there are changes to a library, rebuild its documentation to see if the public API was changed.
For example, let's say that we made some changes to the checks package.
First, rebuild the library and its documentation:
npm run build -w packages/checks
⚠️ Warning:If you changed the public API of the library (e.g. the doctring of the
isEuropeanVat()
function no longer declares the function as@public
, but now declares it as@internal
) API Extractor will print a warning and the build script will fail. Follow the instructions API Extractor gives you and re-run the build script, which this time should pass.
Second, spin up a dev server and double-check the documentation generated for the library:
npx http-server --port 8080 -o docs/checks
Note: if the documentation was generated but you don't see it in the browser, open DevTools and click on Empty Cache and Hard Reload
.
Third, commit the changes, either with a single commit:
git add packages/checks
git add docs/checks
git commit -m 'feat(checks): add function foo()'
or with 2 commits:
# source code
git add packages/checks/src
git commit -m 'feat(checks): add function foo()'
# docs
git add packages/checks/.ae
git add packages/checks/api-docs
git add docs/checks
git commit -m 'docs(checks): rebuild docs'
Keep the npm packages up to date using taze:
npx taze
See also:
- @jackdbd/send-telegram-message: application that sends a message to a Telegram chat.
- @jackdbd/telegram-bot: Telegram bot that I use for several things.
- @jackdbd/wasm-news: application that retrieves news about webassembly from several APIs (Reddit, Twitter, etc) and populates this Google Sheets worksheet.
- @jackdbd/webhooks: application that receives webhook events from several third parties and handles them.