Update capacitor version
This commit is contained in:
parent
91155bce0a
commit
f3b3a86b32
610 changed files with 28718 additions and 7101 deletions
43
@capacitor/cli/dist/android/doctor.js
vendored
43
@capacitor/cli/dist/android/doctor.js
vendored
|
@ -2,21 +2,18 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.doctorAndroid = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const utils_fs_1 = require("@ionic/utils-fs");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const path_1 = require("path");
|
||||
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
||||
const common_1 = require("../common");
|
||||
const errors_1 = require("../errors");
|
||||
const log_1 = require("../log");
|
||||
const fs_1 = require("../util/fs");
|
||||
const xml_1 = require("../util/xml");
|
||||
async function doctorAndroid(config) {
|
||||
var _a;
|
||||
try {
|
||||
await (0, common_1.check)([
|
||||
checkAndroidInstalled,
|
||||
() => checkGradlew(config),
|
||||
() => checkAppSrcDirs(config),
|
||||
]);
|
||||
await (0, common_1.check)([checkAndroidInstalled, () => checkGradlew(config), () => checkAppSrcDirs(config)]);
|
||||
(0, log_1.logSuccess)('Android looking great! 👌');
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -28,20 +25,20 @@ async function doctorAndroid(config) {
|
|||
}
|
||||
exports.doctorAndroid = doctorAndroid;
|
||||
async function checkAppSrcDirs(config) {
|
||||
if (!(await (0, utils_fs_1.pathExists)(config.android.appDirAbs))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(config.android.appDirAbs))) {
|
||||
return `${colors_1.default.strong(config.android.appDir)} directory is missing in ${colors_1.default.strong(config.android.platformDir)}`;
|
||||
}
|
||||
if (!(await (0, utils_fs_1.pathExists)(config.android.srcMainDirAbs))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(config.android.srcMainDirAbs))) {
|
||||
return `${colors_1.default.strong(config.android.srcMainDir)} directory is missing in ${colors_1.default.strong(config.android.platformDir)}`;
|
||||
}
|
||||
if (!(await (0, utils_fs_1.pathExists)(config.android.assetsDirAbs))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(config.android.assetsDirAbs))) {
|
||||
return `${colors_1.default.strong(config.android.assetsDir)} directory is missing in ${colors_1.default.strong(config.android.platformDir)}`;
|
||||
}
|
||||
if (!(await (0, utils_fs_1.pathExists)(config.android.webDirAbs))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(config.android.webDirAbs))) {
|
||||
return `${colors_1.default.strong(config.android.webDir)} directory is missing in ${colors_1.default.strong(config.android.platformDir)}`;
|
||||
}
|
||||
const appSrcMainAssetsWwwIndexHtmlDir = (0, path_1.join)(config.android.webDirAbs, 'index.html');
|
||||
if (!(await (0, utils_fs_1.pathExists)(appSrcMainAssetsWwwIndexHtmlDir))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(appSrcMainAssetsWwwIndexHtmlDir))) {
|
||||
return `${colors_1.default.strong('index.html')} file is missing in ${colors_1.default.strong(config.android.webDirAbs)}`;
|
||||
}
|
||||
return checkAndroidManifestFile(config);
|
||||
|
@ -49,7 +46,7 @@ async function checkAppSrcDirs(config) {
|
|||
async function checkAndroidManifestFile(config) {
|
||||
const manifestFileName = 'AndroidManifest.xml';
|
||||
const manifestFilePath = (0, path_1.join)(config.android.srcMainDirAbs, manifestFileName);
|
||||
if (!(await (0, utils_fs_1.pathExists)(manifestFilePath))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(manifestFilePath))) {
|
||||
return `${colors_1.default.strong(manifestFileName)} is missing in ${colors_1.default.strong(config.android.srcMainDir)}`;
|
||||
}
|
||||
try {
|
||||
|
@ -70,22 +67,22 @@ async function checkAndroidManifestData(config, xmlData) {
|
|||
return `Missing ${colors_1.default.input('<application>')} XML node as a child node of ${colors_1.default.input('<manifest>')} in ${colors_1.default.strong(config.android.srcMainDir)}`;
|
||||
}
|
||||
let mainActivityClassPath = '';
|
||||
const mainApplicationNode = applicationChildNodes.find(applicationChildNode => {
|
||||
const mainApplicationNode = applicationChildNodes.find((applicationChildNode) => {
|
||||
const activityChildNodes = applicationChildNode.activity;
|
||||
if (!Array.isArray(activityChildNodes)) {
|
||||
return false;
|
||||
}
|
||||
const mainActivityNode = activityChildNodes.find(activityChildNode => {
|
||||
const mainActivityNode = activityChildNodes.find((activityChildNode) => {
|
||||
const intentFilterChildNodes = activityChildNode['intent-filter'];
|
||||
if (!Array.isArray(intentFilterChildNodes)) {
|
||||
return false;
|
||||
}
|
||||
return intentFilterChildNodes.find(intentFilterChildNode => {
|
||||
return intentFilterChildNodes.find((intentFilterChildNode) => {
|
||||
const actionChildNodes = intentFilterChildNode.action;
|
||||
if (!Array.isArray(actionChildNodes)) {
|
||||
return false;
|
||||
}
|
||||
const mainActionChildNode = actionChildNodes.find(actionChildNode => {
|
||||
const mainActionChildNode = actionChildNodes.find((actionChildNode) => {
|
||||
const androidName = actionChildNode.$['android:name'];
|
||||
return androidName === 'android.intent.action.MAIN';
|
||||
});
|
||||
|
@ -96,7 +93,7 @@ async function checkAndroidManifestData(config, xmlData) {
|
|||
if (!Array.isArray(categoryChildNodes)) {
|
||||
return false;
|
||||
}
|
||||
return categoryChildNodes.find(categoryChildNode => {
|
||||
return categoryChildNodes.find((categoryChildNode) => {
|
||||
const androidName = categoryChildNode.$['android:name'];
|
||||
return androidName === 'android.intent.category.LAUNCHER';
|
||||
});
|
||||
|
@ -117,12 +114,12 @@ async function checkAndroidManifestData(config, xmlData) {
|
|||
}
|
||||
async function checkPackage(config, mainActivityClassPath) {
|
||||
const appSrcMainJavaDir = (0, path_1.join)(config.android.srcMainDirAbs, 'java');
|
||||
if (!(await (0, utils_fs_1.pathExists)(appSrcMainJavaDir))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(appSrcMainJavaDir))) {
|
||||
return `${colors_1.default.strong('java')} directory is missing in ${colors_1.default.strong(appSrcMainJavaDir)}`;
|
||||
}
|
||||
const mainActivityClassName = mainActivityClassPath.split('.').pop();
|
||||
const srcFiles = await (0, utils_fs_1.readdirp)(appSrcMainJavaDir, {
|
||||
filter: entry => !entry.stats.isDirectory() &&
|
||||
const srcFiles = await (0, fs_1.readdirp)(appSrcMainJavaDir, {
|
||||
filter: (entry) => !entry.stats.isDirectory() &&
|
||||
['.java', '.kt'].includes((0, path_1.extname)(entry.path)) &&
|
||||
mainActivityClassName === (0, path_1.parse)(entry.path).name,
|
||||
});
|
||||
|
@ -134,10 +131,10 @@ async function checkPackage(config, mainActivityClassPath) {
|
|||
async function checkBuildGradle(config) {
|
||||
const fileName = 'build.gradle';
|
||||
const filePath = (0, path_1.join)(config.android.appDirAbs, fileName);
|
||||
if (!(await (0, utils_fs_1.pathExists)(filePath))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(filePath))) {
|
||||
return `${colors_1.default.strong(fileName)} file is missing in ${colors_1.default.strong(config.android.appDir)}`;
|
||||
}
|
||||
let fileContent = await (0, utils_fs_1.readFile)(filePath, { encoding: 'utf-8' });
|
||||
let fileContent = await (0, fs_extra_1.readFile)(filePath, { encoding: 'utf-8' });
|
||||
fileContent = fileContent.replace(/'|"/g, '').replace(/\s+/g, ' ');
|
||||
const searchFor = `applicationId`;
|
||||
if (fileContent.indexOf(searchFor) === -1) {
|
||||
|
@ -148,7 +145,7 @@ async function checkBuildGradle(config) {
|
|||
async function checkGradlew(config) {
|
||||
const fileName = 'gradlew';
|
||||
const filePath = (0, path_1.join)(config.android.platformDirAbs, fileName);
|
||||
if (!(await (0, utils_fs_1.pathExists)(filePath))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(filePath))) {
|
||||
return `${colors_1.default.strong(fileName)} file is missing in ${colors_1.default.strong(config.android.platformDir)}`;
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue