@mnmal-ai/substrate-config 0.0.0 → 1.0.0-alpha.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.
- package/LICENSE +202 -0
- package/README.md +37 -1
- package/bin/toolchain-check.mjs +174 -0
- package/biome.json +36 -0
- package/dist/tsdown.d.ts +48 -0
- package/dist/tsdown.d.ts.map +1 -0
- package/dist/tsdown.js +93 -0
- package/dist/tsdown.js.map +1 -0
- package/package.json +53 -4
- package/toolchain.json +43 -0
- package/tsconfig.app.json +23 -0
- package/tsconfig.base.json +18 -0
- package/tsconfig.dts.json +11 -0
- package/tsconfig.lib.json +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
1
|
# @mnmal-ai/substrate-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workspace tooling, published so other repositories can extend it. It is not bundled into `@mnmal-ai/substrate` and is not part of its public surface.
|
|
4
|
+
|
|
5
|
+
Shared TypeScript, Biome and tsdown configs for the Substrate workspace, and a toolchain manifest with a checker.
|
|
6
|
+
|
|
7
|
+
Exports `tsconfig.base.json` (strict + `exactOptionalPropertyTypes`), the presets `tsconfig.lib.json` / `tsconfig.app.json` / `tsconfig.dts.json` that extend it, `biome.json` (formatter + lint rules), and the `defineLibTsdown` / `defineBinTsdown` helpers for `tsdown.config.ts`. Other repositories can extend these too.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```jsonc
|
|
12
|
+
// In a package's tsconfig.json:
|
|
13
|
+
{
|
|
14
|
+
"extends": "@mnmal-ai/substrate-config/tsconfig.lib.json",
|
|
15
|
+
"include": ["src/**/*", "test/**/*"]
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// In a package's tsdown.config.ts:
|
|
21
|
+
import { defineLibTsdown } from '@mnmal-ai/substrate-config/tsdown';
|
|
22
|
+
export default defineLibTsdown({ external: ['some-runtime-dep'] });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Toolchain manifest
|
|
26
|
+
|
|
27
|
+
`toolchain.json` records the toolchain this workspace is built with: the Node engines floor, pnpm, the Biome schema, tracked catalog entries (TypeScript, tsdown, vitest, Biome, `@types/node`, zod, the MCP SDK) and GitHub Actions pins. A workspace package that depends on it can check the repository against it:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm exec substrate-toolchain-check # report drift, exit 0
|
|
31
|
+
pnpm exec substrate-toolchain-check --strict # exit 1 on drift (for CI)
|
|
32
|
+
pnpm exec substrate-toolchain-check --fix # align in place, then run pnpm install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
It checks only what the repository uses: a catalog entry it lacks, or an action it never calls, is not drift. `--fix` edits in place and keeps formatting (catalog entries, `packageManager`, mise's pnpm, `engines.node`, the Biome schema, Actions pins), and never adds a field a repository does not have. The checker has no dependencies, so it runs on whatever toolchain the repository is on.
|
|
36
|
+
|
|
37
|
+
## More
|
|
38
|
+
|
|
39
|
+
- Source: `packages/substrate-config/src/tsdown.ts` (build helpers), `tsconfig.*.json` (presets), `bin/toolchain-check.mjs`
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* substrate-toolchain-check — compare a repo's toolchain with the fleet's.
|
|
4
|
+
*
|
|
5
|
+
* substrate-toolchain-check [--strict] [--fix] [--root <dir>] [--json]
|
|
6
|
+
*
|
|
7
|
+
* The fleet's versions are `toolchain.json` beside this file, generated from
|
|
8
|
+
* mnmal-ai/substrate's own config at release. So a repo is held to the
|
|
9
|
+
* substrate-config version it depends on, and moving the fleet is a substrate-config
|
|
10
|
+
* bump in each repo rather than N hand edits.
|
|
11
|
+
*
|
|
12
|
+
* Checks only what the repo actually uses: a catalog entry it does not have,
|
|
13
|
+
* or an action it does not call, is not drift. Zero dependencies on purpose,
|
|
14
|
+
* so it runs whatever toolchain the repo is on — including a drifted one.
|
|
15
|
+
*
|
|
16
|
+
* `--fix` rewrites what it finds in place, before checking: catalog entries,
|
|
17
|
+
* pnpm (packageManager + mise), engines.node, the Biome schema and Actions
|
|
18
|
+
* pins. Edits are textual, so formatting survives. It never adds a field a
|
|
19
|
+
* repo does not have. Run `pnpm install` afterwards when the catalog moved.
|
|
20
|
+
*
|
|
21
|
+
* Exit 0 when aligned, or when drift is found without --strict (warn mode);
|
|
22
|
+
* 1 when drift is found with --strict.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
26
|
+
import { dirname, join, resolve } from 'node:path';
|
|
27
|
+
import { fileURLToPath } from 'node:url';
|
|
28
|
+
|
|
29
|
+
const args = process.argv.slice(2);
|
|
30
|
+
const at = args.indexOf('--root');
|
|
31
|
+
const root = resolve(at >= 0 ? (args[at + 1] ?? '.') : '.');
|
|
32
|
+
const strict = args.includes('--strict');
|
|
33
|
+
const asJson = args.includes('--json');
|
|
34
|
+
const fix = args.includes('--fix');
|
|
35
|
+
|
|
36
|
+
const fleet = JSON.parse(
|
|
37
|
+
readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'toolchain.json'), 'utf8')
|
|
38
|
+
);
|
|
39
|
+
const read = (p) => (existsSync(join(root, p)) ? readFileSync(join(root, p), 'utf8') : null);
|
|
40
|
+
|
|
41
|
+
/** Files `--fix` rewrote, for the report. */
|
|
42
|
+
const fixed = [];
|
|
43
|
+
/** Rewrite `path` through `edit` when it exists and the edit changes it. */
|
|
44
|
+
const rewrite = (path, edit) => {
|
|
45
|
+
const before = read(path);
|
|
46
|
+
if (before === null) return;
|
|
47
|
+
const after = edit(before);
|
|
48
|
+
if (after !== before) {
|
|
49
|
+
writeFileSync(join(root, path), after);
|
|
50
|
+
fixed.push(path);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (fix) {
|
|
55
|
+
rewrite('package.json', (t) =>
|
|
56
|
+
t
|
|
57
|
+
.replace(/("packageManager"\s*:\s*")pnpm@[^"]*(")/, `$1pnpm@${fleet.pnpm}$2`)
|
|
58
|
+
.replace(/("engines"\s*:\s*\{[^}]*?"node"\s*:\s*")[^"]*(")/, `$1${fleet.node.engines}$2`)
|
|
59
|
+
);
|
|
60
|
+
rewrite('mise.toml', (t) => t.replace(/^(\s*pnpm\s*=\s*")[^"]+(")/m, `$1${fleet.pnpm}$2`));
|
|
61
|
+
rewrite('biome.json', (t) => t.replace(/(schemas\/)[\d.]+(\/)/, `$1${fleet.biomeSchema}$2`));
|
|
62
|
+
rewrite('pnpm-workspace.yaml', (t) => {
|
|
63
|
+
let on = false;
|
|
64
|
+
return t
|
|
65
|
+
.split('\n')
|
|
66
|
+
.map((line) => {
|
|
67
|
+
if (/^catalog:\s*$/.test(line)) on = true;
|
|
68
|
+
else if (on && line.trim() !== '' && !line.startsWith(' ')) on = false;
|
|
69
|
+
if (!on) return line;
|
|
70
|
+
const m = /^(\s+["']?)([^"':#]+?)(["']?\s*:\s*["']?)([^"'\s#]+)(.*)$/.exec(line);
|
|
71
|
+
const want = m && fleet.catalog?.[m[2]];
|
|
72
|
+
return want === undefined || want === null ? line : `${m[1]}${m[2]}${m[3]}${want}${m[5]}`;
|
|
73
|
+
})
|
|
74
|
+
.join('\n');
|
|
75
|
+
});
|
|
76
|
+
const wfDir = join(root, '.github/workflows');
|
|
77
|
+
if (existsSync(wfDir)) {
|
|
78
|
+
for (const f of readdirSync(wfDir).filter((x) => /\.ya?ml$/.test(x))) {
|
|
79
|
+
rewrite(join('.github/workflows', f), (t) =>
|
|
80
|
+
t.replace(
|
|
81
|
+
/(uses:\s*)([\w./-]+)@([0-9a-f]{40})(\s*#\s*)v[\d.]+/g,
|
|
82
|
+
(whole, pre, action, _sha, gap) => {
|
|
83
|
+
const want = fleet.actions?.[action];
|
|
84
|
+
return want === undefined ? whole : `${pre}${action}@${want.sha}${gap}${want.version}`;
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** @type {Array<{ item: string; want: string; have: string | null; ok: boolean }>} */
|
|
93
|
+
const rows = [];
|
|
94
|
+
const check = (item, want, have) => {
|
|
95
|
+
if (want === undefined || have === null || have === undefined) return;
|
|
96
|
+
rows.push({ item, want: String(want), have: String(have), ok: String(want) === String(have) });
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// A repo without package.json (holomap is Rust) still has workflow pins to check.
|
|
100
|
+
const pkgText = read('package.json');
|
|
101
|
+
if (pkgText !== null) {
|
|
102
|
+
const pkg = JSON.parse(pkgText);
|
|
103
|
+
check('engines.node', fleet.node?.engines, pkg.engines?.node ?? '(none)');
|
|
104
|
+
if (typeof pkg.packageManager === 'string' && pkg.packageManager.startsWith('pnpm@'))
|
|
105
|
+
check('packageManager pnpm', fleet.pnpm, pkg.packageManager.slice(5).split('+')[0]);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const mise = read('mise.toml');
|
|
109
|
+
const misePnpm = mise && /^\s*pnpm\s*=\s*"([^"]+)"/m.exec(mise)?.[1];
|
|
110
|
+
if (misePnpm) check('mise pnpm', fleet.pnpm, misePnpm);
|
|
111
|
+
|
|
112
|
+
const biome = read('biome.json');
|
|
113
|
+
const schema = biome && /schemas\/([\d.]+)\//.exec(biome)?.[1];
|
|
114
|
+
if (schema) check('biome.json $schema', fleet.biomeSchema, schema);
|
|
115
|
+
|
|
116
|
+
const ws = read('pnpm-workspace.yaml');
|
|
117
|
+
if (ws !== null) {
|
|
118
|
+
let on = false;
|
|
119
|
+
for (const line of ws.split('\n')) {
|
|
120
|
+
if (/^catalog:\s*$/.test(line)) {
|
|
121
|
+
on = true;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (!on) continue;
|
|
125
|
+
if (line.trim() !== '' && !line.startsWith(' ')) break;
|
|
126
|
+
const m = /^\s+["']?([^"':#]+?)["']?\s*:\s*["']?([^"'\s#]+)/.exec(line);
|
|
127
|
+
if (m && fleet.catalog?.[m[1]] !== undefined)
|
|
128
|
+
check(`catalog ${m[1]}`, fleet.catalog[m[1]], m[2]);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const wf = join(root, '.github/workflows');
|
|
133
|
+
if (existsSync(wf)) {
|
|
134
|
+
const seen = new Set();
|
|
135
|
+
for (const f of readdirSync(wf).filter((x) => /\.ya?ml$/.test(x))) {
|
|
136
|
+
const text = readFileSync(join(wf, f), 'utf8');
|
|
137
|
+
for (const m of text.matchAll(/uses:\s*([\w./-]+)@([0-9a-f]{40})(?:\s*#\s*(v[\d.]+))?/g)) {
|
|
138
|
+
const [, action, sha, version] = m;
|
|
139
|
+
const want = fleet.actions?.[action];
|
|
140
|
+
if (want === undefined || seen.has(`${action}@${sha}`)) continue;
|
|
141
|
+
seen.add(`${action}@${sha}`);
|
|
142
|
+
check(
|
|
143
|
+
`action ${action} (${f})`,
|
|
144
|
+
`${want.version} ${want.sha.slice(0, 7)}`,
|
|
145
|
+
`${version ?? '?'} ${sha.slice(0, 7)}`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const drift = rows.filter((r) => !r.ok);
|
|
152
|
+
if (fix && !asJson) {
|
|
153
|
+
console.log(
|
|
154
|
+
fixed.length === 0
|
|
155
|
+
? 'fix: nothing to rewrite'
|
|
156
|
+
: `fix: rewrote ${fixed.join(', ')}${fixed.includes('pnpm-workspace.yaml') ? ' (run pnpm install to update the lockfile)' : ''}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
if (asJson) {
|
|
160
|
+
console.log(
|
|
161
|
+
JSON.stringify({ aligned: drift.length === 0, rows, ...(fix ? { fixed } : {}) }, null, 2)
|
|
162
|
+
);
|
|
163
|
+
} else {
|
|
164
|
+
for (const r of rows)
|
|
165
|
+
console.log(
|
|
166
|
+
`${r.ok ? ' ok ' : ' DRIFT'} ${r.item.padEnd(44)} ${r.ok ? r.have : `${r.have} (fleet: ${r.want})`}`
|
|
167
|
+
);
|
|
168
|
+
console.log(
|
|
169
|
+
drift.length === 0
|
|
170
|
+
? `aligned with the fleet toolchain (${rows.length} checks)`
|
|
171
|
+
: `${drift.length} of ${rows.length} drift from the fleet toolchain${strict ? '' : ' (warn only; pass --strict to fail)'}`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
process.exit(drift.length > 0 && strict ? 1 : 0);
|
package/biome.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.5.15/schema.json",
|
|
3
|
+
"root": false,
|
|
4
|
+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
|
5
|
+
"linter": {
|
|
6
|
+
"enabled": true,
|
|
7
|
+
"rules": {
|
|
8
|
+
"preset": "recommended",
|
|
9
|
+
"style": {
|
|
10
|
+
"noNonNullAssertion": "off"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"formatter": {
|
|
15
|
+
"enabled": true,
|
|
16
|
+
"indentStyle": "space",
|
|
17
|
+
"indentWidth": 2,
|
|
18
|
+
"lineWidth": 100
|
|
19
|
+
},
|
|
20
|
+
"javascript": {
|
|
21
|
+
"formatter": {
|
|
22
|
+
"quoteStyle": "single",
|
|
23
|
+
"trailingCommas": "none",
|
|
24
|
+
"semicolons": "always"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": {
|
|
28
|
+
"includes": [
|
|
29
|
+
"**/*.{ts,tsx,js,mjs,json,jsonc}",
|
|
30
|
+
"!**/dist",
|
|
31
|
+
"!**/dist-tarball",
|
|
32
|
+
"!**/node_modules",
|
|
33
|
+
"!**/.turbo"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
package/dist/tsdown.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** A banner: fixed text per output kind. */
|
|
2
|
+
export interface TsdownBanner {
|
|
3
|
+
js?: string;
|
|
4
|
+
css?: string;
|
|
5
|
+
dts?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The tsdown config the helpers build. Declared here rather than as tsdown's
|
|
9
|
+
* `UserConfig` so the published types name no tsdown version; it is
|
|
10
|
+
* assignable to the consumer's own `UserConfig`.
|
|
11
|
+
*/
|
|
12
|
+
export interface TsdownConfig {
|
|
13
|
+
entry: string[] | Record<string, string>;
|
|
14
|
+
format: 'esm'[];
|
|
15
|
+
platform: 'node' | 'neutral';
|
|
16
|
+
target: string;
|
|
17
|
+
fixedExtension: boolean;
|
|
18
|
+
sourcemap: boolean;
|
|
19
|
+
clean: boolean;
|
|
20
|
+
minify: boolean;
|
|
21
|
+
outDir: string;
|
|
22
|
+
dts: boolean;
|
|
23
|
+
deps?: {
|
|
24
|
+
neverBundle?: (string | RegExp)[];
|
|
25
|
+
alwaysBundle?: (string | RegExp)[];
|
|
26
|
+
};
|
|
27
|
+
shims?: boolean;
|
|
28
|
+
banner?: TsdownBanner;
|
|
29
|
+
}
|
|
30
|
+
export interface BinTsdownOptions {
|
|
31
|
+
entry: Record<string, string>;
|
|
32
|
+
banner?: TsdownBanner;
|
|
33
|
+
clean?: boolean;
|
|
34
|
+
/** Extra never-bundle patterns, merged after NODE_BARE_BUILTINS. */
|
|
35
|
+
neverBundle?: (string | RegExp)[];
|
|
36
|
+
/** Force-bundle patterns (deps.alwaysBundle). */
|
|
37
|
+
alwaysBundle?: (string | RegExp)[];
|
|
38
|
+
}
|
|
39
|
+
export declare function defineBinTsdown({ entry, banner, clean, neverBundle, alwaysBundle }: BinTsdownOptions): TsdownConfig;
|
|
40
|
+
export interface LibTsdownOptions {
|
|
41
|
+
entry?: string[] | Record<string, string>;
|
|
42
|
+
/** Never-bundle patterns — mapped to tsdown's `deps.neverBundle`. */
|
|
43
|
+
external?: (string | RegExp)[];
|
|
44
|
+
platform?: 'node' | 'neutral';
|
|
45
|
+
banner?: TsdownBanner;
|
|
46
|
+
}
|
|
47
|
+
export declare function defineLibTsdown({ entry, external, platform, banner }?: LibTsdownOptions): TsdownConfig;
|
|
48
|
+
//# sourceMappingURL=tsdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdown.d.ts","sourceRoot":"","sources":["../src/tsdown.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,CAAC,EAAE;QACL,WAAW,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;QAClC,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;KACpC,CAAC;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAuDD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,WAAW,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAClC,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACpC;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,MAAM,EACN,KAAY,EACZ,WAAgB,EAChB,YAAY,EACb,EAAE,gBAAgB,GAAG,YAAY,CAqBjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,EAC9B,KAAwB,EACxB,QAAQ,EACR,QAAiB,EACjB,MAAM,EACP,GAAE,gBAAqB,GAAG,YAAY,CAgBtC"}
|
package/dist/tsdown.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/tsdown.ts
|
|
2
|
+
/**
|
|
3
|
+
* Bare-name Node builtins. CJS deps (ws, postgres, pino) `require('events')`
|
|
4
|
+
* unprefixed; bin-mode bundling collapses them inline, then the bundler's
|
|
5
|
+
* inner require shim throws at runtime. Listing them as external keeps these
|
|
6
|
+
* imports as Node-resolved at runtime instead of bundled.
|
|
7
|
+
*/
|
|
8
|
+
const NODE_BARE_BUILTINS = [
|
|
9
|
+
"assert",
|
|
10
|
+
"async_hooks",
|
|
11
|
+
"buffer",
|
|
12
|
+
"child_process",
|
|
13
|
+
"cluster",
|
|
14
|
+
"console",
|
|
15
|
+
"constants",
|
|
16
|
+
"crypto",
|
|
17
|
+
"dgram",
|
|
18
|
+
"diagnostics_channel",
|
|
19
|
+
"dns",
|
|
20
|
+
"domain",
|
|
21
|
+
"events",
|
|
22
|
+
"fs",
|
|
23
|
+
"fs/promises",
|
|
24
|
+
"http",
|
|
25
|
+
"http2",
|
|
26
|
+
"https",
|
|
27
|
+
"inspector",
|
|
28
|
+
"module",
|
|
29
|
+
"net",
|
|
30
|
+
"os",
|
|
31
|
+
"path",
|
|
32
|
+
"perf_hooks",
|
|
33
|
+
"process",
|
|
34
|
+
"punycode",
|
|
35
|
+
"querystring",
|
|
36
|
+
"readline",
|
|
37
|
+
"repl",
|
|
38
|
+
"stream",
|
|
39
|
+
"stream/web",
|
|
40
|
+
"string_decoder",
|
|
41
|
+
"sys",
|
|
42
|
+
"timers",
|
|
43
|
+
"tls",
|
|
44
|
+
"trace_events",
|
|
45
|
+
"tty",
|
|
46
|
+
"url",
|
|
47
|
+
"util",
|
|
48
|
+
"v8",
|
|
49
|
+
"vm",
|
|
50
|
+
"wasi",
|
|
51
|
+
"worker_threads",
|
|
52
|
+
"zlib"
|
|
53
|
+
];
|
|
54
|
+
function defineBinTsdown({ entry, banner, clean = true, neverBundle = [], alwaysBundle }) {
|
|
55
|
+
return {
|
|
56
|
+
entry,
|
|
57
|
+
format: ["esm"],
|
|
58
|
+
platform: "node",
|
|
59
|
+
target: "node26",
|
|
60
|
+
fixedExtension: false,
|
|
61
|
+
sourcemap: false,
|
|
62
|
+
clean,
|
|
63
|
+
minify: false,
|
|
64
|
+
outDir: "dist",
|
|
65
|
+
dts: false,
|
|
66
|
+
deps: {
|
|
67
|
+
neverBundle: [...NODE_BARE_BUILTINS, ...neverBundle],
|
|
68
|
+
...alwaysBundle !== void 0 ? { alwaysBundle } : {}
|
|
69
|
+
},
|
|
70
|
+
shims: true,
|
|
71
|
+
...banner !== void 0 ? { banner } : {}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function defineLibTsdown({ entry = ["src/index.ts"], external, platform = "node", banner } = {}) {
|
|
75
|
+
return {
|
|
76
|
+
entry,
|
|
77
|
+
format: ["esm"],
|
|
78
|
+
platform,
|
|
79
|
+
target: "node26",
|
|
80
|
+
fixedExtension: false,
|
|
81
|
+
sourcemap: false,
|
|
82
|
+
clean: true,
|
|
83
|
+
minify: false,
|
|
84
|
+
outDir: "dist",
|
|
85
|
+
dts: false,
|
|
86
|
+
...external !== void 0 ? { deps: { neverBundle: external } } : {},
|
|
87
|
+
...banner !== void 0 ? { banner } : {}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { defineBinTsdown, defineLibTsdown };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=tsdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdown.js","names":[],"sources":["../src/tsdown.ts"],"sourcesContent":["/** A banner: fixed text per output kind. */\nexport interface TsdownBanner {\n js?: string;\n css?: string;\n dts?: string;\n}\n\n/**\n * The tsdown config the helpers build. Declared here rather than as tsdown's\n * `UserConfig` so the published types name no tsdown version; it is\n * assignable to the consumer's own `UserConfig`.\n */\nexport interface TsdownConfig {\n entry: string[] | Record<string, string>;\n format: 'esm'[];\n platform: 'node' | 'neutral';\n target: string;\n fixedExtension: boolean;\n sourcemap: boolean;\n clean: boolean;\n minify: boolean;\n outDir: string;\n dts: boolean;\n deps?: {\n neverBundle?: (string | RegExp)[];\n alwaysBundle?: (string | RegExp)[];\n };\n shims?: boolean;\n banner?: TsdownBanner;\n}\n\n/**\n * Bare-name Node builtins. CJS deps (ws, postgres, pino) `require('events')`\n * unprefixed; bin-mode bundling collapses them inline, then the bundler's\n * inner require shim throws at runtime. Listing them as external keeps these\n * imports as Node-resolved at runtime instead of bundled.\n */\nconst NODE_BARE_BUILTINS = [\n 'assert',\n 'async_hooks',\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'constants',\n 'crypto',\n 'dgram',\n 'diagnostics_channel',\n 'dns',\n 'domain',\n 'events',\n 'fs',\n 'fs/promises',\n 'http',\n 'http2',\n 'https',\n 'inspector',\n 'module',\n 'net',\n 'os',\n 'path',\n 'perf_hooks',\n 'process',\n 'punycode',\n 'querystring',\n 'readline',\n 'repl',\n 'stream',\n 'stream/web',\n 'string_decoder',\n 'sys',\n 'timers',\n 'tls',\n 'trace_events',\n 'tty',\n 'url',\n 'util',\n 'v8',\n 'vm',\n 'wasi',\n 'worker_threads',\n 'zlib'\n];\n\nexport interface BinTsdownOptions {\n entry: Record<string, string>;\n banner?: TsdownBanner;\n clean?: boolean;\n /** Extra never-bundle patterns, merged after NODE_BARE_BUILTINS. */\n neverBundle?: (string | RegExp)[];\n /** Force-bundle patterns (deps.alwaysBundle). */\n alwaysBundle?: (string | RegExp)[];\n}\n\nexport function defineBinTsdown({\n entry,\n banner,\n clean = true,\n neverBundle = [],\n alwaysBundle\n}: BinTsdownOptions): TsdownConfig {\n return {\n entry,\n format: ['esm'],\n platform: 'node',\n target: 'node26',\n // tsdown defaults to .mjs/.d.mts even under type:module — pin .js so\n // package.json main/types/exports/bin paths resolve.\n fixedExtension: false,\n sourcemap: false,\n clean,\n minify: false,\n outDir: 'dist',\n dts: false,\n deps: {\n neverBundle: [...NODE_BARE_BUILTINS, ...neverBundle],\n ...(alwaysBundle !== undefined ? { alwaysBundle } : {})\n },\n shims: true,\n ...(banner !== undefined ? { banner } : {})\n };\n}\n\nexport interface LibTsdownOptions {\n entry?: string[] | Record<string, string>;\n /** Never-bundle patterns — mapped to tsdown's `deps.neverBundle`. */\n external?: (string | RegExp)[];\n platform?: 'node' | 'neutral';\n banner?: TsdownBanner;\n}\n\nexport function defineLibTsdown({\n entry = ['src/index.ts'],\n external,\n platform = 'node',\n banner\n}: LibTsdownOptions = {}): TsdownConfig {\n return {\n entry,\n format: ['esm'],\n platform,\n target: 'node26',\n // See defineBinTsdown — keep emitted extensions at .js/.d.ts.\n fixedExtension: false,\n sourcemap: false,\n clean: true,\n minify: false,\n outDir: 'dist',\n dts: false,\n ...(external !== undefined ? { deps: { neverBundle: external } } : {}),\n ...(banner !== undefined ? { banner } : {})\n };\n}\n"],"mappings":";;;;;;;AAqCA,MAAM,qBAAqB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAYA,SAAgB,gBAAgB,EAC9B,OACA,QACA,QAAQ,MACR,cAAc,CAAC,GACf,gBACiC;CACjC,OAAO;EACL;EACA,QAAQ,CAAC,KAAK;EACd,UAAU;EACV,QAAQ;EAGR,gBAAgB;EAChB,WAAW;EACX;EACA,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,MAAM;GACJ,aAAa,CAAC,GAAG,oBAAoB,GAAG,WAAW;GACnD,GAAI,iBAAiB,KAAA,IAAY,EAAE,aAAa,IAAI,CAAC;EACvD;EACA,OAAO;EACP,GAAI,WAAW,KAAA,IAAY,EAAE,OAAO,IAAI,CAAC;CAC3C;AACF;AAUA,SAAgB,gBAAgB,EAC9B,QAAQ,CAAC,cAAc,GACvB,UACA,WAAW,QACX,WACoB,CAAC,GAAiB;CACtC,OAAO;EACL;EACA,QAAQ,CAAC,KAAK;EACd;EACA,QAAQ;EAER,gBAAgB;EAChB,WAAW;EACX,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,KAAK;EACL,GAAI,aAAa,KAAA,IAAY,EAAE,MAAM,EAAE,aAAa,SAAS,EAAE,IAAI,CAAC;EACpE,GAAI,WAAW,KAAA,IAAY,EAAE,OAAO,IAAI,CAAC;CAC3C;AACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnmal-ai/substrate-config",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
|
+
"description": "Shared TypeScript, Biome, and tsdown configs for the Substrate workspace.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"
|
|
7
|
-
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/mnmal-ai/substrate.git",
|
|
9
|
+
"directory": "packages/substrate-config"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
"./biome.json": "./biome.json",
|
|
14
|
+
"./tsconfig.base.json": "./tsconfig.base.json",
|
|
15
|
+
"./tsconfig.lib.json": "./tsconfig.lib.json",
|
|
16
|
+
"./tsconfig.app.json": "./tsconfig.app.json",
|
|
17
|
+
"./tsconfig.dts.json": "./tsconfig.dts.json",
|
|
18
|
+
"./tsdown": {
|
|
19
|
+
"import": "./dist/tsdown.js",
|
|
20
|
+
"types": "./dist/tsdown.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./toolchain.json": "./toolchain.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"biome.json",
|
|
27
|
+
"tsconfig.base.json",
|
|
28
|
+
"tsconfig.lib.json",
|
|
29
|
+
"tsconfig.app.json",
|
|
30
|
+
"tsconfig.dts.json",
|
|
31
|
+
"toolchain.json",
|
|
32
|
+
"bin"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"registry": "https://registry.npmjs.org/",
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^26.6.4",
|
|
40
|
+
"tsdown": "^0.23.0",
|
|
41
|
+
"typescript": "^7.0.2",
|
|
42
|
+
"vitest": "^5.0.3"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=26.2.0"
|
|
46
|
+
},
|
|
47
|
+
"bin": {
|
|
48
|
+
"substrate-toolchain-check": "bin/toolchain-check.mjs"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsdown && tsc -p tsconfig.self-dts.json",
|
|
52
|
+
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
53
|
+
"lint": "biome check .",
|
|
54
|
+
"test": "vitest run"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/toolchain.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Generated by scripts/emit-toolchain.mjs in mnmal-ai/substrate from its own config. Do not edit; compare with `substrate-toolchain-check`.",
|
|
3
|
+
"node": {
|
|
4
|
+
"engines": ">=26.2.0"
|
|
5
|
+
},
|
|
6
|
+
"pnpm": "12.14.0",
|
|
7
|
+
"biomeSchema": "2.5.15",
|
|
8
|
+
"catalog": {
|
|
9
|
+
"@biomejs/biome": "^2.5.15",
|
|
10
|
+
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
11
|
+
"@types/node": "^26.6.4",
|
|
12
|
+
"tsdown": "^0.23.0",
|
|
13
|
+
"typescript": "^7.0.2",
|
|
14
|
+
"vitest": "^5.0.3",
|
|
15
|
+
"zod": "^4.6.5"
|
|
16
|
+
},
|
|
17
|
+
"actions": {
|
|
18
|
+
"actions/cache": {
|
|
19
|
+
"sha": "55cc8345863c7cc4c66a329aec7e433d2d1c52a9",
|
|
20
|
+
"version": "v6.1.0"
|
|
21
|
+
},
|
|
22
|
+
"actions/checkout": {
|
|
23
|
+
"sha": "3d3c42e5aac5ba805825da76410c181273ba90b1",
|
|
24
|
+
"version": "v7.0.1"
|
|
25
|
+
},
|
|
26
|
+
"actions/download-artifact": {
|
|
27
|
+
"sha": "9000827ccba6bdab643e8b6fd33ac0654aef8333",
|
|
28
|
+
"version": "v8.0.2"
|
|
29
|
+
},
|
|
30
|
+
"actions/setup-node": {
|
|
31
|
+
"sha": "2028fbc5c25fe9cf00d9f06a71cc4710d4507903",
|
|
32
|
+
"version": "v5.0.0"
|
|
33
|
+
},
|
|
34
|
+
"actions/upload-artifact": {
|
|
35
|
+
"sha": "cf430e030ddbb5b0abf93d22962f4752f3646cd9",
|
|
36
|
+
"version": "v7.0.2"
|
|
37
|
+
},
|
|
38
|
+
"jdx/mise-action": {
|
|
39
|
+
"sha": "c2a87611a18de5b3828c5652fe268e992400cb5c",
|
|
40
|
+
"version": "v4.3.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./tsconfig.base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
"lib": ["ES2025"],
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
// Same source-resolution map as tsconfig.lib.json — apps now resolve
|
|
9
|
+
// workspace imports to package SOURCE, killing the transient TS7016
|
|
10
|
+
// "could not find declaration file for .../dist/index.js" noise that fires
|
|
11
|
+
// while the bundler rebuilds a dependency's dist. Paths are relative to THIS file
|
|
12
|
+
// (TS >=5.0 resolves `paths` in `extends` relative to the declaring
|
|
13
|
+
// config). The one exception is substrate-client, the lone DOM-lib package
|
|
14
|
+
// (transport/ws.ts names `BinaryType`); it is back in the workspace, so a
|
|
15
|
+
// consumer app that resolves it to source fails this ES2025-only lib.
|
|
16
|
+
// Such an app (apps/substrate, for `substrate ask`) overrides `paths` in its own
|
|
17
|
+
// tsconfig to point `@mnmal-ai/substrate-client` at its built dist/index.d.ts.
|
|
18
|
+
"paths": {
|
|
19
|
+
"@mnmal-ai/substrate/*": ["../../apps/substrate/src/exports/*.ts"],
|
|
20
|
+
"@mnmal-ai/*": ["../*/src/index.ts", "../../plugins/*/src/index.ts"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": true,
|
|
5
|
+
"noUncheckedIndexedAccess": true,
|
|
6
|
+
"exactOptionalPropertyTypes": true,
|
|
7
|
+
"target": "ES2025",
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"moduleResolution": "Bundler",
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"isolatedModules": true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./tsconfig.base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
// Resolve workspace imports to package SOURCE for type-checking + the
|
|
7
|
+
// editor LSP, not built dist/*.d.ts — kills the transient TS7016
|
|
8
|
+
// "could not find declaration file" noise that fires while the bundler rebuilds a
|
|
9
|
+
// dependency's dist. Paths are relative to THIS file (TS >=5.0 resolves
|
|
10
|
+
// `paths` in `extends` relative to the declaring config). Subpath imports
|
|
11
|
+
// (e.g. @mnmal-ai/substrate-embedder/fake) don't match and fall through to
|
|
12
|
+
// exports resolution. tsconfig.app.json carries the same map; only
|
|
13
|
+
// tsconfig.dts.json is deliberately excluded (declaration emit must
|
|
14
|
+
// reference packages by name, not source).
|
|
15
|
+
"paths": {
|
|
16
|
+
"@mnmal-ai/substrate/*": ["../../apps/substrate/src/exports/*.ts"],
|
|
17
|
+
"@mnmal-ai/*": ["../*/src/index.ts", "../../plugins/*/src/index.ts"]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|