Update capacitor version
This commit is contained in:
parent
91155bce0a
commit
f3b3a86b32
610 changed files with 28718 additions and 7101 deletions
40
@capacitor/cli/dist/tasks/copy.js
vendored
40
@capacitor/cli/dist/tasks/copy.js
vendored
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.copy = exports.copyCommand = 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");
|
||||
|
|
@ -13,7 +13,6 @@ const log_1 = require("../log");
|
|||
const plugin_1 = require("../plugin");
|
||||
const iosplugin_1 = require("../util/iosplugin");
|
||||
const promise_1 = require("../util/promise");
|
||||
const copy_1 = require("../web/copy");
|
||||
const sourcemaps_1 = require("./sourcemaps");
|
||||
async function copyCommand(config, selectedPlatformName, inline = false) {
|
||||
var _a;
|
||||
|
|
@ -29,7 +28,7 @@ async function copyCommand(config, selectedPlatformName, inline = false) {
|
|||
else {
|
||||
const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
|
||||
try {
|
||||
await (0, promise_1.allSerial)(platforms.map(platformName => () => copy(config, platformName, inline)));
|
||||
await (0, promise_1.allSerial)(platforms.map((platformName) => () => copy(config, platformName, inline)));
|
||||
}
|
||||
catch (e) {
|
||||
if ((0, errors_1.isFatal)(e)) {
|
||||
|
|
@ -50,17 +49,15 @@ async function copy(config, platformName, inline = false) {
|
|||
await (0, common_1.runHooks)(config, platformName, config.app.rootDir, 'capacitor:copy:before');
|
||||
const allPlugins = await (0, plugin_1.getPlugins)(config, platformName);
|
||||
let usesFederatedCapacitor = false;
|
||||
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/federated-capacitor').length > 0) {
|
||||
if (allPlugins.filter((plugin) => plugin.id === '@ionic-enterprise/federated-capacitor').length > 0) {
|
||||
usesFederatedCapacitor = true;
|
||||
}
|
||||
let usesLiveUpdates = false;
|
||||
if (allPlugins.filter(plugin => plugin.id === '@capacitor/live-updates')
|
||||
.length > 0) {
|
||||
if (allPlugins.filter((plugin) => plugin.id === '@capacitor/live-updates').length > 0) {
|
||||
usesLiveUpdates = true;
|
||||
}
|
||||
let usesSSLPinning = false;
|
||||
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/ssl-pinning')
|
||||
.length > 0) {
|
||||
if (allPlugins.filter((plugin) => plugin.id === '@ionic-enterprise/ssl-pinning').length > 0) {
|
||||
usesSSLPinning = true;
|
||||
}
|
||||
if (platformName === config.ios.name) {
|
||||
|
|
@ -110,9 +107,6 @@ async function copy(config, platformName, inline = false) {
|
|||
if (usesFederatedCapacitor) {
|
||||
log_1.logger.info('FederatedCapacitor Plugin installed, skipping web bundling...');
|
||||
}
|
||||
else {
|
||||
await (0, copy_1.copyWeb)(config);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `Platform ${platformName} is not valid.`;
|
||||
|
|
@ -129,9 +123,10 @@ async function copyCapacitorConfig(config, nativeAbsDir) {
|
|||
const nativeConfigFile = 'capacitor.config.json';
|
||||
const nativeConfigFilePath = (0, path_1.join)(nativeAbsDir, nativeConfigFile);
|
||||
await (0, common_1.runTask)(`Creating ${colors_1.default.strong(nativeConfigFile)} in ${nativeRelDir}`, async () => {
|
||||
var _a;
|
||||
var _a, _b;
|
||||
(_a = config.app.extConfig.android) === null || _a === void 0 ? true : delete _a.buildOptions;
|
||||
await (0, utils_fs_1.writeJSON)(nativeConfigFilePath, config.app.extConfig, {
|
||||
(_b = config.app.extConfig.ios) === null || _b === void 0 ? true : delete _b.buildOptions;
|
||||
await (0, fs_extra_1.writeJSON)(nativeConfigFilePath, config.app.extConfig, {
|
||||
spaces: '\t',
|
||||
});
|
||||
});
|
||||
|
|
@ -140,14 +135,14 @@ async function copyWebDir(config, nativeAbsDir, webAbsDir) {
|
|||
var _a;
|
||||
const webRelDir = (0, path_1.basename)(webAbsDir);
|
||||
const nativeRelDir = (0, path_1.relative)(config.app.rootDir, nativeAbsDir);
|
||||
if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await (0, utils_fs_1.pathExists)(webAbsDir))) {
|
||||
if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await (0, fs_extra_1.pathExists)(webAbsDir))) {
|
||||
log_1.logger.warn(`Cannot copy web assets from ${colors_1.default.strong(webRelDir)} to ${nativeRelDir}\n` +
|
||||
`Web asset directory specified by ${colors_1.default.input('webDir')} does not exist. This is not an error because ${colors_1.default.input('server.url')} is set in config.`);
|
||||
return;
|
||||
}
|
||||
await (0, common_1.runTask)(`Copying web assets from ${colors_1.default.strong(webRelDir)} to ${nativeRelDir}`, async () => {
|
||||
await (0, utils_fs_1.remove)(nativeAbsDir);
|
||||
return (0, utils_fs_1.copy)(webAbsDir, nativeAbsDir);
|
||||
await (0, fs_extra_1.remove)(nativeAbsDir);
|
||||
return (0, fs_extra_1.copy)(webAbsDir, nativeAbsDir);
|
||||
});
|
||||
}
|
||||
async function copyFederatedWebDirs(config, nativeAbsDir) {
|
||||
|
|
@ -165,7 +160,7 @@ async function copyFederatedWebDirs(config, nativeAbsDir) {
|
|||
throw `FederatedCapacitor plugin is present but there is a problem with the apps defined in the config.`;
|
||||
}
|
||||
const copyApps = () => {
|
||||
return federatedConfig.apps.map(app => {
|
||||
return federatedConfig.apps.map((app) => {
|
||||
const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
|
||||
return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
|
||||
});
|
||||
|
|
@ -177,27 +172,26 @@ async function copyFederatedWebDirs(config, nativeAbsDir) {
|
|||
}
|
||||
}
|
||||
function isFederatedApp(config) {
|
||||
return (config.webDir !== undefined &&
|
||||
config.name !== undefined);
|
||||
return config.webDir !== undefined && config.name !== undefined;
|
||||
}
|
||||
async function copySecureLiveUpdatesKey(secureLiveUpdatesKeyFile, rootDir, nativeAbsDir) {
|
||||
const keyAbsFromPath = (0, path_1.join)(rootDir, secureLiveUpdatesKeyFile);
|
||||
const keyAbsToPath = (0, path_1.join)(nativeAbsDir, (0, path_1.basename)(keyAbsFromPath));
|
||||
const keyRelToDir = (0, path_1.relative)(rootDir, nativeAbsDir);
|
||||
if (!(await (0, utils_fs_1.pathExists)(keyAbsFromPath))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(keyAbsFromPath))) {
|
||||
log_1.logger.warn(`Cannot copy Secure Live Updates signature file from ${colors_1.default.strong(keyAbsFromPath)} to ${keyRelToDir}\n` +
|
||||
`Signature file does not exist at specified key path.`);
|
||||
return;
|
||||
}
|
||||
await (0, common_1.runTask)(`Copying Secure Live Updates key from ${colors_1.default.strong(secureLiveUpdatesKeyFile)} to ${keyRelToDir}`, async () => {
|
||||
return (0, utils_fs_1.copy)(keyAbsFromPath, keyAbsToPath);
|
||||
return (0, fs_extra_1.copy)(keyAbsFromPath, keyAbsToPath);
|
||||
});
|
||||
}
|
||||
async function copySSLCert(sslCertPaths, rootDir, targetDir) {
|
||||
const validCertPaths = [];
|
||||
for (const sslCertPath of sslCertPaths) {
|
||||
const certAbsFromPath = (0, path_1.join)(rootDir, sslCertPath);
|
||||
if (!(await (0, utils_fs_1.pathExists)(certAbsFromPath))) {
|
||||
if (!(await (0, fs_extra_1.pathExists)(certAbsFromPath))) {
|
||||
log_1.logger.warn(`Cannot copy SSL Certificate file from ${colors_1.default.strong(certAbsFromPath)}\n` +
|
||||
`SSL Certificate does not exist at specified path.`);
|
||||
return;
|
||||
|
|
@ -209,7 +203,7 @@ async function copySSLCert(sslCertPaths, rootDir, targetDir) {
|
|||
await (0, common_1.runTask)(`Copying SSL Certificates from to ${certsDirRelToDir}`, async () => {
|
||||
const promises = [];
|
||||
for (const certPath of validCertPaths) {
|
||||
promises.push((0, utils_fs_1.copy)(certPath, (0, path_1.join)(certsDirAbsToPath, (0, path_1.basename)(certPath))));
|
||||
promises.push((0, fs_extra_1.copy)(certPath, (0, path_1.join)(certsDirAbsToPath, (0, path_1.basename)(certPath))));
|
||||
}
|
||||
return Promise.all(promises);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue