diff options
| author | ewy <ewy0@protonmail.com> | 2026-05-02 18:28:40 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-05-02 18:28:40 +0200 |
| commit | e8b9ca135642c76000bc0ec2e78674c602a748dd (patch) | |
| tree | 4e502ce767a4a4f70e40d6e72a3817bc139f1300 /runner/js/target_npm.go | |
| parent | 35e6ac334f6a62cf63b743182cd5355f6baf4406 (diff) | |
add .js and .ts support
also: remove unused/duplicate method runner.Hydrate
Diffstat (limited to 'runner/js/target_npm.go')
| -rw-r--r-- | runner/js/target_npm.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/runner/js/target_npm.go b/runner/js/target_npm.go new file mode 100644 index 0000000..8319fad --- /dev/null +++ b/runner/js/target_npm.go @@ -0,0 +1,42 @@ +package js + +import ( + "github.com/ewy1/pik/model" + "github.com/ewy1/pik/runner" + "os/exec" + "path/filepath" +) + +type Npm struct { + runner.BaseTarget + Name string + Cmd string +} + +func (n *Npm) Icon() string { + return "\uE60B" +} + +func (n *Npm) Description(src *model.HydratedSource) string { + return n.Cmd +} + +func (n *Npm) Target() model.Target { + return n +} + +func (n *Npm) Create(s *model.Source) *exec.Cmd { + return exec.Command(Js.Npm, "run", n.Name) +} + +func (n *Npm) Label() string { + return n.Name +} + +func (n *Npm) Hydrate(src *model.Source) (model.HydratedTarget, error) { + return n, nil +} + +func (n *Npm) File(src *model.Source) string { + return filepath.Join(src.Path, "package.json") +} |
