@capacitor/cli
Advanced tools
Comparing version 0.0.108 to 0.0.109
@@ -55,3 +55,5 @@ "use strict"; | ||
await fs_1.cpAsync(path_1.resolve(config.app.rootDir, config.android.platformDir, 'app/src/main/java/com/getcapacitor/myapp/MainActivity.java'), path_1.resolve(newJavaPath, 'MainActivity.java')); | ||
await fs_extra_1.remove(path_1.resolve(config.app.rootDir, config.android.platformDir, 'app/src/main/java/com/getcapacitor')); | ||
if (appId.split('.')[1] !== 'getcapacitor') { | ||
await fs_extra_1.remove(path_1.resolve(config.app.rootDir, config.android.platformDir, 'app/src/main/java/com/getcapacitor')); | ||
} | ||
// Remove our template 'com' folder if their ID doesn't have it | ||
@@ -66,5 +68,7 @@ if (appId.split('.')[0] !== 'com') { | ||
await fs_1.writeFileAsync(activityPath, activityContent, 'utf8'); | ||
// Update the applicationId in build.gradle | ||
let gradleContent = await fs_1.readFileAsync(buildGradlePath, 'utf8'); | ||
gradleContent = gradleContent.replace(/applicationId "[^"]+"/, `applicationId "${appId}"`); | ||
await fs_1.writeFileAsync(buildGradlePath, gradleContent, 'utf8'); | ||
// Update the settings in res/values/strings.xml | ||
const stringsPath = path_1.resolve(config.app.rootDir, config.android.platformDir, 'app/src/main/res/values/strings.xml'); | ||
@@ -71,0 +75,0 @@ let stringsContent = await fs_1.readFileAsync(stringsPath, 'utf8'); |
@@ -156,3 +156,3 @@ "use strict"; | ||
} | ||
let fileContent = await fs_2.readFileAsync(filePath, 'utf-8'); | ||
let fileContent = await fs_2.readFileAsync(filePath, 'utf8'); | ||
fileContent = fileContent.replace(/'|"/g, '').replace(/\s+/g, ' '); | ||
@@ -159,0 +159,0 @@ const searchFor = `applicationId ${packageId}`; |
@@ -16,2 +16,3 @@ "use strict"; | ||
}); | ||
console.log('Android found these plugins: ', plugins); | ||
const capacitorPlugins = plugins.filter(p => plugin_1.getPluginType(p, platform) === 0 /* Code */); | ||
@@ -18,0 +19,0 @@ const cordovaPlugins = plugins.filter(p => plugin_1.getPluginType(p, platform) === 2 /* Cordova */); |
@@ -41,6 +41,6 @@ "use strict"; | ||
if (!config.app.appId) { | ||
return 'Missing appId in config. Please add it'; | ||
return 'Missing appId for new platform. Please add it in capacitor.config.json.'; | ||
} | ||
if (!config.app.appName) { | ||
return 'Missing appName in config. Please add it'; | ||
return 'Missing appName for new platform. Please add it in capacitor.config.json.'; | ||
} | ||
@@ -69,3 +69,3 @@ const appIdError = await checkAppId(config, config.app.appId); | ||
} | ||
return `Invalid App ID. Must be in domain form (ex: com.example.app)`; | ||
return `Invalid App ID "${id}". Must be in domain form (ex: com.example.app)`; | ||
} | ||
@@ -121,2 +121,20 @@ exports.checkAppId = checkAppId; | ||
exports.writeXML = writeXML; | ||
/** | ||
* Check for or create our main configuration file. | ||
* @param config | ||
*/ | ||
async function getOrCreateConfig(config) { | ||
const configPath = path_1.join(config.app.rootDir, config.app.extConfigName); | ||
if (await fs_1.existsAsync(configPath)) { | ||
return configPath; | ||
} | ||
await writePrettyJSON(config.app.extConfigFilePath, { | ||
appId: config.app.appId, | ||
appName: config.app.appName, | ||
webDir: path_1.relative(config.app.rootDir, config.app.webDir) | ||
}); | ||
// Store our newly created or found external config as the default | ||
config.loadExternalConfig(); | ||
} | ||
exports.getOrCreateConfig = getOrCreateConfig; | ||
function log(...args) { | ||
@@ -123,0 +141,0 @@ console.log(...args); |
@@ -137,3 +137,3 @@ "use strict"; | ||
})); | ||
const content = `<?xml version='1.0' encoding='utf8'?> | ||
const content = `<?xml version='1.0' encoding='utf-8'?> | ||
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> | ||
@@ -140,0 +140,0 @@ ${pluginEntriesString.join('\n')} |
@@ -36,2 +36,3 @@ "use strict"; | ||
}); | ||
console.log('iOS found these plugins: ', plugins); | ||
plugin_1.printPlugins(plugins); | ||
@@ -38,0 +39,0 @@ removePluginsNativeFiles(config); |
@@ -84,8 +84,8 @@ "use strict"; | ||
async function editPlatforms(config, platformName) { | ||
if (platformName == config.ios.name) { | ||
if (platformName === config.ios.name) { | ||
await common_2.editProjectSettingsIOS(config); | ||
} | ||
else if (platformName == config.android.name) { | ||
else if (platformName === config.android.name) { | ||
await common_1.editProjectSettingsAndroid(config); | ||
} | ||
} |
@@ -37,2 +37,3 @@ "use strict"; | ||
config.app.appId = appId; | ||
await common_3.getOrCreateConfig(config); | ||
await create(config, appDir, appName, appId); | ||
@@ -39,0 +40,0 @@ // npm install |
@@ -6,5 +6,3 @@ "use strict"; | ||
const common_1 = require("../common"); | ||
const fs_1 = require("../util/fs"); | ||
const emoji_1 = require("../util/emoji"); | ||
const path_1 = require("path"); | ||
const chalk = require('chalk'); | ||
@@ -21,3 +19,3 @@ async function initCommand(config, appName, appId) { | ||
// Get or create our config | ||
await getOrCreateConfig(config); | ||
await common_1.getOrCreateConfig(config); | ||
}); | ||
@@ -52,19 +50,2 @@ await printNextSteps(config); | ||
/** | ||
* Check for or create our main configuration file. | ||
* @param config | ||
*/ | ||
async function getOrCreateConfig(config) { | ||
const configPath = path_1.join(config.app.rootDir, config.app.extConfigName); | ||
if (await fs_1.existsAsync(configPath)) { | ||
return configPath; | ||
} | ||
await common_1.writePrettyJSON(config.app.extConfigFilePath, { | ||
appId: config.app.appId, | ||
appName: config.app.appName, | ||
webDir: path_1.relative(config.app.rootDir, config.app.webDir) | ||
}); | ||
// Store our newly created or found external config as the default | ||
config.loadExternalConfig(); | ||
} | ||
/** | ||
* Add Android and iOS by default | ||
@@ -71,0 +52,0 @@ * @param config |
{ | ||
"name": "@capacitor/cli", | ||
"version": "0.0.108", | ||
"version": "0.0.109", | ||
"description": "Capacitor: Cross-platform apps with JavaScript and the web", | ||
@@ -65,3 +65,3 @@ "homepage": "https://capacitor.ionicframework.com/", | ||
"@types/inquirer": "0.0.35", | ||
"@types/jest": "^21.1.8", | ||
"@types/jest": "^21.1.10", | ||
"@types/mock-fs": "^3.6.30", | ||
@@ -76,2 +76,3 @@ "@types/opn": "^5.1.0", | ||
"np": "^2.18.2", | ||
"tmp": "0.0.33", | ||
"ts-jest": "^21.2.4", | ||
@@ -94,4 +95,8 @@ "tslint": "^5.8.0", | ||
}, | ||
"testRegex": "/src/.*\\.spec\\.(ts|tsx|js)$" | ||
"testRegex": "(/test/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/test/util.ts" | ||
] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
3031
860234
17
183