<commit_before>/*
	Usage:
	npm run-script [campus-prod|campus-qa]
*/
const fs = require('fs')
const os = require('os')

const REPLACEMENT_ENV = process.argv[2]
const ENV_TYPE = process.argv[3]

// Environment Setup
let myEnv
if (ENV_TYPE === 'ci') {
	myEnv = process.env
} else {
	myEnv = require(os.homedir() + '/.campusmobile/env.js') // eslint-disable-line
}

// File Paths
const APP_SETTINGS_PATH = './app/AppSettings.js',
	SSO_SERVICE_PATH = './app/services/ssoService.js',
	IOS_INFO_PLIST_PATH = './ios/CampusMobile/Info.plist',
	ANDROID_STRINGS_PATH = './android/app/src/main/res/values/strings.xml',
	ANDROID_MANIFEST_PATH = './android/app/src/main/AndroidManifest.xml',
	IOS_GOOGLE_SERVICES_PATH = './ios/GoogleService-Info.plist',
	ANDROID_GOOGLE_SERVICES_PATH = './android/app/google-services.json'

// Placeholder Values
const PH = {
	APP_NAME_PH: 'Campus Mobile',
	GOOGLE_ANALYTICS_ID_PH: 'GOOGLE_ANALYTICS_ID_PH',
	GOOGLE_MAPS_API_KEY_PH: 'GOOGLE_MAPS_API_KEY_PH',
	FIREBASE_KEY_PH: 'FIREBASE_KEY_PH',
	BUGSNAG_KEY_PH: 'BUGSNAG_KEY_PH',
	AUTH_SERVICE_API_KEY_PH: 'AUTH_SERVICE_API_KEY_PH',
	GS_PROJECT_ID_PH: 'GS_PROJECT_ID_PH',
	GS_STORAGE_BUCKET_PH: 'GS_STORAGE_BUCKET_PH',
	GS_FIREBASE_URL_PH: 'GS_FIREBASE_URL_PH',
	GS_PROJECT_NUMBER_PH: 'GS_PROJECT_NUMBER_PH', // iOS: GCM_SENDER_ID, Android: project_info.project_number
	GS_IOS_CLIENT_ID_PH: 'GS_IOS_CLIENT_ID_PH',
	GS_IOS_REVERSED_CLIENT_ID_PH: 'GS_IOS_REVERSED_CLIENT_ID_PH',
	GS_IOS_API_KEY_PH: 'GS_IOS_API_KEY_PH',
	GS_IOS_BUNDLE_ID_PH: 'GS_IOS_BUNDLE_ID_PH',
	GS_IOS_STORAGE_BUCKET_PH: 'GS_IOS_STORAGE_BUCKET_PH',
	GS_IOS_APP_ID_PH: '1:1:ios:1',
	GS_ANDROID_CLIENT_ID_PH: 'GS_ANDROID_CLIENT_ID_PH',
	GS_ANDROID_API_KEY_PH: 'GS_ANDROID_API_KEY_PH',
	GS_ANDROID_APP_ID_PH: 'GS_ANDROID_APP_ID_PH',
	GS_ANDROID_BUNDLE_ID_PH: 'GS_ANDROID_BUNDLE_ID_PH',
}

if (REPLACEMENT_ENV === 'prod' || REPLACEMENT_ENV === 'qa') {
	// AppSettings.js
	makeReplacements(APP_SETTINGS_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.APP_NAME, qaVal: myEnv.APP_NAME, phVal: PH.APP_NAME_PH },
		{ prodVal: myEnv.GOOGLE_ANALYTICS_ID_PROD, qaVal: myEnv.GOOGLE_ANALYTICS_ID_QA, phVal: PH.GOOGLE_ANALYTICS_ID_PH },
	])

	// ssoService.js
	makeReplacements(SSO_SERVICE_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.AUTH_SERVICE_API_KEY_PROD, qaVal: myEnv.AUTH_SERVICE_API_KEY_QA, phVal: PH.AUTH_SERVICE_API_KEY_PH },
	])

	// Info.plist
	makeReplacements(IOS_INFO_PLIST_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.APP_NAME, qaVal: myEnv.APP_NAME, phVal: PH.APP_NAME_PH },
		{ prodVal: myEnv.BUGSNAG_KEY, qaVal: myEnv.BUGSNAG_KEY, phVal: PH.BUGSNAG_KEY_PH }
	])

	// strings.xml
	makeReplacements(ANDROID_STRINGS_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.APP_NAME, qaVal: myEnv.APP_NAME, phVal: PH.APP_NAME_PH },
	])

	// AndroidManifest.xml
	makeReplacements(ANDROID_MANIFEST_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.GOOGLE_MAPS_API_KEY, qaVal: myEnv.GOOGLE_MAPS_API_KEY, phVal: PH.GOOGLE_MAPS_API_KEY_PH },
		{ prodVal: myEnv.BUGSNAG_KEY, qaVal: myEnv.BUGSNAG_KEY, phVal: PH.BUGSNAG_KEY_PH }<commit_msg>Update replacements for android<commit_after>/*
	Usage:
	npm run-script [campus-prod|campus-qa]
*/
const fs = require('fs')
const os = require('os')

const REPLACEMENT_ENV = process.argv[2]
const ENV_TYPE = process.argv[3]

// Environment Setup
let myEnv
if (ENV_TYPE === 'ci') {
	myEnv = process.env
} else {
	myEnv = require(os.homedir() + '/.campusmobile/env.js') // eslint-disable-line
}

// File Paths
const APP_SETTINGS_PATH = './app/AppSettings.js',
	SSO_SERVICE_PATH = './app/services/ssoService.js',
	IOS_INFO_PLIST_PATH = './ios/CampusMobile/Info.plist',
	ANDROID_STRINGS_PATH = './android/app/src/main/res/values/strings.xml',
	ANDROID_MANIFEST_PATH = './android/app/src/main/AndroidManifest.xml',
	IOS_GOOGLE_SERVICES_PATH = './ios/GoogleService-Info.plist',
	ANDROID_GOOGLE_SERVICES_PATH = './android/app/google-services.json'

// Placeholder Values
const PH = {
	APP_NAME_PH: 'Campus Mobile',
	GOOGLE_ANALYTICS_ID_PH: 'GOOGLE_ANALYTICS_ID_PH',
	GOOGLE_MAPS_API_KEY_PH: 'GOOGLE_MAPS_API_KEY_PH',
	FIREBASE_KEY_PH: 'FIREBASE_KEY_PH',
	BUGSNAG_KEY_PH: 'BUGSNAG_KEY_PH',
	AUTH_SERVICE_API_KEY_PH: 'AUTH_SERVICE_API_KEY_PH',
	GS_PROJECT_ID_PH: 'GS_PROJECT_ID_PH',
	GS_STORAGE_BUCKET_PH: 'GS_STORAGE_BUCKET_PH',
	GS_FIREBASE_URL_PH: 'GS_FIREBASE_URL_PH',
	GS_PROJECT_NUMBER_PH: 'GS_PROJECT_NUMBER_PH', // iOS: GCM_SENDER_ID, Android: project_info.project_number
	GS_IOS_CLIENT_ID_PH: 'GS_IOS_CLIENT_ID_PH',
	GS_IOS_REVERSED_CLIENT_ID_PH: 'GS_IOS_REVERSED_CLIENT_ID_PH',
	GS_IOS_API_KEY_PH: 'GS_IOS_API_KEY_PH',
	GS_IOS_BUNDLE_ID_PH: 'GS_IOS_BUNDLE_ID_PH',
	GS_IOS_STORAGE_BUCKET_PH: 'GS_IOS_STORAGE_BUCKET_PH',
	GS_IOS_APP_ID_PH: '1:1:ios:1',
	GS_ANDROID_CLIENT_ID_PH: 'GS_ANDROID_CLIENT_ID_PH',
	GS_ANDROID_API_KEY_PH: 'GS_ANDROID_API_KEY_PH',
	GS_ANDROID_APP_ID_PH: '1:1:android:1',
	GS_ANDROID_BUNDLE_ID_PH: 'GS_ANDROID_BUNDLE_ID_PH',
}

if (REPLACEMENT_ENV === 'prod' || REPLACEMENT_ENV === 'qa') {
	// AppSettings.js
	makeReplacements(APP_SETTINGS_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.APP_NAME, qaVal: myEnv.APP_NAME, phVal: PH.APP_NAME_PH },
		{ prodVal: myEnv.GOOGLE_ANALYTICS_ID_PROD, qaVal: myEnv.GOOGLE_ANALYTICS_ID_QA, phVal: PH.GOOGLE_ANALYTICS_ID_PH },
	])

	// ssoService.js
	makeReplacements(SSO_SERVICE_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.AUTH_SERVICE_API_KEY_PROD, qaVal: myEnv.AUTH_SERVICE_API_KEY_QA, phVal: PH.AUTH_SERVICE_API_KEY_PH },
	])

	// Info.plist
	makeReplacements(IOS_INFO_PLIST_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.APP_NAME, qaVal: myEnv.APP_NAME, phVal: PH.APP_NAME_PH },
		{ prodVal: myEnv.BUGSNAG_KEY, qaVal: myEnv.BUGSNAG_KEY, phVal: PH.BUGSNAG_KEY_PH }
	])

	// strings.xml
	makeReplacements(ANDROID_STRINGS_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.APP_NAME, qaVal: myEnv.APP_NAME, phVal: PH.APP_NAME_PH },
	])

	// AndroidManifest.xml
	makeReplacements(ANDROID_MANIFEST_PATH, REPLACEMENT_ENV, [
		{ prodVal: myEnv.GOOGLE_MAPS_API_KEY, qaVal: myEnv.GOOGLE_MAPS_API_KEY, phVal: PH.GOOGLE_MAPS_API_KEY_PH },
		{ prodVal: myEnv.BUGSNAG_KEY, qaVal: myEnv.BUGSNAG_KEY, phVal: PH.BUGSNAG_KEY_PH }
{'fraction_non_alphanumeric': 0.12227860533638893, 'fraction_numerical': 0.002128007857259781, 'mean_word_length': 6.580645161290323, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7211709', 'n_tokens_mistral': 2838, 'n_tokens_neox': 2823, 'n_words': 333}