@datamitsu/datamitsu-darwin-arm64 0.0.3-alpha-3 → 0.0.3-alpha-5
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 +102 -0
- package/datamitsu +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,6 +52,108 @@ A library that wraps datamitsu passes its config via `--before-config`. The proj
|
|
|
52
52
|
library-base.ts → project/datamitsu.config.ts → final Config
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
## Global Cache Structure
|
|
56
|
+
|
|
57
|
+
datamitsu stores all cached data under `~/.cache/datamitsu/` (or `$XDG_CACHE_HOME/datamitsu/`):
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
~/.cache/datamitsu/
|
|
61
|
+
├── .bin/ # Downloaded binaries
|
|
62
|
+
├── .runtimes/ # Runtime binaries (UV, FNM, JVM)
|
|
63
|
+
├── .apps/ # Runtime-managed applications
|
|
64
|
+
├── .pnpm-store/ # Shared PNPM content-addressable store
|
|
65
|
+
└── projects/ # Per-project caches
|
|
66
|
+
└── {blake2b(gitRoot)}/ # Project directory (keyed by BLAKE2b hash)
|
|
67
|
+
├── toolstate.msgpack # Lint/fix results cache
|
|
68
|
+
└── cache/ # Tool-specific caches
|
|
69
|
+
└── ... # e.g., tsbuildinfo for tsc
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Each project gets its own directory under `projects/`, keyed by a BLAKE2b-256 hash of the git root path. This directory contains both the lint/fix results cache and a `cache/` subdirectory for tool-specific caches.
|
|
73
|
+
|
|
74
|
+
## Cache Management
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Clear cache for the current project (lint/fix results + tool caches)
|
|
78
|
+
datamitsu cache clear
|
|
79
|
+
|
|
80
|
+
# Clear cache for all projects
|
|
81
|
+
datamitsu cache clear --all
|
|
82
|
+
|
|
83
|
+
# Preview what would be deleted (dry-run)
|
|
84
|
+
datamitsu cache clear --dry-run
|
|
85
|
+
|
|
86
|
+
# Show the global cache directory path
|
|
87
|
+
datamitsu cache path
|
|
88
|
+
|
|
89
|
+
# Show the current project's cache directory path
|
|
90
|
+
datamitsu cache path project
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
By default, `cache clear` clears only the current project's cache, which includes:
|
|
94
|
+
|
|
95
|
+
- Lint/fix results (`projects/{hash}/toolstate.msgpack`)
|
|
96
|
+
- Tool-specific caches (`projects/{hash}/cache/`)
|
|
97
|
+
|
|
98
|
+
Use `--all` to clear caches for all projects. Use `--dry-run` to preview what would be deleted without actually deleting anything.
|
|
99
|
+
|
|
100
|
+
## Template Placeholders
|
|
101
|
+
|
|
102
|
+
Tool arguments and paths in configurations support template placeholders that are resolved at execution time:
|
|
103
|
+
|
|
104
|
+
| Placeholder | Resolves To | Example |
|
|
105
|
+
| ------------- | --------------------------------------- | --------------------------- |
|
|
106
|
+
| `{cwd}` | Per-project working directory | `"{cwd}/src"` |
|
|
107
|
+
| `{root}` | Git repository root | `"{root}/.config"` |
|
|
108
|
+
| `{toolCache}` | Project cache directory | `"{toolCache}/tsbuildinfo"` |
|
|
109
|
+
| `{file}` | Single file path (per-file scope tools) | `"{file}"` |
|
|
110
|
+
| `{files}` | Space-separated file list | `"{files}"` |
|
|
111
|
+
|
|
112
|
+
### Using Project Cache in Configurations
|
|
113
|
+
|
|
114
|
+
Tools that maintain their own cache (e.g., `tsc` with `--incremental`) can use the `{toolCache}` placeholder to store cache files in the correct location:
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
tsc: {
|
|
118
|
+
name: "Tsc",
|
|
119
|
+
operations: {
|
|
120
|
+
lint: {
|
|
121
|
+
args: [
|
|
122
|
+
"--noEmit",
|
|
123
|
+
"--incremental",
|
|
124
|
+
"--tsBuildInfoFile",
|
|
125
|
+
"{toolCache}/tsbuildinfo",
|
|
126
|
+
],
|
|
127
|
+
command: "tsc",
|
|
128
|
+
globs: ["**/*.ts", "**/*.tsx"],
|
|
129
|
+
scope: "per-project",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This ensures that:
|
|
136
|
+
|
|
137
|
+
1. Tool caches are stored in a dedicated location (`~/.cache/datamitsu/projects/{hash}/cache/`)
|
|
138
|
+
2. `cache clear` correctly cleans up tool caches alongside lint/fix results
|
|
139
|
+
3. Tool caches don't pollute `node_modules` or other project directories
|
|
140
|
+
|
|
141
|
+
### Facts API vs Templates
|
|
142
|
+
|
|
143
|
+
The `facts()` function provides platform and environment information for conditional logic in configs:
|
|
144
|
+
|
|
145
|
+
- `facts().os`, `facts().arch` - Platform detection
|
|
146
|
+
- `facts().isInGitRepo`, `facts().isMonorepo` - Git state
|
|
147
|
+
- `facts().packageName`, `facts().binaryCommand`, `facts().binaryPath` - Binary info
|
|
148
|
+
- `facts().env` - Environment variables
|
|
149
|
+
|
|
150
|
+
All path references use template placeholders instead. The following facts fields have been removed (breaking change):
|
|
151
|
+
|
|
152
|
+
- `facts().cwd` - use `{cwd}` template
|
|
153
|
+
- `facts().gitRoot` - use `{root}` template
|
|
154
|
+
- `facts().projectRoot` - use `{root}` template
|
|
155
|
+
- `facts().projectCachePath` - use `{toolCache}` template
|
|
156
|
+
|
|
55
157
|
## Examples
|
|
56
158
|
|
|
57
159
|
Usage examples for runtime-managed apps (multi-version isolation, UV isolation, PNPM plugins) are in [examples/](examples/).
|
package/datamitsu
CHANGED
|
Binary file
|
package/package.json
CHANGED