From a91f61f39a112a7b51ea4c99620b90ac425c7912 Mon Sep 17 00:00:00 2001 From: Elias Kassell Date: Thu, 7 Dec 2023 16:37:30 +0000 Subject: [PATCH] Throw a more interpretable error when old CLIs encounter new Core versions --- core/index.ts | 14 +++++++++++--- packages/@dataform/core/index.ts | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/index.ts b/core/index.ts index 33022f36a..fce26dd4d 100644 --- a/core/index.ts +++ b/core/index.ts @@ -17,7 +17,15 @@ const session = globalSession(); const supportedFeatures = [dataform.SupportedFeatures.ARRAY_BUFFER_IPC]; -// These exports constitute the public API of @dataform/core. +// Older versions of the CLI are not compatible with Core version ^3.0.0, and throw when this method +// is not available. Instead this more interpretable error message is thrown. +// Note: for future backwards compatability breaking changes, the exported "version" variable should +// be used instead. +function indexFileGenerator() { + throw new Error("@dataform/cli ^3.0.0 required."); +} + +// These exports constitute the public API of @dataform/core. // They must also be listed in packages/@dataform/core/index.ts. -// Changes to these will break @dataform/api, so take care! -export { compiler, main, session, supportedFeatures, version }; +// Changes to these will break @dataform/cli, so take care! +export { compiler, indexFileGenerator, main, session, supportedFeatures, version }; diff --git a/packages/@dataform/core/index.ts b/packages/@dataform/core/index.ts index 16f611da5..eb90aa7ec 100644 --- a/packages/@dataform/core/index.ts +++ b/packages/@dataform/core/index.ts @@ -1 +1 @@ -export { compiler, main, session, supportedFeatures, version } from "df/core"; +export { compiler, indexFileGenerator, main, session, supportedFeatures, version } from "df/core";