Cartable aims to provide you the best DX to develop your node.js applications. It's focused on server-only applications. Heavily inspired by backpack, the idea is a zero-config tool giving you all the tools you need. You can use it for new apps as well as existing ones.
- TypeScript support out of the box
- Fast, using rspack and swc
- Great DX, readable error messages, live reloading etc
- Fast tests with jest and swc
- Zero-config, one dependency
- Easily customizable
Install the package:
# with npm
npm install --save-dev @cartable/core
# with yarn
yarn add --dev @cartable/core
# with pnpm
pnpm add --save-dev @cartable/coreAdd the cartable scripts to your package.json like this:
{
"scripts": {
"dev": "cartable",
"build": "cartable build",
"test": "cartable test"
}
}Run the dev command that will reload your server when you edit:
npm run dev
Successful builds will show a console like this. Note: screenshot taken from running the basic typescript example.
Run the build command and start your app:
npm run build
node ./dist/index.jsRuns your tests using Jest:
npm run testTo extend rspack, you can define a function that extends its config via cartable.config.js.
// cartable.config.js
module.exports = {
rspack: (config) => {
// Perform customizations to config
// Important: return the modified config
return config;
},
};To extend our usage of swc, you can define a .swcrc file at the root of your app. This file is optional.
If found, cartable will consider it to be the source of truth.
Here's an example .swcrc file:
{
"jsc": {
"target": "es2020",
"parser": {
"syntax": "typescript"
}
}
}Runs cartable in development mode. Your code will reload if you make edits.
Builds the app for production to the dist folder.
It correctly bundles your production mode and optimizes the build for the best performance.
You can run your production application with the following command:
node ./dist/index.jsTest the app with jest. For better performance, compiling the JavaScript / TypeScript code is done via swc.
You can pass any option to jest, for example to generate coverage:
cartable test --coverage- jaredpalmer/backpack - First version of Cartable is a modified version of backpack.
- zeit/next.js
- jaredpalmer/tsdx
MIT License © Léo Pradel
