@react-native-community/cli-platform-android
Advanced tools
Comparing version 14.0.0-alpha.5 to 14.0.0-alpha.6
@@ -14,2 +14,3 @@ import { Config } from '@react-native-community/cli-types'; | ||
packager?: boolean; | ||
device?: string; | ||
deviceId?: string; | ||
@@ -16,0 +17,0 @@ listDevices?: boolean; |
@@ -136,2 +136,6 @@ "use strict"; | ||
async function buildAndRun(args, androidProject) { | ||
if (args.deviceId) { | ||
_cliTools().logger.warn('The `deviceId` parameter is renamed to `device`. Please use the new `device` argument next time to avoid this warning.'); | ||
args.device = args.deviceId; | ||
} | ||
process.chdir(androidProject.sourceDir); | ||
@@ -148,4 +152,4 @@ const cmd = process.platform.startsWith('win') ? 'gradlew.bat' : './gradlew'; | ||
if (args.listDevices || args.interactive) { | ||
if (args.deviceId) { | ||
_cliTools().logger.warn('Both "deviceId" and "list-devices" parameters were passed to "run" command. We will list available devices and let you choose from one'); | ||
if (args.device) { | ||
_cliTools().logger.warn(`Both ${args.deviceId ? 'deviceId' : 'device'} and "list-devices" parameters were passed to "run" command. We will list available devices and let you choose from one`); | ||
} | ||
@@ -184,3 +188,3 @@ const device = await (0, _listAndroidDevices.default)(); | ||
} | ||
if (args.deviceId) { | ||
if (args.device) { | ||
return runOnSpecificDevice(args, adbPath, androidProject, selectedTask); | ||
@@ -266,4 +270,7 @@ } else { | ||
}, { | ||
name: '--device <string>', | ||
description: 'Explicitly set the device to use by name. The value is not required ' + 'if you have a single device connected.' | ||
}, { | ||
name: '--deviceId <string>', | ||
description: 'builds your app and starts it on a specific device/simulator with the ' + 'given device id (listed by running "adb devices" on the command line).' | ||
description: '**DEPRECATED** Builds your app and starts it on a specific device/simulator with the ' + 'given device id (listed by running "adb devices" on the command line).' | ||
}, { | ||
@@ -270,0 +277,0 @@ name: '--list-devices', |
@@ -71,5 +71,2 @@ "use strict"; | ||
_cliTools().logger.info(`Detected architectures ${architectures.join(', ')}`); | ||
// `reactNativeDebugArchitectures` was renamed to `reactNativeArchitectures` in 0.68. | ||
// Can be removed when 0.67 no longer needs to be supported. | ||
gradleArgs.push('-PreactNativeDebugArchitectures=' + architectures.join(',')); | ||
gradleArgs.push('-PreactNativeArchitectures=' + architectures.join(',')); | ||
@@ -76,0 +73,0 @@ } |
@@ -41,3 +41,3 @@ "use strict"; | ||
const applicationIdWithSuffix = [appId || applicationId, appIdSuffix].filter(Boolean).join('.'); | ||
const activityToLaunch = mainActivity.startsWith(packageName) ? mainActivity : mainActivity.startsWith('.') ? [packageName, mainActivity].join('') : [packageName, mainActivity].filter(Boolean).join('.'); | ||
const activityToLaunch = mainActivity.startsWith(packageName) || !mainActivity.startsWith('.') && mainActivity.includes('.') ? mainActivity : mainActivity.startsWith('.') ? [packageName, mainActivity].join('') : [packageName, mainActivity].filter(Boolean).join('.'); | ||
try { | ||
@@ -44,0 +44,0 @@ // Here we're using the same flags as Android Studio to launch the app |
@@ -40,2 +40,34 @@ /** | ||
}; | ||
export declare const validWithDifferentFileName: { | ||
'build.gradle': any; | ||
src: { | ||
'AndroidManifest.xml': any; | ||
main: { | ||
com: { | ||
some: { | ||
example: { | ||
[x: string]: any; | ||
'Main.java': any; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
export declare const validKotlinWithDifferentFileName: { | ||
'build.gradle': any; | ||
src: { | ||
'AndroidManifest.xml': any; | ||
main: { | ||
com: { | ||
some: { | ||
example: { | ||
[x: string]: any; | ||
'Main.java': any; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
export declare const validApp: { | ||
@@ -42,0 +74,0 @@ 'build.gradle': any; |
@@ -8,5 +8,5 @@ /** | ||
*/ | ||
export declare function getMainActivityFiles(folder: string): string[]; | ||
export declare function getMainActivityFiles(folder: string, includePackage?: boolean): string[]; | ||
export default function getPackageClassName(folder: string): string | null; | ||
export declare function matchClassName(file: string): RegExpMatchArray | null; | ||
//# sourceMappingURL=findPackageClassName.d.ts.map |
@@ -46,4 +46,10 @@ "use strict"; | ||
function getMainActivityFiles(folder) { | ||
return _fastGlob().default.sync('**/+(*.java|*.kt)', { | ||
function getMainActivityFiles(folder, includePackage = true) { | ||
let patternArray = []; | ||
if (includePackage) { | ||
patternArray.push('*Package.java', '*Package.kt'); | ||
} else { | ||
patternArray.push('*.java', '*.kt'); | ||
} | ||
return _fastGlob().default.sync(`**/+(${patternArray.join('|')})`, { | ||
cwd: (0, _cliTools().unixifyPaths)(folder) | ||
@@ -53,4 +59,8 @@ }); | ||
function getPackageClassName(folder) { | ||
const files = getMainActivityFiles(folder); | ||
const packages = files.map(filePath => _fs().default.readFileSync(_path().default.join(folder, filePath), 'utf8')).map(matchClassName).filter(match => match); | ||
let files = getMainActivityFiles(folder); | ||
let packages = getClassNameMatches(files, folder); | ||
if (!packages.length) { | ||
files = getMainActivityFiles(folder, false); | ||
packages = getClassNameMatches(files, folder); | ||
} | ||
@@ -60,2 +70,5 @@ // @ts-ignore | ||
} | ||
function getClassNameMatches(files, folder) { | ||
return files.map(filePath => _fs().default.readFileSync(_path().default.join(folder, filePath), 'utf8')).map(matchClassName).filter(match => match); | ||
} | ||
function matchClassName(file) { | ||
@@ -62,0 +75,0 @@ const nativeModuleMatch = file.match(/class\s+(\w+[^(\s]*)[\s\w():]*(\s+implements\s+|:)[\s\w():,]*[^{]*ReactPackage/); |
@@ -9,3 +9,3 @@ "use strict"; | ||
function isProjectUsingKotlin(sourceDir) { | ||
const mainActivityFiles = (0, _findPackageClassName.getMainActivityFiles)(sourceDir); | ||
const mainActivityFiles = (0, _findPackageClassName.getMainActivityFiles)(sourceDir, false); | ||
return mainActivityFiles.some(file => file.endsWith('.kt')); | ||
@@ -12,0 +12,0 @@ } |
{ | ||
"name": "@react-native-community/cli-platform-android", | ||
"version": "14.0.0-alpha.5", | ||
"version": "14.0.0-alpha.6", | ||
"license": "MIT", | ||
@@ -10,3 +10,3 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@react-native-community/cli-tools": "14.0.0-alpha.5", | ||
"@react-native-community/cli-tools": "14.0.0-alpha.6", | ||
"chalk": "^4.1.2", | ||
@@ -25,3 +25,3 @@ "execa": "^5.0.0", | ||
"devDependencies": { | ||
"@react-native-community/cli-types": "14.0.0-alpha.5", | ||
"@react-native-community/cli-types": "14.0.0-alpha.6", | ||
"@types/fs-extra": "^8.1.0" | ||
@@ -35,3 +35,3 @@ }, | ||
}, | ||
"gitHead": "0bcdb73b48fd9c8755b5031326fc0f93bbe69789" | ||
"gitHead": "3e225892eedc9335ad7dc8c64a4014939d2838a5" | ||
} |
@@ -39,6 +39,12 @@ # @react-native-community/cli-platform-android | ||
#### `--device <string>` | ||
Explicitly set the device to use by name. The value is not required if you have a single device connected. | ||
#### `--deviceId <string>` | ||
builds your app and starts it on a specific device/simulator with the given device id (listed by running "adb devices" on the command line). | ||
> **DEPRECATED** - use `--device <string>` instead | ||
Builds your app and starts it on a specific device with the given device id (listed by running "adb devices" on the command line). | ||
#### `--no-packager` | ||
@@ -45,0 +51,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242105
2518
133
+ Added@react-native-community/cli-tools@14.0.0-alpha.6(transitive)
- Removed@react-native-community/cli-tools@14.0.0-alpha.5(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)