Skip to content

Commit b00a8bd

Browse files
committed
refactor(cli): read the bundled signatures once
Keep the parsed release-signatures.json after the first read. Also shorten the changelog entry and keep scripts/**/*.mts in the tsconfig include.
1 parent 8b7f0c5 commit b00a8bd

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
### Changed
1111

12-
- The Coder CLI is now verified with Coder's new release signing key. A CLI
13-
from a release that Coder published before that key (2.29.0 to 2.39.4) is
14-
verified with the signature that Coder made for that release with the new
15-
key, which ships with the extension.
12+
- The Coder CLI is now verified with Coder's new release signing key. Coder
13+
2.29.0 to 2.39.4 were released before that key, so the extension ships with
14+
new signatures for them.
1615

1716
### Fixed
1817

‎src/cli/releaseSignatures.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import type { Logger } from "../logging/logger";
1010
* file, keyed by version (major.minor.patch) and then by binary name.
1111
*/
1212
export class ReleaseSignatures {
13+
private signatures?: Record<string, Record<string, string>>;
14+
1315
constructor(
1416
private readonly signaturesPath: string,
1517
private readonly logger: Logger,
@@ -21,10 +23,10 @@ export class ReleaseSignatures {
2123
binName: string,
2224
): Promise<string | undefined> {
2325
const release = `${version.major}.${version.minor}.${version.patch}`;
24-
const signatures = JSON.parse(
26+
this.signatures ??= JSON.parse(
2527
await fs.readFile(this.signaturesPath, "utf8"),
2628
) as Record<string, Record<string, string>>;
27-
const signature = signatures[release]?.[binName];
29+
const signature = this.signatures[release]?.[binName];
2830
if (signature) {
2931
this.logger.info("Using the bundled signature for", binName, release);
3032
}

‎tsconfig.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
"@repo/shared": ["./packages/shared/src/index.ts"]
1515
}
1616
},
17-
"include": ["src"]
17+
"include": ["src", "scripts/**/*.mts"]
1818
}

0 commit comments

Comments
 (0)