Skip to content

Commit

Permalink
fix(wip): pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Sep 1, 2024
1 parent 66fd096 commit 136234b
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 345 deletions.
2 changes: 2 additions & 0 deletions src/api/kit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ ava.serial(`testing "run" is global`, async (t) => {
await exec(`kit new ${otherScript} main --no-edit`, {
env: {
...process.env,
EXEC_PATH: process.execPath,
KIT_MODE: "js"
}
})
await exec(`kit new ${mainScript} main --no-edit`, {
env: {
...process.env,
EXEC_PATH: process.execPath,
KIT_MODE: "js"
}
})
Expand Down
116 changes: 58 additions & 58 deletions src/cli/duplicate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,76 @@ import ava from "ava"
import "../../test-sdk/config.js"
import { pathToFileURL } from "node:url"

ava.serial("kit duplicate", async t => {
let command = "browse-scriptkit"
let duplicate = `${command}-duplicated`
let scriptPath = kenvPath("scripts", `${duplicate}.js`)
let binPath = kenvPath("bin", `${duplicate}`)
ava.serial("kit duplicate", async (t) => {
let command = "browse-scriptkit"
let duplicate = `${command}-duplicated`
let scriptPath = kenvPath("scripts", `${duplicate}.js`)
let binPath = kenvPath("bin", `${duplicate}`)

await ensureDir(kenvPath("scripts"))
await ensureDir(kenvPath("bin"))
await ensureDir(kenvPath("scripts"))
await ensureDir(kenvPath("bin"))

await exec(`kit duplicate ${command} ${duplicate} main --no-edit`, {
env: {
...process.env,
KIT_MODE: "js"
}
})
await exec(`kit duplicate ${command} ${duplicate} main --no-edit`, {
env: {
...process.env,
EXEC_PATH: process.execPath,
KIT_MODE: "js"
}
})

let scripts = await readdir(kenvPath("scripts"))
let bins = await readdir(kenvPath("bin"))
let scripts = await readdir(kenvPath("scripts"))
let bins = await readdir(kenvPath("bin"))


t.log({
scripts,
bins,
KENV: process.env.KENV,
kenvPath: kenvPath(),
scriptPath,
binPath
})

t.log({
scripts,
bins,
KENV: process.env.KENV,
kenvPath: kenvPath(),
scriptPath,
binPath
})
if (process.platform === "win32") {
binPath += ".cmd"
}

if (process.platform === 'win32') {
binPath += '.cmd';
}

let scriptCreated = await readFile(scriptPath, "utf8")
let binCreated = await readFile(binPath, "utf8")
let scriptCreated = await readFile(scriptPath, "utf8")
let binCreated = await readFile(binPath, "utf8")

t.log({scriptCreated, binCreated})
t.log({ scriptCreated, binCreated })

t.truthy(scriptCreated, `Duplicated ${command} script`)
t.truthy(binCreated, `Duplicated ${command} bin`)
t.truthy(scriptCreated, `Duplicated ${command} script`)
t.truthy(binCreated, `Duplicated ${command} bin`)
})

ava.serial("kit duplicate a typescript file", async t => {
let command = `browse-scriptkit-typescript`
await exec(`kit new ${command} main --no-edit`, {
env: {
...process.env,
KIT_MODE: "ts"
}
})
let duplicate = `${command}-duplicated`
let scriptPath = kenvPath("scripts", `${duplicate}.ts`)
let binPath = kenvPath("bin", `${duplicate}`)
ava.serial("kit duplicate a typescript file", async (t) => {
let command = `browse-scriptkit-typescript`
await exec(`kit new ${command} main --no-edit`, {
env: {
...process.env,
EXEC_PATH: process.execPath,
KIT_MODE: "ts"
}
})
let duplicate = `${command}-duplicated`
let scriptPath = kenvPath("scripts", `${duplicate}.ts`)
let binPath = kenvPath("bin", `${duplicate}`)

await exec(`kit duplicate ${command} ${duplicate} main --no-edit`, {
env: {
...process.env,
KIT_MODE: "ts"
}
})
await exec(`kit duplicate ${command} ${duplicate} main --no-edit`, {
env: {
...process.env,
EXEC_PATH: process.execPath,
KIT_MODE: "ts"
}
})

if (process.platform === "win32") {
binPath += ".cmd"
}

if(process.platform === 'win32') {
binPath += '.cmd';
}
let scriptCreated = test("-f", scriptPath)
let binCreated = test("-f", binPath)

let scriptCreated = test("-f", scriptPath)
let binCreated = test("-f", binPath)

t.true(scriptCreated, `Duplicated ${command} script`)
t.true(binCreated, `Duplicated ${command} bin`)
t.true(scriptCreated, `Duplicated ${command} script`)
t.true(binCreated, `Duplicated ${command} bin`)
})
2 changes: 2 additions & 0 deletions src/cli/kenv.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ava.serial("kenv create", async (t) => {
let { stdout } = await exec(`kit kenv-create ${kenvName}`, {
env: {
...process.env,
EXEC_PATH: process.execPath,
KIT_MODE: "js"
}
})
Expand All @@ -27,6 +28,7 @@ ava.serial("kenv remove", async (t) => {
await exec(`kit kenv-rm ${kenvName}`, {
env: {
...process.env,
EXEC_PATH: process.execPath,
KIT_MODE: "js"
}
})
Expand Down
Loading

0 comments on commit 136234b

Please sign in to comment.