diff --git a/packages/react-scripts/scripts/utils/frontierInit.js b/packages/react-scripts/scripts/utils/frontierInit.js index 29da677b116..52a2fb3e905 100644 --- a/packages/react-scripts/scripts/utils/frontierInit.js +++ b/packages/react-scripts/scripts/utils/frontierInit.js @@ -27,8 +27,8 @@ async function promptForConfig() { value: 'polymer', }, { - name: `Redux (Chances are high you don't need this yet)`, - value: 'redux', + name: `Configure app for Electric Flow`, + value: 'electric-flow', }, ], }, @@ -48,6 +48,9 @@ function installFrontierDependencies(appPath, answers, useYarn, ownPath) { if (additionalFeatures.includes('redux')) { configureRedux(appPath, useYarn, ownPath); } + if (additionalFeatures.includes('electric-flow')) { + configureEF(appPath, useYarn, ownPath); + } injectPolymerCode(appPath); const defaultModules = [ @@ -56,7 +59,10 @@ function installFrontierDependencies(appPath, answers, useYarn, ownPath) { 'fs-webdev/exo', ]; - const defaultDevModules = ['react-styleguidist@9.0.0-beta4', 'webpack@4.19.1']; + const defaultDevModules = [ + 'react-styleguidist@9.0.0-beta4', + 'webpack@4.19.1', + ]; installModulesSync(defaultModules, useYarn); installModulesSync(defaultDevModules, useYarn, true); @@ -144,6 +150,14 @@ function configureRedux(appPath, useYarn, ownPath) { fs.copySync(templatePath, appPath, { overwrite: true }); } +function configureEF(appPath, useYarn, ownPath) { + // TODO - modify package.json to make sure name is correct for blueprint + // TODO - use blueprint.yml as a template + + const templatePath = path.join(ownPath, 'template-ef'); + fs.copySync(templatePath, appPath, { overwrite: true }); +} + function cleanupFrontierCode(appPath) {} function installModulesSync(modules, useYarn, saveDev = false) { diff --git a/packages/react-scripts/template-ef/.buildpacks b/packages/react-scripts/template-ef/.buildpacks new file mode 100644 index 00000000000..96d0a9ddcec --- /dev/null +++ b/packages/react-scripts/template-ef/.buildpacks @@ -0,0 +1 @@ +https://github.com/heroku/heroku-buildpack-nodejs.git diff --git a/packages/react-scripts/template-ef/Procfile b/packages/react-scripts/template-ef/Procfile new file mode 100644 index 00000000000..08ee8b7485d --- /dev/null +++ b/packages/react-scripts/template-ef/Procfile @@ -0,0 +1 @@ +web: node src/server.js \ No newline at end of file diff --git a/packages/react-scripts/template-ef/blueprint.yml b/packages/react-scripts/template-ef/blueprint.yml new file mode 100644 index 00000000000..21a6946ea53 --- /dev/null +++ b/packages/react-scripts/template-ef/blueprint.yml @@ -0,0 +1,55 @@ +version: 1.0 +name: frontier-{{APP_NAME}} + +build: + - type: "Npm-Heroku v1_0" + heroku_stack: heroku-18 + name: npm-build + +deploy: + int: + {{APP_NAME}}: &APP_DEFAULTS + type: "Heroku v1_0" + location: development-fh5-useast1-heroku + binding_sets: + {{BINDING_PATH}}: + - 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: + {{APP_NAME}}: + <<: *APP_DEFAULTS + type: "Heroku v1_0" + location: test-fh3-useast1-heroku + binding_sets: + {{BINDING_PATH}}: + - type: "Service v1_0" + sites: + - beta + bindings: + <<: *BINDING_DEFAULTS + prod: + {{APP_NAME}}: + <<: *APP_DEFAULTS + type: "Heroku v1_0" + location: production-fh1-useast1-heroku + binding_sets: + {{BINDING_PATH}}: + - type: "Service v1_0" + sites: + - prod + bindings: + <<: *BINDING_DEFAULTS +deliver: + deploy_order: + - int + - beta + - prod diff --git a/packages/react-scripts/template-ef/hooks/pre-build/npm-build/create-npmrc.sh b/packages/react-scripts/template-ef/hooks/pre-build/npm-build/create-npmrc.sh new file mode 100644 index 00000000000..9f09b759324 --- /dev/null +++ b/packages/react-scripts/template-ef/hooks/pre-build/npm-build/create-npmrc.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Get artifactory token from SAS +ICS_AF_TOKEN=$(ec-sas-client frontier-hub-ics-public-artifactory-db -b fchPassword) + +# Write .npmrc +echo "//code.lds.org/artifactory/api/npm/npm-fhd/:_authToken=${ICS_AF_TOKEN}" > .npmrc +echo "@fs:registry=https://code.lds.org/artifactory/api/npm/npm-fhd/" >> .npmrc \ No newline at end of file diff --git a/packages/react-scripts/template-ef/src/server.js b/packages/react-scripts/template-ef/src/server.js new file mode 100644 index 00000000000..720cecd0be9 --- /dev/null +++ b/packages/react-scripts/template-ef/src/server.js @@ -0,0 +1,11 @@ +const path = require('path'); +const express = require('express'); +const app = express(); + +// Statically serve up the production built React App +app.use(express.static(`${__dirname}/build`)); + +const port = process.env.PORT || 3000; +app.listen(port, () => { + console.log(`Listening on port ${port}`); +});