Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit a6845fb

Browse files
committed
feat(generate): set range of compatible NodeCG version ranges depending on used nodecg-io version
1 parent ed10299 commit a6845fb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/generate/packageJson.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function genPackageJson(opts: GenerationOptions, install: Installat
2929
version: opts.version.version,
3030
private: true,
3131
nodecg: {
32-
compatibleRange: "^1.4.0",
32+
compatibleRange: genNodeCGCompatibleRange(install),
3333
bundleDependencies: Object.fromEntries(opts.servicePackages.map((pkg) => [pkg.name, `^${pkg.version}`])),
3434
graphics: genNodeCGGraphicConfig(opts),
3535
dashboardPanels: genNodeCGDashboardConfig(opts),
@@ -127,3 +127,16 @@ function getNodecgIODependency(packageName: string, version: string | SemVer, in
127127
return [packageName, `^${version}`];
128128
}
129129
}
130+
131+
/**
132+
* Generates the range of nodecg versions that are compatible with the currently used nodecg-io version.
133+
* @param install the nodecg-io installation, used to get the version
134+
* @returns the semver range of compatible nodecg versions
135+
*/
136+
function genNodeCGCompatibleRange(install: Installation): string {
137+
if (install.version === "0.1" || install.version === "0.2") {
138+
return "^1.4.0";
139+
} else {
140+
return "^1.4.0 || ^2.0.0";
141+
}
142+
}

0 commit comments

Comments
 (0)