From 58c390127a8662f4a0f6d2c4981ac81d3e0f4dd6 Mon Sep 17 00:00:00 2001 From: Mikko Koski Date: Mon, 2 Aug 2021 16:12:38 +0300 Subject: [PATCH 1/4] Override hosting instructions with FTW specific Hosting FTW with static server doesn't seem to work anymore. This is probably due to code splitting. Override the default instructions with FTW specific instructions. --- packages/react-scripts/scripts/build.js | 31 ++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index de2ff505eb3..6fee80884f4 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/scripts/build.js @@ -40,7 +40,36 @@ const configFactory = require('../config/webpack.config'); const paths = require('../config/paths'); const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); -const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); + +// +// Override the default hosting instructions with FTW specific instructions. +// +// const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); +// +function printHostingInstructions( + appPackage, + publicUrl, + publicPath, + buildFolder, + useYarn +) { + console.log(); + console.log(`The ${chalk.cyan(buildFolder)} folder is ready to be deployed.`); + console.log(); + console.log('You may serve it by running:'); + console.log(); + console.log(` ${chalk.cyan('yarn')} start`); + console.log(); + console.log('Find out more about deployment here:'); + console.log(); + console.log( + ` ${chalk.yellow( + 'https://www.sharetribe.com/docs/ftw-hosting/how-to-deploy-ftw-to-production/' + )}` + ); + console.log(); +} + const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); const printBuildError = require('react-dev-utils/printBuildError'); From 21b787baa5c779da11596e0fa458e1ccbeb28ead Mon Sep 17 00:00:00 2001 From: Mikko Koski Date: Tue, 3 Aug 2021 09:00:24 +0300 Subject: [PATCH 2/4] Add "Sharetribe custom:" Co-authored-by: Vesa Luusua --- packages/react-scripts/scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index 6fee80884f4..0bfba993975 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/scripts/build.js @@ -42,7 +42,7 @@ const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); // -// Override the default hosting instructions with FTW specific instructions. +// Sharetribe custom: override the default hosting instructions with FTW specific instructions. // // const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); // From fb00729c4df1af0268f30d7d026256a2542c96bc Mon Sep 17 00:00:00 2001 From: Mikko Koski Date: Tue, 3 Aug 2021 14:57:58 +0300 Subject: [PATCH 3/4] Improve the message a bit --- packages/react-scripts/scripts/build.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index 0bfba993975..0261f49c5e4 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/scripts/build.js @@ -56,11 +56,25 @@ function printHostingInstructions( console.log(); console.log(`The ${chalk.cyan(buildFolder)} folder is ready to be deployed.`); console.log(); - console.log('You may serve it by running:'); + console.log( + 'In local development machine you may serve it on production mode by running:' + ); + console.log(); + console.log(` NODE_ENV=production PORT=3000 ${chalk.cyan('yarn')} start`); + console.log(); + console.log( + 'In production server (e.g. Heroku) we recommend you to set the environment' + ); + console.log( + `variables ${chalk.cyan('NODE_ENV')} and ${chalk.cyan( + 'PORT' + )} using provider\'s own mechanism to manage` + ); + console.log('environment variables, and then start the app by running:'); console.log(); console.log(` ${chalk.cyan('yarn')} start`); console.log(); - console.log('Find out more about deployment here:'); + console.log('Find out more about environment variables and deployment here:'); console.log(); console.log( ` ${chalk.yellow( From dd207af73e21f6c70cd0eff4a3678545a54cd0c3 Mon Sep 17 00:00:00 2001 From: Mikko Koski Date: Tue, 3 Aug 2021 15:05:20 +0300 Subject: [PATCH 4/4] Version 5.0.1 --- packages/react-scripts/README.md | 1 + packages/react-scripts/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/README.md b/packages/react-scripts/README.md index fcac0315648..0aaf88986b5 100644 --- a/packages/react-scripts/README.md +++ b/packages/react-scripts/README.md @@ -23,6 +23,7 @@ which version of `react-scripts` this fork is built from. - Use [postcss-import](https://github.com/postcss/postcss-import) - Use [postcss-apply](https://github.com/pascalduez/postcss-apply) - A separate `build-server` script that makes a build to use in SSR (server side rendering) +- Show customized instructions how to run the production build bundle ## Development diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 54ce5de0f8f..a2c11f68526 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,6 +1,6 @@ { "name": "sharetribe-scripts", - "version": "5.0.0", + "version": "5.0.1", "description": "Fork of facebookincubator/create-react-app@4.0.0 with some additional features.", "repository": { "type": "git",