Skip to content

Commit

Permalink
feat: add basepath to preview generation (#3877)
Browse files Browse the repository at this point in the history
* feat: add basepath to preview generation

* use whatwg parser
  • Loading branch information
abvthecity authored Jun 19, 2024
1 parent 292c2ce commit 94cccaf
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 26 deletions.
18 changes: 9 additions & 9 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
2 changes: 1 addition & 1 deletion packages/cli/configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"@fern-api/core-utils": "workspace:*",
"@fern-api/fdr-sdk": "0.98.2-d590e2c8a",
"@fern-api/fdr-sdk": "0.98.2-feb732f15",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/task-context": "workspace:*",
"@fern-fern/fiddle-sdk": "^0.0.552",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@fern-api/docs-resolver": "workspace:*",
"@fern-api/fdr-sdk": "0.98.2-d590e2c8a",
"@fern-api/fdr-sdk": "0.98.2-feb732f15",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
"@fern-api/logger": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/docs-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": {
"@fern-api/configuration": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-api/fdr-sdk": "0.98.2-d590e2c8a",
"@fern-api/fdr-sdk": "0.98.2-feb732f15",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@fern-api/core": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-api/docs-resolver": "workspace:*",
"@fern-api/fdr-sdk": "0.98.2-d590e2c8a",
"@fern-api/fdr-sdk": "0.98.2-feb732f15",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-migrations": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export async function publishDocs({

let docsRegistrationId: string | undefined;
let urlToOutput = customDomains[0] ?? domain;
const basePath = parseBasePath(domain);
const resolver = new DocsDefinitionResolver(
domain,
docsWorkspace,
Expand Down Expand Up @@ -101,7 +102,8 @@ export async function publishDocs({
orgId: organization,
authConfig: isPrivate ? { type: "private", authType: "sso" } : { type: "public" },
filepaths,
images
images,
basePath
});
if (startDocsRegisterResponse.ok) {
urlToOutput = startDocsRegisterResponse.body.previewUrl;
Expand Down Expand Up @@ -275,3 +277,11 @@ function startDocsRegisterFailed(
return context.failAndThrow("Failed to publish docs.", error);
}
}

function parseBasePath(domain: string): string | undefined {
try {
return new URL(wrapWithHttps(domain)).pathname;
} catch (e) {
return undefined;
}
}
2 changes: 1 addition & 1 deletion packages/cli/register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@fern-api/configuration": "workspace:*",
"@fern-api/core": "workspace:*",
"@fern-api/core-utils": "workspace:*",
"@fern-api/fdr-sdk": "0.98.2-d590e2c8a",
"@fern-api/fdr-sdk": "0.98.2-feb732f15",
"@fern-api/ir-generator": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
"@fern-api/task-context": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"depcheck": "depcheck"
},
"dependencies": {
"@fern-api/fdr-sdk": "0.98.2-d590e2c8a",
"@fern-api/fdr-sdk": "0.98.2-feb732f15",
"@fern-api/venus-api-sdk": "0.0.38",
"@fern-fern/fdr-test-sdk": "^0.0.5297",
"@fern-fern/fiddle-sdk": "^0.0.552"
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3450,7 +3450,7 @@ __metadata:
resolution: "@fern-api/configuration@workspace:packages/cli/configuration"
dependencies:
"@fern-api/core-utils": "workspace:*"
"@fern-api/fdr-sdk": 0.98.2-d590e2c8a
"@fern-api/fdr-sdk": 0.98.2-feb732f15
"@fern-api/fs-utils": "workspace:*"
"@fern-api/task-context": "workspace:*"
"@fern-fern/fiddle-sdk": ^0.0.552
Expand Down Expand Up @@ -3497,7 +3497,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@fern-api/core@workspace:packages/core"
dependencies:
"@fern-api/fdr-sdk": 0.98.2-d590e2c8a
"@fern-api/fdr-sdk": 0.98.2-feb732f15
"@fern-api/venus-api-sdk": 0.0.38
"@fern-fern/fdr-test-sdk": ^0.0.5297
"@fern-fern/fiddle-sdk": ^0.0.552
Expand Down Expand Up @@ -3559,7 +3559,7 @@ __metadata:
resolution: "@fern-api/docs-preview@workspace:packages/cli/docs-preview"
dependencies:
"@fern-api/docs-resolver": "workspace:*"
"@fern-api/fdr-sdk": 0.98.2-d590e2c8a
"@fern-api/fdr-sdk": 0.98.2-feb732f15
"@fern-api/fs-utils": "workspace:*"
"@fern-api/ir-sdk": "workspace:*"
"@fern-api/logger": "workspace:*"
Expand Down Expand Up @@ -3599,7 +3599,7 @@ __metadata:
dependencies:
"@fern-api/configuration": "workspace:*"
"@fern-api/core-utils": "workspace:*"
"@fern-api/fdr-sdk": 0.98.2-d590e2c8a
"@fern-api/fdr-sdk": 0.98.2-feb732f15
"@fern-api/fs-utils": "workspace:*"
"@fern-api/ir-generator": "workspace:*"
"@fern-api/ir-sdk": "workspace:*"
Expand Down Expand Up @@ -3681,9 +3681,9 @@ __metadata:
languageName: unknown
linkType: soft

"@fern-api/fdr-sdk@npm:0.98.2-d590e2c8a":
version: 0.98.2-d590e2c8a
resolution: "@fern-api/fdr-sdk@npm:0.98.2-d590e2c8a"
"@fern-api/fdr-sdk@npm:0.98.2-feb732f15":
version: 0.98.2-feb732f15
resolution: "@fern-api/fdr-sdk@npm:0.98.2-feb732f15"
dependencies:
dayjs: ^1.11.11
fast-deep-equal: ^3.1.3
Expand All @@ -3695,7 +3695,7 @@ __metadata:
tinycolor2: ^1.6.0
title: ^3.5.3
url-join: 5.0.0
checksum: 40586b9a273aee33a4b003ee37117d81cfaf8970f2abaaf482e2ec4a7d4882c0393ef63c6b034e216b1ea61a6c075a984248829e63386d03b76e698547e92ec6
checksum: 2480ba175cfa6dc3a12630c7ef0cdcd740cc48e12e6362ce7c7aa8304ab9032501e90ddaabf84f3d4bd89c06b6127211350af1ca3c6023982246bcf3542b0be1
languageName: node
linkType: hard

Expand Down Expand Up @@ -4340,7 +4340,7 @@ __metadata:
"@fern-api/configuration": "workspace:*"
"@fern-api/core": "workspace:*"
"@fern-api/core-utils": "workspace:*"
"@fern-api/fdr-sdk": 0.98.2-d590e2c8a
"@fern-api/fdr-sdk": 0.98.2-feb732f15
"@fern-api/ir-generator": "workspace:*"
"@fern-api/ir-sdk": "workspace:*"
"@fern-api/task-context": "workspace:*"
Expand All @@ -4367,7 +4367,7 @@ __metadata:
"@fern-api/core": "workspace:*"
"@fern-api/core-utils": "workspace:*"
"@fern-api/docs-resolver": "workspace:*"
"@fern-api/fdr-sdk": 0.98.2-d590e2c8a
"@fern-api/fdr-sdk": 0.98.2-feb732f15
"@fern-api/fs-utils": "workspace:*"
"@fern-api/ir-generator": "workspace:*"
"@fern-api/ir-migrations": "workspace:*"
Expand Down

0 comments on commit 94cccaf

Please sign in to comment.