This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

1 line
3.0 KiB
Plaintext
Raw Permalink Normal View History

2021-04-02 02:24:13 +03:00
{"version":3,"file":"Version.js","sourceRoot":"","sources":["../../src/android/Version.ts"],"names":[],"mappings":";;;;;;;;;AAGA,gEAAgE;AAChE,qEAAuD;AAE1C,QAAA,WAAW,GAAiB,MAAM,CAAC,EAAE;IAChD,OAAO,oCAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QACzC,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC3C,MAAM,CAAC,UAAU,CAAC,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAChF,MAAM,CAAC,UAAU,CAAC,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SACjF;aAAM;YACL,iBAAiB,CAAC,iBAAiB,CACjC,iBAAiB,EACjB,oEAAoE,CACrE,CAAC;SACH;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAgB,cAAc,CAAC,MAAmC;;IAChE,aAAO,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC;AAChC,CAAC;AAFD,wCAEC;AAED,SAAgB,cAAc,CAAC,MAAmC,EAAE,WAAmB;IACrF,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,WAAW,KAAK,IAAI,EAAE;QACxB,OAAO,WAAW,CAAC;KACpB;IAED,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC/C,OAAO,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,WAAW,GAAG,CAAC,CAAC;AACtE,CAAC;AARD,wCAQC;AAED,SAAgB,cAAc,CAAC,MAAmC;;IAChE,mBAAO,MAAM,CAAC,OAAO,0CAAE,WAAW,mCAAI,IAAI,CAAC;AAC7C,CAAC;AAFD,wCAEC;AAED,SAAgB,cAAc,CAAC,MAAmC,EAAE,WAAmB;IACrF,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,WAAW,KAAK,IAAI,EAAE;QACxB,OAAO,WAAW,CAAC;KACpB;IAED,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,WAAW,EAAE,CAAC,CAAC;AACpE,CAAC;AARD,wCAQC","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ConfigPlugin } from '../Plugin.types';\nimport { withAppBuildGradle } from '../plugins/android-plugins';\nimport * as WarningAggregator from '../utils/warnings';\n\nexport const withVersion: ConfigPlugin = config => {\n return withAppBuildGradle(config, config => {\n if (config.modResults.language === 'groovy') {\n config.modResults.contents = setVersionCode(config, config.modResults.contents);\n config.modResults.contents = setVersionName(config, config.modResults.contents);\n } else {\n WarningAggregator.addWarningAndroid(\n 'android-version',\n `Cannot automatically configure app build.gradle if it's not groovy`\n );\n }\n return config;\n });\n};\n\nexport function getVersionName(config: Pick<ExpoConfig, 'version'>) {\n return config.version ?? null;\n}\n\nexport function setVersionName(config: Pick<ExpoConfig, 'version'>, buildGradle: string) {\n const versionName = getVersionName(config);\n if (versionName === null) {\n return buildGradle;\n }\n\n const pattern = new RegExp(`versionName \".*\"`);\n return buildGradle.replace(pattern, `versionName \"${versionName}\"`);\n}\n\nexport function getVersionCode(config: Pick<ExpoConfig, 'android'>) {\n return config.android?.versionCode ?? null;\n}\n\nexport function setVersionCode(config: Pick<ExpoConfig, 'android'>, buildGradle: string) {\n const versionCode = getVersionCode(config);\n if (versionCode === null) {\n return buildGradle;\n }\n\n const pattern = new RegExp(`versionCode.*`);\n return buildGradle.replace(pattern, `versionCode ${versionCode}`);\n}\n"]}