Skip to content

Commit

Permalink
Fix @dataform/core on Windows. (#1526)
Browse files Browse the repository at this point in the history
* Fix `@dataform/core` on Windows.

* bump version
  • Loading branch information
BenBirt committed Aug 15, 2023
1 parent a5ee673 commit a8279e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function main(encodedCoreExecutionRequest: string): string {

// Require "includes" *.js files.
compileRequest.compileConfig.filePaths
.filter(path => path.startsWith("includes/"))
.filter(path => path.startsWith(`includes${utils.pathSeperator}`))
.filter(path => path.endsWith(".js"))
.forEach(includePath => {
try {
Expand All @@ -65,7 +65,7 @@ export function main(encodedCoreExecutionRequest: string): string {

// Require all "definitions" files (attaching them to the session).
compileRequest.compileConfig.filePaths
.filter(path => path.startsWith("definitions/"))
.filter(path => path.startsWith(`definitions${utils.pathSeperator}`))
.filter(path => path.endsWith(".js") || path.endsWith(".sqlx"))
.forEach(definitionPath => {
try {
Expand Down
10 changes: 7 additions & 3 deletions core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IActionProto, Session } from "df/core/session";
import { Table } from "df/core/table";
import { dataform } from "df/protos/ts";

const pathSeperator = (() => {
export const pathSeperator = (() => {
if (typeof process !== "undefined") {
return process.platform === "win32" ? "\\" : "/";
}
Expand Down Expand Up @@ -271,13 +271,17 @@ export function tableTypeEnumToString(enumType: dataform.TableType) {
}

export function setOrValidateTableEnumType(table: dataform.ITable) {
let enumTypeFromStr: dataform.TableType|null = null;
let enumTypeFromStr: dataform.TableType | null = null;
if (table.type !== "" && table.type !== undefined) {
enumTypeFromStr = tableTypeStringToEnum(table.type, true);
}
if (table.enumType === dataform.TableType.UNKNOWN_TYPE || table.enumType === undefined) {
table.enumType = enumTypeFromStr!;
} else if (enumTypeFromStr !== null && table.enumType !== enumTypeFromStr) {
throw new Error(`Table str type "${table.type}" and enumType "${tableTypeEnumToString(table.enumType)}" are not equivalent.`);
throw new Error(
`Table str type "${table.type}" and enumType "${tableTypeEnumToString(
table.enumType
)}" are not equivalent.`
);
}
}
2 changes: 1 addition & 1 deletion version.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# NOTE: If you change the format of this line, you must change the bash command
# in /scripts/publish to extract the version string correctly.
DF_VERSION = "2.6.3"
DF_VERSION = "2.6.4"

0 comments on commit a8279e1

Please sign in to comment.