Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
support typescript templates
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Sep 10, 2022
1 parent ee946f6 commit d717b04
Show file tree
Hide file tree
Showing 24 changed files with 633 additions and 776 deletions.
8 changes: 4 additions & 4 deletions cmd/app/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ func RemoveCMD() *cobra.Command {
}

remove.Remove(opts)

if botwaygo.GetBotInfo("bot.host_service") == "render.com" {
render.DeleteRenderService(args[0])
}
} else {
cmd.Help()
}
Expand All @@ -29,10 +33,6 @@ func RemoveCMD() *cobra.Command {

if botwaygo.GetBotInfo("bot.host_service") == "railway.app" {
cmd.PostRunE = Contextualize(handler.Delete, handler.Panic)
} else if botwaygo.GetBotInfo("bot.host_service") == "render.com" {
cmd.Run = func(cmd *cobra.Command, args []string) {
render.Deploy()
}
}

return cmd
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/npm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ RUN apk update && \

RUN npm i --production

ENTRYPOINT ["node", "./src/main.js"]
ENTRYPOINT ["npm", "start"]
2 changes: 1 addition & 1 deletion dockerfiles/pnpm.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ COPY . .
RUN pnpm fetch --prod
RUN pnpm install

ENTRYPOINT ["node", "./src/main.js"]
ENTRYPOINT ["pnpm", "start"]
2 changes: 1 addition & 1 deletion dockerfiles/yarn.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ COPY . .

RUN yarn

ENTRYPOINT ["node", "./src/main.js"]
ENTRYPOINT ["yarn", "start"]
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/abdfnx/botway
go 1.18

require (
github.com/AlecAivazis/survey/v2 v2.3.5
github.com/AlecAivazis/survey/v2 v2.3.6
github.com/MakeNowJust/heredoc v1.0.0
github.com/abdfnx/botwaygo v0.0.9
github.com/abdfnx/looker v0.1.0
Expand All @@ -26,7 +26,7 @@ require (
github.com/spf13/viper v1.13.0
github.com/tidwall/gjson v1.14.3
github.com/tidwall/sjson v1.2.5
golang.org/x/sys v0.0.0-20220908164124-27713097b956
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -95,7 +95,7 @@ require (
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4 // indirect
github.com/yuin/goldmark v1.4.14 // indirect
github.com/yuin/goldmark-emoji v1.0.1 // indirect
golang.org/x/net v0.0.0-20220907135653-1e95f45603a7 // indirect
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
10 changes: 8 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/AlecAivazis/survey/v2 v2.3.5 h1:A8cYupsAZkjaUmhtTYv3sSqc7LO5mp1XDfqe5E/9wRQ=
github.com/AlecAivazis/survey/v2 v2.3.5/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
github.com/AlecAivazis/survey/v2 v2.3.6 h1:NvTuVHISgTHEHeBFqt6BHOe4Ny/NwGZr7w+F8S9ziyw=
github.com/AlecAivazis/survey/v2 v2.3.6/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
Expand All @@ -46,6 +48,8 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63n
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/abdfnx/botwaygo v0.0.9 h1:Y1ZZst9Y97CYUvGfVQy7xOAKVtUYjU9qcmGlmq3UCV8=
github.com/abdfnx/botwaygo v0.0.9/go.mod h1:cSnH5z3N9YTIYlzOXwglI+gChnRFSvtNDkWJ7KMoqso=
github.com/abdfnx/botwaygo v0.0.83 h1:DZkQr1OmTWAQwylvgyITBmjFhHwdySAAWihNbGmYrXI=
github.com/abdfnx/botwaygo v0.0.83/go.mod h1:0HyyA0FxqRy94B++LOmg0w5wz7+7BMHVhzgPHhndimI=
github.com/abdfnx/looker v0.1.0 h1:tMN7E0wKIgbydAPPQ1RkppJ1bGHn+B+y9PZy7mwa+3U=
github.com/abdfnx/looker v0.1.0/go.mod h1:QVfPHnredPBUg4R+MtEkZbMBbqrgtoaj0JHO3KYkvyE=
github.com/abdfnx/resto v0.1.6 h1:yOM9O9bpMP4lb2ox0U7/gcFXO78P5eUZBxWuKrfdrFA=
Expand All @@ -62,8 +66,6 @@ github.com/botwayorg/gh v0.0.9 h1:jHXglsDdAup+wNAhLvqeeXNILTR4DEL12gubyDcxEWs=
github.com/botwayorg/gh v0.0.9/go.mod h1:E3dTBPLt3L9wogY7e4QPHqUYHAbWrlNnumKgu9tcglA=
github.com/botwayorg/git v0.0.0-20220813023031-a7a261511635 h1:AJLUr0Ef6avA5S2SXua7XG4yXI7vAjsZLBrZD5zCOk4=
github.com/botwayorg/git v0.0.0-20220813023031-a7a261511635/go.mod h1:XdqqKSxdEZz88SByHfT4Vwpl/b9gQK9tjZ/FQuwrM0g=
github.com/botwayorg/railway-api v0.0.1 h1:hJ83aYAceBMqwCGPAiardD8qth8mVtWo9sSsKLYln1Q=
github.com/botwayorg/railway-api v0.0.1/go.mod h1:ueVRSQ85zXHVOCU1kkHF9yC/s4YaxIIizFzwfvUlc3s=
github.com/botwayorg/railway-api v0.0.2 h1:IPYuZqpjPdJHK/wySYrajwaxJfVyFAN8pDhiH+qmkkQ=
github.com/botwayorg/railway-api v0.0.2/go.mod h1:pc0Ko0nhKt++RMk0O3+cmMZQtpNOlCqQDIVgjN95nos=
github.com/briandowns/spinner v1.19.0 h1:s8aq38H+Qju89yhp89b4iIiMzMm8YN3p6vGpwyh/a8E=
Expand Down Expand Up @@ -444,6 +446,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220907135653-1e95f45603a7 h1:1WGATo9HAhkWMbfyuVU0tEFP88OIkUvwaHFveQPvzCQ=
golang.org/x/net v0.0.0-20220907135653-1e95f45603a7/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI=
golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -517,6 +521,8 @@ golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2 h1:wM1k/lXfpc5HdkJJyW9GELpd8ERGdnh8sMGL6Gzq3Ho=
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
Expand Down
38 changes: 19 additions & 19 deletions internal/pipes/new/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func updatePlatforms(msg tea.Msg, m model) (tea.Model, tea.Cmd) {
case "j", "down":
m.PlatformChoice += 1
if m.PlatformChoice > 2 {
m.PlatformChoice = 3
m.PlatformChoice = 2
}

case "k", "up":
Expand All @@ -64,17 +64,17 @@ func updateLangs(msg tea.Msg, m model) (tea.Model, tea.Cmd) {
m.LangChoice += 1

if m.PlatformChoice == 2 {
if m.LangChoice > 1 {
m.LangChoice = 1
if m.LangChoice > 2 {
m.LangChoice = 2
}
} else {
if m.PlatformChoice == 0 {
if m.LangChoice > 14 {
m.LangChoice = 14
if m.LangChoice > 15 {
m.LangChoice = 15
}
} else {
if m.LangChoice > 13 {
m.LangChoice = 13
if m.LangChoice > 14 {
m.LangChoice = 14
}
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ func updatePMs(msg tea.Msg, m model) (tea.Model, tea.Cmd) {
m.PMChoice = 0
}
}
} else if m.LangChoice == 0 || m.LangChoice == 2 {
} else if m.LangChoice == 0 || m.LangChoice == 2 || m.LangChoice == 3 {
if m.PMChoice > 3 {
m.PMChoice = 3
}
Expand Down Expand Up @@ -151,31 +151,31 @@ func buildBot(msg tea.Msg, m model) (tea.Model, tea.Cmd) {
} else {
l = "Go"
}
} else if m.LangChoice == 2 || m.LangChoice == 5 {
} else if m.LangChoice == 2 || m.LangChoice == 3 || m.LangChoice == 6 {
l = "Node"
} else if m.LangChoice == 3 {
l = "Ruby"
} else if m.LangChoice == 4 {
l = "Ruby"
} else if m.LangChoice == 5 {
l = "Rust"
} else if m.LangChoice == 6 {
l = "C#"
} else if m.LangChoice == 7 {
l = "Dart"
l = "C#"
} else if m.LangChoice == 8 {
l = "Dart"
} else if m.LangChoice == 9 {
l = "PHP"
} else if m.LangChoice == 9 || m.LangChoice == 10 {
} else if m.LangChoice == 10 || m.LangChoice == 11 {
l = "Java"
} else if m.LangChoice == 11 {
l = "C++"
} else if m.LangChoice == 12 {
l = "Nim"
l = "C++"
} else if m.LangChoice == 13 {
l = "Nim"
} else if m.LangChoice == 14 {
if m.PlatformChoice == 1 {
l = "Swift"
} else {
l = "C"
}
} else if m.LangChoice == 14 {
} else if m.LangChoice == 15 {
l = "Crystal"
}

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions internal/pipes/new/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,23 @@ func NewBot(m model, l string, platform, lang int) {
os.Exit(0)
}

if lang == 5 {
if lang == 6 {
respone += "fileloader.ts"
}

if lang == 6 {
if lang == 7 {
respone = CSharpGitIgnore()
}

if lang == 9 || lang == 10 {
if lang == 8 || lang == 11 {
respone += "\n.gradle\nbuild"
}

if lang == 13 && platform == 1 {
if lang == 14 && platform == 1 {
respone += "\n.build\nPackage.resolved"
}

if lang == 14 {
if lang == 15 {
respone = `/docs/
/lib/
/bin/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (
"github.com/abdfnx/botway/templates/discord/java"
"github.com/abdfnx/botway/templates/discord/kotlin"
"github.com/abdfnx/botway/templates/discord/nim"
"github.com/abdfnx/botway/templates/discord/nodejs"
"github.com/abdfnx/botway/templates/discord/php"
"github.com/abdfnx/botway/templates/discord/python/pip"
"github.com/abdfnx/botway/templates/discord/python/pipenv"
"github.com/abdfnx/botway/templates/discord/python/poetry"
"github.com/abdfnx/botway/templates/discord/ruby"
"github.com/abdfnx/botway/templates/discord/rust"
"github.com/abdfnx/botway/templates/nodejs"
"github.com/abdfnx/botway/templates/ts"
)

func DiscordHandler(m model) {
Expand All @@ -30,38 +31,46 @@ func DiscordHandler(m model) {
} else if m.PlatformChoice == 0 && m.LangChoice == 1 {
dgo.DiscordGo(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 2 && m.PMChoice == 0 {
nodejs.DiscordNodejs(opts.BotName, "npm")
nodejs.Nodejs(opts.BotName, "npm", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 2 && m.PMChoice == 1 {
nodejs.DiscordNodejs(opts.BotName, "yarn")
nodejs.Nodejs(opts.BotName, "yarn", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 2 && m.PMChoice == 2 {
nodejs.DiscordNodejs(opts.BotName, "pnpm")
nodejs.Nodejs(opts.BotName, "pnpm", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 2 && m.PMChoice == 3 {
nodejs.DiscordNodejs(opts.BotName, "bun")
} else if m.PlatformChoice == 0 && m.LangChoice == 3 {
nodejs.Nodejs(opts.BotName, "bun", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 3 && m.PMChoice == 0 {
ts.NodejsTS(opts.BotName, "npm", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 3 && m.PMChoice == 1 {
ts.NodejsTS(opts.BotName, "yarn", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 3 && m.PMChoice == 2 {
ts.NodejsTS(opts.BotName, "pnpm", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 3 && m.PMChoice == 3 {
ts.NodejsTS(opts.BotName, "bun", "discord")
} else if m.PlatformChoice == 0 && m.LangChoice == 4 {
ruby.DiscordRuby(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 4 && m.PMChoice == 0 {
} else if m.PlatformChoice == 0 && m.LangChoice == 5 && m.PMChoice == 0 {
rust.DiscordRust(opts.BotName, "cargo")
} else if m.PlatformChoice == 0 && m.LangChoice == 4 && m.PMChoice == 1 {
} else if m.PlatformChoice == 0 && m.LangChoice == 5 && m.PMChoice == 1 {
rust.DiscordRust(opts.BotName, "fleet")
} else if m.PlatformChoice == 0 && m.LangChoice == 5 {
deno.DiscordDeno(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 6 {
csharp.DiscordCsharp(opts.BotName)
deno.DiscordDeno(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 7 {
dart.DiscordDart(opts.BotName)
csharp.DiscordCsharp(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 8 {
php.DiscordPHP(opts.BotName)
dart.DiscordDart(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 9 {
kotlin.DiscordKotlin(opts.BotName)
php.DiscordPHP(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 10 {
java.DiscordJava(opts.BotName)
kotlin.DiscordKotlin(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 11 {
cpp.DiscordCpp(opts.BotName)
java.DiscordJava(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 12 {
nim.DiscordNim(opts.BotName)
cpp.DiscordCpp(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 13 {
c.DiscordC(opts.BotName)
nim.DiscordNim(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 14 {
c.DiscordC(opts.BotName)
} else if m.PlatformChoice == 0 && m.LangChoice == 15 {
crystal.DiscordCrystal(opts.BotName)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package new

import (
"github.com/abdfnx/botway/templates/slack/nodejs"
"github.com/abdfnx/botway/templates/nodejs"
"github.com/abdfnx/botway/templates/slack/python/pip"
"github.com/abdfnx/botway/templates/slack/python/pipenv"
"github.com/abdfnx/botway/templates/slack/python/poetry"
"github.com/abdfnx/botway/templates/ts"
)

func SlackHandler(m model) {
Expand All @@ -15,12 +16,20 @@ func SlackHandler(m model) {
} else if m.PlatformChoice == 2 && m.LangChoice == 0 && m.PMChoice == 2 {
poetry.SlackPythonPoetry(opts.BotName)
} else if m.PlatformChoice == 2 && m.LangChoice == 1 && m.PMChoice == 0 {
nodejs.SlackNodejs(opts.BotName, "npm")
nodejs.Nodejs(opts.BotName, "npm", "slack")
} else if m.PlatformChoice == 2 && m.LangChoice == 1 && m.PMChoice == 1 {
nodejs.SlackNodejs(opts.BotName, "yarn")
nodejs.Nodejs(opts.BotName, "yarn", "slack")
} else if m.PlatformChoice == 2 && m.LangChoice == 1 && m.PMChoice == 2 {
nodejs.SlackNodejs(opts.BotName, "pnpm")
nodejs.Nodejs(opts.BotName, "pnpm", "slack")
} else if m.PlatformChoice == 2 && m.LangChoice == 1 && m.PMChoice == 3 {
nodejs.SlackNodejs(opts.BotName, "bun")
nodejs.Nodejs(opts.BotName, "bun", "slack")
} else if m.PlatformChoice == 2 && m.LangChoice == 2 && m.PMChoice == 0 {
ts.NodejsTS(opts.BotName, "npm", "slack")
} else if m.PlatformChoice == 2 && m.LangChoice == 2 && m.PMChoice == 1 {
ts.NodejsTS(opts.BotName, "yarn", "slack")
} else if m.PlatformChoice == 2 && m.LangChoice == 2 && m.PMChoice == 2 {
ts.NodejsTS(opts.BotName, "pnpm", "slack")
} else if m.PlatformChoice == 2 && m.LangChoice == 2 && m.PMChoice == 3 {
ts.NodejsTS(opts.BotName, "bun", "slack")
}
}
Loading

0 comments on commit d717b04

Please sign in to comment.