-
Notifications
You must be signed in to change notification settings - Fork 31
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
1 parent
3b7b9c0
commit 0e67d8b
Showing
10 changed files
with
329 additions
and
433 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
module github.com/txthinking/nami | ||
|
||
go 1.19 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/bitly/go-simplejson v0.5.0 | ||
github.com/d5/tengo/v2 v2.10.1 | ||
github.com/bitly/go-simplejson v0.5.1 | ||
github.com/d5/tengo/v2 v2.16.1 | ||
github.com/google/go-github v17.0.0+incompatible | ||
github.com/olekukonko/tablewriter v0.0.5 | ||
github.com/urfave/cli/v2 v2.3.0 | ||
go.etcd.io/bbolt v1.3.5 | ||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c | ||
github.com/urfave/cli/v2 v2.25.7 | ||
go.etcd.io/bbolt v1.3.8 | ||
golang.org/x/oauth2 v0.13.0 | ||
) | ||
|
||
require ( | ||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect | ||
github.com/golang/protobuf v1.4.2 // indirect | ||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/google/go-querystring v1.1.0 // indirect | ||
github.com/mattn/go-runewidth v0.0.9 // indirect | ||
github.com/russross/blackfriday/v2 v2.0.1 // indirect | ||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect | ||
golang.org/x/net v0.7.0 // indirect | ||
golang.org/x/sys v0.5.0 // indirect | ||
google.golang.org/appengine v1.6.6 // indirect | ||
google.golang.org/protobuf v1.25.0 // indirect | ||
github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect | ||
golang.org/x/net v0.17.0 // indirect | ||
golang.org/x/sys v0.13.0 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/protobuf v1.31.0 // indirect | ||
) |
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,54 @@ | ||
os := import("os") | ||
fmt := import("fmt") | ||
text := import("text") | ||
nami := import("nami") | ||
json := import("json") | ||
|
||
b := nami.sh1("curl", "-L", "https://go.dev/dl/?mode=json") | ||
if is_error(b) { | ||
fmt.println(b) | ||
os.exit(1) | ||
} | ||
v := json.decode(b)[0].version[2:] | ||
err := nami.write_file(nami.cache_dir+"/version", v) | ||
if is_error(err) { | ||
fmt.println(err) | ||
os.exit(1) | ||
} | ||
|
||
if nami.os != "linux" && nami.os != "darwin" && nami.os != "windows" { | ||
fmt.println("This package does not support your OS or Arch now. PR welcome: https://github.com/txthinking/nami/blob/master/package") | ||
os.exit(1) | ||
} | ||
|
||
if nami.os != "windows" { | ||
err := nami.sh("curl", "-L", "--progress-bar", "https://go.dev/dl/go"+v+"."+nami.os+"-"+nami.arch+".tar.gz", "-o", "/tmp/_.tgz") | ||
if is_error(err) { | ||
fmt.println(err) | ||
os.exit(1) | ||
} | ||
nami.sh("rm", "-rf", "/tmp/_") | ||
nami.sh("mkdir", "/tmp/_") | ||
nami.sh("tar", "zxvf", "/tmp/_.tgz", "-C", "/tmp/_") | ||
nami.sh("mv", "/tmp/_/go", nami.cache_dir+"/go") | ||
nami.write_file(nami.cache_dir+"/links", "go/bin/go\n") | ||
nami.append_file(nami.cache_dir+"/links", "go/bin/gofmt\n") | ||
} | ||
|
||
if nami.os == "windows" { | ||
if err := nami.sh("which", "7z"); is_error(err){ | ||
fmt.println("Please install 7z first: $ nami install 7z") | ||
os.exit(1) | ||
} | ||
err := nami.sh("curl", "-L", "--progress-bar", "https://go.dev/dl/go"+v+"."+nami.os+"-"+nami.arch+".zip", "-o", "/tmp/_.zip") | ||
if is_error(err) { | ||
fmt.println(err) | ||
os.exit(1) | ||
} | ||
nami.sh("rm", "-rf", "/tmp/_") | ||
nami.sh("mkdir", "/tmp/_") | ||
nami.sh("7z", "x", "/tmp/_.zip", "-o/tmp/_") | ||
nami.sh("mv", "/tmp/_/go", nami.cache_dir+"/go") | ||
nami.write_file(nami.cache_dir+"/links", "go/bin/go.exe\n") | ||
nami.append_file(nami.cache_dir+"/links", "go/bin/gofmt.exe\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,51 @@ | ||
// check os | ||
if (!(nami.os == "darwin" && nami.arch == "arm64") && !(nami.os == "darwin" && nami.arch == "amd64") && !(nami.os == "linux" && nami.arch == "arm64") && !(nami.os == "linux" && nami.arch == "amd64") && !(nami.os == "windows" && nami.arch == "amd64")) { | ||
echo("This package does not support your OS or Arch now. PR welcome: https://github.com/txthinking/nami/blob/master/package") | ||
exit(1) | ||
} | ||
|
||
// version | ||
var s = $1("curl -L https://nodejs.org/download/release/index.json") | ||
var v = JSON.parse(s).find(v => v.lts).version | ||
await writefile(`${nami.cache_dir}/version`, v) | ||
|
||
if (nami.os != "windows") { | ||
var s = "" | ||
if (nami.os == "darwin" && nami.arch == "arm64") { | ||
s = "darwin-arm64" | ||
} | ||
if (nami.os == "darwin" && nami.arch == "amd64") { | ||
s = "darwin-x64" | ||
} | ||
if (nami.os == "linux" && nami.arch == "arm64") { | ||
s = "linux-arm64" | ||
} | ||
if (nami.os == "linux" && nami.arch == "amd64") { | ||
s = "linux-x64" | ||
} | ||
s = `node-${v}-${s}` | ||
$(`curl -L --progress-bar https://nodejs.org/dist/${v}/${s}.tar.gz -o /tmp/_.tgz`) | ||
$`rm -rf /tmp/_` | ||
$`mkdir /tmp/_` | ||
$`tar zxvf /tmp/_.tgz -C /tmp/_` | ||
$(`mv /tmp/_/${s} ${nami.cache_dir}/node`) | ||
write_file(`${nami.cache_dir}/links`, "node/bin/node\n") | ||
append_file(`${nami.cache_dir}/links`, "node/bin/corepack\n") | ||
append_file(`${nami.cache_dir}/links`, "node/bin/npm\n") | ||
append_file(`${nami.cache_dir}/links`, "node/bin/npx\n") | ||
} | ||
if (nami.os == "windows") { | ||
if (!which("7z")) { | ||
throw 'need 7z, recommend $ nami install 7z'; | ||
} | ||
var s = `node-${v}-win-x64` | ||
$(`curl -L --progress-bar https://nodejs.org/dist/${v}/${s}.zip -o /tmp/_.zip`) | ||
$`rm -rf /tmp/_` | ||
$`mkdir /tmp/_` | ||
$`7z x /tmp/_.zip -o/tmp/_` | ||
$(`mv /tmp/_/${s} ${nami.cache_dir}/node`) | ||
write_file(`${nami.cache_dir}/links`, "node/bin/node.exe\n") | ||
append_file(`${nami.cache_dir}/links`, "node/bin/corepack\n") | ||
append_file(`${nami.cache_dir}/links`, "node/bin/npm\n") | ||
append_file(`${nami.cache_dir}/links`, "node/bin/npx\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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// check os | ||
if (!(nami.os == "darwin" && nami.arch == "arm64") && !(nami.os == "darwin" && nami.arch == "amd64") && !(nami.os == "linux" && nami.arch == "arm64") && !(nami.os == "linux" && nami.arch == "amd64")) { | ||
echo("This package does not support your OS or Arch now. PR welcome: https://github.com/txthinking/nami/blob/master/package") | ||
exit(1) | ||
} | ||
|
||
// version | ||
// var s = $1("curl -L https://ziglang.org/download/index.json") | ||
var v = "0.12.0-dev.899+027aabf49"; // force version since zig still not 1.0 | ||
await writefile(`${nami.cache_dir}/version`, v) | ||
|
||
var s = "" | ||
if (nami.os == "darwin" && nami.arch == "arm64") { | ||
s = "macos-aarch64" | ||
} | ||
if (nami.os == "darwin" && nami.arch == "amd64") { | ||
s = "macos-x86_64" | ||
} | ||
if (nami.os == "linux" && nami.arch == "arm64") { | ||
s = "linux-aarch64" | ||
} | ||
if (nami.os == "linux" && nami.arch == "amd64") { | ||
s = "linux-x86_64" | ||
} | ||
s = `zig-${s}-${v}` | ||
$(`curl -L --progress-bar https://ziglang.org/builds/${s}.tar.xz -o /tmp/_.txz`) | ||
$`rm -rf /tmp/_` | ||
$`mkdir /tmp/_` | ||
$`tar Jxvf /tmp/_.txz -C /tmp/_` | ||
$(`mv /tmp/_/${s} ${nami.cache_dir}/zig`) | ||
write_file(`${nami.cache_dir}/links`, "zig/zig\n") | ||
|
Oops, something went wrong.