MCPcopy Create free account
hub / github.com/appium/appium / findDeployVersion

Function findDeployVersion

packages/docutils/lib/builder/deploy.ts:213–231  ·  view source on GitHub ↗
(
  packageJsonPath?: string,
  usePrefixedMajorVersion?: boolean,
  cwd = process.cwd(),
)

Source from the content-addressed store, hash-verified

211 * @param cwd Current working directory
212 */
213export async function findDeployVersion(
214 packageJsonPath?: string,
215 usePrefixedMajorVersion?: boolean,
216 cwd = process.cwd(),
217): Promise<string> {
218 const {pkg} = await readPackageJson(packageJsonPath ? path.dirname(packageJsonPath) : cwd, true);
219 const version = pkg.version;
220 if (!version) {
221 throw new DocutilsError('No "version" field found in package.json; please add one or specify a version to deploy');
222 }
223
224 // If a minor version can be extracted, use MAJOR.MINOR as the deploy version, otherwise use MAJOR.
225 // If usePrefixedMajorVersion is true, always use vMAJOR
226 const versionParts = version.split('.');
227 if (versionParts.length === 1) {
228 return usePrefixedMajorVersion ? `v${version}` : version;
229 }
230 return usePrefixedMajorVersion ? `v${versionParts[0]}` : `${versionParts[0]}.${versionParts[1]}`;
231}
232
233/**
234 * Runs `mike serve`

Callers 2

deployFunction · 0.85
builder.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected