Skip to content

Commit

Permalink
fix(npm): fixing npm for kit-action
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Sep 13, 2024
1 parent 0a4f67b commit 68d2cb1
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions src/cli/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ import {
} from "@johnlindquist/kit-internal/date-fns"
import { KIT_FIRST_PATH } from "../core/utils.js"

let workflowLog =
(color: "green" | "yellow" | "red" | "blue" | "magenta" | "cyan" | "white") =>
(...messages: any[]) => {
if (process.env.KIT_CONTEXT === "workflow") {
// if any of the message items are not a string, convert them to a string
for (let message of messages) {
if (typeof message !== "string") {
message = JSON.stringify(message)
}
global.echo(global.chalk`{${color} ${message}}`)
}
}
}


let wlog = workflowLog("green")
let wwarn = workflowLog("yellow")
let werror = workflowLog("red")

let install = async (packageNames) => {
let cwd = kenvPath()

Expand All @@ -28,8 +47,8 @@ let install = async (packageNames) => {
let packages = packageNames.join(" ")
let command = `${toolPath} ${toolArgs} -D ${packages}`.trim()

global.log(`Running: ${command}`)
global.log(`In: ${cwd}`)
wlog(`Running: ${command}`)
wlog(`In: ${cwd}`)

return await term({
name: "pnpm install",
Expand Down Expand Up @@ -84,6 +103,13 @@ let packages = await arg(

let installNames = [...packages.split(" ")]
if (process?.send) global.setChoices([])


wlog(`Installing:`, {
installNames,
args,
argOpts
})
await install([...installNames, ...args, ...argOpts])

export { packages }

0 comments on commit 68d2cb1

Please sign in to comment.