quarto-dev / quarto-dev/quarto-cli
platform arch refactor
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 6k
- Fork
- 458
- Merge medio
- 1g 9h
- PR unite (30g)
- 41
Descrizione
In working on #237 getting arm logic added in will take some interface redesign:
The existing Dependency interface is as such:
dependencies.ts
export interface Dependency {
name: string;
version: string;
"darwin"?: PlatformDependency;
"linux"?: PlatformDependency;
"windows": PlatformDependency;
}
which is used by say the esBuild (and dart/pandoc) resolvers:
return {
name: "esbuild javscript bundler",
version,
"windows": esBuildRelease("windows-64"),
"linux": esBuildRelease("linux-64"),
"darwin": esBuildRelease("darwin-64"),
};
these then are used in configure.ts as kDependencies
// Download dependencies
info("Downloading dependencies");
for (const dependency of kDependencies) {
info(`Preparing ${dependency.name}`);
const platformDep = dependency[Deno.build.os];
if (platformDep) {
info(`Downloading ${dependency.name}`);
const targetFile = await downloadBinaryDependency(platformDep, config);
info(`Configuring ${dependency.name}`);
await platformDep.configure(targetFile);
info(`Cleaning up`);
Deno.removeSync(targetFile);
}
info(`${dependency.name} complete.\n`);
}
APIs to consider:
nested archs - Deno.build.arch can be "x86_64" | "aarch64" making it easy to use as a key
export interface Dependency {
name: string;
version: string;
"aarch64": {
"darwin"?: PlatformDependency;
"linux"?: PlatformDependency;
"windows"?: PlatformDependency;
};
"x86_64": {
"darwin"?: PlatformDependency;
"linux"?: PlatformDependency;
"windows"?: PlatformDependency;
};
}
which would essentially result in dl resolution code changing to:
-const platformDep = dependency[Deno.build.os];
+const platformDep = dependency[Deno.build.arch][Deno.build.os];
or some flatter designs:
- x86 default:
- darwin + darwin-aarch64
- no default (my preference given a flat structure):
- darwin-x86_64 + darwin-x86_64
and do something like
-const platformDep = dependency[Deno.build.os];
+const platformDep = dependency[`${Deno.build.os}-${Deno.build.arch}`];
Secondarily, the other implication to consider in the surrounding code is that arm builds are still generally not as first-class. While it seems everything has x86 builds in place, even for misc dev versions, arm versions are more hit or miss. As such, the general codebase could potentially use a little love to make more informative where its hitting problems and potentially more aggressively halt. The existing code just tries to dl if it exists and regardless will print info(${dependency.name} complete.\n);
@dragonstyle any particular preferences or other interface designs come to mind?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Start with dependencies.ts and configure.ts, including the kDependencies loop and its use of Deno.build.os; review the existing resolver examples for esBuild, dart, and pandoc. Done means the project has a settled interface for OS and architecture selection and dependency setup reports missing or unsuccessful downloads instead of unconditionally printing completion.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- deno, typescript
- Ambito
- build-system, tooling
- Tipo di issue
- Refactoring
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100