data.js — react Source File
Architecture documentation for data.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
'use strict';
const https = require('https');
const path = require('path');
const {execFileAsync, repoRoot} = require('./utils');
async function fetchNpmInfo(packageName, {log}) {
const npmArgs = ['view', `${packageName}@latest`, '--json'];
const options = {cwd: repoRoot, maxBuffer: 10 * 1024 * 1024};
log(`Fetching npm info for ${packageName}...`);
const {stdout} = await execFileAsync('npm', npmArgs, options);
let data = stdout.trim();
if (!data) {
throw new Error(`npm view returned empty result for ${packageName}`);
}
let info = JSON.parse(data);
if (Array.isArray(info)) {
info = info[info.length - 1];
}
const version = info.version || info['dist-tags']?.latest;
let gitHead = info.gitHead || null;
if (!gitHead) {
const gitHeadResult = await execFileAsync(
'npm',
['view', `${packageName}@${version}`, 'gitHead'],
{cwd: repoRoot, maxBuffer: 1024 * 1024}
);
const possibleGitHead = gitHeadResult.stdout.trim();
if (
possibleGitHead &&
possibleGitHead !== 'undefined' &&
possibleGitHead !== 'null'
) {
log(`Found gitHead for ${packageName}@${version}: ${possibleGitHead}`);
gitHead = possibleGitHead;
}
}
if (!version) {
throw new Error(
`Unable to determine latest published version for ${packageName}`
);
}
if (!gitHead) {
throw new Error(
`Unable to determine git commit for ${packageName}@${version}`
);
}
return {
publishedVersion: version,
gitHead,
};
}
// ... (131 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does data.js do?
data.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in data.js?
data.js defines 5 function(s): collectCommitsSince, extractPrNumber, fetchNpmInfo, fetchPullRequestMetadata, loadCommitDetails.
Where is data.js in the architecture?
data.js is located at scripts/tasks/generate-changelog/data.js (domain: BabelCompiler, subdomain: Entrypoint, directory: scripts/tasks/generate-changelog).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free