@gasboost/cli 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,30 @@ Gasboost エコシステム共通の開発CLIです。
6
6
  pnpm add -D @gasboost/cli
7
7
  ```
8
8
 
9
+ ## Project Console
10
+
11
+ プロジェクトの `package.json` に Console script を追加します。
12
+
13
+ ```json
14
+ {
15
+ "scripts": {
16
+ "console": "gasboost console open"
17
+ }
18
+ }
19
+ ```
20
+
21
+ 次のコマンドでローカルConsoleを開きます。
22
+
23
+ ```bash
24
+ pnpm console
25
+ ```
26
+
27
+ 自動でBrowserを開かずに起動する場合は `gasboost console open --no-browser` を使用できます。
28
+
29
+ ConsoleのBrowser UIから実行できるのは、登録済みoperationと各operationのschemaを満たすstructured inputだけです。
30
+
31
+ `appsScript` capabilityを設定したプロジェクトでは、Google認証、Apps Script project作成、editor表示、local filesのpushをConsoleから実行できます。
32
+
9
33
  ## RTDB Security Rules
10
34
 
11
35
  `@gasboost/realtime-firebase` で定義した Firebase Realtime Database の Security Rules を生成できます。
@@ -18,13 +42,18 @@ pnpm add -D @gasboost/cli
18
42
  import { defineGasboostConfig } from "@gasboost/cli";
19
43
 
20
44
  export default defineGasboostConfig({
21
- rtdb: {
22
- source: "./src/backend/lib/rtdb.ts",
23
- out: "./database.rules.json",
45
+ firebase: {
46
+ realtimeDatabase: {
47
+ source: "./src/backend/lib/rtdb.ts",
48
+ out: "./database.rules.json",
49
+ },
24
50
  },
25
51
  });
26
52
  ```
27
53
 
54
+ 従来の `rtdb: { source, out }` 形式も互換性のため読み込めますが、
55
+ 新しい設定では `firebase.realtimeDatabase` を使用してください。
56
+
28
57
  ### RTDB definition
29
58
 
30
59
  `source` で指定した module は `rtdb` を named export します。
@@ -50,6 +79,7 @@ CLI はこの module を実行し、export された `rtdb` の `rules()` を呼
50
79
  ### Generate
51
80
 
52
81
  ```bash
82
+ gasboost console open [--no-browser]
53
83
  gasboost rtdb rules
54
84
  ```
55
85
 
@@ -104,10 +134,10 @@ Gasboost CLI を利用するためだけに import path を書き換える必要
104
134
  gasboost.config.ts
105
135
 
106
136
 
107
- GasboostConfigLoader
137
+ @gasboost/config
108
138
 
109
139
 
110
- ModuleLoader
140
+ loadGasboostConfig
111
141
  jiti
112
142
 
113
143
 
package/dist/bin.js CHANGED
@@ -1,23 +1,22 @@
1
1
  #!/usr/bin/env node
2
+ import { loadGasboostConfig, ModuleLoader } from "@gasboost/config";
2
3
  import { Cli } from "./cli/Cli.js";
3
4
  import { CommandRouter } from "./cli/CommandRouter.js";
4
- import { GasboostConfigLoader } from "./config/GasboostConfigLoader.js";
5
- import { ModuleLoader } from "./module/ModuleLoader.js";
5
+ import { ConsoleOpenCommand } from "./console/ConsoleOpenCommand.js";
6
6
  import { RtdbRulesCommand } from "./rtdb/RtdbRulesCommand.js";
7
7
  import { RtdbRulesWriter } from "./rtdb/RtdbRulesWriter.js";
8
8
  const projectRoot = process.cwd();
9
9
  const moduleLoader = new ModuleLoader(projectRoot);
10
- const configLoader = new GasboostConfigLoader({
11
- projectRoot,
12
- moduleLoader,
13
- });
14
10
  const writer = new RtdbRulesWriter(projectRoot);
15
11
  const rtdbRulesCommand = new RtdbRulesCommand({
16
- configLoader,
12
+ loadConfig: () => loadGasboostConfig({ projectRoot }),
17
13
  moduleLoader,
18
14
  writer,
19
15
  });
