diff options
author | 2021-10-28 17:33:40 -0700 | |
---|---|---|
committer | 2021-10-28 17:33:40 -0700 | |
commit | b6675dd0abadbcd29c6ff10010fda1afefbc4559 (patch) | |
tree | 20b5cf9068710583c935ee3b51bb8bcdca7cd61d /src | |
parent | dff40c5220fc080f80b46e1caac5618b7d25ec33 (diff) | |
download | bun-b6675dd0abadbcd29c6ff10010fda1afefbc4559.tar.gz bun-b6675dd0abadbcd29c6ff10010fda1afefbc4559.tar.zst bun-b6675dd0abadbcd29c6ff10010fda1afefbc4559.zip |
Explicitly check content type
Diffstat (limited to '')
-rw-r--r-- | src/cli.zig | 4 | ||||
-rw-r--r-- | src/cli/install.sh | 52 | ||||
-rw-r--r-- | src/cli/upgrade_command.zig | 5 |
3 files changed, 21 insertions, 40 deletions
diff --git a/src/cli.zig b/src/cli.zig index 9748945e8..514ab764d 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -146,7 +146,7 @@ pub const Arguments = struct { clap.parseParam("-i, --inject <STR>... Inject module at the top of every file") catch unreachable, clap.parseParam("-l, --loader <STR>... Parse files with .ext:loader, e.g. --loader .js:jsx. Valid loaders: jsx, js, json, tsx, ts, css") catch unreachable, clap.parseParam("--origin <STR> Rewrite import paths to start with --origin. Default: \"\"") catch unreachable, - clap.parseParam("--port <STR> Port to serve Bun's dev server on. Default: \"/3000\"") catch unreachable, + clap.parseParam("--port <STR> Port to serve Bun's dev server on. Default: \"3000\"") catch unreachable, clap.parseParam("--silent Don't repeat the command for bun run") catch unreachable, // clap.parseParam("-o, --outdir <STR> Save output to directory (default: \"out\" if none provided and multiple entry points passed)") catch unreachable, @@ -477,7 +477,7 @@ const HelpCommand = struct { \\> <r> <b><cyan>create<r><d> next ./app<r> Start a new project from a template<r> \\> <r> <b><magenta>bun <r><d> ./a.ts ./b.jsx<r> Bundle dependencies of input files into a <r><magenta>.bun<r> \\> <r> <green>run <r><d> ./a.ts <r> Run a JavaScript-like file with Bun.js - \\> <r> <b><blue>discord<r> Open Bun's Discord server + \\> <r> <b><blue>discord<r> Open Bun's Discord server \\> <r> <b><blue>upgrade <r> Get the latest version of Bun \\> <r> <b><d>help <r> Print this help menu \\ diff --git a/src/cli/install.sh b/src/cli/install.sh index e771ba28d..9c92bb745 100644 --- a/src/cli/install.sh +++ b/src/cli/install.sh @@ -1,52 +1,28 @@ #!/bin/bash - # Reset -Color_Off='' # Text Reset +Color_Off='' # Regular Colors -Black='' # Black -Red='' # Red -Green='' # Green -Yellow='' # Yellow -Blue='' # Blue -Purple='' # Purple -Cyan='' # Cyan -White='' # White +Red='' +Green='' # Bold -BBlack='' # Black -BRed='' # Red -BGreen='' # Green -BYellow='' # Yellow -BBlue='' # Blue -BPurple='' # Purple -BCyan='' # Cyan -BWhite='' # White +BWhite='' +BGreen='' if test -t 1; then -# Reset -Color_Off='\033[0m' # Text Reset + # Reset + Color_Off='\033[0m' # Text Reset -# Regular Colors -Black='\033[0;30m' # Black -Red='\033[0;31m' # Red -Green='\033[0;32m' # Green -Yellow='\033[0;33m' # Yellow -Blue='\033[0;34m' # Blue -Purple='\033[0;35m' # Purple -Cyan='\033[0;36m' # Cyan -White='\033[0;37m' # White + # Regular Colors + Red='\033[0;31m' # Red + Green='\033[0;32m' # Green + White='\033[0;37m' # White -# Bold -BBlack='\033[1;30m' # Black -BRed='\033[1;31m' # Red -BGreen='\033[1;32m' # Green -BYellow='\033[1;33m' # Yellow -BBlue='\033[1;34m' # Blue -BPurple='\033[1;35m' # Purple -BCyan='\033[1;36m' # Cyan -BWhite='\033[1;37m' # White + # Bold + BGreen='\033[1;32m' # Green + BWhite='\033[1;37m' # White fi diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig index 1ea8b5391..af6c4e97a 100644 --- a/src/cli/upgrade_command.zig +++ b/src/cli/upgrade_command.zig @@ -270,6 +270,11 @@ pub const UpgradeCommand = struct { var assets = assets_.expr.asArray() orelse break :get_asset; while (assets.next()) |asset| { + if (asset.asProperty("content_type")) |content_type| { + const content_type_ = (content_type.expr.asString(allocator)) orelse continue; + if (!strings.eqlComptime(content_type, "application/zip")) continue; + } + if (asset.asProperty("name")) |name_| { if (name_.expr.asString(allocator)) |name| { if (strings.eqlComptime(name, Version.zip_filename)) { |