Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bun commands #36

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/palladian/cli/functions/add_impl.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import std/osproc
import std/strutils
import std/strformat

proc add*(dev=false, args:seq[string]):int =
## = `bun add xx`. Add a dependency to package.json
let packages = args.join(" ")
let isDev = if dev: "-d" else: ""
echo execProcess(&"bun add {isDev} {packages}")
1 change: 1 addition & 0 deletions src/palladian/cli/functions/install_impl.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import std/osproc

proc install*() =
## = `bun install`. Install dependencies for a package.json
echo execProcess("bun install")
2 changes: 1 addition & 1 deletion src/palladian/cli/functions/new_impl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ Successfully created a new palladian project "{packageName}"


proc new*(args:seq[string]):int =
## Create new project
## Create a new project
var
message:string
packageName:string
Expand Down
8 changes: 8 additions & 0 deletions src/palladian/cli/functions/remove_impl.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import std/osproc
import std/strutils
import std/strformat

proc remove*(args:seq[string]):int =
## = `bun remove xx`. Remove a dependency from package.json
let packages = args.join(" ")
echo execProcess(&"bun remove {packages}")
5 changes: 5 additions & 0 deletions src/palladian/cli/functions/update_impl.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import std/osproc

proc update*() =
## = `bun update`. Update outdated dependencies.
echo execProcess("bun update")
15 changes: 14 additions & 1 deletion src/palladian/cli/palladian_cli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,18 @@ import ./functions/dev_impl
import ./functions/serve_impl
import ./functions/build_impl
import ./functions/install_impl
import ./functions/add_impl
import ./functions/remove_impl
import ./functions/update_impl

dispatchMulti([newImpl.new], [serve], [dev], [build], [install_impl.install])

dispatchMulti(
[newImpl.new],
[dev_impl.dev],
[serve_impl.serve],
[build_impl.build],
[install_impl.install],
[add_impl.add, help={"dev": "Add dependency to \"devDependencies\""}],
[remove_impl.remove],
[update_impl.update]
)