-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into replace-atty-with-is-terminal
- Loading branch information
Showing
21 changed files
with
331 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"fnm": minor | ||
--- | ||
|
||
Add --corepack-enabled flag for automatically enabling corepack on fnm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"fnm": patch | ||
--- | ||
|
||
use cygwinpath to make the path posix-like on Windows Bash usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Bash installs corepack: Bash 1`] = ` | ||
"set -e | ||
eval "$(fnm env --corepack-enabled)" | ||
fnm install 18 | ||
fnm exec --using=18 node test-pnpm-corepack.js" | ||
`; | ||
|
||
exports[`Fish installs corepack: Fish 1`] = ` | ||
"fnm env --corepack-enabled | source | ||
fnm install 18 | ||
fnm exec --using=18 node test-pnpm-corepack.js" | ||
`; | ||
|
||
exports[`PowerShell installs corepack: PowerShell 1`] = ` | ||
"$ErrorActionPreference = "Stop" | ||
fnm env --corepack-enabled | Out-String | Invoke-Expression | ||
fnm install 18 | ||
fnm exec --using=18 node test-pnpm-corepack.js" | ||
`; | ||
|
||
exports[`Zsh installs corepack: Zsh 1`] = ` | ||
"set -e | ||
eval "$(fnm env --corepack-enabled)" | ||
fnm install 18 | ||
fnm exec --using=18 node test-pnpm-corepack.js" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import fs from "fs" | ||
import { script } from "./shellcode/script.js" | ||
import { Bash, Fish, PowerShell, Zsh } from "./shellcode/shells.js" | ||
import describe from "./describe.js" | ||
import path from "path" | ||
import testCwd from "./shellcode/test-cwd.js" | ||
import { createRequire } from "module" | ||
|
||
const require = createRequire(import.meta.url) | ||
const whichPath = require.resolve("which") | ||
|
||
const nodescript = ` | ||
const which = require(${JSON.stringify(whichPath)}); | ||
const pnpmBinary = which.sync('pnpm') | ||
const nodeBinary = which.sync('node') | ||
const binPath = require('path').dirname(nodeBinary); | ||
if (!pnpmBinary.includes(binPath)) { | ||
console.log('pnpm not found in current Node.js bin', { binPath, pnpmBinary }); | ||
process.exit(1); | ||
} | ||
const scriptContents = require('fs').readFileSync(pnpmBinary, 'utf8'); | ||
console.log('scriptContents', scriptContents) | ||
if (!scriptContents.includes('corepack')) { | ||
console.log('corepack not found in pnpm script'); | ||
process.exit(1); | ||
} | ||
` | ||
|
||
for (const shell of [Bash, Fish, PowerShell, Zsh]) { | ||
describe(shell, () => { | ||
test(`installs corepack`, async () => { | ||
const cwd = testCwd() | ||
const filepath = path.join(cwd, "test-pnpm-corepack.js") | ||
fs.writeFileSync(filepath, nodescript) | ||
|
||
await script(shell) | ||
.then(shell.env({ corepackEnabled: true })) | ||
.then(shell.call("fnm", ["install", "18"])) | ||
.then( | ||
shell.call("fnm", [ | ||
"exec", | ||
"--using=18", | ||
"node", | ||
"test-pnpm-corepack.js", | ||
]) | ||
) | ||
.takeSnapshot(shell) | ||
// .addExtraEnvVar("RUST_LOG", "fnm=debug") | ||
.execute(shell) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.