初始化提交

This commit is contained in:
2026-02-03 16:52:44 +08:00
commit d2f9806384
512 changed files with 65167 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
const {plist, logger} = require('@appium/support');
const path = require('node:path');
const semver = require('semver');
const log = logger.getLogger('Versioner');
/**
* @param {string} argName
* @returns {string|null}
*/
function parseArgValue (argName) {
const argNamePattern = new RegExp(`^--${argName}\\b`);
for (let i = 1; i < process.argv.length; ++i) {
const arg = process.argv[i];
if (argNamePattern.test(arg)) {
return arg.includes('=') ? arg.split('=')[1] : process.argv[i + 1];
}
}
return null;
}
async function updateWdaVersion() {
const newVersion = parseArgValue('package-version');
if (!newVersion) {
throw new Error('No package version argument (use `--package-version=xxx`)');
}
if (!semver.valid(newVersion)) {
throw new Error(
`Invalid version specified '${newVersion}'. Version should be in the form '1.2.3'`
);
}
const libManifest = path.resolve('WebDriverAgentLib', 'Info.plist');
log.info(`Updating the WebDriverAgent manifest at '${libManifest}' to version '${newVersion}'`);
await plist.updatePlistFile(libManifest, {
CFBundleShortVersionString: newVersion,
CFBundleVersion: newVersion,
}, false);
}
(async () => await updateWdaVersion())();