Skip to content

Commit

Permalink
fix(options): handling url only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
anymaniax committed Feb 18, 2022
1 parent cfde8e2 commit 7174cd0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const normalizeOptions = async (

const normalizedOptions: NormalizedOptions = {
input: {
target: normalizePath(inputOptions.target, workspace),
target: normalizePathOrUrl(inputOptions.target, workspace),
validation: inputOptions.validation || false,
override: {
transformer: normalizePath(
Expand Down Expand Up @@ -215,14 +215,18 @@ const normalizeMutator = <T>(
return mutator;
};

export const normalizePath = <T>(path: T, workspace: string) => {
const normalizePathOrUrl = <T>(path: T, workspace: string) => {
if (isString(path) && !isUrl(path)) {
return resolve(workspace, path);
return normalizePath(path, workspace);
}

return path;
};

export const normalizePath = <T>(path: T, workspace: string) => {
return resolve(workspace, path);
};

const normalizeOperationsAndTags = (
operationsOrTags: {
[key: string]: OperationOptions;
Expand Down

1 comment on commit 7174cd0

@vercel
Copy link

@vercel vercel bot commented on 7174cd0 Feb 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.