@capacitor/cli
Advanced tools
Comparing version 0.0.73 to 0.0.74
@@ -23,3 +23,3 @@ "use strict"; | ||
'{\n' + | ||
' "windowsAndroidStudioPath": "H:\\Android Studio\\bin\\studio64.exe"\n' + | ||
' "windowsAndroidStudioPath": "H:\\\\Android Studio\\\\bin\\\\studio64.exe"\n' + | ||
'}'); | ||
@@ -26,0 +26,0 @@ } |
@@ -10,2 +10,3 @@ "use strict"; | ||
async function updateAndroid(config, needsUpdate) { | ||
const platform = 'android'; | ||
const plugins = await common_1.runTask('Fetching plugins', async () => { | ||
@@ -16,4 +17,13 @@ const allPlugins = await plugin_1.getPlugins(); | ||
}); | ||
await update_1.copyPluginsJS(config, plugins, 'android'); | ||
await autoGenerateConfig(config, plugins); | ||
const cordovaPlugins = plugins | ||
.filter(p => update_1.getPluginType(p, platform) === 2 /* Cordova */); | ||
if (cordovaPlugins.length > 0) { | ||
await update_1.copyCordovaJS(config, platform); | ||
await update_1.copyPluginsJS(config, cordovaPlugins, platform); | ||
} | ||
else { | ||
update_1.removePluginFiles(config, platform); | ||
update_1.createEmptyCordovaJS(config, platform); | ||
} | ||
await autoGenerateConfig(config, cordovaPlugins); | ||
await common_1.runTask(`Updating android`, async () => { | ||
@@ -25,3 +35,3 @@ common_1.log('\n'); | ||
exports.updateAndroid = updateAndroid; | ||
async function autoGenerateConfig(config, plugins) { | ||
async function autoGenerateConfig(config, cordovaPlugins) { | ||
const xmlDir = path_1.join(config.android.resDir, 'xml'); | ||
@@ -32,3 +42,3 @@ fs_1.ensureDirSync(xmlDir); | ||
let pluginEntries = []; | ||
plugins.filter(p => p.android.type === 2 /* Cordova */).map(p => { | ||
cordovaPlugins.map(p => { | ||
const androidPlatform = p.xml.platform.filter(function (item) { return item.$.name === 'android'; }); | ||
@@ -35,0 +45,0 @@ const androidConfigFiles = androidPlatform[0]['config-file']; |
@@ -12,2 +12,3 @@ "use strict"; | ||
async function updateIOS(config, needsUpdate) { | ||
const platform = 'ios'; | ||
var chalk = require('chalk'); | ||
@@ -32,4 +33,13 @@ common_2.log(`\n${chalk.bold('iOS Note:')} you should periodically run "pod repo update" to make sure your ` + | ||
}); | ||
plugin_1.printPlugins(plugins); | ||
await update_1.copyPluginsJS(config, plugins, 'ios'); | ||
// printPlugins(plugins); | ||
const cordovaPlugins = plugins | ||
.filter(p => update_1.getPluginType(p, platform) === 2 /* Cordova */); | ||
if (cordovaPlugins.length > 0) { | ||
await update_1.copyCordovaJS(config, platform); | ||
await update_1.copyPluginsJS(config, cordovaPlugins, platform); | ||
} | ||
else { | ||
update_1.removePluginFiles(config, platform); | ||
update_1.createEmptyCordovaJS(config, platform); | ||
} | ||
await autoGeneratePods(plugins); | ||
@@ -36,0 +46,0 @@ await installCocoaPodsPlugins(config, plugins, needsUpdate); |
@@ -28,3 +28,2 @@ "use strict"; | ||
await copyNativeBridge(config, config.ios.webDir); | ||
await copyCordovaJS(config, config.ios.webDir); | ||
} | ||
@@ -34,3 +33,2 @@ else if (platformName === config.android.name) { | ||
await copyNativeBridge(config, config.android.webDir); | ||
await copyCordovaJS(config, config.android.webDir); | ||
} | ||
@@ -53,10 +51,2 @@ else if (platformName === config.web.name) { | ||
} | ||
async function copyCordovaJS(config, nativeAbsDir) { | ||
const cordovaPath = path_1.resolve('node_modules', '@capacitor/core', 'cordova.js'); | ||
if (!await fs_1.existsAsync(cordovaPath)) { | ||
common_1.logFatal(`Unable to find node_modules/@capacitor/core/cordova.js. Are you sure`, '@capacitor/core is installed? This file is currently required for Capacitor to function.'); | ||
return; | ||
} | ||
return fs_extra_1.copy(cordovaPath, path_1.join(nativeAbsDir, 'cordova.js')); | ||
} | ||
async function copyWebDir(config, nativeAbsDir) { | ||
@@ -63,0 +53,0 @@ var chalk = require('chalk'); |
@@ -9,2 +9,4 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const fs_2 = require("../util/fs"); | ||
const fs_extra_1 = require("fs-extra"); | ||
async function updateCommand(config, selectedPlatformName) { | ||
@@ -47,13 +49,11 @@ const platforms = config.selectPlatforms(selectedPlatformName); | ||
await update_1.updateAndroid(config, needsUpdate); | ||
await copyCordovaJS(config, config.android.webDir); | ||
} | ||
} | ||
exports.update = update; | ||
async function copyPluginsJS(config, plugins, platform) { | ||
async function copyPluginsJS(config, cordovaPlugins, platform) { | ||
const webDir = getwebDir(config, platform); | ||
const pluginsDir = path_1.join(webDir, 'plugins'); | ||
const cordovaPluginsJSFile = path_1.join(webDir, 'cordova_plugins.js'); | ||
fs_1.removeSync(pluginsDir); | ||
fs_1.removeSync(cordovaPluginsJSFile); | ||
const cordovaPlugins = plugins | ||
.filter(p => getPluginType(p, platform) === 2 /* Cordova */); | ||
removePluginFiles(config, platform); | ||
cordovaPlugins.map(async (p) => { | ||
@@ -138,1 +138,24 @@ const pluginDir = path_1.join(pluginsDir, p.id, 'www'); | ||
} | ||
exports.getPluginType = getPluginType; | ||
async function copyCordovaJS(config, platform) { | ||
const cordovaPath = path_1.resolve('node_modules', '@capacitor/core', 'cordova.js'); | ||
if (!await fs_2.existsAsync(cordovaPath)) { | ||
common_1.logFatal(`Unable to find node_modules/@capacitor/core/cordova.js. Are you sure`, '@capacitor/core is installed? This file is currently required for Capacitor to function.'); | ||
return; | ||
} | ||
return fs_extra_1.copy(cordovaPath, path_1.join(getwebDir(config, platform), 'cordova.js')); | ||
} | ||
exports.copyCordovaJS = copyCordovaJS; | ||
function createEmptyCordovaJS(config, platform) { | ||
fs_1.writeFileAsync(path_1.join(getwebDir(config, platform), 'cordova.js'), ""); | ||
fs_1.writeFileAsync(path_1.join(getwebDir(config, platform), 'cordova_plugins.js'), ""); | ||
} | ||
exports.createEmptyCordovaJS = createEmptyCordovaJS; | ||
function removePluginFiles(config, platform) { | ||
const webDir = getwebDir(config, platform); | ||
const pluginsDir = path_1.join(webDir, 'plugins'); | ||
const cordovaPluginsJSFile = path_1.join(webDir, 'cordova_plugins.js'); | ||
fs_1.removeSync(pluginsDir); | ||
fs_1.removeSync(cordovaPluginsJSFile); | ||
} | ||
exports.removePluginFiles = removePluginFiles; |
{ | ||
"name": "@capacitor/cli", | ||
"version": "0.0.73", | ||
"version": "0.0.74", | ||
"description": "Capacitor: Cross-platform apps with JavaScript and the web", | ||
@@ -5,0 +5,0 @@ "homepage": "https://capacitor.ionicframework.com/", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1334531
2249
14