-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new
normalizePathForInlineCode
utility
- Loading branch information
1 parent
12a1f75
commit acd0370
Showing
4 changed files
with
35 additions
and
2 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 @@ | ||
--- | ||
"@opennextjs/cloudflare": patch | ||
--- | ||
|
||
TODO: add a proper changeset |
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
10 changes: 10 additions & 0 deletions
10
packages/cloudflare/src/cli/build/utils/normalize-path-for-inline-code.spec.ts
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,10 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { normalizePathForInlineCode } from "./normalize-path-for-inline-code"; | ||
|
||
describe("normalizePathForInlineCode", () => { | ||
it("should extract production env vars", () => { | ||
const result = normalizePathForInlineCode("TODO"); | ||
expect(result).toBeFalsy(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
packages/cloudflare/src/cli/build/utils/normalize-path-for-inline-code.ts
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,16 @@ | ||
import { normalizePath } from "./normalize-path"; | ||
|
||
/** | ||
* TODO: add proper comment | ||
* | ||
* @param path | ||
*/ | ||
export function normalizePathForInlineCode(path: string): string { | ||
// let's normalize the path for good measure | ||
const normalizedPath = normalizePath(path); | ||
|
||
// we need to escape | ||
const doublyEscaped = normalizedPath.replaceAll("\\", "\\\\"); | ||
|
||
return doublyEscaped; | ||
} |