-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip: poetry port * feat: poetry port Added a hook into pipi port to inject dependencies. * fix: fmt & lint * fix: typing * fix: `dependencies` field visibility * fix: naming & formatting
- Loading branch information
1 parent
7b19bc7
commit 4c1295f
Showing
3 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { | ||
defaultLatestStable, | ||
InstallConfigSimple, | ||
osXarch, | ||
zod, | ||
} from "../port.ts"; | ||
import { Port as PipiPort } from "./pipi.ts"; | ||
import { | ||
ALL_ARCH, | ||
ALL_OS, | ||
DownloadArgs, | ||
InstallArgs, | ||
InstallConfigLiteX, | ||
ListAllArgs, | ||
} from "../modules/ports/types.ts"; | ||
import * as std_ports from "../modules/ports/std.ts"; | ||
|
||
export const manifest = { | ||
ty: "denoWorker@v1" as const, | ||
name: "poetry", | ||
version: "0.1.0", | ||
moduleSpecifier: import.meta.url, | ||
buildDeps: [std_ports.cpy_bs_ghrel], | ||
platforms: osXarch([...ALL_OS], [...ALL_ARCH]), | ||
}; | ||
|
||
const confValidator = zod.object({ | ||
plugins: zod.array(zod.object({ | ||
name: zod.string(), | ||
version: zod.string().nullish(), | ||
})).nullish(), | ||
}).passthrough(); | ||
|
||
export type PoetryInstallConf = | ||
& InstallConfigSimple | ||
& zod.input<typeof confValidator>; | ||
|
||
export default function conf(config: PoetryInstallConf = {}) { | ||
return { | ||
...config, | ||
port: manifest, | ||
}; | ||
} | ||
|
||
const toPipiConfig = (config: InstallConfigLiteX) => ({ | ||
...config, | ||
packageName: "poetry", | ||
peerDeps: config.plugins, | ||
}); | ||
|
||
export class Port extends PipiPort { | ||
listAll(args: ListAllArgs) { | ||
return super.listAll({ ...args, config: toPipiConfig(args.config) }); | ||
} | ||
|
||
latestStable(args: ListAllArgs): Promise<string> { | ||
return defaultLatestStable(this, { | ||
...args, | ||
config: toPipiConfig(args.config), | ||
}); | ||
} | ||
|
||
download(args: DownloadArgs) { | ||
return super.download({ ...args, config: toPipiConfig(args.config) }); | ||
} | ||
|
||
install(args: InstallArgs) { | ||
return super.install({ ...args, config: toPipiConfig(args.config) }); | ||
} | ||
} |