feat: givingvthe deno scriptvan auto confirm option so it works in devcontainer.json postCreate script.

This commit is contained in:
Alex Yong 2025-08-07 02:34:16 +00:00
parent ae21da7711
commit 75e94f0a89
3 changed files with 21 additions and 7 deletions

View File

@ -10,7 +10,7 @@
"jdkDistro": "oracle"
}
},
"postCreateCommand": "chmod +x gradlew && cp revoltbuild.properties.example revoltbuild.properties && cp sentry.properties.example sentry.properties && cp app/google-services.json.example app/google-services.json && git submodule update --init --recursive",
"postCreateCommand": "chmod +x gradlew && deno run -A scripts/download_deps.ts --yes && cp revoltbuild.properties.example revoltbuild.properties && cp sentry.properties.example sentry.properties && cp app/google-services.json.example app/google-services.json && git submodule update --init --recursive",
"customizations": {
"vscode": {
"extensions": [

View File

@ -11,7 +11,7 @@ If you want to compile the app for yourself, you can also follow these guideline
:::danger
It may be tempting to skip some of these steps, but make sure you follow them to ensure that your development environment is set up correctly.
Note: If you are doing this in Github Codespaces, steps 1-10 (except 7) will be done for you.
Note: If you are doing this in Github Codespaces, steps 1-10 will be done for you.
:::
import { Tabs, TabItem, Steps } from "@astrojs/starlight/components"

View File

@ -1,4 +1,14 @@
import { resolve } from "jsr:@std/path"
import { parseArgs } from "jsr:@std/cli/parse-args"
const args = parseArgs(Deno.args, {
boolean: ["yes", "y", "auto-accept"],
alias: {
"y": "yes"
}
})
const autoAccept = args.yes || args["auto-accept"]
const outputFolderParent = resolve(Deno.cwd(), "app", "src", "main", "assets")
@ -13,7 +23,7 @@ try {
console.error(
"Usage: " +
"\x1b[35m" + // magenta
"deno run -A scripts/download_deps.ts" +
"deno run -A scripts/download_deps.ts [--yes|-y|--auto-accept]" +
"\x1b[0m" +
" from the " +
"\x1b[1;31;4m" + // bold red underline
@ -299,10 +309,14 @@ for (const dep of deps) {
console.log(`- ${dep.file} from ${dep.url}`)
}
console.log("Will download the above files.")
if (!confirm("Continue?")) {
console.log("Aborted.")
Deno.exit(0)
if (!autoAccept) {
console.log("Will download the above files.")
if (!confirm("Continue?")) {
console.log("Aborted.")
Deno.exit(0)
}
} else {
console.log("Will download the above files. (auto-accepted)")
}
const fontsFolder = resolve(outputFolder, "fonts")