From a6845fb3d072abacb7d884ab378a511be7d2d5bc Mon Sep 17 00:00:00 2001 From: Daniel Huber <30466471+daniel0611@users.noreply.github.com> Date: Sat, 27 May 2023 19:17:43 +0000 Subject: [PATCH] feat(generate): set range of compatible NodeCG version ranges depending on used nodecg-io version --- src/generate/packageJson.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/generate/packageJson.ts b/src/generate/packageJson.ts index 48625fb..314cc1e 100644 --- a/src/generate/packageJson.ts +++ b/src/generate/packageJson.ts @@ -29,7 +29,7 @@ export async function genPackageJson(opts: GenerationOptions, install: Installat version: opts.version.version, private: true, nodecg: { - compatibleRange: "^1.4.0", + compatibleRange: genNodeCGCompatibleRange(install), bundleDependencies: Object.fromEntries(opts.servicePackages.map((pkg) => [pkg.name, `^${pkg.version}`])), graphics: genNodeCGGraphicConfig(opts), dashboardPanels: genNodeCGDashboardConfig(opts), @@ -127,3 +127,16 @@ function getNodecgIODependency(packageName: string, version: string | SemVer, in return [packageName, `^${version}`]; } } + +/** + * Generates the range of nodecg versions that are compatible with the currently used nodecg-io version. + * @param install the nodecg-io installation, used to get the version + * @returns the semver range of compatible nodecg versions + */ +function genNodeCGCompatibleRange(install: Installation): string { + if (install.version === "0.1" || install.version === "0.2") { + return "^1.4.0"; + } else { + return "^1.4.0 || ^2.0.0"; + } +}