From 0f72be8fb0e426c7edf34cf95e3b72f0662ada90 Mon Sep 17 00:00:00 2001 From: Jan Poeschko Date: Tue, 11 Sep 2018 03:02:54 +0200 Subject: [PATCH 1/3] Add a checkbox to fixtures UI to choose React production build --- fixtures/dom/.gitignore | 3 +++ fixtures/dom/package.json | 2 +- fixtures/dom/src/components/Header.js | 20 ++++++++++++++- fixtures/dom/src/react-loader.js | 36 +++++++++++++++++++-------- fixtures/dom/src/style.css | 5 ++++ 5 files changed, 54 insertions(+), 12 deletions(-) diff --git a/fixtures/dom/.gitignore b/fixtures/dom/.gitignore index bffad9e24b6de..9f05c1cc2b73d 100644 --- a/fixtures/dom/.gitignore +++ b/fixtures/dom/.gitignore @@ -9,8 +9,11 @@ coverage # production build public/react.development.js +public/react.production.min.js public/react-dom.development.js +public/react-dom.production.min.js public/react-dom-server.browser.development.js +public/react-dom-server.browser.production.min.js # misc .DS_Store diff --git a/fixtures/dom/package.json b/fixtures/dom/package.json index 0f2959684a65b..90cb22479c124 100644 --- a/fixtures/dom/package.json +++ b/fixtures/dom/package.json @@ -18,7 +18,7 @@ }, "scripts": { "start": "react-scripts start", - "prestart": "cp ../../build/dist/react.development.js ../../build/dist/react-dom.development.js ../../build/dist/react-dom-server.browser.development.js public/", + "prestart": "cp ../../build/dist/react.development.js ../../build/dist/react-dom.development.js ../../build/dist/react.production.min.js ../../build/dist/react-dom.production.min.js ../../build/dist/react-dom-server.browser.development.js ../../build/dist/react-dom-server.browser.production.min.js public/", "build": "react-scripts build && cp build/index.html build/200.html", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" diff --git a/fixtures/dom/src/components/Header.js b/fixtures/dom/src/components/Header.js index 9671d2c1d9af7..8276900bc0807 100644 --- a/fixtures/dom/src/components/Header.js +++ b/fixtures/dom/src/components/Header.js @@ -7,8 +7,9 @@ class Header extends React.Component { super(props, context); const query = parse(window.location.search); const version = query.version || 'local'; + const production = query.production || false; const versions = [version]; - this.state = {version, versions}; + this.state = {version, versions, production}; } componentWillMount() { getVersionTags().then(tags => { @@ -25,6 +26,14 @@ class Header extends React.Component { } window.location.search = stringify(query); } + handleProductionChange(event) { + const query = parse(window.location.search); + query.production = event.target.checked; + if (!query.production) { + delete query.production; + } + window.location.search = stringify(query); + } handleFixtureChange(event) { window.location.pathname = event.target.value; } @@ -43,6 +52,15 @@ class Header extends React.Component {
+ +