@capacitor/cli 5.0.0-beta.1 → 5.0.0-dev-20230412T155745.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/android-template.tar.gz +0 -0
- package/assets/capacitor-cordova-android-plugins.tar.gz +0 -0
- package/assets/capacitor-cordova-ios-plugins.tar.gz +0 -0
- package/assets/ios-template.tar.gz +0 -0
- package/dist/common.js +1 -1
- package/dist/config.js +26 -3
- package/dist/declarations.d.ts +6 -6
- package/dist/ios/common.js +31 -2
- package/dist/ios/doctor.js +1 -1
- package/dist/ios/update.js +10 -3
- package/dist/tasks/add.js +4 -1
- package/dist/tasks/copy.js +27 -25
- package/dist/tasks/update.js +1 -1
- package/package.json +3 -3
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/common.js
CHANGED
|
@@ -95,7 +95,7 @@ async function checkAppId(config, id) {
|
|
|
95
95
|
exports.checkAppId = checkAppId;
|
|
96
96
|
async function checkAppName(config, name) {
|
|
97
97
|
// We allow pretty much anything right now, have fun
|
|
98
|
-
if (!name ||
|
|
98
|
+
if (!(name === null || name === void 0 ? void 0 : name.length)) {
|
|
99
99
|
return `Must provide an app name. For example: 'Spacebook'`;
|
|
100
100
|
}
|
|
101
101
|
return null;
|
package/dist/config.js
CHANGED
|
@@ -12,6 +12,7 @@ const fn_1 = require("./util/fn");
|
|
|
12
12
|
const js_1 = require("./util/js");
|
|
13
13
|
const node_1 = require("./util/node");
|
|
14
14
|
const promise_1 = require("./util/promise");
|
|
15
|
+
const subprocess_1 = require("./util/subprocess");
|
|
15
16
|
const debug = (0, debug_1.default)('capacitor:config');
|
|
16
17
|
exports.CONFIG_FILE_NAME_TS = 'capacitor.config.ts';
|
|
17
18
|
exports.CONFIG_FILE_NAME_JS = 'capacitor.config.js';
|
|
@@ -205,7 +206,6 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
|
|
|
205
206
|
async function loadIOSConfig(rootDir, extConfig) {
|
|
206
207
|
var _a, _b, _c, _d;
|
|
207
208
|
const name = 'ios';
|
|
208
|
-
const podPath = determineCocoapodPath();
|
|
209
209
|
const platformDir = (_b = (_a = extConfig.ios) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : 'ios';
|
|
210
210
|
const platformDirAbs = (0, path_1.resolve)(rootDir, platformDir);
|
|
211
211
|
const scheme = (_d = (_c = extConfig.ios) === null || _c === void 0 ? void 0 : _c.scheme) !== null && _d !== void 0 ? _d : 'App';
|
|
@@ -216,6 +216,7 @@ async function loadIOSConfig(rootDir, extConfig) {
|
|
|
216
216
|
const nativeXcodeProjDir = `${nativeProjectDir}/App.xcodeproj`;
|
|
217
217
|
const nativeXcodeProjDirAbs = (0, path_1.resolve)(platformDirAbs, nativeXcodeProjDir);
|
|
218
218
|
const nativeXcodeWorkspaceDirAbs = (0, promise_1.lazy)(() => determineXcodeWorkspaceDirAbs(nativeProjectDirAbs));
|
|
219
|
+
const podPath = (0, promise_1.lazy)(() => determineGemfileOrCocoapodPath(rootDir, platformDirAbs, nativeProjectDirAbs));
|
|
219
220
|
const webDirAbs = (0, promise_1.lazy)(() => determineIOSWebDirAbs(nativeProjectDirAbs, nativeTargetDirAbs, nativeXcodeProjDirAbs));
|
|
220
221
|
const cordovaPluginsDir = 'capacitor-cordova-ios-plugins';
|
|
221
222
|
return {
|
|
@@ -315,11 +316,33 @@ async function determineAndroidStudioPath(os) {
|
|
|
315
316
|
}
|
|
316
317
|
return '';
|
|
317
318
|
}
|
|
318
|
-
function
|
|
319
|
+
async function determineGemfileOrCocoapodPath(rootDir, platformDir, nativeProjectDirAbs) {
|
|
319
320
|
if (process.env.CAPACITOR_COCOAPODS_PATH) {
|
|
320
321
|
return process.env.CAPACITOR_COCOAPODS_PATH;
|
|
321
322
|
}
|
|
322
|
-
|
|
323
|
+
// Look for 'Gemfile' in app directories
|
|
324
|
+
const appSpecificGemfileExists = (await (0, utils_fs_1.pathExists)((0, path_1.resolve)(rootDir, 'Gemfile'))) ||
|
|
325
|
+
(await (0, utils_fs_1.pathExists)((0, path_1.resolve)(platformDir, 'Gemfile'))) ||
|
|
326
|
+
(await (0, utils_fs_1.pathExists)((0, path_1.resolve)(nativeProjectDirAbs, 'Gemfile')));
|
|
327
|
+
// Multi-app projects might share a single global 'Gemfile' at the Git repository root directory.
|
|
328
|
+
let globalGemfileExists = false;
|
|
329
|
+
if (!appSpecificGemfileExists) {
|
|
330
|
+
try {
|
|
331
|
+
const output = await (0, subprocess_1.getCommandOutput)('git', ['rev-parse', '--show-toplevel'], { cwd: rootDir });
|
|
332
|
+
if (output != null) {
|
|
333
|
+
globalGemfileExists = await (0, utils_fs_1.pathExists)((0, path_1.resolve)(output, 'Gemfile'));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
catch (e) {
|
|
337
|
+
// Nothing
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (appSpecificGemfileExists || globalGemfileExists) {
|
|
341
|
+
return 'bundle exec pod';
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
return 'pod';
|
|
345
|
+
}
|
|
323
346
|
}
|
|
324
347
|
function formatConfigTS(extConfig) {
|
|
325
348
|
// TODO: <reference> tags
|
package/dist/declarations.d.ts
CHANGED
|
@@ -537,7 +537,7 @@ export interface CapacitorConfig {
|
|
|
537
537
|
*/
|
|
538
538
|
includePlugins?: string[];
|
|
539
539
|
}
|
|
540
|
-
export interface
|
|
540
|
+
export interface FederatedApp {
|
|
541
541
|
name: string;
|
|
542
542
|
webDir: string;
|
|
543
543
|
liveUpdateConfig?: LiveUpdateConfig;
|
|
@@ -560,13 +560,13 @@ export interface PluginsConfig {
|
|
|
560
560
|
[key: string]: any;
|
|
561
561
|
} | undefined;
|
|
562
562
|
/**
|
|
563
|
-
*
|
|
563
|
+
* FederatedCapacitor plugin configuration
|
|
564
564
|
*
|
|
565
|
-
* @since
|
|
565
|
+
* @since 5.0.0
|
|
566
566
|
*/
|
|
567
|
-
|
|
568
|
-
shell:
|
|
569
|
-
apps:
|
|
567
|
+
FederatedCapacitor?: {
|
|
568
|
+
shell: FederatedApp;
|
|
569
|
+
apps: FederatedApp[];
|
|
570
570
|
liveUpdatesKey?: string;
|
|
571
571
|
};
|
|
572
572
|
/**
|
package/dist/ios/common.js
CHANGED
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.editProjectSettingsIOS = exports.resolvePlugin = exports.getIOSPlugins = exports.checkCocoaPods = exports.checkIOSPackage = void 0;
|
|
3
|
+
exports.editProjectSettingsIOS = exports.resolvePlugin = exports.getIOSPlugins = exports.checkCocoaPods = exports.checkBundler = exports.checkIOSPackage = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
8
9
|
const common_1 = require("../common");
|
|
9
10
|
const cordova_1 = require("../cordova");
|
|
11
|
+
const log_1 = require("../log");
|
|
10
12
|
const plugin_1 = require("../plugin");
|
|
11
13
|
const subprocess_1 = require("../util/subprocess");
|
|
12
14
|
async function checkIOSPackage(config) {
|
|
13
15
|
return (0, common_1.checkCapacitorPlatform)(config, 'ios');
|
|
14
16
|
}
|
|
15
17
|
exports.checkIOSPackage = checkIOSPackage;
|
|
18
|
+
function execBundler() {
|
|
19
|
+
try {
|
|
20
|
+
const bundleOutput = (0, child_process_1.execSync)('bundle &> /dev/null ; echo $?');
|
|
21
|
+
return parseInt(bundleOutput.toString());
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return -1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function checkBundler(config) {
|
|
28
|
+
if (config.cli.os === "mac" /* OS.Mac */) {
|
|
29
|
+
let bundlerResult = execBundler();
|
|
30
|
+
if (bundlerResult === 1) {
|
|
31
|
+
// Bundler version is outdated
|
|
32
|
+
log_1.logger.info(`Using ${colors_1.default.strong('Gemfile')}: Bundler update needed...`);
|
|
33
|
+
await (0, subprocess_1.runCommand)('gem', ['install', 'bundler']);
|
|
34
|
+
bundlerResult = execBundler();
|
|
35
|
+
}
|
|
36
|
+
if (bundlerResult === 0) {
|
|
37
|
+
// Bundler in use, all gems current
|
|
38
|
+
log_1.logger.info(`Using ${colors_1.default.strong('Gemfile')}: RubyGems bundle installed`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
exports.checkBundler = checkBundler;
|
|
16
44
|
async function checkCocoaPods(config) {
|
|
17
|
-
if (!(await (0, subprocess_1.isInstalled)(config.ios.podPath)) &&
|
|
45
|
+
if (!(await (0, subprocess_1.isInstalled)(await config.ios.podPath)) &&
|
|
46
|
+
config.cli.os === "mac" /* OS.Mac */) {
|
|
18
47
|
return (`CocoaPods is not installed.\n` +
|
|
19
48
|
`See this install guide: ${colors_1.default.strong('https://capacitorjs.com/docs/getting-started/environment-setup#homebrew')}`);
|
|
20
49
|
}
|
package/dist/ios/doctor.js
CHANGED
|
@@ -21,7 +21,7 @@ async function doctorIOS(config) {
|
|
|
21
21
|
// check if www folder is empty (index.html does not exist)
|
|
22
22
|
try {
|
|
23
23
|
await (0, common_1.check)([
|
|
24
|
-
() => (0, common_2.checkCocoaPods)(config),
|
|
24
|
+
() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config),
|
|
25
25
|
() => (0, common_1.checkWebDir)(config),
|
|
26
26
|
checkXcode,
|
|
27
27
|
]);
|
package/dist/ios/update.js
CHANGED
|
@@ -40,7 +40,7 @@ async function updateIOS(config, deployment) {
|
|
|
40
40
|
}
|
|
41
41
|
exports.updateIOS = updateIOS;
|
|
42
42
|
async function installCocoaPodsPlugins(config, plugins, deployment) {
|
|
43
|
-
await (0, common_1.runTask)(`Updating iOS native dependencies with ${colors_1.default.input(`${config.ios.podPath} install`)}`, () => {
|
|
43
|
+
await (0, common_1.runTask)(`Updating iOS native dependencies with ${colors_1.default.input(`${await config.ios.podPath} install`)}`, () => {
|
|
44
44
|
return updatePodfile(config, plugins, deployment);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -51,9 +51,16 @@ async function updatePodfile(config, plugins, deployment) {
|
|
|
51
51
|
let podfileContent = await (0, utils_fs_1.readFile)(podfilePath, { encoding: 'utf-8' });
|
|
52
52
|
podfileContent = podfileContent.replace(/(def capacitor_pods)[\s\S]+?(\nend)/, `$1${dependenciesContent}$2`);
|
|
53
53
|
await (0, utils_fs_1.writeFile)(podfilePath, podfileContent, { encoding: 'utf-8' });
|
|
54
|
+
const podPath = await config.ios.podPath;
|
|
55
|
+
const useBundler = podPath.startsWith('bundle');
|
|
54
56
|
const podCommandExists = await (0, subprocess_1.isInstalled)('pod');
|
|
55
|
-
if (podCommandExists) {
|
|
56
|
-
|
|
57
|
+
if (useBundler || podCommandExists) {
|
|
58
|
+
if (useBundler) {
|
|
59
|
+
await (0, subprocess_1.runCommand)('bundle', ['exec', 'pod', 'install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
await (0, subprocess_1.runCommand)(podPath, ['install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
else {
|
|
59
66
|
log_1.logger.warn('Skipping pod install because CocoaPods is not installed');
|
package/dist/tasks/add.js
CHANGED
|
@@ -82,7 +82,10 @@ function printNextSteps(platformName) {
|
|
|
82
82
|
}
|
|
83
83
|
function addChecks(config, platformName) {
|
|
84
84
|
if (platformName === config.ios.name) {
|
|
85
|
-
return [
|
|
85
|
+
return [
|
|
86
|
+
() => (0, common_3.checkIOSPackage)(config),
|
|
87
|
+
() => (0, common_3.checkBundler)(config) || (0, common_3.checkCocoaPods)(config),
|
|
88
|
+
];
|
|
86
89
|
}
|
|
87
90
|
else if (platformName === config.android.name) {
|
|
88
91
|
return [() => (0, common_1.checkAndroidPackage)(config)];
|
package/dist/tasks/copy.js
CHANGED
|
@@ -47,9 +47,9 @@ async function copy(config, platformName, inline = false) {
|
|
|
47
47
|
}
|
|
48
48
|
await (0, common_1.runPlatformHook)(config, platformName, config.app.rootDir, 'capacitor:copy:before');
|
|
49
49
|
const allPlugins = await (0, plugin_1.getPlugins)(config, platformName);
|
|
50
|
-
let
|
|
51
|
-
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/capacitor
|
|
52
|
-
|
|
50
|
+
let usesFederatedCapacitor = false;
|
|
51
|
+
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/federated-capacitor').length > 0) {
|
|
52
|
+
usesFederatedCapacitor = true;
|
|
53
53
|
}
|
|
54
54
|
let usesLiveUpdates = false;
|
|
55
55
|
if (allPlugins.filter(plugin => plugin.id === '@capacitor/live-updates')
|
|
@@ -62,10 +62,10 @@ async function copy(config, platformName, inline = false) {
|
|
|
62
62
|
usesSSLPinning = true;
|
|
63
63
|
}
|
|
64
64
|
if (platformName === config.ios.name) {
|
|
65
|
-
if (
|
|
65
|
+
if (usesFederatedCapacitor) {
|
|
66
66
|
await copyFederatedWebDirs(config, await config.ios.webDirAbs);
|
|
67
|
-
if ((_c = (_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.
|
|
68
|
-
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.
|
|
67
|
+
if ((_c = (_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.FederatedCapacitor) === null || _c === void 0 ? void 0 : _c.liveUpdatesKey) {
|
|
68
|
+
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.FederatedCapacitor.liveUpdatesKey, config.app.rootDir, config.ios.nativeTargetDirAbs);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
@@ -82,10 +82,10 @@ async function copy(config, platformName, inline = false) {
|
|
|
82
82
|
await (0, cordova_1.handleCordovaPluginsJS)(cordovaPlugins, config, platformName);
|
|
83
83
|
}
|
|
84
84
|
else if (platformName === config.android.name) {
|
|
85
|
-
if (
|
|
85
|
+
if (usesFederatedCapacitor) {
|
|
86
86
|
await copyFederatedWebDirs(config, config.android.webDirAbs);
|
|
87
|
-
if ((_o = (_m = (_l = config.app.extConfig) === null || _l === void 0 ? void 0 : _l.plugins) === null || _m === void 0 ? void 0 : _m.
|
|
88
|
-
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.
|
|
87
|
+
if ((_o = (_m = (_l = config.app.extConfig) === null || _l === void 0 ? void 0 : _l.plugins) === null || _m === void 0 ? void 0 : _m.FederatedCapacitor) === null || _o === void 0 ? void 0 : _o.liveUpdatesKey) {
|
|
88
|
+
await copySecureLiveUpdatesKey(config.app.extConfig.plugins.FederatedCapacitor.liveUpdatesKey, config.app.rootDir, config.android.assetsDirAbs);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
@@ -103,8 +103,8 @@ async function copy(config, platformName, inline = false) {
|
|
|
103
103
|
await (0, cordova_1.writeCordovaAndroidManifest)(cordovaPlugins, config, platformName);
|
|
104
104
|
}
|
|
105
105
|
else if (platformName === config.web.name) {
|
|
106
|
-
if (
|
|
107
|
-
log_1.logger.info('
|
|
106
|
+
if (usesFederatedCapacitor) {
|
|
107
|
+
log_1.logger.info('FederatedCapacitor Plugin installed, skipping web bundling...');
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
110
|
await (0, copy_1.copyWeb)(config);
|
|
@@ -148,23 +148,25 @@ async function copyWebDir(config, nativeAbsDir, webAbsDir) {
|
|
|
148
148
|
}
|
|
149
149
|
async function copyFederatedWebDirs(config, nativeAbsDir) {
|
|
150
150
|
var _a, _b;
|
|
151
|
-
log_1.logger.info('
|
|
152
|
-
if (!((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.
|
|
153
|
-
throw `
|
|
151
|
+
log_1.logger.info('FederatedCapacitor Plugin Loaded - Copying Web Assets');
|
|
152
|
+
if (!((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.FederatedCapacitor)) {
|
|
153
|
+
throw `FederatedCapacitor plugin is present but no valid config is defined.`;
|
|
154
154
|
}
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
|
|
155
|
+
const federatedConfig = config.app.extConfig.plugins.FederatedCapacitor;
|
|
156
|
+
if (federatedConfig) {
|
|
157
|
+
if (!isFederatedApp(federatedConfig.shell)) {
|
|
158
|
+
throw `FederatedCapacitor plugin is present but no valid Shell application is defined in the config.`;
|
|
159
|
+
}
|
|
160
|
+
if (!federatedConfig.apps.every(isFederatedApp)) {
|
|
161
|
+
throw `FederatedCapacitor plugin is present but there is a problem with the apps defined in the config.`;
|
|
162
|
+
}
|
|
163
|
+
await Promise.all([...federatedConfig.apps, federatedConfig.shell].map(app => {
|
|
164
|
+
const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
|
|
165
|
+
return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
|
|
166
|
+
}));
|
|
158
167
|
}
|
|
159
|
-
if (!portalsConfig.apps.every(isPortal)) {
|
|
160
|
-
throw `Capacitor Portals plugin is present but there is a problem with the apps defined in the config.`;
|
|
161
|
-
}
|
|
162
|
-
await Promise.all([...portalsConfig.apps, portalsConfig.shell].map(app => {
|
|
163
|
-
const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
|
|
164
|
-
return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
|
|
165
|
-
}));
|
|
166
168
|
}
|
|
167
|
-
function
|
|
169
|
+
function isFederatedApp(config) {
|
|
168
170
|
return (config.webDir !== undefined &&
|
|
169
171
|
config.name !== undefined);
|
|
170
172
|
}
|
package/dist/tasks/update.js
CHANGED
|
@@ -44,7 +44,7 @@ function updateChecks(config, platforms) {
|
|
|
44
44
|
const checks = [];
|
|
45
45
|
for (const platformName of platforms) {
|
|
46
46
|
if (platformName === config.ios.name) {
|
|
47
|
-
checks.push(() => (0, common_2.checkCocoaPods)(config));
|
|
47
|
+
checks.push(() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config));
|
|
48
48
|
}
|
|
49
49
|
else if (platformName === config.android.name) {
|
|
50
50
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-dev-20230412T155745.0",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"semver": "^7.3.7",
|
|
61
61
|
"tar": "^6.1.11",
|
|
62
62
|
"tslib": "^2.4.0",
|
|
63
|
-
"xml2js": "^0.
|
|
63
|
+
"xml2js": "^0.5.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/debug": "^4.1.7",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "b445bfa2bd54f2810d62729ebd99ca2d03ed3cc5"
|
|
89
89
|
}
|