-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
8 deletions.
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,47 @@ | ||
#!/usr/bin/env -S tea -E | ||
|
||
/*--- | ||
args: | ||
- deno | ||
- run | ||
- --allow-read | ||
- --allow-env | ||
- --import-map={{ srcroot }}/import-map.json | ||
---*/ | ||
|
||
import { PackageRequirement, parsePackageRequirement } from "types" | ||
import usePantry from "hooks/usePantry.ts" | ||
import useFlags from "hooks/useFlags.ts" | ||
import hydrate from "prefab/hydrate.ts" | ||
|
||
const pantry = usePantry() | ||
|
||
useFlags() | ||
|
||
const mode: 'build' | 'install' = Deno.args.includes("-b") ? 'build' : 'install' | ||
const get_deps = async (pkg: PackageRequirement) => { | ||
const deps = await pantry.getDeps(pkg) | ||
switch (mode) { | ||
case 'build': | ||
return [...deps.build, ...deps.runtime] | ||
case 'install': | ||
return deps.runtime | ||
} | ||
} | ||
|
||
const dry = Deno.args.compactMap(arg => !arg.startsWith('-') && parsePackageRequirement(arg)) | ||
const explicit = new Set(dry.map(x=>x.project)) | ||
const wet = await hydrate(dry, get_deps) | ||
const gas = wet.pkgs.compactMap(({project}) => { | ||
if (Deno.args.includes('-i')) { | ||
return project | ||
} else { | ||
return explicit.has(project) || project | ||
} | ||
}) | ||
|
||
if (Deno.env.get("GITHUB_ACTIONS")) { | ||
console.log(`::set-output name=pkgs::${gas.join(" ")}\n`) | ||
} else { | ||
console.log(gas.join("\n")) | ||
} |
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,23 @@ | ||
#!/usr/bin/env -S tea -E | ||
|
||
/* | ||
--- | ||
args: | ||
- deno | ||
- run | ||
- --allow-net | ||
- --allow-read=/opt | ||
- --allow-write=/opt | ||
- --allow-run # uses `/bin/ln` | ||
- --import-map={{ srcroot }}/import-map.json | ||
--- | ||
*/ | ||
|
||
import repairLinks from "prefab/repair-links.ts" | ||
import { print } from "utils" | ||
|
||
print("this because otherwise console.verbose is not defined lol") | ||
|
||
for (const project of Deno.args) { | ||
await repairLinks(project) | ||
} |