forked from dataform-co/dataform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Action builders and path utils fixes (dataform-co#1606)
* Tidy up path separator * Tidy action target constructors * Minor comment nit * Lint fix * Fix empty schema and database * Move path to a separate file * fix import order
- Loading branch information
Showing
12 changed files
with
119 additions
and
71 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
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,33 @@ | ||
export const separator = (() => { | ||
if (typeof process !== "undefined") { | ||
return process.platform === "win32" ? "\\" : "/"; | ||
} | ||
return "/"; | ||
})(); | ||
|
||
export function relativePath(fullPath: string, base: string) { | ||
if (base.length === 0) { | ||
return fullPath; | ||
} | ||
const stripped = fullPath.substr(base.length); | ||
if (stripped.startsWith(separator)) { | ||
return stripped.substr(1); | ||
} else { | ||
return stripped; | ||
} | ||
} | ||
|
||
export function fileName(fullPath: string) { | ||
return fullPath | ||
.split(separator) | ||
.slice(-1)[0] | ||
.split(".")[0]; | ||
} | ||
|
||
export function escapedFileName(path: string) { | ||
return fileName(path).replace(/\\/g, "\\\\"); | ||
} | ||
|
||
export function fileExtension(fullPath: string) { | ||
return fullPath.split(".").slice(-1)[0]; | ||
} |
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