mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 04:51:22 +00:00
2b279ad630
As discussed with @mmastrac. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
61 lines
1.3 KiB
TypeScript
61 lines
1.3 KiB
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
import { $, ReleasesMdFile, 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({
|
|
name: "deno",
|
|
path: DenoWorkspace.rootDirPath,
|
|
}),
|
|
);
|
|
}
|
|
|
|
private constructor(repo: Repo) {
|
|
this.#repo = repo;
|
|
}
|
|
|
|
get repo() {
|
|
return this.#repo;
|
|
}
|
|
|
|
get crates() {
|
|
return this.#repo.crates;
|
|
}
|
|
|
|
/** Gets the CLI dependency crates that should be published. */
|
|
getCliDependencyCrates() {
|
|
return this.getCliCrate()
|
|
.descendantDependenciesInRepo()
|
|
.filter((c) => c.name !== "test_server");
|
|
}
|
|
|
|
getCliCrate() {
|
|
return this.getCrate("deno");
|
|
}
|
|
|
|
getCrate(name: string) {
|
|
return this.#repo.getCrate(name);
|
|
}
|
|
|
|
getReleasesMdFile() {
|
|
return new ReleasesMdFile(
|
|
$.path.join(DenoWorkspace.rootDirPath, "Releases.md"),
|
|
);
|
|
}
|
|
|
|
async runFormatter() {
|
|
await this.#repo.command(
|
|
"deno run --allow-write --allow-read --allow-net --allow-run ./tools/format.js",
|
|
);
|
|
}
|
|
}
|