-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion-module-utils.mjs
More file actions
34 lines (29 loc) · 1001 Bytes
/
version-module-utils.mjs
File metadata and controls
34 lines (29 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-FileCopyrightText: 2026 CoreWeave, Inc.
// SPDX-License-Identifier: MIT
// SPDX-PackageName: weave-claude-plugin
import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import { VERSION as currentVersion } from '../../src/version.mjs';
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
const versionModulePath = path.join(repoRoot, 'src', 'version.mjs');
export function readVersionMetadata() {
if (typeof currentVersion !== 'string') {
throw new Error('Failed to read release metadata from src/version.mjs');
}
return {
version: currentVersion,
};
}
export function writeVersionModule({ version }) {
fs.writeFileSync(
versionModulePath,
[
'// BEGIN AUTO-MANAGED VERSION',
'// This section is maintained by release automation. Do not edit manually.',
`export const VERSION = '${version}';`,
'// END AUTO-MANAGED VERSION',
'',
].join('\n'),
);
}