@capacitor/cli 1.3.0 → 1.5.2
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/electron-template/index.js +3 -1
- package/assets/electron-template/package.json +1 -1
- package/dist/android/common.js +3 -3
- package/dist/android/open.js +23 -4
- package/dist/android/update.js +3 -69
- package/dist/common.js +2 -2
- package/dist/config.js +4 -17
- package/dist/cordova.js +91 -15
- package/dist/index.js +7 -5
- package/dist/ios/update.js +40 -20
- package/dist/plugin.js +3 -3
- package/dist/tasks/add.js +2 -2
- package/dist/tasks/copy.js +5 -2
- package/dist/tasks/doctor.js +1 -1
- package/dist/tasks/init.js +1 -1
- package/dist/tasks/new-plugin.js +14 -32
- package/dist/tasks/sync.js +4 -4
- package/dist/tasks/update.js +4 -4
- package/package.json +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { app, BrowserWindow, Menu } = require('electron');
|
|
2
2
|
const isDevMode = require('electron-is-dev');
|
|
3
|
-
const { CapacitorSplashScreen } = require('@capacitor/electron');
|
|
3
|
+
const { CapacitorSplashScreen, configCapacitor } = require('@capacitor/electron');
|
|
4
4
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
@@ -40,6 +40,8 @@ async function createWindow () {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
+
configCapacitor(mainWindow);
|
|
44
|
+
|
|
43
45
|
if (isDevMode) {
|
|
44
46
|
// Set our above template to the Menu Object if we are in development mode, dont want users having the devtools.
|
|
45
47
|
Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplateDev));
|
package/dist/android/common.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const common_1 = require("../common");
|
|
4
|
-
const
|
|
4
|
+
const cordova_1 = require("../cordova");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const fs_1 = require("../util/fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
|
-
const
|
|
8
|
+
const plugin_1 = require("../plugin");
|
|
9
9
|
async function gradleClean(config) {
|
|
10
10
|
await common_1.runCommand(`cd ${config.android.platformDir} && ./gradlew clean`);
|
|
11
11
|
}
|
|
@@ -84,7 +84,7 @@ async function editProjectSettingsAndroid(config) {
|
|
|
84
84
|
const stringsPath = path_1.resolve(config.app.rootDir, config.android.platformDir, 'app/src/main/res/values/strings.xml');
|
|
85
85
|
let stringsContent = await fs_1.readFileAsync(stringsPath, 'utf8');
|
|
86
86
|
stringsContent = stringsContent.replace(/com.getcapacitor.myapp/g, appId);
|
|
87
|
-
stringsContent = stringsContent.replace(/My App/g, appName.replace(/'/g,
|
|
87
|
+
stringsContent = stringsContent.replace(/My App/g, appName.replace(/'/g, `\\'`));
|
|
88
88
|
await fs_1.writeFileAsync(stringsPath, stringsContent);
|
|
89
89
|
}
|
|
90
90
|
exports.editProjectSettingsAndroid = editProjectSettingsAndroid;
|
package/dist/android/open.js
CHANGED
|
@@ -16,11 +16,30 @@ async function openAndroid(config) {
|
|
|
16
16
|
await opn(dir, { app: 'android studio', wait: false });
|
|
17
17
|
break;
|
|
18
18
|
case definitions_1.OS.Windows:
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
let androidStudioPath = config.windows.androidStudioPath;
|
|
20
|
+
try {
|
|
21
|
+
if (!fs_1.existsSync(androidStudioPath)) {
|
|
22
|
+
let commandResult = await common_1.runCommand('REG QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio" /v Path');
|
|
23
|
+
commandResult = commandResult.replace(/(\r\n|\n|\r)/gm, '');
|
|
24
|
+
const ix = commandResult.indexOf('REG_SZ');
|
|
25
|
+
if (ix > 0) {
|
|
26
|
+
androidStudioPath = commandResult.substring(ix + 6).trim() + '\\bin\\studio64.exe';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
androidStudioPath = '';
|
|
32
|
+
}
|
|
33
|
+
if (androidStudioPath) {
|
|
34
|
+
opn(dir, { app: androidStudioPath, wait: false });
|
|
21
35
|
}
|
|
22
36
|
else {
|
|
23
|
-
common_1.logError('
|
|
37
|
+
common_1.logError('Android Studio not found. Make sure it\'s installed and configure "windowsAndroidStudioPath" ' +
|
|
38
|
+
'in your capacitor.config.json to point to the location of studio64.exe, using JavaScript-escaped paths:\n' +
|
|
39
|
+
'Example:\n' +
|
|
40
|
+
'{\n' +
|
|
41
|
+
' "windowsAndroidStudioPath": "C:\\\\Program Files\\\\Android\\\\Android Studio\\\\bin\\\\studio64.exe"\n' +
|
|
42
|
+
'}');
|
|
24
43
|
}
|
|
25
44
|
break;
|
|
26
45
|
case definitions_1.OS.Linux:
|
|
@@ -33,7 +52,7 @@ async function openAndroid(config) {
|
|
|
33
52
|
'}');
|
|
34
53
|
};
|
|
35
54
|
try {
|
|
36
|
-
await opn(dir, { app: config.linux.androidStudioPath, wait:
|
|
55
|
+
await opn(dir, { app: config.linux.androidStudioPath, wait: true });
|
|
37
56
|
}
|
|
38
57
|
catch (e) {
|
|
39
58
|
linuxError();
|
package/dist/android/update.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const common_1 = require("../common");
|
|
4
|
-
const plugin_1 = require("../plugin");
|
|
5
4
|
const common_2 = require("./common");
|
|
6
5
|
const cordova_1 = require("../cordova");
|
|
7
6
|
const fs_1 = require("../util/fs");
|
|
8
7
|
const path_1 = require("path");
|
|
8
|
+
const plugin_1 = require("../plugin");
|
|
9
9
|
const platform = 'android';
|
|
10
10
|
async function updateAndroid(config) {
|
|
11
11
|
let plugins = await getPluginsTask(config);
|
|
@@ -27,7 +27,7 @@ async function updateAndroid(config) {
|
|
|
27
27
|
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platform);
|
|
28
28
|
await installGradlePlugins(config, capacitorPlugins, cordovaPlugins);
|
|
29
29
|
await handleCordovaPluginsGradle(config, cordovaPlugins);
|
|
30
|
-
await writeCordovaAndroidManifest(cordovaPlugins, config);
|
|
30
|
+
await cordova_1.writeCordovaAndroidManifest(cordovaPlugins, config, platform);
|
|
31
31
|
const incompatibleCordovaPlugins = plugins
|
|
32
32
|
.filter(p => plugin_1.getPluginType(p, platform) === 2 /* Incompatible */);
|
|
33
33
|
plugin_1.printPlugins(incompatibleCordovaPlugins, platform, 'incompatible');
|
|
@@ -167,7 +167,7 @@ function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
167
167
|
if (resourceFile.$.src.split('.').pop() === 'aar') {
|
|
168
168
|
fs_1.copySync(plugin_1.getFilePath(config, p, resourceFile.$.src), path_1.join(pluginsPath, 'libs', target.split('/').pop()));
|
|
169
169
|
}
|
|
170
|
-
else if (target !==
|
|
170
|
+
else if (target !== '.') {
|
|
171
171
|
fs_1.copySync(plugin_1.getFilePath(config, p, resourceFile.$.src), path_1.join(pluginsPath, target));
|
|
172
172
|
}
|
|
173
173
|
});
|
|
@@ -191,69 +191,3 @@ async function getPluginsTask(config) {
|
|
|
191
191
|
return androidPlugins;
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
async function writeCordovaAndroidManifest(cordovaPlugins, config) {
|
|
195
|
-
const pluginsFolder = path_1.resolve(config.app.rootDir, 'android', config.android.assets.pluginsFolderName);
|
|
196
|
-
const manifestPath = path_1.join(pluginsFolder, 'src', 'main', 'AndroidManifest.xml');
|
|
197
|
-
let rootXMLEntries = [];
|
|
198
|
-
let applicationXMLEntries = [];
|
|
199
|
-
cordovaPlugins.map(async (p) => {
|
|
200
|
-
const editConfig = plugin_1.getPlatformElement(p, platform, 'edit-config');
|
|
201
|
-
const configFile = plugin_1.getPlatformElement(p, platform, 'config-file');
|
|
202
|
-
editConfig.concat(configFile).map(async (configElement) => {
|
|
203
|
-
if (configElement.$ && (configElement.$.target && configElement.$.target.includes('AndroidManifest.xml') || configElement.$.file && configElement.$.file.includes('AndroidManifest.xml'))) {
|
|
204
|
-
const keys = Object.keys(configElement).filter(k => k !== '$');
|
|
205
|
-
keys.map(k => {
|
|
206
|
-
configElement[k].map((e) => {
|
|
207
|
-
const xmlElement = common_1.buildXmlElement(e, k);
|
|
208
|
-
const pathParts = getPathParts(configElement.$.parent || configElement.$.target);
|
|
209
|
-
if (pathParts.length > 1) {
|
|
210
|
-
if (pathParts.pop() === 'application') {
|
|
211
|
-
if (!applicationXMLEntries.includes(xmlElement) && !contains(applicationXMLEntries, xmlElement, k)) {
|
|
212
|
-
applicationXMLEntries.push(xmlElement);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
common_1.logInfo(`plugin ${p.id} requires to add \n ${xmlElement} to your AndroidManifest.xml to work`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
if (!rootXMLEntries.includes(xmlElement) && !contains(rootXMLEntries, xmlElement, k)) {
|
|
221
|
-
rootXMLEntries.push(xmlElement);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
let content = `<?xml version='1.0' encoding='utf-8'?>
|
|
230
|
-
<manifest package="capacitor.android.plugins"
|
|
231
|
-
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
232
|
-
xmlns:amazon="http://schemas.amazon.com/apk/res/android">
|
|
233
|
-
<application>
|
|
234
|
-
${applicationXMLEntries.join('\n')}
|
|
235
|
-
</application>
|
|
236
|
-
${rootXMLEntries.join('\n')}
|
|
237
|
-
</manifest>`;
|
|
238
|
-
content = content.replace(new RegExp(('$PACKAGE_NAME').replace('$', '\\$&'), 'g'), config.app.appId);
|
|
239
|
-
await fs_1.writeFileAsync(manifestPath, content);
|
|
240
|
-
}
|
|
241
|
-
function getPathParts(path) {
|
|
242
|
-
const rootPath = 'manifest';
|
|
243
|
-
path = path.replace('/*', rootPath);
|
|
244
|
-
let parts = path.split('/').filter(part => part !== '');
|
|
245
|
-
if (parts.length > 1 || parts.includes(rootPath)) {
|
|
246
|
-
return parts;
|
|
247
|
-
}
|
|
248
|
-
return [rootPath, path];
|
|
249
|
-
}
|
|
250
|
-
function contains(a, obj, k) {
|
|
251
|
-
const element = common_1.parseXML(obj);
|
|
252
|
-
for (var i = 0; i < a.length; i++) {
|
|
253
|
-
const current = common_1.parseXML(a[i]);
|
|
254
|
-
if (element && current && current[k] && element[k] && current[k].$ && element[k].$ && element[k].$["android:name"] === current[k].$["android:name"]) {
|
|
255
|
-
return true;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return false;
|
|
259
|
-
}
|
package/dist/common.js
CHANGED
|
@@ -19,7 +19,7 @@ async function check(config, checks) {
|
|
|
19
19
|
}
|
|
20
20
|
exports.check = check;
|
|
21
21
|
async function checkWebDir(config) {
|
|
22
|
-
const invalidFolders = [
|
|
22
|
+
const invalidFolders = ['', '.', '..', '../', './'];
|
|
23
23
|
if (invalidFolders.includes(config.app.webDir)) {
|
|
24
24
|
return `"${config.app.webDir}" is not a valid value for webDir`;
|
|
25
25
|
}
|
|
@@ -179,7 +179,7 @@ async function getOrCreateConfig(config) {
|
|
|
179
179
|
exports.getOrCreateConfig = getOrCreateConfig;
|
|
180
180
|
async function mergeConfig(config, settings) {
|
|
181
181
|
const configPath = path_1.join(config.app.rootDir, config.app.extConfigName);
|
|
182
|
-
await writePrettyJSON(config.app.extConfigFilePath, Object.assign({}, config.app.extConfig, settings));
|
|
182
|
+
await writePrettyJSON(config.app.extConfigFilePath, Object.assign(Object.assign({}, config.app.extConfig), settings));
|
|
183
183
|
// Store our newly created or found external config as the default
|
|
184
184
|
config.loadExternalConfig();
|
|
185
185
|
}
|
package/dist/config.js
CHANGED
|
@@ -4,7 +4,6 @@ const fs_1 = require("fs");
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const common_1 = require("./common");
|
|
6
6
|
const definitions_1 = require("./definitions");
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
7
|
let Package;
|
|
9
8
|
let ExtConfig;
|
|
10
9
|
class Config {
|
|
@@ -85,6 +84,9 @@ class Config {
|
|
|
85
84
|
templateName: 'app-template',
|
|
86
85
|
templateDir: '',
|
|
87
86
|
pluginsTemplateDir: ''
|
|
87
|
+
},
|
|
88
|
+
server: {
|
|
89
|
+
cleartext: false
|
|
88
90
|
}
|
|
89
91
|
};
|
|
90
92
|
this.plugins = {
|
|
@@ -174,22 +176,7 @@ class Config {
|
|
|
174
176
|
if (this.cli.os !== definitions_1.OS.Windows) {
|
|
175
177
|
return;
|
|
176
178
|
}
|
|
177
|
-
|
|
178
|
-
try {
|
|
179
|
-
if (!fs_1.existsSync(this.app.windowsAndroidStudioPath)) {
|
|
180
|
-
const buffer = child_process_1.execSync('REG QUERY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio" /v Path');
|
|
181
|
-
const bufferString = buffer.toString('utf-8').replace(/(\r\n|\n|\r)/gm, '');
|
|
182
|
-
const ix = bufferString.indexOf('REG_SZ');
|
|
183
|
-
if (ix > 0) {
|
|
184
|
-
this.app.windowsAndroidStudioPath = bufferString.substring(ix + 6).trim() + '\\bin\\studio64.exe';
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
this.windows.androidStudioPath = this.app.windowsAndroidStudioPath;
|
|
188
|
-
}
|
|
189
|
-
catch (e) {
|
|
190
|
-
this.windows.androidStudioPath = '';
|
|
191
|
-
}
|
|
192
|
-
}
|
|
179
|
+
this.windows.androidStudioPath = this.app.windowsAndroidStudioPath;
|
|
193
180
|
}
|
|
194
181
|
initLinuxConfig() {
|
|
195
182
|
if (this.app.linuxAndroidStudioPath) {
|
package/dist/cordova.js
CHANGED
|
@@ -109,7 +109,7 @@ async function copyPluginsJS(config, cordovaPlugins, platform) {
|
|
|
109
109
|
// mimics Cordova's module name logic if the name attr is missing
|
|
110
110
|
const name = pluginId + '.' + (jsModule.$.name || path_1.basename(jsModule.$.src, path_1.extname(jsModule.$.src)));
|
|
111
111
|
data = `cordova.define("${name}", function(require, exports, module) { \n${data}\n});`;
|
|
112
|
-
data = data.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi,
|
|
112
|
+
data = data.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '');
|
|
113
113
|
await fs_1.writeFileAsync(filePath, data, 'utf8');
|
|
114
114
|
}));
|
|
115
115
|
}));
|
|
@@ -208,7 +208,7 @@ async function handleCordovaPluginsJS(cordovaPlugins, config, platform) {
|
|
|
208
208
|
await autoGenerateConfig(config, cordovaPlugins, platform);
|
|
209
209
|
}
|
|
210
210
|
exports.handleCordovaPluginsJS = handleCordovaPluginsJS;
|
|
211
|
-
async function
|
|
211
|
+
async function getCordovaPlugins(config, platform) {
|
|
212
212
|
const allPlugins = await plugin_1.getPlugins(config);
|
|
213
213
|
let plugins = [];
|
|
214
214
|
if (platform === config.ios.name) {
|
|
@@ -217,11 +217,10 @@ async function copyCordovaJSFiles(config, platform) {
|
|
|
217
217
|
else if (platform === config.android.name) {
|
|
218
218
|
plugins = common_2.getAndroidPlugins(allPlugins);
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
return plugins
|
|
221
221
|
.filter(p => plugin_1.getPluginType(p, platform) === 1 /* Cordova */);
|
|
222
|
-
await handleCordovaPluginsJS(cordovaPlugins, config, platform);
|
|
223
222
|
}
|
|
224
|
-
exports.
|
|
223
|
+
exports.getCordovaPlugins = getCordovaPlugins;
|
|
225
224
|
async function logCordovaManualSteps(cordovaPlugins, config, platform) {
|
|
226
225
|
cordovaPlugins.map(p => {
|
|
227
226
|
const editConfig = plugin_1.getPlatformElement(p, platform, 'edit-config');
|
|
@@ -251,7 +250,7 @@ async function logiOSPlist(configElement, config, plugin) {
|
|
|
251
250
|
}
|
|
252
251
|
else if (configElement.array || configElement.dict) {
|
|
253
252
|
if (configElement.array && configElement.array[0] && configElement.array[0].string) {
|
|
254
|
-
var xml =
|
|
253
|
+
var xml = '';
|
|
255
254
|
configElement.array[0].string.map((element) => {
|
|
256
255
|
if (!plistData[configElement.$.parent].includes(element)) {
|
|
257
256
|
xml = xml.concat(`<string>${element}</string>\n`);
|
|
@@ -309,7 +308,7 @@ async function checkAndInstallDependencies(config, plugins, platform) {
|
|
|
309
308
|
needsUpdate = true;
|
|
310
309
|
}
|
|
311
310
|
catch (e) {
|
|
312
|
-
common_1.log(
|
|
311
|
+
common_1.log('\n');
|
|
313
312
|
common_1.logError(`couldn't install dependency plugin ${plugin}`);
|
|
314
313
|
}
|
|
315
314
|
}
|
|
@@ -320,15 +319,15 @@ async function checkAndInstallDependencies(config, plugins, platform) {
|
|
|
320
319
|
}
|
|
321
320
|
exports.checkAndInstallDependencies = checkAndInstallDependencies;
|
|
322
321
|
function getIncompatibleCordovaPlugins(platform) {
|
|
323
|
-
let pluginList = [
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (platform ===
|
|
328
|
-
pluginList.push(
|
|
322
|
+
let pluginList = ['cordova-plugin-splashscreen', 'cordova-plugin-ionic-webview', 'cordova-plugin-crosswalk-webview',
|
|
323
|
+
'cordova-plugin-wkwebview-engine', 'cordova-plugin-console', 'cordova-plugin-music-controls',
|
|
324
|
+
'cordova-plugin-add-swift-support', 'cordova-plugin-ionic-keyboard', 'cordova-plugin-braintree',
|
|
325
|
+
'@ionic-enterprise/filesystem', '@ionic-enterprise/keyboard', '@ionic-enterprise/splashscreen'];
|
|
326
|
+
if (platform === 'ios') {
|
|
327
|
+
pluginList.push('cordova-plugin-googlemaps', 'cordova-plugin-statusbar', '@ionic-enterprise/statusbar');
|
|
329
328
|
}
|
|
330
|
-
if (platform ===
|
|
331
|
-
pluginList.push(
|
|
329
|
+
if (platform === 'android') {
|
|
330
|
+
pluginList.push('cordova-plugin-compat');
|
|
332
331
|
}
|
|
333
332
|
return pluginList;
|
|
334
333
|
}
|
|
@@ -359,3 +358,80 @@ async function getCordovaPreferences(config) {
|
|
|
359
358
|
return cordova;
|
|
360
359
|
}
|
|
361
360
|
exports.getCordovaPreferences = getCordovaPreferences;
|
|
361
|
+
async function writeCordovaAndroidManifest(cordovaPlugins, config, platform) {
|
|
362
|
+
var _a;
|
|
363
|
+
const pluginsFolder = path_1.resolve(config.app.rootDir, 'android', config.android.assets.pluginsFolderName);
|
|
364
|
+
const manifestPath = path_1.join(pluginsFolder, 'src', 'main', 'AndroidManifest.xml');
|
|
365
|
+
let rootXMLEntries = [];
|
|
366
|
+
let applicationXMLEntries = [];
|
|
367
|
+
let applicationXMLAttributes = [];
|
|
368
|
+
cordovaPlugins.map(async (p) => {
|
|
369
|
+
const editConfig = plugin_1.getPlatformElement(p, platform, 'edit-config');
|
|
370
|
+
const configFile = plugin_1.getPlatformElement(p, platform, 'config-file');
|
|
371
|
+
editConfig.concat(configFile).map(async (configElement) => {
|
|
372
|
+
if (configElement.$ && (configElement.$.target && configElement.$.target.includes('AndroidManifest.xml') || configElement.$.file && configElement.$.file.includes('AndroidManifest.xml'))) {
|
|
373
|
+
const keys = Object.keys(configElement).filter(k => k !== '$');
|
|
374
|
+
keys.map(k => {
|
|
375
|
+
configElement[k].map((e) => {
|
|
376
|
+
const xmlElement = common_1.buildXmlElement(e, k);
|
|
377
|
+
const pathParts = getPathParts(configElement.$.parent || configElement.$.target);
|
|
378
|
+
if (pathParts.length > 1) {
|
|
379
|
+
if (pathParts.pop() === 'application') {
|
|
380
|
+
if (configElement.$.mode && configElement.$.mode === 'merge') {
|
|
381
|
+
Object.keys(e.$).map((ek) => {
|
|
382
|
+
applicationXMLAttributes.push(`${ek}="${e.$[ek]}"`);
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
else if (!applicationXMLEntries.includes(xmlElement) && !contains(applicationXMLEntries, xmlElement, k)) {
|
|
386
|
+
applicationXMLEntries.push(xmlElement);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
common_1.logInfo(`plugin ${p.id} requires to add \n ${xmlElement} to your AndroidManifest.xml to work`);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
if (!rootXMLEntries.includes(xmlElement) && !contains(rootXMLEntries, xmlElement, k)) {
|
|
395
|
+
rootXMLEntries.push(xmlElement);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
let cleartext = ((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.cleartext) ? 'android:usesCleartextTraffic="true"' : '';
|
|
404
|
+
let content = `<?xml version='1.0' encoding='utf-8'?>
|
|
405
|
+
<manifest package="capacitor.android.plugins"
|
|
406
|
+
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
407
|
+
xmlns:amazon="http://schemas.amazon.com/apk/res/android">
|
|
408
|
+
<application ${applicationXMLAttributes.join('\n')}${cleartext}>
|
|
409
|
+
${applicationXMLEntries.join('\n')}
|
|
410
|
+
</application>
|
|
411
|
+
${rootXMLEntries.join('\n')}
|
|
412
|
+
</manifest>`;
|
|
413
|
+
content = content.replace(new RegExp(('$PACKAGE_NAME').replace('$', '\\$&'), 'g'), config.app.appId);
|
|
414
|
+
if (fs_extra_1.existsSync(manifestPath)) {
|
|
415
|
+
await fs_1.writeFileAsync(manifestPath, content);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
exports.writeCordovaAndroidManifest = writeCordovaAndroidManifest;
|
|
419
|
+
function getPathParts(path) {
|
|
420
|
+
const rootPath = 'manifest';
|
|
421
|
+
path = path.replace('/*', rootPath);
|
|
422
|
+
let parts = path.split('/').filter(part => part !== '');
|
|
423
|
+
if (parts.length > 1 || parts.includes(rootPath)) {
|
|
424
|
+
return parts;
|
|
425
|
+
}
|
|
426
|
+
return [rootPath, path];
|
|
427
|
+
}
|
|
428
|
+
function contains(a, obj, k) {
|
|
429
|
+
const element = common_1.parseXML(obj);
|
|
430
|
+
for (var i = 0; i < a.length; i++) {
|
|
431
|
+
const current = common_1.parseXML(a[i]);
|
|
432
|
+
if (element && current && current[k] && element[k] && current[k].$ && element[k].$ && element[k].$['android:name'] === current[k].$['android:name']) {
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return false;
|
|
437
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -46,15 +46,17 @@ function run(process, cliBinDir) {
|
|
|
46
46
|
});
|
|
47
47
|
program
|
|
48
48
|
.command('sync [platform]')
|
|
49
|
-
.description('
|
|
50
|
-
.
|
|
51
|
-
|
|
49
|
+
.description('copy + update')
|
|
50
|
+
.option('--deployment', 'Optional: if provided, Podfile.lock won\'t be deleted and pod install will use --deployment option')
|
|
51
|
+
.action((platform, { deployment }) => {
|
|
52
|
+
return sync_1.syncCommand(config, platform, deployment);
|
|
52
53
|
});
|
|
53
54
|
program
|
|
54
55
|
.command('update [platform]')
|
|
55
56
|
.description(`updates the native plugins and dependencies based in package.json`)
|
|
56
|
-
.
|
|
57
|
-
|
|
57
|
+
.option('--deployment', 'Optional: if provided, Podfile.lock won\'t be deleted and pod install will use --deployment option')
|
|
58
|
+
.action((platform, { deployment }) => {
|
|
59
|
+
return update_1.updateCommand(config, platform, deployment);
|
|
58
60
|
});
|
|
59
61
|
program
|
|
60
62
|
.command('copy [platform]')
|
package/dist/ios/update.js
CHANGED
|
@@ -7,10 +7,9 @@ const path_1 = require("path");
|
|
|
7
7
|
const fs_2 = require("fs");
|
|
8
8
|
const plugin_1 = require("../plugin");
|
|
9
9
|
const cordova_1 = require("../cordova");
|
|
10
|
-
//import * as inquirer from 'inquirer';
|
|
11
10
|
exports.updateIOSChecks = [common_1.checkCocoaPods, common_1.checkIOSProject];
|
|
12
11
|
const platform = 'ios';
|
|
13
|
-
async function updateIOS(config) {
|
|
12
|
+
async function updateIOS(config, deployment) {
|
|
14
13
|
let plugins = await getPluginsTask(config);
|
|
15
14
|
const capacitorPlugins = plugins.filter(p => plugin_1.getPluginType(p, platform) === 0 /* Core */);
|
|
16
15
|
plugin_1.printPlugins(capacitorPlugins, 'ios');
|
|
@@ -29,7 +28,7 @@ async function updateIOS(config) {
|
|
|
29
28
|
}
|
|
30
29
|
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platform);
|
|
31
30
|
await generateCordovaPodspecs(cordovaPlugins, config);
|
|
32
|
-
await installCocoaPodsPlugins(config, plugins);
|
|
31
|
+
await installCocoaPodsPlugins(config, plugins, deployment);
|
|
33
32
|
await cordova_1.logCordovaManualSteps(cordovaPlugins, config, platform);
|
|
34
33
|
const incompatibleCordovaPlugins = plugins
|
|
35
34
|
.filter(p => plugin_1.getPluginType(p, platform) === 2 /* Incompatible */);
|
|
@@ -37,13 +36,13 @@ async function updateIOS(config) {
|
|
|
37
36
|
await common_2.checkPlatformVersions(config, platform);
|
|
38
37
|
}
|
|
39
38
|
exports.updateIOS = updateIOS;
|
|
40
|
-
async function installCocoaPodsPlugins(config, plugins) {
|
|
39
|
+
async function installCocoaPodsPlugins(config, plugins, deployment) {
|
|
41
40
|
await common_2.runTask('Updating iOS native dependencies with "pod install" (may take several minutes)', () => {
|
|
42
|
-
return updatePodfile(config, plugins);
|
|
41
|
+
return updatePodfile(config, plugins, deployment);
|
|
43
42
|
});
|
|
44
43
|
}
|
|
45
44
|
exports.installCocoaPodsPlugins = installCocoaPodsPlugins;
|
|
46
|
-
async function updatePodfile(config, plugins) {
|
|
45
|
+
async function updatePodfile(config, plugins, deployment) {
|
|
47
46
|
const dependenciesContent = generatePodFile(config, plugins);
|
|
48
47
|
const projectName = config.ios.nativeProjectName;
|
|
49
48
|
const projectRoot = path_1.resolve(config.app.rootDir, config.ios.name, projectName);
|
|
@@ -53,8 +52,14 @@ async function updatePodfile(config, plugins) {
|
|
|
53
52
|
podfileContent = podfileContent.replace(/(Automatic Capacitor Pod dependencies, do not delete)[\s\S]*(# Do not delete)/, '$1' + dependenciesContent + '\n $2');
|
|
54
53
|
podfileContent = podfileContent.replace(/platform :ios, '[^']*'/, `platform :ios, '${config.ios.minVersion}'`);
|
|
55
54
|
await fs_1.writeFileAsync(podfilePath, podfileContent, 'utf8');
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
let installCommand = 'pod install';
|
|
56
|
+
if (!deployment) {
|
|
57
|
+
fs_1.removeSync(podfileLockPath);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
installCommand += ' --deployment';
|
|
61
|
+
}
|
|
62
|
+
await common_2.runCommand(`cd "${config.app.rootDir}" && cd "${config.ios.name}" && cd "${projectName}" && ${installCommand} && xcodebuild -project App.xcodeproj clean`);
|
|
58
63
|
}
|
|
59
64
|
exports.updatePodfile = updatePodfile;
|
|
60
65
|
function generatePodFile(config, plugins) {
|
|
@@ -97,7 +102,7 @@ function getFrameworkName(framework) {
|
|
|
97
102
|
return framework.$.src.substr(0, framework.$.src.indexOf('.')).replace('lib', '');
|
|
98
103
|
}
|
|
99
104
|
function isFramework(framework) {
|
|
100
|
-
return framework.$.src.split(
|
|
105
|
+
return framework.$.src.split('.').pop() === 'framework';
|
|
101
106
|
}
|
|
102
107
|
async function generateCordovaPodspecs(cordovaPlugins, config) {
|
|
103
108
|
const noPodPlugins = cordovaPlugins.filter(filterNoPods);
|
|
@@ -113,6 +118,7 @@ async function generateCordovaPodspec(cordovaPlugins, config, isStatic) {
|
|
|
113
118
|
let systemLibraries = [];
|
|
114
119
|
let sourceFrameworks = [];
|
|
115
120
|
let frameworkDeps = [];
|
|
121
|
+
let compilerFlags = [];
|
|
116
122
|
let name = 'CordovaPlugins';
|
|
117
123
|
let sourcesFolderName = 'sources';
|
|
118
124
|
if (isStatic) {
|
|
@@ -176,28 +182,37 @@ async function generateCordovaPodspec(cordovaPlugins, config, isStatic) {
|
|
|
176
182
|
const sourceFiles = plugin_1.getPlatformElement(plugin, platform, 'source-file');
|
|
177
183
|
sourceFiles.map((sourceFile) => {
|
|
178
184
|
if (sourceFile.$.framework && sourceFile.$.framework === 'true') {
|
|
179
|
-
const fileName = sourceFile.$.src.split(
|
|
185
|
+
const fileName = sourceFile.$.src.split('/').pop();
|
|
180
186
|
const frameworktPath = path_1.join(sourcesFolderName, plugin.name, fileName);
|
|
181
187
|
if (!sourceFrameworks.includes(frameworktPath)) {
|
|
182
188
|
sourceFrameworks.push(frameworktPath);
|
|
183
189
|
}
|
|
184
190
|
}
|
|
191
|
+
else if (sourceFile.$['compiler-flags']) {
|
|
192
|
+
const cFlag = sourceFile.$['compiler-flags'];
|
|
193
|
+
if (!compilerFlags.includes(cFlag)) {
|
|
194
|
+
compilerFlags.push(cFlag);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
185
197
|
});
|
|
186
198
|
});
|
|
187
199
|
if (weakFrameworks.length > 0) {
|
|
188
|
-
frameworkDeps.push(`s.weak_frameworks = '${weakFrameworks.join(
|
|
200
|
+
frameworkDeps.push(`s.weak_frameworks = '${weakFrameworks.join(`', '`)}'`);
|
|
189
201
|
}
|
|
190
202
|
if (linkedFrameworks.length > 0) {
|
|
191
|
-
frameworkDeps.push(`s.frameworks = '${linkedFrameworks.join(
|
|
203
|
+
frameworkDeps.push(`s.frameworks = '${linkedFrameworks.join(`', '`)}'`);
|
|
192
204
|
}
|
|
193
205
|
if (systemLibraries.length > 0) {
|
|
194
|
-
frameworkDeps.push(`s.libraries = '${systemLibraries.join(
|
|
206
|
+
frameworkDeps.push(`s.libraries = '${systemLibraries.join(`', '`)}'`);
|
|
195
207
|
}
|
|
196
208
|
if (customFrameworks.length > 0) {
|
|
197
|
-
frameworkDeps.push(`s.vendored_frameworks = '${customFrameworks.join(
|
|
209
|
+
frameworkDeps.push(`s.vendored_frameworks = '${customFrameworks.join(`', '`)}'`);
|
|
198
210
|
}
|
|
199
211
|
if (sourceFrameworks.length > 0) {
|
|
200
|
-
frameworkDeps.push(`s.vendored_libraries = '${sourceFrameworks.join(
|
|
212
|
+
frameworkDeps.push(`s.vendored_libraries = '${sourceFrameworks.join(`', '`)}'`);
|
|
213
|
+
}
|
|
214
|
+
if (compilerFlags.length > 0) {
|
|
215
|
+
frameworkDeps.push(`s.compiler_flags = '${compilerFlags.join(' ')}'`);
|
|
201
216
|
}
|
|
202
217
|
const arcPlugins = cordovaPlugins.filter(filterARCFiles);
|
|
203
218
|
if (arcPlugins.length > 0) {
|
|
@@ -206,7 +221,7 @@ async function generateCordovaPodspec(cordovaPlugins, config, isStatic) {
|
|
|
206
221
|
sna.source_files = 'noarc/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
207
222
|
end`);
|
|
208
223
|
}
|
|
209
|
-
const frameworksString = frameworkDeps.join(
|
|
224
|
+
const frameworksString = frameworkDeps.join('\n ');
|
|
210
225
|
const content = `
|
|
211
226
|
Pod::Spec.new do |s|
|
|
212
227
|
s.name = '${name}'
|
|
@@ -245,8 +260,8 @@ function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
245
260
|
}
|
|
246
261
|
const sourcesFolder = path_1.join(pluginsPath, sourcesFolderName, p.name);
|
|
247
262
|
codeFiles.map((codeFile) => {
|
|
248
|
-
const fileName = codeFile.$.src.split(
|
|
249
|
-
const fileExt = codeFile.$.src.split(
|
|
263
|
+
const fileName = codeFile.$.src.split('/').pop();
|
|
264
|
+
const fileExt = codeFile.$.src.split('.').pop();
|
|
250
265
|
let destFolder = sourcesFolderName;
|
|
251
266
|
if (codeFile.$['compiler-flags'] && codeFile.$['compiler-flags'] === '-fno-objc-arc') {
|
|
252
267
|
destFolder = 'noarc';
|
|
@@ -255,7 +270,7 @@ function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
255
270
|
const fileDest = path_1.join(pluginsPath, destFolder, p.name, fileName);
|
|
256
271
|
fs_1.copySync(filePath, fileDest);
|
|
257
272
|
let fileContent = fs_1.readFileSync(fileDest, 'utf8');
|
|
258
|
-
if (fileExt ===
|
|
273
|
+
if (fileExt === 'swift') {
|
|
259
274
|
fileContent = 'import Cordova\n' + fileContent;
|
|
260
275
|
fs_1.writeFileSync(fileDest, fileContent, 'utf8');
|
|
261
276
|
}
|
|
@@ -264,11 +279,16 @@ function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
264
279
|
fileContent = fileContent.replace('@import Firebase;', '#import <Firebase/Firebase.h>');
|
|
265
280
|
fs_1.writeFileSync(fileDest, fileContent, 'utf8');
|
|
266
281
|
}
|
|
282
|
+
if (fileContent.includes('[NSBundle bundleForClass:[self class]]') || fileContent.includes('[NSBundle bundleForClass:[CDVCapture class]]')) {
|
|
283
|
+
fileContent = fileContent.replace('[NSBundle bundleForClass:[self class]]', '[NSBundle mainBundle]');
|
|
284
|
+
fileContent = fileContent.replace('[NSBundle bundleForClass:[CDVCapture class]]', '[NSBundle mainBundle]');
|
|
285
|
+
fs_1.writeFileSync(fileDest, fileContent, 'utf8');
|
|
286
|
+
}
|
|
267
287
|
}
|
|
268
288
|
});
|
|
269
289
|
const resourceFiles = plugin_1.getPlatformElement(p, platform, 'resource-file');
|
|
270
290
|
resourceFiles.map((resourceFile) => {
|
|
271
|
-
const fileName = resourceFile.$.src.split(
|
|
291
|
+
const fileName = resourceFile.$.src.split('/').pop();
|
|
272
292
|
fs_1.copySync(plugin_1.getFilePath(config, p, resourceFile.$.src), path_1.join(pluginsPath, 'resources', fileName));
|
|
273
293
|
});
|
|
274
294
|
frameworks.map((framework) => {
|
package/dist/plugin.js
CHANGED
|
@@ -61,7 +61,7 @@ function fixName(name) {
|
|
|
61
61
|
}
|
|
62
62
|
exports.fixName = fixName;
|
|
63
63
|
function removeScope(name) {
|
|
64
|
-
var parts = name.split(
|
|
64
|
+
var parts = name.split('/');
|
|
65
65
|
if (parts.length > 1) {
|
|
66
66
|
name = parts[parts.length - 1];
|
|
67
67
|
}
|
|
@@ -123,8 +123,8 @@ function getJSModules(p, platform) {
|
|
|
123
123
|
}
|
|
124
124
|
exports.getJSModules = getJSModules;
|
|
125
125
|
function getFilePath(config, plugin, path) {
|
|
126
|
-
if (path.startsWith(
|
|
127
|
-
let pathSegments = path.split(
|
|
126
|
+
if (path.startsWith('node_modules')) {
|
|
127
|
+
let pathSegments = path.split('/').slice(1);
|
|
128
128
|
if (pathSegments[0].startsWith('@')) {
|
|
129
129
|
pathSegments = [pathSegments[0] + '/' + pathSegments[1], ...pathSegments.slice(2)];
|
|
130
130
|
}
|
package/dist/tasks/add.js
CHANGED
|
@@ -29,7 +29,7 @@ async function addCommand(config, selectedPlatformName) {
|
|
|
29
29
|
await doAdd(config, platformName);
|
|
30
30
|
await editPlatforms(config, platformName);
|
|
31
31
|
if (shouldSync(config, platformName)) {
|
|
32
|
-
await sync_1.sync(config, platformName);
|
|
32
|
+
await sync_1.sync(config, platformName, false);
|
|
33
33
|
}
|
|
34
34
|
if (platformName === config.ios.name || platformName === config.android.name) {
|
|
35
35
|
common_3.log(chalk_1.default `\nNow you can run {green {bold npx cap open ${platformName}}} to launch ${platformName === config.ios.name ? 'Xcode' : 'Android Studio'}`);
|
|
@@ -104,7 +104,7 @@ async function editPlatforms(config, platformName) {
|
|
|
104
104
|
}
|
|
105
105
|
function shouldSync(config, platformName) {
|
|
106
106
|
// Don't sync if we're adding the iOS platform not on a mac
|
|
107
|
-
if (config.cli.os !== definitions_1.OS.Mac && platformName ===
|
|
107
|
+
if (config.cli.os !== definitions_1.OS.Mac && platformName === 'ios') {
|
|
108
108
|
return false;
|
|
109
109
|
}
|
|
110
110
|
return true;
|
package/dist/tasks/copy.js
CHANGED
|
@@ -33,13 +33,16 @@ async function copy(config, platformName) {
|
|
|
33
33
|
await copyWebDir(config, config.ios.webDirAbs);
|
|
34
34
|
await copyNativeBridge(config, config.ios.webDirAbs);
|
|
35
35
|
await copyCapacitorConfig(config, path_1.join(config.ios.platformDir, config.ios.nativeProjectName, config.ios.nativeProjectName));
|
|
36
|
-
await cordova_1.
|
|
36
|
+
const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
|
|
37
|
+
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
|
|
37
38
|
}
|
|
38
39
|
else if (platformName === config.android.name) {
|
|
39
40
|
await copyWebDir(config, config.android.webDirAbs);
|
|
40
41
|
await copyNativeBridge(config, config.android.webDirAbs);
|
|
41
42
|
await copyCapacitorConfig(config, path_1.join(config.android.platformDir, 'app/src/main/assets'));
|
|
42
|
-
await cordova_1.
|
|
43
|
+
const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
|
|
44
|
+
await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
|
|
45
|
+
await cordova_1.writeCordovaAndroidManifest(cordovaPlugins, config, platformName);
|
|
43
46
|
}
|
|
44
47
|
else if (platformName === config.web.name) {
|
|
45
48
|
await copy_1.copyWeb(config);
|
package/dist/tasks/doctor.js
CHANGED
|
@@ -30,7 +30,7 @@ async function doctorCore(config) {
|
|
|
30
30
|
}
|
|
31
31
|
exports.doctorCore = doctorCore;
|
|
32
32
|
async function printInstalledPackages(config) {
|
|
33
|
-
const packageNames = [
|
|
33
|
+
const packageNames = ['@capacitor/cli', '@capacitor/core', '@capacitor/android', '@capacitor/ios'];
|
|
34
34
|
await Promise.all(packageNames.map(async (packageName) => {
|
|
35
35
|
let version;
|
|
36
36
|
const packagePath = common_1.resolveNode(config, packageName, 'package.json');
|
package/dist/tasks/init.js
CHANGED
package/dist/tasks/new-plugin.js
CHANGED
|
@@ -23,61 +23,42 @@ exports.newPluginCommand = newPluginCommand;
|
|
|
23
23
|
async function newPlugin(config) {
|
|
24
24
|
common_1.log(`${emoji_1.emoji('✏️', '*')} Creating new Capacitor plugin`);
|
|
25
25
|
const inquirer = await Promise.resolve().then(() => require('inquirer'));
|
|
26
|
+
const requiredInput = (input) => {
|
|
27
|
+
if (!input || input.trim() === '') {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
26
32
|
const answers = await inquirer.prompt([
|
|
27
33
|
{
|
|
28
34
|
type: 'input',
|
|
29
35
|
name: 'name',
|
|
30
|
-
message: 'Plugin NPM name (
|
|
31
|
-
validate:
|
|
32
|
-
if (!input || input.trim() === '') {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
36
|
+
message: 'Plugin NPM name (kebab-case):',
|
|
37
|
+
validate: requiredInput
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
type: 'input',
|
|
40
41
|
name: 'domain',
|
|
41
42
|
message: 'Plugin id (domain-style syntax. ex: com.example.plugin)',
|
|
42
|
-
validate:
|
|
43
|
-
if (!input || input.trim() === '') {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
43
|
+
validate: requiredInput
|
|
48
44
|
},
|
|
49
45
|
{
|
|
50
46
|
type: 'input',
|
|
51
47
|
name: 'className',
|
|
52
48
|
message: 'Plugin class name (ex: AwesomePlugin)',
|
|
53
|
-
validate:
|
|
54
|
-
if (!input || input.trim() === '') {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
49
|
+
validate: requiredInput
|
|
59
50
|
},
|
|
60
51
|
{
|
|
61
52
|
type: 'input',
|
|
62
53
|
name: 'description',
|
|
63
54
|
message: 'description:',
|
|
64
|
-
validate:
|
|
65
|
-
if (!input || input.trim() === '') {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
55
|
+
validate: requiredInput
|
|
70
56
|
},
|
|
71
57
|
{
|
|
72
58
|
type: 'input',
|
|
73
59
|
name: 'git',
|
|
74
60
|
message: 'git repository:',
|
|
75
|
-
validate:
|
|
76
|
-
if (!input || input.trim() === '') {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
61
|
+
validate: requiredInput
|
|
81
62
|
},
|
|
82
63
|
{
|
|
83
64
|
type: 'input',
|
|
@@ -204,7 +185,7 @@ function generatePackageJSON(answers) {
|
|
|
204
185
|
types: 'dist/esm/index.d.ts',
|
|
205
186
|
scripts: {
|
|
206
187
|
'build': 'npm run clean && tsc',
|
|
207
|
-
'clean': '
|
|
188
|
+
'clean': 'rimraf ./dist',
|
|
208
189
|
'watch': 'tsc --watch',
|
|
209
190
|
'prepublishOnly': 'npm run build'
|
|
210
191
|
},
|
|
@@ -214,6 +195,7 @@ function generatePackageJSON(answers) {
|
|
|
214
195
|
'@capacitor/core': 'latest'
|
|
215
196
|
},
|
|
216
197
|
devDependencies: {
|
|
198
|
+
'rimraf': '^3.0.0',
|
|
217
199
|
'typescript': '^3.2.4',
|
|
218
200
|
'@capacitor/ios': 'latest',
|
|
219
201
|
'@capacitor/android': 'latest'
|
package/dist/tasks/sync.js
CHANGED
|
@@ -7,7 +7,7 @@ const promise_1 = require("../util/promise");
|
|
|
7
7
|
/**
|
|
8
8
|
* Sync is a copy and an update in one.
|
|
9
9
|
*/
|
|
10
|
-
async function syncCommand(config, selectedPlatform) {
|
|
10
|
+
async function syncCommand(config, selectedPlatform, deployment) {
|
|
11
11
|
const then = +new Date;
|
|
12
12
|
const platforms = config.selectPlatforms(selectedPlatform);
|
|
13
13
|
if (platforms.length === 0) {
|
|
@@ -16,7 +16,7 @@ async function syncCommand(config, selectedPlatform) {
|
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
18
|
await common_1.check(config, [common_1.checkPackage, common_1.checkWebDir, ...update_1.updateChecks(config, platforms)]);
|
|
19
|
-
await promise_1.allSerial(platforms.map(platformName => () => sync(config, platformName)));
|
|
19
|
+
await promise_1.allSerial(platforms.map(platformName => () => sync(config, platformName, deployment)));
|
|
20
20
|
const now = +new Date;
|
|
21
21
|
const diff = (now - then) / 1000;
|
|
22
22
|
common_1.log(`Sync finished in ${diff}s`);
|
|
@@ -26,13 +26,13 @@ async function syncCommand(config, selectedPlatform) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.syncCommand = syncCommand;
|
|
29
|
-
async function sync(config, platformName) {
|
|
29
|
+
async function sync(config, platformName, deployment) {
|
|
30
30
|
try {
|
|
31
31
|
await copy_1.copy(config, platformName);
|
|
32
32
|
}
|
|
33
33
|
catch (e) {
|
|
34
34
|
common_1.logError(e);
|
|
35
35
|
}
|
|
36
|
-
await update_1.update(config, platformName);
|
|
36
|
+
await update_1.update(config, platformName, deployment);
|
|
37
37
|
}
|
|
38
38
|
exports.sync = sync;
|
package/dist/tasks/update.js
CHANGED
|
@@ -5,7 +5,7 @@ const update_2 = require("../ios/update");
|
|
|
5
5
|
const promise_1 = require("../util/promise");
|
|
6
6
|
const common_1 = require("../common");
|
|
7
7
|
const chalk_1 = require("chalk");
|
|
8
|
-
async function updateCommand(config, selectedPlatformName) {
|
|
8
|
+
async function updateCommand(config, selectedPlatformName, deployment) {
|
|
9
9
|
const then = +new Date;
|
|
10
10
|
const platforms = config.selectPlatforms(selectedPlatformName);
|
|
11
11
|
if (platforms.length === 0) {
|
|
@@ -14,7 +14,7 @@ async function updateCommand(config, selectedPlatformName) {
|
|
|
14
14
|
}
|
|
15
15
|
try {
|
|
16
16
|
await common_1.check(config, [common_1.checkPackage, ...updateChecks(config, platforms)]);
|
|
17
|
-
await promise_1.allSerial(platforms.map(platformName => async () => await update(config, platformName)));
|
|
17
|
+
await promise_1.allSerial(platforms.map(platformName => async () => await update(config, platformName, deployment)));
|
|
18
18
|
const now = +new Date;
|
|
19
19
|
const diff = (now - then) / 1000;
|
|
20
20
|
common_1.log(`Update finished in ${diff}s`);
|
|
@@ -46,11 +46,11 @@ function updateChecks(config, platforms) {
|
|
|
46
46
|
return checks;
|
|
47
47
|
}
|
|
48
48
|
exports.updateChecks = updateChecks;
|
|
49
|
-
async function update(config, platformName) {
|
|
49
|
+
async function update(config, platformName, deployment) {
|
|
50
50
|
try {
|
|
51
51
|
await common_1.runTask(chalk_1.default `{green {bold update}} {bold ${platformName}}`, async () => {
|
|
52
52
|
if (platformName === config.ios.name) {
|
|
53
|
-
await update_2.updateIOS(config);
|
|
53
|
+
await update_2.updateIOS(config, deployment);
|
|
54
54
|
}
|
|
55
55
|
else if (platformName === config.android.name) {
|
|
56
56
|
await update_1.updateAndroid(config);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitor.ionicframework.com/",
|
|
6
6
|
"author": "Ionic Team <hi@ionicframework.com> (https://ionicframework.com) ",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "npm run clean && npm run assets && tsc",
|
|
17
|
-
"clean": "
|
|
17
|
+
"clean": "rimraf ./dist",
|
|
18
18
|
"deploy": "np",
|
|
19
19
|
"lint": "tslint --project tsconfig.json",
|
|
20
20
|
"assets": "node scripts/copy-assets.js",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"jest": "^23.6.0",
|
|
70
70
|
"mock-fs": "^4.4.2",
|
|
71
71
|
"np": "^2.18.2",
|
|
72
|
+
"rimraf": "^3.0.0",
|
|
72
73
|
"tmp": "0.0.33",
|
|
73
74
|
"ts-jest": "^23.10.4",
|
|
74
75
|
"tslint": "^5.8.0",
|