Bob (The Bundler)
There's no documentation yet but you can check GraphQL Code Generator repository to see how to use Bob.
Requirements
- Supports only scoped packages (same scope)
- Yarn Workspaces
- TypeScript with Paths
- It's so strict you shouldn't use it!
Configuration
Bob only accepts bob.config.js
in root directory:
module.exports = {
scope: "@graphql-codegen",
ignore: ["@graphql-codegen/website", "@graphql-codegen/live-demo"],
track: [
"bob.config.js",
"jest.config.js",
"jest-project.js",
"package.json",
"tsconfig.json",
"<project>/src/**",
"<project>/jest.config.js",
"<project>/package.json",
"<project>/tsconfig.json",
],
base: "origin/master",
commands: {
test: {
track: ["<project>/tests/**"],
run(affected) {
return [`yarn`, ["test", ...affected.paths]];
},
},
build: {
run() {
return [`yarn`, ["build"]];
},
},
},
};
Build Options
In your <project>/package.json
:
{
"buildOptions": {
"external": ["simple-git/promise"],
"bin": {
"cli": {
"input": "src/cli.ts"
}
}
}
}
Support for Node ES Modules
In your <project>/package.json
, just add "exports"
like this:
{
"main": "dist/index.cjs.js",
"exports": {
"require": "dist/index.cjs.js",
"default": "dist/index.mjs"
}
}
Usage
$ bob affected test
$ bob affected build
$ bob build
$ bob prepack