Fix determining TSR version when running in certain configurations
About the Contributor
Type of Contribution
This is a Bug fix / Code improvement for compatibility with later node versions
Current Behavior
Using import with a json file is banned in node 20 unless you use with { type: 'json' }, which is not supported in node 16, our current build target.
Question: Does using import freeze the value at sofie-core build time, not reflect the version that yarn has chosen to install? If so, is that the right thing to do?
New Behavior
Use require to import the package.json file.
Testing
- [ ] I have added one or more unit tests for this PR
- [ ] I have updated the relevant unit tests
- [x] No unit test changes are needed for this PR
Affected areas
This PR affects building blueprints.
Time Frame
- Not urgent, but we would like to get this merged into the in-development release.
Status
- [ ] PR is ready to be reviewed.
- [ ] The functionality has been tested by the author.
- [ ] Relevant unit tests has been added / updated.
- [ ] Relevant documentation (code comments, system documentation) has been added / updated.
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:loudspeaker: Thoughts on this report? Let us know!
I'm wondering where/how this is an issue, as these libs officially only suport node22+ in release52+. https://github.com/Sofie-Automation/sofie-core/blob/9bd232e8f0561a46db8cc6143c5353d7fa531206/packages/shared-lib/package.json#L31-L33
The build config might be doing so with support for older, but that will be changed whenever someone feels like it (it often lags a bit behind)
The latest r53 build of this file (from https://www.npmjs.com/package/@sofie-automation/shared-lib/v/1.53.0-nightly-release53-20250924-143640-007a9da.0?activeTab=code) is:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TSR_VERSION = exports.TSR = void 0;
const tslib_1 = require("tslib");
const TSR = tslib_1.__importStar(require("timeline-state-resolver-types"));
exports.TSR = TSR;
const tsrPkgInfo = tslib_1.__importStar(require("timeline-state-resolver-types/package.json"));
exports.TSR_VERSION = tsrPkgInfo.version;
//# sourceMappingURL=tsr.js.map
so I am curious what this PR will actually change