Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log(
chalk.magenta(
`${CHEVRON} Saving selection to the ${chalk.underline`expo.android.permissions`} array in the ${chalk.bold`app.json`}...`
)
);
if (isExpo) {
if (selectedAll) {
console.log(
chalk.magenta(
`${CHEVRON} Expo will default to using all permissions in your project by deleting the ${chalk.underline`expo.android.permissions`} array.`
)
);
}
}
await writeConfigJsonAsync(projectDir, {
android: {
...(exp.android || {}),
// An empty array means no permissions
// No value means all permissions
permissions: selectedAll
? undefined
: answer.map((permission: string) => {
if (permission.startsWith('android.permission.')) {
return permission.split('.').pop();
}
return permission;
}),
},
});
if (!isExpo) {
async function logAutoConfigValuesAsync(env: Environment) {
const locations = env.locations || (await getPathsAsync(env.projectRoot));
const { exp: config } = readConfigJson(env.projectRoot, true, true);
const standardConfig = ensurePWAConfig({}, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
const pwaConfig = ensurePWAConfig(config, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
// @ts-ignore
const nonStandard = diff(standardConfig, pwaConfig);
let obj = {};
for (const diff of nonStandard) {
// console.log(chalk.bold(diff.path.join('/') + ': ') + chalk.bgRed(JSON.stringify(diff.rhs, null, 2)));
async function logAutoConfigValuesAsync(env: Environment) {
const locations = env.locations || (await getPathsAsync(env.projectRoot));
const { exp: config } = readConfigJson(env.projectRoot);
const standardConfig = ensurePWAConfig({}, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
const pwaConfig = ensurePWAConfig(config, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
// @ts-ignore
const nonStandard = diff(standardConfig, pwaConfig);
let obj = {};
for (const diff of nonStandard) {
// console.log(chalk.bold(diff.path.join('/') + ': ') + chalk.bgRed(JSON.stringify(diff.rhs, null, 2)));
async function logAutoConfigValuesAsync(env: Environment) {
const locations = env.locations || (await getPathsAsync(env.projectRoot));
const { exp: config } = readConfigJson(env.projectRoot, true, true);
const standardConfig = ensurePWAConfig({}, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
const pwaConfig = ensurePWAConfig(config, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
// @ts-ignore
const nonStandard = diff(standardConfig, pwaConfig);
let obj = {};
for (const diff of nonStandard) {
// console.log(chalk.bold(diff.path.join('/') + ': ') + chalk.bgRed(JSON.stringify(diff.rhs, null, 2)));
// TODO: Bacon: add support for array updates: https://www.npmjs.com/package/deep-diff#differences
if (diff.kind !== 'A') {
async function logAutoConfigValuesAsync(env: Environment) {
const locations = env.locations || (await getPathsAsync(env.projectRoot));
const { exp: config } = readConfigJson(env.projectRoot);
const standardConfig = ensurePWAConfig({}, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
const pwaConfig = ensurePWAConfig(config, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
// @ts-ignore
const nonStandard = diff(standardConfig, pwaConfig);
let obj = {};
for (const diff of nonStandard) {
// console.log(chalk.bold(diff.path.join('/') + ': ') + chalk.bgRed(JSON.stringify(diff.rhs, null, 2)));
// TODO: Bacon: add support for array updates: https://www.npmjs.com/package/deep-diff#differences
if (diff.kind !== 'A') {
setDeepValue(diff.path, obj, diff);
}
}
async function logAutoConfigValuesAsync(env: Environment) {
const locations = env.locations || (await getPathsAsync(env.projectRoot));
const { exp: config } = readConfigJson(env.projectRoot);
const standardConfig = ensurePWAConfig({}, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
const pwaConfig = ensurePWAConfig(config, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
// @ts-ignore
const nonStandard = diff(standardConfig, pwaConfig);
let obj = {};
for (const diff of nonStandard) {
// console.log(chalk.bold(diff.path.join('/') + ': ') + chalk.bgRed(JSON.stringify(diff.rhs, null, 2)));
// TODO: Bacon: add support for array updates: https://www.npmjs.com/package/deep-diff#differences
if (diff.kind !== 'A') {
async function logAutoConfigValuesAsync(env: Environment) {
const locations = env.locations || (await getPathsAsync(env.projectRoot));
const { exp: config } = readConfigJson(env.projectRoot, true, true);
const standardConfig = ensurePWAConfig({}, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
const pwaConfig = ensurePWAConfig(config, locations.absolute, {
templateIcon: locations.template.get('icon.png'),
});
// @ts-ignore
const nonStandard = diff(standardConfig, pwaConfig);
let obj = {};
for (const diff of nonStandard) {
// console.log(chalk.bold(diff.path.join('/') + ': ') + chalk.bgRed(JSON.stringify(diff.rhs, null, 2)));
// TODO: Bacon: add support for array updates: https://www.npmjs.com/package/deep-diff#differences
if (diff.kind !== 'A') {
setDeepValue(diff.path, obj, diff);
}
}
async prepareProjectInfo(): Promise {
// always use local json to unify behaviour between regular apps and self hosted ones
const { exp } = await readConfigJsonAsync(this.projectDir);
this.manifest = exp;
this.user = await UserManager.ensureLoggedInAsync();
await this.checkProjectConfig();
}
async function getConfigAsync(
projectRoot: string,
options: {
current?: boolean;
mode?: string;
platform?: 'android' | 'ios' | 'all';
expIds?: Array;
type?: string;
releaseChannel?: string;
bundleIdentifier?: string;
publicUrl?: string;
} = {}
) {
if (!options.publicUrl) {
// get the manifest from the project directory
const { exp, pkg } = await readConfigJsonAsync(projectRoot);
const configName = configFilename(projectRoot);
return {
exp,
pkg,
configName: configFilename(projectRoot),
configPrefix: configName === 'app.json' ? 'expo.' : '',
};
} else {
// get the externally hosted manifest
return {
exp: await ThirdParty.getManifest(options.publicUrl, options),
configName: options.publicUrl,
configPrefix: '',
pkg: {},
};
}
opts = defaultOpts;
} else {
opts = Object.assign({}, defaultOpts, opts);
}
let packagerInfo = await ProjectSettings.readPackagerInfoAsync(projectRoot);
let protocol;
if (opts.urlType === 'http') {
protocol = 'http';
} else if (opts.urlType === 'no-protocol') {
protocol = null;
} else {
protocol = 'exp';
let { exp } = await readConfigJsonAsync(projectRoot);
if (exp.detach) {
if (exp.scheme && Versions.gteSdkVersion(exp, '27.0.0')) {
protocol = exp.scheme;
} else if (exp.detach.scheme) {
// must keep this fallback in place for older projects
// and those detached with an older version of xdl
protocol = exp.detach.scheme;
}
}
}
let hostname;
let port;
const proxyURL = isPackager
? process.env.EXPO_PACKAGER_PROXY_URL