@capacitor/cli 4.1.1-nightly-9658fe15.0 → 4.2.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/CHANGELOG.md +13 -0
- 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/android/run.js +3 -2
- package/dist/declarations.d.ts +7 -0
- package/dist/index.js +13 -4
- package/dist/ios/run.js +4 -3
- package/dist/tasks/copy.js +36 -3
- package/dist/tasks/sync.js +4 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.2.0](https://github.com/ionic-team/capacitor/compare/4.1.0...4.2.0) (2022-09-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **cli:** add inline option to copy command ([#5901](https://github.com/ionic-team/capacitor/issues/5901)) ([17fbabb](https://github.com/ionic-team/capacitor/commit/17fbabb2a77d1b356d24048efc5883bd4d049104))
|
|
12
|
+
* **cli:** add scheme and flavor options to run command ([#5873](https://github.com/ionic-team/capacitor/issues/5873)) ([e4c143d](https://github.com/ionic-team/capacitor/commit/e4c143d4da653533570215964808c2f32f5469d3))
|
|
13
|
+
* **cli:** copy signature when using secure live updates ([#5896](https://github.com/ionic-team/capacitor/issues/5896)) ([0f17177](https://github.com/ionic-team/capacitor/commit/0f17177b1c64c0f69f86e990e4e150b820da497b))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
# [4.1.0](https://github.com/ionic-team/capacitor/compare/4.0.1...4.1.0) (2022-08-18)
|
|
7
20
|
|
|
8
21
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/run.js
CHANGED
|
@@ -9,10 +9,11 @@ const common_1 = require("../common");
|
|
|
9
9
|
const native_run_1 = require("../util/native-run");
|
|
10
10
|
const subprocess_1 = require("../util/subprocess");
|
|
11
11
|
const debug = debug_1.default('capacitor:android:run');
|
|
12
|
-
async function runAndroid(config, { target: selectedTarget }) {
|
|
12
|
+
async function runAndroid(config, { target: selectedTarget, flavor: selectedFlavor }) {
|
|
13
13
|
var _a;
|
|
14
14
|
const target = await common_1.promptForPlatformTarget(await native_run_1.getPlatformTargets('android'), selectedTarget);
|
|
15
|
-
const
|
|
15
|
+
const runFlavor = selectedFlavor || ((_a = config.android) === null || _a === void 0 ? void 0 : _a.flavor) || '';
|
|
16
|
+
const arg = `assemble${runFlavor}Debug`;
|
|
16
17
|
const gradleArgs = [arg];
|
|
17
18
|
debug('Invoking ./gradlew with args: %O', gradleArgs);
|
|
18
19
|
try {
|
package/dist/declarations.d.ts
CHANGED
|
@@ -476,6 +476,7 @@ export interface LiveUpdateConfig {
|
|
|
476
476
|
channel: string;
|
|
477
477
|
autoUpdateMethod: AutoUpdateMethod;
|
|
478
478
|
maxVersions?: number;
|
|
479
|
+
key?: string;
|
|
479
480
|
}
|
|
480
481
|
export declare type AutoUpdateMethod = 'none' | 'background';
|
|
481
482
|
export interface PluginsConfig {
|
|
@@ -496,4 +497,10 @@ export interface PluginsConfig {
|
|
|
496
497
|
shell: Portal;
|
|
497
498
|
apps: Portal[];
|
|
498
499
|
};
|
|
500
|
+
/**
|
|
501
|
+
* Capacitor Live Updates plugin configuration
|
|
502
|
+
*
|
|
503
|
+
* @since 4.2.0
|
|
504
|
+
*/
|
|
505
|
+
LiveUpdates?: LiveUpdateConfig;
|
|
499
506
|
}
|
package/dist/index.js
CHANGED
|
@@ -80,22 +80,31 @@ function runProgram(config) {
|
|
|
80
80
|
commander_1.program
|
|
81
81
|
.command('copy [platform]')
|
|
82
82
|
.description('copies the web app build into the native app')
|
|
83
|
-
.
|
|
83
|
+
.option('--inline', 'Optional: if true, all source maps will be inlined for easier debugging on mobile devices', false)
|
|
84
|
+
.action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { inline }) => {
|
|
84
85
|
config_1.checkExternalConfig(config.app);
|
|
85
86
|
const { copyCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/copy')));
|
|
86
|
-
await copyCommand(config, platform);
|
|
87
|
+
await copyCommand(config, platform, inline);
|
|
87
88
|
})));
|
|
88
89
|
commander_1.program
|
|
89
90
|
.command(`run [platform]`)
|
|
90
91
|
.description(`runs ${colors_1.default.input('sync')}, then builds and deploys the native app`)
|
|
92
|
+
.option('--scheme <schemeName>', 'set the scheme of the iOS project')
|
|
93
|
+
.option('--flavor <flavorName>', 'set the flavor of the Android project')
|
|
91
94
|
.option('--list', 'list targets, then quit')
|
|
92
95
|
// TODO: remove once --json is a hidden option (https://github.com/tj/commander.js/issues/1106)
|
|
93
96
|
.allowUnknownOption(true)
|
|
94
97
|
.option('--target <id>', 'use a specific target')
|
|
95
98
|
.option('--no-sync', `do not run ${colors_1.default.input('sync')}`)
|
|
96
|
-
.action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { list, target, sync }) => {
|
|
99
|
+
.action(cli_1.wrapAction(telemetry_1.telemetryAction(config, async (platform, { scheme, flavor, list, target, sync }) => {
|
|
97
100
|
const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
|
|
98
|
-
await runCommand(config, platform, {
|
|
101
|
+
await runCommand(config, platform, {
|
|
102
|
+
scheme,
|
|
103
|
+
flavor,
|
|
104
|
+
list,
|
|
105
|
+
target,
|
|
106
|
+
sync,
|
|
107
|
+
});
|
|
99
108
|
})));
|
|
100
109
|
commander_1.program
|
|
101
110
|
.command('open [platform]')
|
package/dist/ios/run.js
CHANGED
|
@@ -9,14 +9,15 @@ const common_1 = require("../common");
|
|
|
9
9
|
const native_run_1 = require("../util/native-run");
|
|
10
10
|
const subprocess_1 = require("../util/subprocess");
|
|
11
11
|
const debug = debug_1.default('capacitor:ios:run');
|
|
12
|
-
async function runIOS(config, { target: selectedTarget }) {
|
|
12
|
+
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme }) {
|
|
13
13
|
const target = await common_1.promptForPlatformTarget(await native_run_1.getPlatformTargets('ios'), selectedTarget);
|
|
14
|
+
const runScheme = selectedScheme || config.ios.scheme;
|
|
14
15
|
const derivedDataPath = path_1.resolve(config.ios.platformDirAbs, 'DerivedData', target.id);
|
|
15
16
|
const xcodebuildArgs = [
|
|
16
17
|
'-workspace',
|
|
17
18
|
path_1.basename(await config.ios.nativeXcodeWorkspaceDirAbs),
|
|
18
19
|
'-scheme',
|
|
19
|
-
|
|
20
|
+
runScheme,
|
|
20
21
|
'-configuration',
|
|
21
22
|
'Debug',
|
|
22
23
|
'-destination',
|
|
@@ -28,7 +29,7 @@ async function runIOS(config, { target: selectedTarget }) {
|
|
|
28
29
|
await common_1.runTask('Running xcodebuild', async () => subprocess_1.runCommand('xcrun', ['xcodebuild', ...xcodebuildArgs], {
|
|
29
30
|
cwd: config.ios.nativeProjectDirAbs,
|
|
30
31
|
}));
|
|
31
|
-
const appName = `${
|
|
32
|
+
const appName = `${runScheme}.app`;
|
|
32
33
|
const appPath = path_1.resolve(derivedDataPath, 'Build/Products', target.virtual ? 'Debug-iphonesimulator' : 'Debug-iphoneos', appName);
|
|
33
34
|
const nativeRunArgs = ['ios', '--app', appPath, '--target', target.id];
|
|
34
35
|
debug('Invoking native-run with args: %O', nativeRunArgs);
|
package/dist/tasks/copy.js
CHANGED
|
@@ -12,7 +12,8 @@ const log_1 = require("../log");
|
|
|
12
12
|
const plugin_1 = require("../plugin");
|
|
13
13
|
const promise_1 = require("../util/promise");
|
|
14
14
|
const copy_1 = require("../web/copy");
|
|
15
|
-
|
|
15
|
+
const sourcemaps_1 = require("./sourcemaps");
|
|
16
|
+
async function copyCommand(config, selectedPlatformName, inline = false) {
|
|
16
17
|
var _a;
|
|
17
18
|
if (selectedPlatformName && !(await common_1.isValidPlatform(selectedPlatformName))) {
|
|
18
19
|
const platformDir = common_1.resolvePlatform(config, selectedPlatformName);
|
|
@@ -26,7 +27,7 @@ async function copyCommand(config, selectedPlatformName) {
|
|
|
26
27
|
else {
|
|
27
28
|
const platforms = await common_1.selectPlatforms(config, selectedPlatformName);
|
|
28
29
|
try {
|
|
29
|
-
await promise_1.allSerial(platforms.map(platformName => () => copy(config, platformName)));
|
|
30
|
+
await promise_1.allSerial(platforms.map(platformName => () => copy(config, platformName, inline)));
|
|
30
31
|
}
|
|
31
32
|
catch (e) {
|
|
32
33
|
if (errors_1.isFatal(e)) {
|
|
@@ -37,7 +38,7 @@ async function copyCommand(config, selectedPlatformName) {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
exports.copyCommand = copyCommand;
|
|
40
|
-
async function copy(config, platformName) {
|
|
41
|
+
async function copy(config, platformName, inline = false) {
|
|
41
42
|
await common_1.runTask(colors_1.default.success(colors_1.default.strong(`copy ${platformName}`)), async () => {
|
|
42
43
|
const result = await common_1.checkWebDir(config);
|
|
43
44
|
if (result) {
|
|
@@ -49,6 +50,11 @@ async function copy(config, platformName) {
|
|
|
49
50
|
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/capacitor-portals').length > 0) {
|
|
50
51
|
usesCapacitorPortals = true;
|
|
51
52
|
}
|
|
53
|
+
let usesLiveUpdates = false;
|
|
54
|
+
if (allPlugins.filter(plugin => plugin.id === '@capacitor/live-updates')
|
|
55
|
+
.length > 0) {
|
|
56
|
+
usesLiveUpdates = true;
|
|
57
|
+
}
|
|
52
58
|
if (platformName === config.ios.name) {
|
|
53
59
|
if (usesCapacitorPortals) {
|
|
54
60
|
await copyFederatedWebDirs(config, await config.ios.webDirAbs);
|
|
@@ -56,6 +62,9 @@ async function copy(config, platformName) {
|
|
|
56
62
|
else {
|
|
57
63
|
await copyWebDir(config, await config.ios.webDirAbs, config.app.webDirAbs);
|
|
58
64
|
}
|
|
65
|
+
if (usesLiveUpdates) {
|
|
66
|
+
await copySecureLiveUpdatesKey(config, config.ios.nativeTargetDirAbs);
|
|
67
|
+
}
|
|
59
68
|
await copyCapacitorConfig(config, config.ios.nativeTargetDirAbs);
|
|
60
69
|
const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
|
|
61
70
|
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
|
|
@@ -67,6 +76,9 @@ async function copy(config, platformName) {
|
|
|
67
76
|
else {
|
|
68
77
|
await copyWebDir(config, config.android.webDirAbs, config.app.webDirAbs);
|
|
69
78
|
}
|
|
79
|
+
if (usesLiveUpdates) {
|
|
80
|
+
await copySecureLiveUpdatesKey(config, config.android.assetsDirAbs);
|
|
81
|
+
}
|
|
70
82
|
await copyCapacitorConfig(config, config.android.assetsDirAbs);
|
|
71
83
|
const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
|
|
72
84
|
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
|
|
@@ -83,6 +95,9 @@ async function copy(config, platformName) {
|
|
|
83
95
|
else {
|
|
84
96
|
throw `Platform ${platformName} is not valid.`;
|
|
85
97
|
}
|
|
98
|
+
if (inline) {
|
|
99
|
+
await sourcemaps_1.inlineSourceMaps(config, platformName);
|
|
100
|
+
}
|
|
86
101
|
});
|
|
87
102
|
await common_1.runPlatformHook(config, platformName, config.app.rootDir, 'capacitor:copy:after');
|
|
88
103
|
}
|
|
@@ -133,3 +148,21 @@ function isPortal(config) {
|
|
|
133
148
|
return (config.webDir !== undefined &&
|
|
134
149
|
config.name !== undefined);
|
|
135
150
|
}
|
|
151
|
+
async function copySecureLiveUpdatesKey(config, nativeAbsDir) {
|
|
152
|
+
var _a, _b, _c;
|
|
153
|
+
if (!((_c = (_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.LiveUpdates) === null || _c === void 0 ? void 0 : _c.key)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const secureLiveUpdatesKeyFile = config.app.extConfig.plugins.LiveUpdates.key;
|
|
157
|
+
const keyAbsFromPath = path_1.join(config.app.rootDir, secureLiveUpdatesKeyFile);
|
|
158
|
+
const keyAbsToPath = path_1.join(nativeAbsDir, path_1.basename(keyAbsFromPath));
|
|
159
|
+
const keyRelToDir = path_1.relative(config.app.rootDir, nativeAbsDir);
|
|
160
|
+
if (!(await utils_fs_1.pathExists(keyAbsFromPath))) {
|
|
161
|
+
log_1.logger.warn(`Cannot copy Secure Live Updates signature file from ${colors_1.default.strong(keyAbsFromPath)} to ${keyRelToDir}\n` +
|
|
162
|
+
`Signature file does not exist at specified key path.`);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
await common_1.runTask(`Copying Secure Live Updates key from ${colors_1.default.strong(secureLiveUpdatesKeyFile)} to ${keyRelToDir}`, async () => {
|
|
166
|
+
return utils_fs_1.copy(keyAbsFromPath, keyAbsToPath);
|
|
167
|
+
});
|
|
168
|
+
}
|
package/dist/tasks/sync.js
CHANGED
|
@@ -6,16 +6,15 @@ const errors_1 = require("../errors");
|
|
|
6
6
|
const log_1 = require("../log");
|
|
7
7
|
const promise_1 = require("../util/promise");
|
|
8
8
|
const copy_1 = require("./copy");
|
|
9
|
-
const sourcemaps_1 = require("./sourcemaps");
|
|
10
9
|
const update_1 = require("./update");
|
|
11
10
|
/**
|
|
12
11
|
* Sync is a copy and an update in one.
|
|
13
12
|
*/
|
|
14
|
-
async function syncCommand(config, selectedPlatformName, deployment, inline) {
|
|
13
|
+
async function syncCommand(config, selectedPlatformName, deployment, inline = false) {
|
|
15
14
|
var _a, _b;
|
|
16
15
|
if (selectedPlatformName && !(await common_1.isValidPlatform(selectedPlatformName))) {
|
|
17
16
|
try {
|
|
18
|
-
await copy_1.copyCommand(config, selectedPlatformName);
|
|
17
|
+
await copy_1.copyCommand(config, selectedPlatformName, inline);
|
|
19
18
|
}
|
|
20
19
|
catch (e) {
|
|
21
20
|
log_1.logger.error((_a = e.stack) !== null && _a !== void 0 ? _a : e);
|
|
@@ -45,14 +44,11 @@ async function syncCommand(config, selectedPlatformName, deployment, inline) {
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
exports.syncCommand = syncCommand;
|
|
48
|
-
async function sync(config, platformName, deployment, inline) {
|
|
47
|
+
async function sync(config, platformName, deployment, inline = false) {
|
|
49
48
|
var _a;
|
|
50
49
|
await common_1.runPlatformHook(config, platformName, config.app.rootDir, 'capacitor:sync:before');
|
|
51
50
|
try {
|
|
52
|
-
await copy_1.copy(config, platformName);
|
|
53
|
-
if (inline) {
|
|
54
|
-
await sourcemaps_1.inlineSourceMaps(config, platformName);
|
|
55
|
-
}
|
|
51
|
+
await copy_1.copy(config, platformName, inline);
|
|
56
52
|
}
|
|
57
53
|
catch (e) {
|
|
58
54
|
log_1.logger.error((_a = e.stack) !== null && _a !== void 0 ? _a : e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.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)",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "101a5681ab37147de8c702b2048ae3185b28a5b2"
|
|
87
87
|
}
|