factorio-test-cli 3.1.0 → 3.1.1

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.
Files changed (3) hide show
  1. package/README.md +0 -57
  2. package/cli.js +3 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,60 +9,3 @@ If using an npm package, you can install `factorio-test-cli` to your dev depende
9
9
  ```bash
10
10
  npm install --save-dev factorio-test-cli
11
11
  ```
12
-
13
- ## Configuration Architecture
14
-
15
- ### Config Categories
16
-
17
- | Category | Casing | Location | Example Fields |
18
- |----------|--------|----------|----------------|
19
- | CLI-only | camelCase | `cli-config.ts` | `config`, `graphics`, `watch` |
20
- | File+CLI | camelCase | `cli-config.ts` | `modPath`, `factorioPath`, `verbose`, `forbidOnly` |
21
- | Test | snake_case | `types/config.d.ts` | `test_pattern`, `game_speed`, `bail` |
22
-
23
- - **CLI-only**: Options only available via command line, not in config files
24
- - **File+CLI**: Options that can be set in `factorio-test.json` or via command line (CLI overrides file)
25
- - **Test**: Runner configuration passed to the Factorio mod; uses snake_case for Lua compatibility
26
-
27
- ### Type Hierarchy
28
-
29
- ```
30
- types/config.d.ts
31
- └── TestRunnerConfig # CLI-passable fields (source of truth)
32
-
33
- ├── Extended by: FactorioTest.Config (types/index.d.ts)
34
- │ └── Adds mod-only fields: default_ticks_between_tests,
35
- │ before_test_run, after_test_run, sound_effects
36
-
37
- └── Validated by: testRunnerConfigSchema (cli/config/test-config.ts)
38
- └── Zod schema for runtime validation
39
- ```
40
-
41
- ### Data Flow
42
-
43
- ```
44
- CLI args ─────────────────┐
45
-
46
- factorio-test.json ──► loadConfig() ──► mergeCliConfig() ──► RunOptions
47
-
48
-
49
- buildTestConfig() ──► TestRunnerConfig ──► Factorio mod
50
- ```
51
-
52
- 1. `loadConfig()` reads `factorio-test.json` (or `package.json["factorio-test"]`)
53
- 2. `mergeCliConfig()` merges file config with CLI options (CLI wins)
54
- 3. `buildTestConfig()` extracts test runner options, combining patterns with OR logic
55
-
56
- ### File Organization
57
-
58
- ```
59
- types/
60
- ├── config.d.ts # TestRunnerConfig interface (source of truth for CLI-passable test options)
61
- └── index.d.ts # FactorioTest.Config extends TestRunnerConfig with mod-only fields
62
-
63
- cli/config/
64
- ├── index.ts # Re-exports all public APIs
65
- ├── test-config.ts # Zod schema validating TestRunnerConfig + CLI registration
66
- ├── cli-config.ts # CliConfig + CliOnlyOptions schemas + CLI registration
67
- └── loader.ts # Config loading, path resolution, merging, RunOptions type
68
- ```
package/cli.js CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import chalk from "chalk";
3
3
  import { program } from "commander";
4
+ import { readFileSync } from "fs";
4
5
  import { CliError } from "./cli-error.js";
5
6
  import "./run.js";
7
+ const { version } = JSON.parse(readFileSync(new URL("package.json", import.meta.url), "utf8"));
6
8
  try {
7
9
  await program
8
10
  .name("factorio-test")
11
+ .version(version)
9
12
  .description("cli for factorio testing")
10
13
  .helpCommand(true)
11
14
  .showHelpAfterError()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "factorio-test-cli",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "A CLI to run FactorioTest.",
5
5
  "license": "MIT",
6
6
  "repository": {