20
- const commandRouter = new CommandRouter(rtdbRulesCommand);
16
+ const commandRouter = new CommandRouter({
17
+ consoleOpenCommand: new ConsoleOpenCommand(projectRoot),
18
+ rtdbRulesCommand,
19
+ });
21
20
  const cli = new Cli(commandRouter);
22
21
  process.exitCode = await cli.run(process.argv.slice(2));
23
22
  //# sourceMappingURL=bin.js.map
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc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eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAElC,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,WAAW,CAAC,CAAC;AAEnD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;AAEhD,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC;IAC5C,UAAU,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;IACrD,YAAY;IACZ,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;IACtC,kBAAkB,EAAE,IAAI,kBAAkB,CAAC,WAAW,CAAC;IACvD,gBAAgB;CACjB,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;AAEnC,OAAO,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,7 +1,12 @@
1
+ import type { ConsoleOpenCommand } from "../console/ConsoleOpenCommand.js";
1
2
  import type { RtdbRulesCommand } from "../rtdb/RtdbRulesCommand.js";
2
3
  export declare class CommandRouter {
4
+ private readonly consoleOpenCommand;
3
5
  private readonly rtdbRulesCommand;
4
- constructor(rtdbRulesCommand: RtdbRulesCommand);
6
+ constructor({ consoleOpenCommand, rtdbRulesCommand, }: {
7
+ consoleOpenCommand: ConsoleOpenCommand;
8
+ rtdbRulesCommand: RtdbRulesCommand;
9
+ });
5
10
  route(args: readonly string[]): Promise<void>;
6
11
  }
7
12
  //# sourceMappingURL=CommandRouter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandRouter.d.ts","sourceRoot":"","sources":["../../src/cli/CommandRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IAEpD,YAAmB,gBAAgB,EAAE,gBAAgB,EAEpD;IAEY,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBzD;CACF"}
