-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): support uploading files for docs deployments on windows (#4674
) * add utility to convert paths * export utilites from fs-utils * update imports * add windows test * run in pr for now * move execution policies * ps env var * don't run in background * don't run in background * don't run in background * debug * try claude script * proper invocation * different gh action * move function above invocation * add silent removal * run on main push * add changelog entry
- Loading branch information
1 parent
effc59b
commit 9f96f7b
Showing
10 changed files
with
124 additions
and
6 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { AbsoluteFilePath } from "./AbsoluteFilePath"; | ||
import { RelativeFilePath } from "./RelativeFilePath"; | ||
|
||
// in this function, we ignore drive paths and roots, since many strings are passed as partial relative paths | ||
export function convertToOsPath(path: string): string { | ||
if (process.platform === "win32") { | ||
return path.replace(/\//g, "\\"); | ||
} else { | ||
return path.replace(/\\/g, "/"); | ||
} | ||
} | ||
|
||
function convertToFernHostPath(path: string): string { | ||
let unixPath = path; | ||
if (/^[a-zA-Z]:\\/.test(path)) { | ||
unixPath = path.substring(2); | ||
} | ||
|
||
return unixPath.replace(/\\/g, "/"); | ||
} | ||
|
||
export function convertToFernHostAbsoluteFilePath(path: AbsoluteFilePath): AbsoluteFilePath { | ||
// Don't use 'of' here, as it will use OS path, we want fern path | ||
return convertToFernHostPath(path) as AbsoluteFilePath; | ||
} | ||
export function convertToFernHostRelativeFilePath(path: RelativeFilePath): RelativeFilePath { | ||
// Don't use 'of' here, as it will use OS path, we want fern path | ||
return convertToFernHostPath(path) as RelativeFilePath; | ||
} |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import path from "path"; | ||
import { AbsoluteFilePath } from "./AbsoluteFilePath"; | ||
import { convertToOsPath } from "./osPathConverter"; | ||
|
||
export function resolve(first: AbsoluteFilePath, ...rest: string[]): AbsoluteFilePath; | ||
export function resolve(...paths: string[]): string { | ||
return path.resolve(...paths); | ||
return path.resolve(...paths.map(convertToOsPath)); | ||
} |
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,38 @@ | ||
param( | ||
[Parameter(Mandatory=$true)] | ||
[string]$cli_path, | ||
|
||
[Parameter(Mandatory=$true)] | ||
[string]$token | ||
) | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
function New-TemporaryDirectory { | ||
$parent = [System.IO.Path]::GetTempPath() | ||
$name = [System.Guid]::NewGuid().ToString() | ||
$path = Join-Path $parent $name | ||
New-Item -ItemType Directory -Path $path | ||
} | ||
|
||
$original_dir = Get-Location | ||
$test_dir = New-TemporaryDirectory | ||
Set-Location $test_dir | ||
|
||
try { | ||
$env:FERN_TOKEN = $token | ||
|
||
Write-Host "Running Fern Commands!" | ||
$DebugPreference = "Continue" | ||
& node $cli_path init --organization fern | ||
& node $cli_path add fern-java-sdk | ||
& node $cli_path add fern-python-sdk | ||
& node $cli_path add fern-postman | ||
& node $cli_path generate --log-level debug | ||
$DebugPreference = "SilentlyContinue" | ||
& node $cli_path register --log-level debug | ||
} | ||
finally { | ||
Set-Location $original_dir | ||
Remove-Item -Recurse -Force $test_dir -ErrorAction SilentlyContinue | ||
} |