MCPcopy Create free account
hub / github.com/react/create-react-app / checkForLatestVersion

Function checkForLatestVersion

packages/create-react-app/createReactApp.js:1097–1118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1095}
1096
1097function checkForLatestVersion() {
1098 return new Promise((resolve, reject) => {
1099 https
1100 .get(
1101 'https://registry.npmjs.org/-/package/create-react-app/dist-tags',
1102 res => {
1103 if (res.statusCode === 200) {
1104 let body = '';
1105 res.on('data', data => (body += data));
1106 res.on('end', () => {
1107 resolve(JSON.parse(body).latest);
1108 });
1109 } else {
1110 reject();
1111 }
1112 }
1113 )
1114 .on('error', () => {
1115 reject();
1116 });
1117 });
1118}
1119
1120module.exports = {
1121 init,

Callers 1

initFunction · 0.85

Calls 2

resolveFunction · 0.50
rejectFunction · 0.50

Tested by

no test coverage detected