forked from x/icebergs
add node
This commit is contained in:
parent
5a1f38e7d9
commit
746fb79e7c
@ -99,6 +99,7 @@ const (
|
||||
MIPSLE = "mipsle"
|
||||
GOOS = "GOOS"
|
||||
LINUX = "linux"
|
||||
MACOS = "macos"
|
||||
DARWIN = "darwin"
|
||||
WINDOWS = "windows"
|
||||
)
|
||||
|
@ -19,9 +19,10 @@ func init() {
|
||||
func IsSearchForEach(m *ice.Message, arg []string, cb func() []string) bool {
|
||||
if arg[0] == FOREACH && arg[1] == "" {
|
||||
if cb != nil {
|
||||
args := cb()
|
||||
if args := cb(); len(args) > 0 {
|
||||
m.PushSearch(TYPE, kit.Select("", args, 0), NAME, kit.Select("", args, 1), TEXT, kit.Select("", args, 2))
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
@ -24,6 +24,17 @@ func init() {
|
||||
})
|
||||
}},
|
||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { PackFile.Remove(path.Clean(m.Option(PATH))) }},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == mdb.FOREACH {
|
||||
OptionFiles(m, PackFile)
|
||||
m.Cmd(DIR, SRC, PATH, kit.Dict(DIR_REG, kit.Format(`.*%s.*\.shy`, arg[1]), DIR_DEEP, ice.TRUE, DIR_TYPE, CAT), func(value ice.Maps) {
|
||||
m.PushSearch(mdb.TYPE, SHY, mdb.NAME, value[PATH])
|
||||
})
|
||||
m.Cmd(DIR, USR, PATH, kit.Dict(DIR_REG, kit.Format(`.*%s.*\.shy`, arg[1]), DIR_DEEP, ice.TRUE, DIR_TYPE, CAT), func(value ice.Maps) {
|
||||
m.PushSearch(mdb.TYPE, SHY, mdb.NAME, value[PATH])
|
||||
})
|
||||
}
|
||||
}},
|
||||
mdb.IMPORT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
OptionFiles(m, DiskFile)
|
||||
Open(m, path.Join(m.Option(PATH), m.Option(FILE)), func(r io.Reader, p string) {
|
||||
|
@ -65,7 +65,7 @@ func _binpack_all(m *ice.Message) {
|
||||
for _, k := range kit.SortedKey(list) {
|
||||
v := kit.Select(k, list[k])
|
||||
m.Cmd(nfs.DIR, nfs.PWD, nfs.PATH, kit.Dict(nfs.DIR_ROOT, v, nfs.DIR_REG, kit.ExtReg(SH, SHY, PY, JS, CSS, HTML))).Table(func(value ice.Maps) {
|
||||
if ice.Info.Make.Remote != "shylinux.com/x/contexts" && kit.HasPrefix(k, ice.USR_ICEBERGS) {
|
||||
if ice.Info.Make.Remote != "https://shylinux.com/x/contexts" && kit.HasPrefix(k, ice.USR_ICEBERGS) {
|
||||
return
|
||||
}
|
||||
_binpack_file(m, w, kit.Path(v, value[nfs.PATH]), path.Join(k, value[nfs.PATH]))
|
||||
|
@ -76,11 +76,9 @@ func _install_build(m *ice.Message, arg ...string) string {
|
||||
}
|
||||
func _install_order(m *ice.Message, arg ...string) {
|
||||
p := _install_path(m, "")
|
||||
if m.Option(nfs.PATH) == "" {
|
||||
kit.For([]string{"", "sbin", "bin", "_install/bin"}, func(v string) {
|
||||
kit.If(nfs.Exists(m, path.Join(p, v)), func() { m.Option(nfs.PATH, v) })
|
||||
})
|
||||
}
|
||||
m.Cmdy(cli.SYSTEM, nfs.PUSH, path.Join(p, m.Option(nfs.PATH)))
|
||||
}
|
||||
func _install_spawn(m *ice.Message, arg ...string) {
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/lex"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
@ -44,6 +45,18 @@ func _spark_md(m *ice.Message, arg ...string) *ice.Message {
|
||||
func _spark_show(m *ice.Message, name, text string, arg ...string) *ice.Message {
|
||||
return _wiki_template(m.Options(mdb.LIST, kit.SplitLine(text)), name, name, text, arg...)
|
||||
}
|
||||
func _spark_tabs(m *ice.Message, arg ...string) {
|
||||
m.Echo(`<div class="story" data-type="spark_tabs">`)
|
||||
{
|
||||
m.Echo(`<div class="tabs">`)
|
||||
{
|
||||
kit.For(arg[1:], func(k, v string) { m.Echo(`<div class="item">%s</div>`, k) })
|
||||
}
|
||||
m.Echo(`</div>`)
|
||||
kit.For(arg[1:], func(k, v string) { m.Cmdy("", arg[0], v) })
|
||||
}
|
||||
m.Echo(`</div>`)
|
||||
}
|
||||
|
||||
const (
|
||||
SHELL = "shell"
|
||||
@ -60,6 +73,8 @@ func init() {
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.Ext(arg[0]) == "md" {
|
||||
_spark_md(m, arg...)
|
||||
} else if arg[0] == SHELL && kit.IsIn(kit.Select("", arg, 1), cli.LINUX, cli.MACOS, cli.DARWIN, cli.WINDOWS) {
|
||||
_spark_tabs(m, arg...)
|
||||
} else {
|
||||
arg = _name(m, arg)
|
||||
_spark_show(m, arg[0], strings.TrimSpace(arg[1]), arg[2:]...)
|
||||
|
@ -1,41 +1 @@
|
||||
package java
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const (
|
||||
MVN = "mvn"
|
||||
JAVA = "java"
|
||||
JAVAC = "javac"
|
||||
)
|
||||
|
||||
type compile struct {
|
||||
ice.Code
|
||||
regexp string `data:".*\.java$"`
|
||||
linux string `data:"https://mirrors.huaweicloud.com/openjdk/18/openjdk-18_linux-x64_bin.tar.gz"`
|
||||
list string `name:"list path auto listScript order install" help:"编译器"`
|
||||
}
|
||||
|
||||
func (s compile) Init(m *ice.Message) {
|
||||
cli.IsAlpine(m.Message, JAVA, "openjdk8")
|
||||
cli.IsAlpine(m.Message, JAVAC, "openjdk8")
|
||||
cli.IsAlpine(m.Message, MVN, "maven openjdk8")
|
||||
cli.IsCentos(m.Message, JAVA, "java-1.8.0-openjdk-devel.x86_64")
|
||||
cli.IsCentos(m.Message, JAVAC, "java-1.8.0-openjdk-devel.x86_64")
|
||||
cli.IsCentos(m.Message, MVN, "maven java-1.8.0-openjdk-devel.x86_64")
|
||||
}
|
||||
func (s compile) List(m *ice.Message, arg ...string) {
|
||||
s.Code.Source(m, "", arg...)
|
||||
}
|
||||
func (s compile) RunScript(m *ice.Message) {
|
||||
if s.Code.System(m, nfs.PWD, JAVAC, "-d", ice.BIN, m.Option(nfs.PATH)); cli.IsSuccess(m.Message) {
|
||||
s.Code.System(m, nfs.PWD, JAVA, "-cp", kit.Path(ice.BIN), strings.TrimPrefix(strings.TrimSuffix(m.Option(nfs.PATH), ".java"), "src/"))
|
||||
}
|
||||
}
|
||||
func init() { ice.CodeCtxCmd(compile{}) }
|
||||
|
@ -1,18 +0,0 @@
|
||||
section "java"
|
||||
refer `
|
||||
官网 https://www.java.com/
|
||||
文档 https://docs.oracle.com/javase/tutorial/
|
||||
源码 https://github.com/openjdk/jdk
|
||||
开源 https://openjdk.org/
|
||||
`
|
||||
field web.code.java.compile
|
||||
|
||||
shell `
|
||||
wget https://github.com/Tencent/TencentKona-8/releases/download/8.0.11-GA/TencentKona8.0.11.b2_jdk_linux-x86_64_8u345.tar.gz
|
||||
tar xvf TencentKona8.0.11.b2_jdk_linux-x86_64_8u345.tar.gz && cd TencentKona-8.0.11-345/
|
||||
|
||||
https://repo.huaweicloud.com/java/jdk/8u202-b08/
|
||||
wget https://mirrors.huaweicloud.com/openjdk/18/openjdk-18_linux-x64_bin.tar.gz
|
||||
tar xvf openjdk-18_linux-x64_bin.tar.gz && cd jdk-18
|
||||
`
|
||||
|
41
misc/java/java.go
Normal file
41
misc/java/java.go
Normal file
@ -0,0 +1,41 @@
|
||||
package java
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const (
|
||||
MVN = "mvn"
|
||||
JAVA = "java"
|
||||
JAVAC = "javac"
|
||||
)
|
||||
|
||||
type java struct {
|
||||
ice.Code
|
||||
regexp string `data:"java"`
|
||||
linux string `data:"https://mirrors.huaweicloud.com/openjdk/18/openjdk-18_linux-x64_bin.tar.gz"`
|
||||
list string `name:"list path auto listScript order install" help:"编译器"`
|
||||
}
|
||||
|
||||
func (s java) Init(m *ice.Message) {
|
||||
cli.IsAlpine(m.Message, JAVA, "openjdk8")
|
||||
cli.IsAlpine(m.Message, JAVAC, "openjdk8")
|
||||
cli.IsAlpine(m.Message, MVN, "maven openjdk8")
|
||||
cli.IsCentos(m.Message, JAVA, "java-1.8.0-openjdk-devel.x86_64")
|
||||
cli.IsCentos(m.Message, JAVAC, "java-1.8.0-openjdk-devel.x86_64")
|
||||
cli.IsCentos(m.Message, MVN, "maven java-1.8.0-openjdk-devel.x86_64")
|
||||
}
|
||||
func (s java) List(m *ice.Message, arg ...string) {
|
||||
s.Code.Source(m, "", arg...)
|
||||
}
|
||||
func (s java) RunScript(m *ice.Message) {
|
||||
if s.Code.System(m, nfs.PWD, JAVAC, "-d", ice.BIN, m.Option(nfs.PATH)); cli.IsSuccess(m.Message) {
|
||||
s.Code.System(m, nfs.PWD, JAVA, "-cp", kit.Path(ice.BIN), strings.TrimPrefix(strings.TrimSuffix(m.Option(nfs.PATH), ".java"), "src/"))
|
||||
}
|
||||
}
|
||||
func init() { ice.CodeCtxCmd(java{}) }
|
20
misc/java/java.shy
Normal file
20
misc/java/java.shy
Normal file
@ -0,0 +1,20 @@
|
||||
section "java"
|
||||
refer `
|
||||
官网 https://www.java.com/
|
||||
文档 https://docs.oracle.com/javase/tutorial/
|
||||
下载 https://repo.huaweicloud.com/java/jdk/8u202-b08/
|
||||
源码 https://github.com/openjdk/jdk
|
||||
开源 https://openjdk.org/
|
||||
`
|
||||
field web.code.java.java
|
||||
|
||||
shell linux `
|
||||
wget https://mirrors.huaweicloud.com/openjdk/18/openjdk-18_linux-x64_bin.tar.gz
|
||||
tar xvf openjdk-18_linux-x64_bin.tar.gz && cd jdk-18
|
||||
` macos `
|
||||
curl -O https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-macosx-x64.dmg
|
||||
open jdk-8u202-macosx-x64.dmg
|
||||
` window `
|
||||
wget https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-windows-x64.exe
|
||||
explore jdk-8u202-windows-x64.exe
|
||||
`
|
1
misc/node.go
Normal file
1
misc/node.go
Normal file
@ -0,0 +1 @@
|
||||
package misc
|
14
misc/node/admin.shy
Normal file
14
misc/node/admin.shy
Normal file
@ -0,0 +1,14 @@
|
||||
section "admin"
|
||||
refer `
|
||||
https://www.imooc.com/course/list?c=nodejs
|
||||
https://gitee.com/talelin
|
||||
https://doc.cms.talelin.com
|
||||
http://face.cms.talelin.com
|
||||
https://www.imooc.com/video/23022
|
||||
https://www.imooc.com/video/23025
|
||||
`
|
||||
|
||||
shell `
|
||||
git clone -b imooc-island https://gitee.com/talelin/lin-cms-vue.git
|
||||
git clone -b imooc-island https://gitee.com/talelin/lin-cms-koa.git
|
||||
`
|
@ -1,12 +0,0 @@
|
||||
section "node"
|
||||
refer `
|
||||
官网 https://nodejs.org/
|
||||
文档 https://nodejs.org/docs/latest-v6.x/api/
|
||||
源码 https://github.com/nodejs/node
|
||||
`
|
||||
field web.code.node.compile
|
||||
|
||||
shell `
|
||||
wget https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-linux-x64.tar.xz
|
||||
tar xvf node-v16.15.1-linux-x64.tar.xz && cd node-v16.15.1-linux-x64
|
||||
`
|
7
misc/node/grpc.shy
Normal file
7
misc/node/grpc.shy
Normal file
@ -0,0 +1,7 @@
|
||||
section "grpc"
|
||||
shell `
|
||||
cnpm i --save-dev grpc-web
|
||||
cnpm i --save-dev google-protobuf
|
||||
cnpm i -g protoc-gen-js protoc-gen-grpc-web
|
||||
protoc --js_out=import_style=commonjs:./demo/src --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./demo/src ./idl/*.proto
|
||||
`
|
@ -11,22 +11,22 @@ const (
|
||||
NODE = "node"
|
||||
)
|
||||
|
||||
type compile struct {
|
||||
type node struct {
|
||||
ice.Code
|
||||
regexp string `data:".*\.js$"`
|
||||
regexp string `data:"js"`
|
||||
linux string `data:"https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-linux-x64.tar.xz"`
|
||||
darwin string `data:"https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-darwin-x64.tar.gz"`
|
||||
list string `name:"list path auto xterm listScript order install" help:"编译器"`
|
||||
list string `name:"list path auto xterm listScript order install" help:"node"`
|
||||
}
|
||||
|
||||
func (s compile) Init(m *ice.Message) {
|
||||
func (s node) Init(m *ice.Message) {
|
||||
cli.IsAlpine(m.Message, NPM)
|
||||
cli.IsAlpine(m.Message, NODE, "nodejs")
|
||||
}
|
||||
func (s compile) List(m *ice.Message, arg ...string) {
|
||||
func (s node) List(m *ice.Message, arg ...string) {
|
||||
s.Code.Source(m, "", arg...)
|
||||
}
|
||||
func (s compile) Xterm(m *ice.Message, arg ...string) {
|
||||
func (s node) Xterm(m *ice.Message, arg ...string) {
|
||||
s.Code.Xterm(m, []string{mdb.TYPE, NODE}, arg...)
|
||||
}
|
||||
func init() { ice.CodeCtxCmd(compile{}) }
|
||||
func init() { ice.CodeCtxCmd(node{}) }
|
28
misc/node/node.shy
Normal file
28
misc/node/node.shy
Normal file
@ -0,0 +1,28 @@
|
||||
section "node"
|
||||
refer `
|
||||
官网 https://nodejs.org/
|
||||
源码 https://github.com/nodejs/node
|
||||
文档 https://nodejs.org/docs/latest-v6.x/api/
|
||||
`
|
||||
|
||||
field web.code.node.node
|
||||
|
||||
shell linux `
|
||||
wget https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-linux-x64.tar.xz
|
||||
tar xvf node-v16.15.1-linux-x64.tar.xz && cd node-v16.15.1-linux-x64
|
||||
` macos `
|
||||
curl -O https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-darwin-x64.tar.xz
|
||||
tar xvf node-v16.15.1-darwin-x64.tar.xz && cd node-v16.15.1-darwin-x64
|
||||
` windows `
|
||||
http://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-x64.msi
|
||||
`
|
||||
|
||||
shell `
|
||||
./bin/node
|
||||
`
|
||||
|
||||
source npm.shy
|
||||
source vue.shy
|
||||
source grpc.shy
|
||||
source admin.shy
|
||||
source vscode.shy
|
4
misc/node/npm.shy
Normal file
4
misc/node/npm.shy
Normal file
@ -0,0 +1,4 @@
|
||||
section "npm"
|
||||
shell `
|
||||
./bin/npm install -g cnpm --registry=https://registry.npm.taobao.org
|
||||
`
|
13
misc/node/vscode.shy
Normal file
13
misc/node/vscode.shy
Normal file
@ -0,0 +1,13 @@
|
||||
section "vscode"
|
||||
refer `
|
||||
官网 https://code.visualstudio.com
|
||||
文档 https://code.visualstudio.com/docs
|
||||
`
|
||||
shell linux `
|
||||
|
||||
` macos `
|
||||
https://az764295.vo.msecnd.net/stable/b3e4e68a0bc097f0ae7907b217c1119af9e03435/VSCode-darwin-universal.zip
|
||||
https://vscode.cdn.azure.cn/stable/b3e4e68a0bc097f0ae7907b217c1119af9e03435/VSCode-darwin-universal.zip
|
||||
` windows `
|
||||
|
||||
`
|
@ -4,3 +4,9 @@ refer `
|
||||
源码 https://github.com/vuejs/vue
|
||||
入门 https://vuejs.org/guide/quick-start.html
|
||||
`
|
||||
|
||||
shell `
|
||||
cnpm install -g @vue/cli
|
||||
vue create demo && cd demo
|
||||
vue serve
|
||||
`
|
||||
|
Loading…
x
Reference in New Issue
Block a user