defineConfig
プロジェクト全体の設定を定義する関数です。
CLIはこの関数の戻り値からプロジェクト全体の設定内容を読み込みます。basemachina.config.tsで使用し、default exportします。
使用例
import { defineConfig } from "@basemachina/sdk/oac";
import { getUsers } from "./src/actions/get-users";
import { listUsers } from "./src/actions/list-users";
export default defineConfig({
project: {
id: "your-project-id",
},
actions: [getUsers, listUsers],
});開発環境にのみ反映したいアクションはdevelopmentActionsに指定します。
import { defineConfig } from "@basemachina/sdk/oac";
import { getUsers } from "./src/actions/get-users";
import { listUsers } from "./src/actions/list-users";
import { experimentalAction } from "./src/actions/experimental-action";
export default defineConfig({
project: {
id: "your-project-id",
},
actions: [getUsers, listUsers],
developmentActions: [experimentalAction],
});プロパティ
| プロパティ | 型 | 必須 | 説明 |
|---|---|---|---|
project.id | string | はい | プロジェクトのID |
actions | ActionConfig[] | はい | アクション定義(defineActionの戻り値)の配列 |
developmentActions | ActionConfig[] | いいえ | 開発環境にのみ反映するアクション定義の配列。bm syncでの開発環境への反映時にはactionsと同様に反映されますが、bm sync <環境ID>での他環境への同期では対象外になります |
actionsとdevelopmentActionsに同じ識別子(id)を持つアクションを指定するとバリデーションエラーになります。同じアクションを両方に書くことはできません。