amis-rpc-design/node_modules/@react-native-community/cli/build/commands/upgrade/upgrade.js.map

1 line
26 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"names":["repos","rawDiffUrl","webDiffUrl","dependencyName","isConnected","output","includes","checkForErrors","CLIError","logger","warn","getLatestRNVersion","repoName","info","stdout","stderr","execa","getRNPeerDeps","version","JSON","parse","getPatch","currentVersion","newVersion","config","patch","data","fetch","error","message","chalk","underline","dim","patchWithRenamedProjects","Object","keys","project","forEach","platform","xcodeProject","ios","replace","RegExp","name","packageName","split","join","getVersionToUpgradeTo","argv","projectDir","argVersion","semverCoercedVersion","semver","coerce","valid","gt","eq","dependencies","require","path","parsedVersion","length","satisfies","installDeps","root","peerDeps","deps","map","module","PackageManager","install","silent","installCocoaPodsDeps","process","installPods","directory","pop","debug","applyPatch","tmpPatchFile","defaultExcludes","filesThatDontExist","filesThatFailedToApply","relativePathFromRoot","excludes","e","errorLines","filter","x","Boolean","file","bold","upgrade","ctx","rnName","success","patchSuccess","fs","writeFileSync","Error","unlinkSync","stdio","upgradeCommand","description","func"],"sources":["../../../src/commands/upgrade/upgrade.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\nimport chalk from 'chalk';\nimport semver from 'semver';\nimport execa from 'execa';\nimport {Config} from '@react-native-community/cli-types';\nimport {logger, CLIError, fetch} from '@react-native-community/cli-tools';\nimport * as PackageManager from '../../tools/packageManager';\nimport {installPods} from '@react-native-community/cli-doctor';\n\ntype UpgradeError = {message: string; stderr: string};\n\n// https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0-rc.3\n\ntype RepoNameType = 'react-native' | 'react-native-tvos';\n\nconst repos = {\n 'react-native': {\n rawDiffUrl:\n 'https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs',\n webDiffUrl: 'https://react-native-community.github.io/upgrade-helper',\n dependencyName: 'react-native',\n },\n 'react-native-tvos': {\n rawDiffUrl:\n 'https://raw.githubusercontent.com/react-native-tvos/rn-diff-purge-tv/diffs/diffs',\n webDiffUrl: 'https://react-native-community.github.io/upgrade-helper',\n dependencyName: 'react-native@npm:react-native-tvos',\n },\n};\n\nconst isConnected = (output: string): boolean => {\n // there is no reliable way of checking for internet connectivity, so we should just\n // read the output from npm (to check for connectivity errors) which is faster and relatively more reliable.\n return !output.includes('the host is inaccessible');\n};\n\nconst checkForErrors = (output: string): void => {\n if (!output) {\n return;\n }\n if (!isConnected(output)) {\n throw new CLIError(\n 'Upgrade failed. You do not seem to have an internet connection.',\n );\n }\n\n if (output.includes('npm ERR')) {\n throw new CLIError(`Upgrade failed with the following errors:\\n${output}`);\n }\n\n if (output.includes('npm WARN')) {\n logger.warn(output);\n }\n};\n\nconst getLatestRNVersion = async (repoName: RepoNameType): Promise<string> => {\n logger.info('No version passed. Fetching latest...');\n const {stdout, stderr} = await execa('npm', ['info', repoName, 'version']);\n checkForErrors(stderr);\n return stdout;\n};\n\nconst getRNPeerDeps = async (\n version: string,\n repoName: RepoNameType,\n): Promise<{[key: string]: string}> => {\n const {stdout, stderr} = await execa('npm', [\n 'info',\n `${repoName}@${version}`,\n 'peerDependencies',\n '--json',\n ]);\n checkForErrors(stderr);\n return JSON.parse(stdout);\n};\n\nconst getPatch = async (\n currentVersion: string,\n newVersion: string,\n config: Config,\n repoName: RepoNameType,\n) => {\n let patch;\n\n logger.info(`Fetching diff between v${currentVersion} and v${newVersion}...`);\n\n try {\n const {data} = await fetch(\n `${repos[repoName].rawDiffUrl}/${currentVersion}..${newV