From 8002e3f0d7a179f9aa7c4d50b252215396bb5776 Mon Sep 17 00:00:00 2001 From: Joey Cozza Date: Fri, 12 Jul 2019 11:18:51 -0600 Subject: [PATCH 1/4] a "publish" script to force push the "built" react app to the fs-webdev/fresh-cra-template repo --- .travis.yml | 19 +++--- freshCraTemplateBlueprint.yml | 66 +++++++++++++++++++++ freshCraTemplateUpdate.sh | 7 +++ packages/react-scripts/template/.travis.yml | 2 +- 4 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 freshCraTemplateBlueprint.yml create mode 100755 freshCraTemplateUpdate.sh diff --git a/.travis.yml b/.travis.yml index d77ebc8689..d8ae706872 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - 10 + - "10" before_install: - echo -e "machine github.com\n login $CI_USER_TOKEN" > ~/.netrc - echo "//code.lds.org/artifactory/api/npm/npm-fhd/:_authToken=${NPM_PUBLISH_TOKEN}" >> ~/.npmrc @@ -25,12 +25,17 @@ script: - cd ${TRAVIS_BUILD_DIR} before_deploy: "cd packages/react-scripts" deploy: - provider: npm - skip_cleanup: true - email: "dl-fh-eng-frontier@groups.ldschurch.org" - api_key: "$NPM_PUBLISH_TOKEN" - on: - branch: frontierMaster + - provider: npm + skip_cleanup: true + email: "dl-fh-eng-frontier@groups.ldschurch.org" + api_key: "$NPM_PUBLISH_TOKEN" + on: + branch: frontierMaster + - provider: script + skip_cleanup: true + script: cd ${TRAVIS_BUILD_DIR} && ./freshCraTemplateUpdate.sh + on: + branch: frontierMaster # This tells travis to not build when the branch is master. This is important to have on our master # branch as well because anytime we merge upstream changes from facebook, travis builds their whole matrix of 24 different builds. # We do NOT need or want that to occur. Please leave this branches.except here, even on the master branch diff --git a/freshCraTemplateBlueprint.yml b/freshCraTemplateBlueprint.yml new file mode 100644 index 0000000000..ce2a9dfbd7 --- /dev/null +++ b/freshCraTemplateBlueprint.yml @@ -0,0 +1,66 @@ +version: 1.0 +name: frontier-fresh-cra-template + +build: + - type: "Npm-Heroku v1_0" + heroku_stack: heroku-18 + name: npm-build + full_npm_install: true + test_location: local + +deploy: + int: + cra-template: &APP_DEFAULTS + type: "Heroku v1_0" + location: development-fh5-useast1-heroku + binding_sets: + fresh-template.frontier: + - type: "Service v1_0" + sites: + - integ + bindings: &BINDING_DEFAULTS + heroku: + type: "Alias v1_0" + aliases: + - www + non_ssl_action: + type: redirect_to_https + append_slash: true + beta: + cra-template: + <<: *APP_DEFAULTS + type: "Heroku v1_0" + location: test-fh3-useast1-heroku + binding_sets: + fresh-template.frontier: + - type: "Service v1_0" + sites: + - beta + bindings: + <<: *BINDING_DEFAULTS + prod: + cra-template: + <<: *APP_DEFAULTS + type: "Heroku v1_0" + location: production-fh1-useast1-heroku + binding_sets: + fresh-template.frontier: + - type: "Service v1_0" + sites: + - prod + bindings: + <<: *BINDING_DEFAULTS + +deliver: + deploy_order: + - name: integration + type: coupled + systems: int + +# - name: beta +# type: coupled +# systems: beta + +# - name: production +# type: coupled +# systems: prod \ No newline at end of file diff --git a/freshCraTemplateUpdate.sh b/freshCraTemplateUpdate.sh new file mode 100755 index 0000000000..da51858d0f --- /dev/null +++ b/freshCraTemplateUpdate.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +cd ${HOME}/tmp/my-test-app +cp ${TRAVIS_BUILD_DIR}/freshCraTemplateBlueprint.yml ${HOME}/tmp/my-test-app/blueprint.yml +git commit -a -m 'putting correct blueprint.yml file in place' +git remote add origin https://github.com/fs-webdev/fresh-cra-template.git +git push --force origin master diff --git a/packages/react-scripts/template/.travis.yml b/packages/react-scripts/template/.travis.yml index 16e9793b77..17fb5f4799 100644 --- a/packages/react-scripts/template/.travis.yml +++ b/packages/react-scripts/template/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - 10 + - '10' before_install: - echo -e "machine github.com\n login $CI_USER_TOKEN" > ~/.netrc - echo "//code.lds.org/artifactory/api/npm/npm-fhd/:_authToken=${NPM_TOKEN}" >> ~/.npmrc From 46b77d38348132225b3a001fca6a8fbbc8f2c81d Mon Sep 17 00:00:00 2001 From: Joey Cozza Date: Fri, 12 Jul 2019 11:53:32 -0600 Subject: [PATCH 2/4] modifying the blueprint instead of totally replacing it --- .travis.yml | 4 +-- freshCraTemplateBlueprint.yml | 66 ----------------------------------- freshCraTemplateUpdate.sh | 8 ++++- 3 files changed, 9 insertions(+), 69 deletions(-) delete mode 100644 freshCraTemplateBlueprint.yml diff --git a/.travis.yml b/.travis.yml index d8ae706872..7b5f17f8b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,8 @@ script: - npm test # test that a new app can be created with these scripts - mkdir -p ${HOME}/tmp && cd ${HOME}/tmp - - npx create-react-app my-test-app --use-npm --scripts-version file:${TRAVIS_BUILD_DIR}/packages/react-scripts/ - - cd my-test-app + - npx create-react-app fresh-cra-template --use-npm --scripts-version file:${TRAVIS_BUILD_DIR}/packages/react-scripts/ + - cd fresh-cra-template - CI=true npm test - npm run build - cd ${TRAVIS_BUILD_DIR} diff --git a/freshCraTemplateBlueprint.yml b/freshCraTemplateBlueprint.yml deleted file mode 100644 index ce2a9dfbd7..0000000000 --- a/freshCraTemplateBlueprint.yml +++ /dev/null @@ -1,66 +0,0 @@ -version: 1.0 -name: frontier-fresh-cra-template - -build: - - type: "Npm-Heroku v1_0" - heroku_stack: heroku-18 - name: npm-build - full_npm_install: true - test_location: local - -deploy: - int: - cra-template: &APP_DEFAULTS - type: "Heroku v1_0" - location: development-fh5-useast1-heroku - binding_sets: - fresh-template.frontier: - - type: "Service v1_0" - sites: - - integ - bindings: &BINDING_DEFAULTS - heroku: - type: "Alias v1_0" - aliases: - - www - non_ssl_action: - type: redirect_to_https - append_slash: true - beta: - cra-template: - <<: *APP_DEFAULTS - type: "Heroku v1_0" - location: test-fh3-useast1-heroku - binding_sets: - fresh-template.frontier: - - type: "Service v1_0" - sites: - - beta - bindings: - <<: *BINDING_DEFAULTS - prod: - cra-template: - <<: *APP_DEFAULTS - type: "Heroku v1_0" - location: production-fh1-useast1-heroku - binding_sets: - fresh-template.frontier: - - type: "Service v1_0" - sites: - - prod - bindings: - <<: *BINDING_DEFAULTS - -deliver: - deploy_order: - - name: integration - type: coupled - systems: int - -# - name: beta -# type: coupled -# systems: beta - -# - name: production -# type: coupled -# systems: prod \ No newline at end of file diff --git a/freshCraTemplateUpdate.sh b/freshCraTemplateUpdate.sh index da51858d0f..1d7c2b805b 100755 --- a/freshCraTemplateUpdate.sh +++ b/freshCraTemplateUpdate.sh @@ -1,7 +1,13 @@ #! /bin/bash cd ${HOME}/tmp/my-test-app -cp ${TRAVIS_BUILD_DIR}/freshCraTemplateBlueprint.yml ${HOME}/tmp/my-test-app/blueprint.yml +# https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/ +sed -i.bak 's/{{BINDING_PATH}}/fresh-cra-template.frontier/' blueprint.yml +# https://stackoverflow.com/questions/5410757/delete-lines-in-a-text-file-that-contain-a-specific-string +sed -i.bak '/Replace/d' blueprint.yml +sed -i.bak '/See/d' blueprint.yml +sed -i.bak 's/#//' blueprint.yml +rm blueprint.yml.bak git commit -a -m 'putting correct blueprint.yml file in place' git remote add origin https://github.com/fs-webdev/fresh-cra-template.git git push --force origin master From 8f1f53adfa062adcc965248ae28eda0990cbdd62 Mon Sep 17 00:00:00 2001 From: Joey Cozza Date: Fri, 12 Jul 2019 11:56:45 -0600 Subject: [PATCH 3/4] adding note about order of sed commands --- freshCraTemplateUpdate.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freshCraTemplateUpdate.sh b/freshCraTemplateUpdate.sh index 1d7c2b805b..f6842a6420 100755 --- a/freshCraTemplateUpdate.sh +++ b/freshCraTemplateUpdate.sh @@ -1,7 +1,8 @@ #! /bin/bash cd ${HOME}/tmp/my-test-app -# https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/ +# The order of these sed commands is kind of important. The last one of uncommenting all lines needs to occur after +# removing comments explaining in english steps for replacing the binding path sed -i.bak 's/{{BINDING_PATH}}/fresh-cra-template.frontier/' blueprint.yml # https://stackoverflow.com/questions/5410757/delete-lines-in-a-text-file-that-contain-a-specific-string sed -i.bak '/Replace/d' blueprint.yml From ce0b307a6f85f304826752c86da3dd9edb651127 Mon Sep 17 00:00:00 2001 From: Joey Cozza Date: Fri, 12 Jul 2019 13:59:56 -0600 Subject: [PATCH 4/4] double quotes in yaml --- packages/react-scripts/template/.travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/template/.travis.yml b/packages/react-scripts/template/.travis.yml index 17fb5f4799..e41f7b56df 100644 --- a/packages/react-scripts/template/.travis.yml +++ b/packages/react-scripts/template/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - '10' + - "10" before_install: - echo -e "machine github.com\n login $CI_USER_TOKEN" > ~/.netrc - echo "//code.lds.org/artifactory/api/npm/npm-fhd/:_authToken=${NPM_TOKEN}" >> ~/.npmrc