Skip to content

Commit

Permalink
Merge pull request #363 from codeoverflow-org/feat/nodecg-v2-support
Browse files Browse the repository at this point in the history
feat(generate): dynamically set range of compatible NodeCG version ranges
  • Loading branch information
hlxid committed May 28, 2023
2 parents cb3d43c + a6845fb commit b4dd5e5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/generate/packageJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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";
}
}

0 comments on commit b4dd5e5

Please sign in to comment.