Merge pull request #17752 from backstage/rugvip/react16

cli: deprecate use of react 16
This commit is contained in:
Patrik Oldsberg
2023-05-14 11:05:53 +02:00
committed by GitHub
2 changed files with 31 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Deprecated the use of React 16
@@ -32,6 +32,30 @@ interface StartAppOptions {
configPaths: string[];
}
function checkReactVersion() {
try {
// Make sure we're looking at the root of the target repo
const reactPkgPath = require.resolve('react/package.json', {
paths: [paths.targetRoot],
});
const reactPkg = require(reactPkgPath);
if (reactPkg.version.startsWith('16.')) {
console.log(
chalk.yellow(
`
⚠️ ⚠️
⚠️ You are using React version 16, which is deprecated for use in Backstage. ⚠️
⚠️ Please upgrade to React 17 by updating your packages/app dependencies. ⚠️
⚠️ ⚠️
`,
),
);
}
} catch {
/* ignored */
}
}
export async function startFrontend(options: StartAppOptions) {
if (options.verifyVersions) {
const lockfile = await Lockfile.load(paths.resolveTargetRoot('yarn.lock'));
@@ -65,6 +89,8 @@ export async function startFrontend(options: StartAppOptions) {
}
}
checkReactVersion();
const { name } = await fs.readJson(paths.resolveTarget('package.json'));
const config = await loadCliConfig({
args: options.configPaths,