1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-27 01:48:27 +08:00

opt webpack

This commit is contained in:
shaoying 2021-08-02 01:01:10 +08:00
parent d3e9ca1aeb
commit 3089574388
2 changed files with 22 additions and 17 deletions

View File

@ -205,17 +205,15 @@ func init() {
_action_show(m, arg[0], arg[1], arg[2], arg[3:]...) _action_show(m, arg[0], arg[1], arg[2], arg[3:]...)
}}, }},
"/cmd": {Name: "/cmd", Help: "命令", Action: map[string]*ice.Action{ "/cmd/": {Name: "/cmd/", Help: "命令", Action: map[string]*ice.Action{
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) { ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 { if len(arg) == 0 {
m.Push("index", "cli.system") arg = strings.Split(strings.TrimPrefix(m.Option("_names"), "/chat/cmd/"), "/")
m.Push("args", kit.Format(kit.Simple("pwd"))) m.Push("index", arg[0])
m.Push("args", kit.Format(arg[1:]))
m.Push("index", "cli.runtime")
m.Push("args", kit.Format(kit.Simple("procinfo")))
return return
} }
m.Cmdy(ctx.COMMAND, arg) m.Cmdy(ctx.COMMAND, arg[0])
}}, }},
cli.RUN: {Name: "command", Help: "执行", Hand: func(m *ice.Message, arg ...string) { cli.RUN: {Name: "command", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(arg) m.Cmdy(arg)
@ -223,8 +221,5 @@ func init() {
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.RenderDownload(path.Join(m.Conf(web.SERVE, kit.Keym(ice.VOLCANOS, kit.MDB_PATH)), "page/cmd.html")) m.RenderDownload(path.Join(m.Conf(web.SERVE, kit.Keym(ice.VOLCANOS, kit.MDB_PATH)), "page/cmd.html"))
}}, }},
"/cmd/": {Name: "/cmd/", Help: "命令", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.RenderDownload(path.Join(m.Conf(web.SERVE, kit.Keym(ice.VOLCANOS, kit.MDB_PATH)), "page/cmd.html"))
}},
}}) }})
} }

View File

@ -11,6 +11,13 @@ import (
kit "github.com/shylinux/toolkits" kit "github.com/shylinux/toolkits"
) )
func _volcanos(file ...string) string {
return path.Join(ice.USR_VOLCANOS, path.Join(file...))
}
func _publish(file ...string) string {
return path.Join(ice.USR_PUBLISH, path.Join(file...))
}
const WEBPACK = "webpack" const WEBPACK = "webpack"
func init() { func init() {
@ -62,19 +69,22 @@ func init() {
} }
m.Option(nfs.DIR_ROOT, "") m.Option(nfs.DIR_ROOT, "")
if f, p, e := kit.Create(path.Join(ice.USR_PUBLISH, WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), HTML))); m.Assert(e) { if f, p, e := kit.Create(_publish(WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), HTML))); m.Assert(e) {
f.WriteString(fmt.Sprintf(_pack, f.WriteString(fmt.Sprintf(_pack,
m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/cache.css")), m.Cmdx(nfs.CAT, _volcanos("page/cache.css")),
m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/index.css")), m.Cmdx(nfs.CAT, _volcanos("page/index.css")),
m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, ice.PROTO_JS)), m.Cmdx(nfs.CAT, _volcanos(ice.PROTO_JS)),
m.Cmdx(nfs.CAT, path.Join(ice.USR_PUBLISH, path.Join(WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), JS)))), m.Cmdx(nfs.CAT, _publish(path.Join(WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), JS)))),
m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/cache.js")), m.Cmdx(nfs.CAT, _volcanos("page/cache.js")),
m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/index.js")), m.Cmdx(nfs.CAT, _volcanos("page/index.js")),
)) ))
m.Echo(p) m.Echo(p)
} }
m.Cmd(nfs.COPY, _volcanos("page/can.css"), _volcanos("page/index.css"), _volcanos("page/cache.css"))
m.Cmd(nfs.COPY, _volcanos("page/can.js"), _volcanos("proto.js"), _volcanos("page/cache.js"))
}}, }},
mdb.PRUNES: {Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) { mdb.PRUNES: {Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(nfs.SAVE, path.Join(ice.USR_VOLCANOS, "page/cache.css"), "") m.Cmd(nfs.SAVE, path.Join(ice.USR_VOLCANOS, "page/cache.css"), "")