MCPcopy Create free account
hub / github.com/reactnativecn/react-native-update / main

Function main

scripts/prepublish.ts:139–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

137}
138
139async function main(): Promise<void> {
140 try {
141 if (isGitHubCI()) {
142 const version = await resolveVersion();
143 if (!isValidSemver(version)) {
144 throw new Error(
145 `Resolved version "${version}" is not a valid semantic version. ` +
146 `Please ensure RELEASE_VERSION, GITHUB_REF, or GITHUB_REF_NAME is set correctly, ` +
147 `or that the git history is fully fetched.`
148 );
149 }
150 console.log(`Using publish version ${version}`);
151 await modifyPackageJson({ version });
152 } else {
153 console.log(
154 'ℹ️ Not in GitHub CI, skipping version resolution and package.json modification',
155 );
156 if (shouldSkipNativeBuild()) {
157 console.log(
158 'ℹ️ --skip flag detected, skipping native artifacts build',
159 );
160 } else {
161 await buildNativeArtifacts();
162 }
163 }
164
165 console.log('✅ Prepublish script completed successfully');
166 } catch (error) {
167 console.error('❌ Prepublish script failed:', error);
168 process.exit(1);
169 }
170}
171
172main();

Callers 1

prepublish.tsFile · 0.70

Calls 7

isGitHubCIFunction · 0.85
resolveVersionFunction · 0.85
isValidSemverFunction · 0.85
modifyPackageJsonFunction · 0.85
shouldSkipNativeBuildFunction · 0.85
buildNativeArtifactsFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected