Skip to content

Commit

Permalink
feat: create script to do a deep merge of secrets.json and the main a…
Browse files Browse the repository at this point in the history
…pp.json
  • Loading branch information
hopetambala committed Jan 9, 2021
1 parent 5f3e4c7 commit ef43b11
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ web-build/
# macOS
.DS_Store*
.env*
environment.js
environment.js
scripts/dynamic-env/app.secrets.json
6 changes: 0 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ All notable changes to this project will be documented in this file. See [standa

## [10.3.0](https://github.com/hopetambala/puente-reactnative-collect/compare/v10.1.4...v10.3.0) (2021-01-09)

## [10.2.0](https://github.com/hopetambala/puente-reactnative-collect/compare/v10.1.4...v10.2.0) (2021-01-09)

### [10.1.4](https://github.com/hopetambala/puente-reactnative-collect/compare/v10.1.3...v10.1.4) (2021-01-09)

## [10.1.0](https://github.com/hopetambala/puente-reactnative-collect/compare/v10.0.0...v10.1.0) (2021-01-09)


### New Features

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
"testDebug": "jest -o --watch --coverage=false",
"lint": "./node_modules/.bin/eslint '**/*.{js,jsx}' --quiet",
"lint-fix": "./node_modules/.bin/eslint '**/*.{js,jsx}' --fix",
"publish-staging": "expo build:ios --release-channel staging && expo build:android --release-channel staging",
"publish-prod": "expo build:ios --release-channel prod && expo build:android --release-channel prod",
"upload": "expo upload:ios --latest && expo upload:android --latest",
"prepublish": "node scripts/dynamic-env/generate-env-app-json.js > app.generated.json",
"publish-staging": "npm run prepublish && expo build:ios --config app.generated.json --release-channel staging && expo build:android --config app.generated.json --release-channel staging",
"publish-prod": "npm run prepublish && expo build:ios --config app.generated.json --release-channel prod && expo build:android --config app.generated.json --release-channel prod",
"upload": "expo upload:ios --config app.generated.json --latest && expo upload:android --config app.generated.json --latest && rm -rf app.generated.json",
"gh-prune": "git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done",
"release-patch": "npx standard-version --release-as patch",
"release-minor": "npx standard-version --release-as minor",
Expand Down Expand Up @@ -93,4 +94,4 @@
"standard-version-expo": "1.0.3"
},
"private": true
}
}
15 changes: 15 additions & 0 deletions scripts/dynamic-env/app.secrets-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"expo": {
"ios": {
"bundleIdentifier": "SECRET_BUNDLE_IDENTIFIER"
},
"android": {
"package": "PACKAGE_NAME",
"config": {
"googleMaps": {
"apiKey": "YOUR_GOOGLE_API_KEY"
}
}
}
}
}
5 changes: 5 additions & 0 deletions scripts/dynamic-env/generate-env-app-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const merge = require("deepmerge")
const baseAppJson = require("../../app.json")
const override = require("./app.secrets.json")
const merged = merge.all([baseAppJson, override])
console.log(JSON.stringify(merged, null, 2))

0 comments on commit ef43b11

Please sign in to comment.