1
+ {"version":3,"file":"CommandRouter.d.ts","sourceRoot":"","sources":["../../src/cli/CommandRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IAExD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IAEpD,YAAmB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,EAAE;QACD,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,gBAAgB,EAAE,gBAAgB,CAAC;KACpC,EAGA;IAEY,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCzD;CACF"}
@@ -1,11 +1,26 @@
1
1
  export class CommandRouter {
2
+ consoleOpenCommand;
2
3
  rtdbRulesCommand;
3
- constructor(rtdbRulesCommand) {
4
+ constructor({ consoleOpenCommand, rtdbRulesCommand, }) {
5
+ this.consoleOpenCommand = consoleOpenCommand;
4
6
  this.rtdbRulesCommand = rtdbRulesCommand;
5
7
  }
6
8
  async route(args) {
7
9
  if (args.length === 0 || args[0] === "--help" || args[0] === "-h") {
8
- console.log(["Usage:", " gasboost rtdb rules"].join("\n"));
10
+ console.log([
11
+ "Usage:",
12
+ " gasboost console open [--no-browser]",
13
+ " gasboost rtdb rules",
14
+ ].join("\n"));
15
+ return;
16
+ }
17
+ if (args[0] === "console" &&
18
+ args[1] === "open" &&
19
+ (args.length === 2 || (args.length === 3 && args[2] === "--no-browser"))) {
20
+ const url = await this.consoleOpenCommand.execute({
21
+ openBrowser: args[2] !== "--no-browser",
22
+ });
23
+ console.log(`Gasboost Console opened: ${url}`);
9
24
  return;
10
25
  }
11
26
  if (args[0] === "rtdb" && args[1] === "rules" && args.length === 2) {
@@ -1 +1 @@
1
- {"version":3,"file":"CommandRouter.js","sourceRoot":"","sources":["../../src/cli/CommandRouter.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IACP,gBAAgB,CAAmB;IAEpD,YAAmB,gBAAkC;QACnD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAAuB;QACxC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAE5D,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAEzD,OAAO,CAAC,GAAG,CAAC,2CAA2C,UAAU,EAAE,CAAC,CAAC;YAErE,OAAO;QACT,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;CACF"}
1
+ {"version":3,"file":"CommandRouter.js","sourceRoot":"","sources":["../../src/cli/CommandRouter.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAa;I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C,UAAU,EAAE,CAAC,CAAC;YAErE,OAAO;QACT,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ export declare class ConsoleOpenCommand {
2
+ private readonly projectRoot;
3
+ constructor(projectRoot: string);
4
+ execute({ openBrowser, }: {
5
+ readonly openBrowser: boolean;
6
+ }): Promise<string>;
7
+ }
8
+ //# sourceMappingURL=ConsoleOpenCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleOpenCommand.d.ts","sourceRoot":"","sources":["../../src/console/ConsoleOpenCommand.ts"],"names":[],"mappings":"AAEA,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC,YAAmB,WAAW,EAAE,MAAM,EAErC;IAEY,OAAO,CAAC,EACnB,WAAW,GACZ,EAAE;QACD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;KAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,CAOlB;CACF"}
@@ -0,0 +1,15 @@
1
+ import { startGasboostConsole } from "@gasboost/console";
2
+ export class ConsoleOpenCommand {
3
+ projectRoot;
4
+ constructor(projectRoot) {
5
+ this.projectRoot = projectRoot;
6
+ }
7
+ async execute({ openBrowser, }) {
8
+ const runtime = await startGasboostConsole({
9
+ projectRoot: this.projectRoot,
10
+ openBrowser,
11
+ });
12
+ return runtime.url;
13
+ }
14
+ }
15
+ //# sourceMappingURL=ConsoleOpenCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleOpenCommand.js","sourceRoot":"","sources":["../../src/console/ConsoleOpenCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,OAAO,kBAAkB;IACZ,WAAW,CAAS;IAErC,YAAmB,WAAmB;QACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,EACnB,WAAW,GAGZ;QACC,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC;YACzC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW;SACZ,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,GAAG,CAAC;IACrB,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { defineGasboostConfig, type GasboostConfig, type GasboostRtdbConfig, } from "./config/GasboostConfig.js";
1
+ export { defineGasboostConfig, type GasboostConfig, type GasboostRtdbConfig, } from "@gasboost/config";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,GACxB,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,GACxB,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { defineGasboostConfig, } from "./config/GasboostConfig.js";
1
+ export { defineGasboostConfig, } from "@gasboost/config";
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAGrB,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAGrB,MAAM,kBAAkB,CAAC"}
@@ -1,12 +1,11 @@
1
- import type { GasboostConfigLoader } from "../config/GasboostConfigLoader.js";
2
- import type { ModuleLoader } from "../module/ModuleLoader.js";
1
+ import type { ModuleLoader, NormalizedGasboostConfig } from "@gasboost/config";
3
2
  import type { RtdbRulesWriter } from "./RtdbRulesWriter.js";
4
3
  export declare class RtdbRulesCommand {
5
- private readonly configLoader;
4
+ private readonly loadConfig;
6
5
  private readonly moduleLoader;
7
6
  private readonly writer;
8
- constructor({ configLoader, moduleLoader, writer, }: {
9
- configLoader: GasboostConfigLoader;
7
+ constructor({ loadConfig, moduleLoader, writer, }: {
8
+ loadConfig: () => Promise<NormalizedGasboostConfig>;
10
9
  moduleLoader: ModuleLoader;
11
10
  writer: RtdbRulesWriter;
12
11
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RtdbRulesCommand.d.ts","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAU5D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuB;IAEpD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAE5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC,YAAmB,EACjB,YAAY,EACZ,YAAY,EACZ,MAAM,GACP,EAAE;QACD,YAAY,EAAE,oBAAoB,CAAC;QACnC,YAAY,EAAE,YAAY,CAAC;QAC3B,MAAM,EAAE,eAAe,CAAC;KACzB,EAIA;IAEY,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAwCtC;CACF"}
1
+ {"version":3,"file":"RtdbRulesCommand.d.ts","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAU5D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IAErE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAE5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC,YAAmB,EACjB,UAAU,EACV,YAAY,EACZ,MAAM,GACP,EAAE;QACD,UAAU,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAC;QACpD,YAAY,EAAE,YAAY,CAAC;QAC3B,MAAM,EAAE,eAAe,CAAC;KACzB,EAIA;IAEY,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAyCtC;CACF"}
@@ -1,34 +1,35 @@
1
1
  export class RtdbRulesCommand {
2
- configLoader;
2
+ loadConfig;
3
3
  moduleLoader;
4
4
  writer;
5
- constructor({ configLoader, moduleLoader, writer, }) {
6
- this.configLoader = configLoader;
5
+ constructor({ loadConfig, moduleLoader, writer, }) {
6
+ this.loadConfig = loadConfig;
7
7
  this.moduleLoader = moduleLoader;
8
8
  this.writer = writer;
9
9
  }
10
10
  async execute() {
11
- const config = await this.configLoader.load();
12
- if (config.rtdb === undefined) {
11
+ const config = await this.loadConfig();
12
+ const rtdb = config.firebase?.realtimeDatabase;
13
+ if (rtdb === undefined) {
13
14
  throw new Error("RTDB configuration was not found in gasboost.config.ts.");
14
15
  }
15
- if (config.rtdb.source.length === 0) {
16
- throw new Error("rtdb.source must not be empty.");
16
+ if (rtdb.source.length === 0) {
17
+ throw new Error("firebase.realtimeDatabase.source must not be empty.");
17
18
  }
18
- if (config.rtdb.out.length === 0) {
19
- throw new Error("rtdb.out must not be empty.");
19
+ if (rtdb.out.length === 0) {
20
+ throw new Error("firebase.realtimeDatabase.out must not be empty.");
20
21
  }
21
- const source = await this.moduleLoader.import(config.rtdb.source);
22
+ const source = await this.moduleLoader.import(rtdb.source);
22
23
  if (typeof source.rtdb !== "object" ||
23
24
  source.rtdb === null ||
24
25
  !("rules" in source.rtdb) ||
25
26
  typeof source.rtdb.rules !== "function") {
26
- throw new Error(`RTDB source '${config.rtdb.source}' must export 'rtdb' with a rules() method.`);
27
+ throw new Error(`RTDB source '${rtdb.source}' must export 'rtdb' with a rules() method.`);
27
28
  }
28
- const rtdb = source.rtdb;
29
- const rules = rtdb.rules();
29
+ const definition = source.rtdb;
30
+ const rules = definition.rules();
30
31
  return this.writer.write({
31
- out: config.rtdb.out,
32
+ out: rtdb.out,
32
33
  rules,
33
34
  });
34
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RtdbRulesCommand.js","sourceRoot":"","sources":["../../src/rtdb/RtdbRulesCommand.ts"],"names":[],"mappings":"AAaA,MAAM,OAAO,gBAAgB;IACV,YAAY,CAAuB;IAEnC,YAAY,CAAe;IAE3B,MAAM,CAAkB;IAEzC,YAAmB,EACjB,YAAY,EACZ,YAAY,EACZ,MAAM,GAKP;QACC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAE9C,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACj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B,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;QACJ,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QAED,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAC3C,IAAI,CAAC,MAAM,CACZ,CAAC;QAEF,IACE,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ;YAC/B,MAAM,CAAC,IAAI,KAAK,IAAI;YACpB,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC;YACzB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,UAAU,EACvC,CAAC;YACD,MAAM,IAAI,KAAK,CACb,gBAAgB,IAAI,CAAC,MAAM,6CAA6C,CACzE,CAAC;QACJ,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,CAAC,IAAsB,CAAC;QAEjD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;QAEjC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACvB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gasboost/cli",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Developer tooling for the Gasboost ecosystem",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,8 @@
20
20
  "node": ">=24"
21
21
  },
22
22
  "dependencies": {
23
- "jiti": "^2.7.0"
23
+ "@gasboost/config": "0.1.1",
24
+ "@gasboost/console": "0.2.0"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@gasboost/realtime-firebase": "^0.1.0",
@@ -1,9 +0,0 @@
1
- export type GasboostRtdbConfig = {
2
- readonly source: string;
3
- readonly out: string;
4
- };
5
- export type GasboostConfig = {
6
- readonly rtdb?: GasboostRtdbConfig;
7
- };
8
- export declare function defineGasboostConfig(config: GasboostConfig): GasboostConfig;
9
- //# sourceMappingURL=GasboostConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GasboostConfig.d.ts","sourceRoot":"","sources":["../../src/config/GasboostConfig.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC;CACpC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAE3E"}
@@ -1,4 +0,0 @@
1
- export function defineGasboostConfig(config) {
2
- return config;
3
- }
4
- //# sourceMappingURL=GasboostConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GasboostConfig.js","sourceRoot":"","sources":["../../src/config/GasboostConfig.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACzD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { ModuleLoader } from "../module/ModuleLoader.js";
2
- import type { GasboostConfig } from "./GasboostConfig.js";
3
- export declare class GasboostConfigLoader {
4
- private readonly projectRoot;
5
- private readonly moduleLoader;
6
- constructor({ projectRoot, moduleLoader, }: {
7
- projectRoot: string;
8
- moduleLoader: ModuleLoader;
9
- });
10
- load(): Promise<GasboostConfig>;
11
- }
12
- //# sourceMappingURL=GasboostConfigLoader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GasboostConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/GasboostConfigLoader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAE5C,YAAmB,EACjB,WAAW,EACX,YAAY,GACb,EAAE;QACD,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,YAAY,CAAC;KAC5B,EAGA;IAEY,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,CAsB3C;CACF"}
@@ -1,26 +0,0 @@
1
- import { access } from "node:fs/promises";
2
- import { resolve } from "node:path";
3
- export class GasboostConfigLoader {
4
- projectRoot;
5
- moduleLoader;
6
- constructor({ projectRoot, moduleLoader, }) {
7
- this.projectRoot = projectRoot;
8
- this.moduleLoader = moduleLoader;
9
- }
10
- async load() {
11
- const configPath = resolve(this.projectRoot, "gasboost.config.ts");
12
- try {
13
- await access(configPath);
14
- }
15
- catch {
16
- throw new Error(`Gasboost config was not found: ${configPath}`);
17
- }
18
- const configModule = await this.moduleLoader.import("gasboost.config.ts");
19
- const config = configModule.default;
20
- if (typeof config !== "object" || config === null) {
21
- throw new Error("gasboost.config.ts must export a Gasboost config as the default export.");
22
- }
23
- return config;
24
- }
25
- }
26
- //# sourceMappingURL=GasboostConfigLoader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GasboostConfigLoader.js","sourceRoot":"","sources":["../../src/config/GasboostConfigLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,OAAO,oBAAoB;IACd,WAAW,CAAS;IAEpB,YAAY,CAAe;IAE5C,YAAmB,EACjB,WAAW,EACX,YAAY,GAIb;QACC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,IAAI;QACf,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;QAEnE,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAEhD,oBAAoB,CAAC,CAAC;QAEzB,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC;QAEpC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;QACJ,CAAC;QAED,OAAO,MAAwB,CAAC;IAClC,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- export declare class ModuleLoader {
2
- private readonly projectRoot;
3
- private readonly jiti;
4
- constructor(projectRoot: string);
5
- import<T extends object>(path: string): Promise<T>;
6
- }
7
- //# sourceMappingURL=ModuleLoader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleLoader.d.ts","sourceRoot":"","sources":["../../src/module/ModuleLoader.ts"],"names":[],"mappings":"AAIA,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgC;IAErD,YAAmB,WAAW,EAAE,MAAM,EASrC;IAEY,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAI9D;CACF"}
@@ -1,18 +0,0 @@
1
- import { createJiti } from "jiti";
2
- import { resolve } from "node:path";
3
- import { pathToFileURL } from "node:url";
4
- export class ModuleLoader {
5
- projectRoot;
6
- jiti;
7
- constructor(projectRoot) {
8
- this.projectRoot = projectRoot;
9
- this.jiti = createJiti(pathToFileURL(resolve(projectRoot, "gasboost.config.ts")).href, {
10
- tsconfigPaths: true,
11
- });
12
- }
13
- async import(path) {
14
- const modulePath = resolve(this.projectRoot, path);
15
- return (await this.jiti.import(modulePath));
16
- }
17
- }
18
- //# sourceMappingURL=ModuleLoader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleLoader.js","sourceRoot":"","sources":["../../src/module/ModuleLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,OAAO,YAAY;IACN,WAAW,CAAS;IAEpB,IAAI,CAAgC;IAErD,YAAmB,WAAmB;QACpC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,IAAI,CAAC,IAAI,GAAG,UAAU,CACpB,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAC9D;YACE,aAAa,EAAE,IAAI;SACpB,CACF,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,MAAM,CAAmB,IAAY;QAChD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAM,CAAC;IACnD,CAAC;CACF"}