1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/tools/release/deno_workspace.ts
David Sherret 96dc7421ae
chore: automatically update Releases.md when doing a release (#13837)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-03-04 22:28:23 -05:00

81 lines
1.6 KiB
TypeScript

// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import { path, Repo } from "./deps.ts";
export class DenoWorkspace {
#repo: Repo;
static get rootDirPath() {
const currentDirPath = path.dirname(path.fromFileUrl(import.meta.url));
return path.resolve(currentDirPath, "../../");
}
static async load(): Promise<DenoWorkspace> {
return new DenoWorkspace(
await Repo.load("deno", DenoWorkspace.rootDirPath),
);
}
private constructor(repo: Repo) {
this.#repo = repo;
}
get repo() {
return this.#repo;
}
get crates() {
return this.#repo.crates;
}
/** Gets the dependency crates used for the first part of the release process. */
getDependencyCrates() {
return [
this.getBenchUtilCrate(),
this.getSerdeV8Crate(),
this.getCoreCrate(),
...this.getExtCrates(),
this.getRuntimeCrate(),
];
}
getSerdeV8Crate() {
return this.getCrate("serde_v8");
}
getCliCrate() {
return this.getCrate("deno");
}
getCoreCrate() {
return this.getCrate("deno_core");
}
getRuntimeCrate() {
return this.getCrate("deno_runtime");
}
getBenchUtilCrate() {
return this.getCrate("deno_bench_util");
}
getExtCrates() {
const extPath = path.join(this.#repo.folderPath, "ext");
return this.crates.filter((c) => c.manifestPath.startsWith(extPath));
}
getCrate(name: string) {
return this.#repo.getCrate(name);
}
runFormatter() {
return this.#repo.runCommandWithOutput([
"deno",
"run",
"--allow-write",
"--allow-read",
"--allow-run",
"./tools/format.js",
]);
}
}