mise-projen 0.0.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.
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Downloads a JSON schema from a URL and writes it to a local file.
4
+ *
5
+ * Used by the "upgrade-bundled" task to refresh vendored JSON schemas
6
+ * (e.g. schemas/pyproject.json, schemas/uv.json) that are not published
7
+ * as npm packages and therefore can't be upgraded via a dependency bump.
8
+ *
9
+ * Usage: node scripts/update-schema.js <url> <destPath>
10
+ */
11
+ const { writeFileSync } = require("node:fs");
12
+
13
+ async function main() {
14
+ const [url, destPath] = process.argv.slice(2);
15
+ if (!url || !destPath) {
16
+ console.error("Usage: node scripts/update-schema.js <url> <destPath>");
17
+ process.exit(1);
18
+ }
19
+
20
+ const response = await fetch(url);
21
+ if (!response.ok) {
22
+ throw new Error(
23
+ `Failed to download schema from ${url}: ${response.status} ${response.statusText}`,
24
+ );
25
+ }
26
+
27
+ const text = await response.text();
28
+ // Validate that the response is valid JSON before overwriting the cached file.
29
+ const parsed = JSON.parse(text);
30
+
31
+ writeFileSync(destPath, `${JSON.stringify(parsed, null, 2)}\n`);
32
+ console.log(`Updated ${destPath} from ${url}`);
33
+ }
34
+
35
+ main().catch((err) => {
36
+ console.error(err);
37
+ process.exit(1);
38
+ });