Skip to main content

Configuration

Assuming @baeta/compiler is installed, the configuration is defined in baeta.ts. Otherwise .js, .cjs, .mjs files will be handled accordingly.

First things first, define the schemas and modules directory.

import { defineConfig } from '@baeta/cli';

export default defineConfig({
graphql: {
schemas: ['src/**.gql'],
modulesDir: 'src/modules',
},
});

After defining the schemas and modules directory, define the entry point of your app and the location where the compiler should build.

import { defineConfig } from '@baeta/cli';

export default defineConfig({
graphql: {
schemas: ['src/**.gql'],
modulesDir: 'src/modules',
},
compiler: {
src: 'src/app.ts',
dist: 'dist',
},
});

Finally, add the following scripts to package.json:

"scripts": {
"build": "baeta build --generate",
"generate": "baeta generate",
"start": "baeta build --watch --generate --onSuccess='node --enable-source-maps dist/app.js'"
}

These scripts will build your app and start it. You can modify these scripts based on your requirements.

For more configuration options and defaults, check out the advanced guide.