run() — react Function Reference
Architecture documentation for the run() function in validate-tags.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 8139d7a3_92f2_be55_09fa_fd9fd65eb02f["run()"] c822c245_fe66_6975_0347_d0360a9b4937["validate-tags.js"] 8139d7a3_92f2_be55_09fa_fd9fd65eb02f -->|defined in| c822c245_fe66_6975_0347_d0360a9b4937 style 8139d7a3_92f2_be55_09fa_fd9fd65eb02f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/release/publish-commands/validate-tags.js lines 9–61
const run = async ({cwd, packages, tags}) => {
// Prevent a "next" release from ever being published as @latest
// All canaries share a version number, so it's okay to check any of them.
const arbitraryPackageName = packages[0];
const packageJSONPath = join(
cwd,
'build',
'node_modules',
arbitraryPackageName,
'package.json'
);
const {version} = await readJson(packageJSONPath);
const isExperimentalVersion = version.indexOf('experimental') !== -1;
if (version.indexOf('-') !== -1) {
if (tags.includes('latest')) {
if (isExperimentalVersion) {
console.log(
theme`{error Experimental release} {version ${version}} {error cannot be tagged as} {tag latest}`
);
} else {
console.log(
theme`{error Next release} {version ${version}} {error cannot be tagged as} {tag latest}`
);
}
process.exit(1);
}
if (tags.includes('next') && isExperimentalVersion) {
console.log(
theme`{error Experimental release} {version ${version}} {error cannot be tagged as} {tag next}`
);
process.exit(1);
}
if (tags.includes('experimental') && !isExperimentalVersion) {
console.log(
theme`{error Next release} {version ${version}} {error cannot be tagged as} {tag experimental}`
);
process.exit(1);
}
} else {
if (!tags.includes('latest')) {
console.log(
theme`{error Stable release} {version ${version}} {error must always be tagged as} {tag latest}`
);
process.exit(1);
}
if (tags.includes('experimental')) {
console.log(
theme`{error Stable release} {version ${version}} {error cannot be tagged as} {tag experimental}`
);
process.exit(1);
}
}
};
Domain
Subdomains
Source
Frequently Asked Questions
What does run() do?
run() is a function in the react codebase, defined in scripts/release/publish-commands/validate-tags.js.
Where is run() defined?
run() is defined in scripts/release/publish-commands/validate-tags.js at line 9.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free