2024-01-01 14:58:21 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2022-03-01 15:40:32 -05:00
|
|
|
|
2022-07-19 16:35:58 -04:00
|
|
|
import { $, ReleasesMdFile, Repo } from "./deps.ts";
|
2022-03-01 15:40:32 -05:00
|
|
|
|
|
|
|
export class DenoWorkspace {
|
|
|
|
#repo: Repo;
|
|
|
|
|
|
|
|
static get rootDirPath() {
|
2022-07-19 16:35:58 -04:00
|
|
|
const currentDirPath = $.path.dirname($.path.fromFileUrl(import.meta.url));
|
|
|
|
return $.path.resolve(currentDirPath, "../../");
|
2022-03-01 15:40:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static async load(): Promise<DenoWorkspace> {
|
|
|
|
return new DenoWorkspace(
|
2022-03-30 16:37:00 -04:00
|
|
|
await Repo.load({
|
|
|
|
name: "deno",
|
|
|
|
path: DenoWorkspace.rootDirPath,
|
|
|
|
}),
|
2022-03-01 15:40:32 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
private constructor(repo: Repo) {
|
|
|
|
this.#repo = repo;
|
|
|
|
}
|
|
|
|
|
|
|
|
get repo() {
|
|
|
|
return this.#repo;
|
|
|
|
}
|
|
|
|
|
|
|
|
get crates() {
|
|
|
|
return this.#repo.crates;
|
|
|
|
}
|
|
|
|
|
2022-03-16 20:33:14 -04:00
|
|
|
/** Gets the CLI dependency crates that should be published. */
|
|
|
|
getCliDependencyCrates() {
|
|
|
|
return this.getCliCrate()
|
|
|
|
.descendantDependenciesInRepo()
|
|
|
|
.filter((c) => c.name !== "test_util");
|
2022-03-01 15:40:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
getCliCrate() {
|
|
|
|
return this.getCrate("deno");
|
|
|
|
}
|
|
|
|
|
|
|
|
getCrate(name: string) {
|
|
|
|
return this.#repo.getCrate(name);
|
|
|
|
}
|
2022-03-04 22:28:23 -05:00
|
|
|
|
2022-04-02 11:25:12 -04:00
|
|
|
getReleasesMdFile() {
|
|
|
|
return new ReleasesMdFile(
|
2022-07-19 16:35:58 -04:00
|
|
|
$.path.join(DenoWorkspace.rootDirPath, "Releases.md"),
|
2022-04-02 11:25:12 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-07-19 16:35:58 -04:00
|
|
|
async runFormatter() {
|
|
|
|
await this.#repo.command(
|
2023-09-03 00:39:15 -04:00
|
|
|
"deno run --unstable --allow-write --allow-read --allow-net --allow-run ./tools/format.js",
|
2022-07-19 16:35:58 -04:00
|
|
|
);
|
2022-03-04 22:28:23 -05:00
|
|
|
}
|
2022-03-01 15:40:32 -05:00
|
|
|
}
|