Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make manifest.env available in publish and export commands
Browse files Browse the repository at this point in the history
rodrigorm committed Dec 18, 2019
1 parent a19d624 commit 1397261
Showing 2 changed files with 26 additions and 24 deletions.
23 changes: 23 additions & 0 deletions packages/config/src/Config.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,22 @@ import { AppJSONConfig, ExpRc, ExpoConfig, PackageJSONConfig, ProjectConfig } fr
import { ConfigError } from './Errors';
import { getExpoSDKVersion } from './Project';

let blacklistedEnvironmentVariables = new Set([
'EXPO_APPLE_PASSWORD',
'EXPO_ANDROID_KEY_PASSWORD',
'EXPO_ANDROID_KEYSTORE_PASSWORD',
'EXPO_IOS_DIST_P12_PASSWORD',
'EXPO_IOS_PUSH_P12_PASSWORD',
'EXPO_CLI_PASSWORD',
]);

function shouldExposeEnvironmentVariableInManifest(key) {
if (blacklistedEnvironmentVariables.has(key.toUpperCase())) {
return false;
}
return key.startsWith('REACT_NATIVE_') || key.startsWith('EXPO_');
}

export function readConfigJson(
projectRoot: string,
skipValidation: boolean = false,
@@ -161,6 +177,13 @@ function ensureConfigHasDefaultValues(
exp.platforms = ['android', 'ios'];
}

exp.env = {};
for (let key of Object.keys(process.env)) {
if (shouldExposeEnvironmentVariableInManifest(key)) {
exp.env[key] = process.env[key];
}
}

return { exp, pkg };
}

27 changes: 3 additions & 24 deletions packages/xdl/src/Project.ts
Original file line number Diff line number Diff line change
@@ -1943,22 +1943,6 @@ export async function stopReactNativeServerAsync(projectRoot: string): Promise<v
});
}

let blacklistedEnvironmentVariables = new Set([
'EXPO_APPLE_PASSWORD',
'EXPO_ANDROID_KEY_PASSWORD',
'EXPO_ANDROID_KEYSTORE_PASSWORD',
'EXPO_IOS_DIST_P12_PASSWORD',
'EXPO_IOS_PUSH_P12_PASSWORD',
'EXPO_CLI_PASSWORD',
]);

function shouldExposeEnvironmentVariableInManifest(key: string) {
if (blacklistedEnvironmentVariables.has(key.toUpperCase())) {
return false;
}
return key.startsWith('REACT_NATIVE_') || key.startsWith('EXPO_');
}

export async function startExpoServerAsync(projectRoot: string): Promise<void> {
_assertValidProjectRoot(projectRoot);
await stopExpoServerAsync(projectRoot);
@@ -2002,14 +1986,9 @@ export async function startExpoServerAsync(projectRoot: string): Promise<void> {
projectRoot,
};
manifest.packagerOpts = packagerOpts;
manifest.env = {};
for (let key of Object.keys(process.env)) {
if (shouldExposeEnvironmentVariableInManifest(key)) {
manifest.env[key] = process.env[key];
}
}
let platform = (req.headers['exponent-platform'] || 'ios').toString();
let entryPoint = Exp.determineEntryPoint(projectRoot, platform);
let entryPoint = await Exp.determineEntryPointAsync(projectRoot);
let platform = req.headers['exponent-platform'] || 'ios';
entryPoint = UrlUtils.getPlatformSpecificBundleUrl(entryPoint, platform);
let mainModuleName = UrlUtils.guessMainModulePath(entryPoint);
let queryParams = await UrlUtils.constructBundleQueryParamsAsync(projectRoot, packagerOpts);
let path = `/${encodeURI(mainModuleName)}.bundle?platform=${encodeURIComponent(

0 comments on commit 1397261

Please sign in to comment.