From 733617c743e97c7fa434e741806c00e0e370f499 Mon Sep 17 00:00:00 2001 From: Carlos Kelly Date: Mon, 13 Jan 2020 18:34:58 -0600 Subject: [PATCH 1/5] Upgrade React Live to v2 (#800) * Upgrade React Live to v2 * Fix Code Pane test --- package.json | 2 +- .../__snapshots__/code-pane.test.js.snap | 121 +- .../component-playground.test.js.snap | 4446 +++++++++++------ src/components/code-pane.test.js | 6 +- src/components/component-playground.js | 14 +- yarn.lock | 113 +- 6 files changed, 3019 insertions(+), 1683 deletions(-) diff --git a/package.json b/package.json index 058c7772d..483c781c3 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "normalize.css": "^8.0.1", "prismjs": "^1.17.1", "react-emotion": "^8.0.8", - "react-live": "^1.6", + "react-live": "^2.2.2", "react-redux": "^5.1.1", "react-transition-group": "1.2.1", "react-typography": "^0.16.18", diff --git a/src/components/__snapshots__/code-pane.test.js.snap b/src/components/__snapshots__/code-pane.test.js.snap index a2867b204..6d4e3dc9a 100644 --- a/src/components/__snapshots__/code-pane.test.js.snap +++ b/src/components/__snapshots__/code-pane.test.js.snap @@ -1,38 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` should render correctly. 1`] = ` - - -
- - - -
const myButton = (
-        <CustomButton
-          style={{ background: '#f00' }}
-          onClick={this.action}
-        >
-         Click Me
-        </CustomButton>
-      );
-    ",
-                }
-              }
-              spellCheck="false"
-            />
-          
-        
-      
-    
-
-
+ contentEditable={false} + language="jsx" + onClick={[Function]} + onKeyDown={[Function]} + onKeyUp={[Function]} + prismTheme="dark;" + syntaxStyles={Object {}} + /> + `; diff --git a/src/components/__snapshots__/component-playground.test.js.snap b/src/components/__snapshots__/component-playground.test.js.snap index a3c7cf3c4..87ffab0c0 100644 --- a/src/components/__snapshots__/component-playground.test.js.snap +++ b/src/components/__snapshots__/component-playground.test.js.snap @@ -1,9 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` Should render the dark theme correctly 1`] = ` -
+Array [
@@ -30,7 +28,7 @@ exports[` Should render the dark theme correctly 1`] = `
-
+ ,
@@ -38,7 +36,7 @@ exports[` Should render the dark theme correctly 1`] = ` class="css-1fc71w4 e177gi4f5" >

Should render the dark theme correctly 1`] = `
-
-        
           /**
  * Sample React Component
  * Output domContainerNode is 'mountNode'
  */
-        
-        
-
-
-        
-          const
-        
-         styles 
-        
-          =
-        
-         
-        
-          {
-        
-        
-  heading
-        
-          :
-        
-         
-        
-          {
-        
-        
-    fontSize
-        
-          :
-        
-         
-        
-          "2.25rem"
-        
-        
-          ,
-        
-        
-    fontWeight
-        
-          :
-        
-         
-        
-          "bold"
-        
-        
-  
-        
-          }
-        
-        
-          ,
-        
-        
-  copy
-        
-          :
-        
-         
-        
-          {
-        
-        
-    fontSize
-        
-          :
-        
-         
-        
-          "1.5rem"
-        
-        
-  
-        
-          }
-        
-        
 
-        
-          }
-        
-        
+const styles = {
+  heading: {
+    fontSize: "2.25rem",
+    fontWeight: "bold"
+  },
+  copy: {
+    fontSize: "1.5rem"
+  }
+}
 
+const HelloWorld = ({ name }) => (
+  <div>
+    <h1 style={styles.heading}>
+      Create Live Code Examples in {name}!
+    </h1>
+    <p style={styles.copy}>
+      Supports Light and Dark Syntax Themes
+    </p>
+  </div>
+)
 
-        
-          const
-        
-         HelloWorld 
-        
-          =
-        
-         
-        
-          (
-        
-        
-          {
-        
-         name 
-        
-          }
-        
-        
-          )
-        
-         
-        
-          =
-        
-        
-          >
-        
-         
-        
-          (
-        
-        
-  
-        
+        
-    
-

-
-`; - -exports[` Should render the light theme correctly 1`] = ` -
-
-
- Live Preview -
-
- Source Code - -
-
-
-
-
-
-

- Create Live Code Examples in Spectacle! -

-

- Supports Light and Dark Syntax Themes -

-
-
-
-
-
-        
-          /**
- * Sample React Component
- * Output domContainerNode is 'mountNode'
- */
-        
-        
-
-
-        
-          const
-        
-         styles 
-        
-          =
-        
-         
-        
-          {
-        
-        
-  heading
-        
-          :
-        
-         
-        
-          {
-        
-        
-    fontSize
-        
-          :
-        
-         
-        
-          "2.25rem"
-        
-        
-          ,
-        
-        
-    fontWeight
-        
-          :
-        
-         
-        
-          "bold"
-        
-        
-  
-        
-          }
-        
-        
-          ,
-        
-        
-  copy
-        
-          :
-        
-         
-        
-          {
-        
-        
-    fontSize
-        
-          :
-        
-         
-        
-          "1.5rem"
-        
-        
-  
-        
-          }
-        
-        
-
-        
-          }
-        
-        
-
-
-        
-          const
-        
-         HelloWorld 
-        
-          =
-        
-         
-        
-          (
-        
-        
-          {
-        
-         name 
-        
-          }
-        
-        
-          )
-        
-         
-        
-          =
-        
-        
-          >
-        
-         
-        
-          (
-        
-        
-  
-        
-          
+              "bold"
+            
+            
+          
+
+ + + - < + } - div - - - > - - - - - - - < + , - h1 - - - - style - - +
+
- = + copy - { + : - styles - . + - heading - } + { - - - > - - - - Create Live Code Examples - - in - - - - { - - name - - } - - - ! - - - - - +
+
- </ + fontSize - h1 - - - > - - - - - - - < + : - p - - - - style - - - = + - { + "1.5rem" - styles +
+
+ - . + - copy } - - - > - - - - Supports Light and Dark Syntax Themes - - - +
+
+ - </ + } - p - - - > - - - - - - +
+
+ +
+
+ + + const + + + + + + HelloWorld + + + + + + = + + + + + + ( + + + { + + + name + + + } + + + ) + + + + + + => + + + + + + ( + + +
+
+ + + + + < + + + div + + + > + + +
+
+ + + + + < + + + h1 + + + + + + style + + + = + + + { + + + styles + + + . + + + heading + + + } + + + > + + +
+
+ + Create Live Code Examples + + + in + + + + + + { + + + name + + + } + + + ! + + +
+
+ + + + + </ + + + h1 + + + > + + +
+
+ + + + + < + + + p + + + + + + style + + + = + + + { + + + styles + + + . + + + copy + + + } + + + > + + +
+
+ + Supports Light and Dark Syntax Themes + +
+
+ + + + + </ + + + p + + + > + + +
+
+ + + + + </ + + + div + + + > + + +
+
+ + + ) + + +
+
+ +
+
+ + + render + + + ( + + + < + + + HelloWorld + + + + + + name + + + = + + + " + + + Spectacle + + + " + + + + + + /> + + + ) + +
+ +
+
+
, +] +`; + +exports[` Should render the light theme correctly 1`] = ` +Array [ +
+
+ Live Preview +
+
+ Source Code + +
+
, +
+
+
+
+

+ Create Live Code Examples in Spectacle! +

+

+ Supports Light and Dark Syntax Themes +

+
+
+
+
+
+ + +
+
+
, +] +`; + +exports[` Should render with a custom background color 1`] = ` +Array [ +
+
+ Live Preview +
+
+ Source Code + +
+
, +
+
+
+
+

+ Create Live Code Examples in Spectacle! +

+

+ Supports Light and Dark Syntax Themes +

+
+
+
+
+
+ + -
-
-
-`; - -exports[` Should render with a custom background color 1`] = ` -
-
-
- Live Preview -
-
- Source Code - -
-
-
-
-
-
-

- Create Live Code Examples in Spectacle! -

-

+ ! + + +

+
- Supports Light and Dark Syntax Themes -

-
-
-
-
-
-        
-          /**
- * Sample React Component
- * Output domContainerNode is 'mountNode'
- */
-        
-        
-
-
-        
-          const
-        
-         styles 
-        
-          =
-        
-         
-        
-          {
-        
-        
-  heading
-        
-          :
-        
-         
-        
-          {
-        
-        
-    fontSize
-        
-          :
-        
-         
-        
-          "2.25rem"
-        
-        
-          ,
-        
-        
-    fontWeight
-        
-          :
-        
-         
-        
-          "bold"
-        
-        
-  
-        
-          }
-        
-        
-          ,
-        
-        
-  copy
-        
-          :
-        
-         
-        
-          {
-        
-        
-    fontSize
-        
-          :
-        
-         
-        
-          "1.5rem"
-        
-        
-  
-        
-          }
-        
-        
-
-        
-          }
-        
-        
-
-
-        
-          const
-        
-         HelloWorld 
-        
-          =
-        
-         
-        
-          (
-        
-        
-          {
-        
-         name 
-        
-          }
-        
-        
-          )
-        
-         
-        
-          =
-        
-        
-          >
-        
-         
-        
-          (
-        
-        
-  
-        
-          
+                  
+            
+            
+              </
+            
+            
+              h1
+            
+            
+              >
+            
+            
+          
+
+ + + < - div - - - > - - - - - - + p + + + + + + style + + + = + + + { + + + styles + + + . + + + copy + + + } + + + > + + +
+
+ + Supports Light and Dark Syntax Themes + +
+
+ + + + </ + + + p + + - < + > - h1 - - - - style - - +
+
- = + - { + </ - styles - . + div - heading - } + > - - - > - - - - Create Live Code Examples - - in - - - - { - - name - - } - - - ! - - - - - +
+
+ - </ + ) - h1 - - - > - - - - - - +
+
+
+
+ + - < + render - p - - - - style - - - = + ( - { + < - styles - . + HelloWorld - copy - } + - - - > - - - - Supports Light and Dark Syntax Themes - - - - </ + name - p - - - > - - - - - - - </ + = - div - - - > - - - - - - ) - - - - - - render - - - ( - - - - < + " - HelloWorld - - - - name - - - = + Spectacle " - Spectacle + + + + + /> + - " + ) - - - - /> - - - - ) - - +
+ +
- - + , +] `; exports[` Should render with a custom code block 1`] = ` -
+Array [
@@ -1626,7 +2944,7 @@ exports[` Should render with a custom code block 1`] = `
-
+ ,
@@ -1634,234 +2952,336 @@ exports[` Should render with a custom code block 1`] = ` class="css-1fc71w4 e177gi4f5" >
-
ReferenceError: mountNode is not defined -
+
-
-        
-          const
-        
-         Button 
-        
-          =
-        
-         
-        
-          (
-        
-        
-          {
-        
-         title 
-        
-          }
-        
-        
-          )
-        
-         
-        
-          =
-        
-        
-          >
-        
-         
-        
-          (
-        
-        
-          
+          const Button = ({ title }) => (<button type="button">{ title }</button>);
+      render(<Button title="My Button" />, mountNode);
+        
+        
+            
+              My Button
+            
+            
+              "
+            
+            
+               
+            
+            
+              />
+            
+            
+              ,
+            
+            
+               mountNode
+            
+            
+              )
+            
+            
+              ;
+            
+          
+ +
- - + , +] `; diff --git a/src/components/code-pane.test.js b/src/components/code-pane.test.js index e0243b966..d95ee68c6 100644 --- a/src/components/code-pane.test.js +++ b/src/components/code-pane.test.js @@ -1,5 +1,5 @@ import React from 'react'; -import { mount } from 'enzyme'; +import { shallow } from 'enzyme'; import CodePane from './code-pane'; describe('', () => { @@ -20,7 +20,9 @@ describe('', () => { ); `; - const wrapper = mount(, { context }); + const wrapper = shallow(, { + context + }); expect(wrapper).toMatchSnapshot(); }); }); diff --git a/src/components/component-playground.js b/src/components/component-playground.js index 97cc331c8..80a4bfebb 100644 --- a/src/components/component-playground.js +++ b/src/components/component-playground.js @@ -156,13 +156,23 @@ class ComponentPlayground extends Component { static getDerivedStateFromProps(nextProps, prevState) { const updatedState = {}; - if (nextProps.code !== prevState.code) { + if ( + typeof nextProps.code !== 'undefined' && + nextProps.code !== prevState.code + ) { const code = (nextProps.code || defaultCode).trim(); updatedState.code = code; + } else { + updatedState.code = prevState.code; } - if (nextProps.scope !== prevState.scope) { + if ( + typeof nextProps.scope !== 'undefined' && + nextProps.scope !== prevState.scope + ) { const scope = getEnhancedScope(nextProps.scope); updatedState.scope = scope; + } else { + updatedState.scope = prevState.scope; } return isEmpty(updatedState) ? null : updatedState; } diff --git a/yarn.lock b/yarn.lock index 9489ef20d..08613f116 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1016,11 +1016,6 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" -acorn-dynamic-import@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" - integrity sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw== - acorn-globals@^4.1.0: version "4.3.4" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" @@ -1036,11 +1031,6 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" -acorn-jsx@^5.0.1: - version "5.0.2" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f" - integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw== - acorn-walk@^6.0.1: version "6.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" @@ -1056,7 +1046,7 @@ acorn@^5.5.0, acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.1, acorn@^6.1.1, acorn@^6.2.1: +acorn@^6.0.1, acorn@^6.2.1: version "6.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== @@ -1806,19 +1796,17 @@ bser@^2.0.0: dependencies: node-int64 "^0.4.0" -buble@^0.19.3: - version "0.19.8" - resolved "https://registry.yarnpkg.com/buble/-/buble-0.19.8.tgz#d642f0081afab66dccd897d7b6360d94030b9d3d" - integrity sha512-IoGZzrUTY5fKXVkgGHw3QeXFMUNBFv+9l8a4QJKG1JhG3nCMHTdEX1DCOg8568E2Q9qvAQIiSokv6Jsgx8p2cA== +buble@0.19.6: + version "0.19.6" + resolved "https://registry.yarnpkg.com/buble/-/buble-0.19.6.tgz#915909b6bd5b11ee03b1c885ec914a8b974d34d3" + integrity sha512-9kViM6nJA1Q548Jrd06x0geh+BG2ru2+RMDkIHHgJY/8AcyCs34lTHwra9BX7YdPrZXd5aarkpr/SY8bmPgPdg== dependencies: - acorn "^6.1.1" - acorn-dynamic-import "^4.0.0" - acorn-jsx "^5.0.1" - chalk "^2.4.2" - magic-string "^0.25.3" + chalk "^2.4.1" + magic-string "^0.25.1" minimist "^1.2.0" - os-homedir "^2.0.0" - regexpu-core "^4.5.4" + os-homedir "^1.0.1" + regexpu-core "^4.2.0" + vlq "^1.0.0" buffer-from@^1.0.0: version "1.1.1" @@ -2111,15 +2099,6 @@ cli-width@^2.0.0: resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= -clipboard@^1.5.5: - version "1.7.1" - resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-1.7.1.tgz#360d6d6946e99a7a1fef395e42ba92b5e9b5a16b" - integrity sha1-Ng1taUbpmnof7zleQrqStem1oWs= - dependencies: - good-listener "^1.2.2" - select "^1.1.2" - tiny-emitter "^2.0.0" - clipboard@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.4.tgz#836dafd66cf0fea5d71ce5d5b0bf6e958009112d" @@ -2401,10 +2380,10 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -create-react-context@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.3.tgz#9ec140a6914a22ef04b8b09b7771de89567cb6f3" - integrity sha512-CQBmD0+QGgTaxDL3OX1IDXYqjkp2It4RIbcb99jS6AEg27Ga+a9G3JtK6SIu0HBwPLZlmwt9F7UwWA4Bn92Rag== +create-react-context@0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/create-react-context/-/create-react-context-0.2.2.tgz#9836542f9aaa22868cd7d4a6f82667df38019dca" + integrity sha512-KkpaLARMhsTsgp0d2NA/R94F/eDLbhXERdIq3LvX2biCAXcDvHYoOqHfWCHf1+OLj+HKBotLG3KqaOOf+C1C+A== dependencies: fbjs "^0.8.0" gud "^1.0.0" @@ -5841,10 +5820,10 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -magic-string@^0.25.3: - version "0.25.3" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.3.tgz#34b8d2a2c7fec9d9bdf9929a3fd81d271ef35be9" - integrity sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA== +magic-string@^0.25.1: + version "0.25.6" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.6.tgz#5586387d1242f919c6d223579cc938bf1420795e" + integrity sha512-3a5LOMSGoCTH5rbqobC2HuDNRtE2glHZ8J7pK+QZYppyWA36yuNpsX994rIY2nCuyP7CZYy7lQq/X2jygiZ89g== dependencies: sourcemap-codec "^1.4.4" @@ -6636,16 +6615,11 @@ os-browserify@^0.3.0: resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= -os-homedir@^1.0.0: +os-homedir@^1.0.0, os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= -os-homedir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-2.0.0.tgz#a0c76bb001a8392a503cbd46e7e650b3423a923c" - integrity sha512-saRNz0DSC5C/I++gFIaJTXoFJMRwiP5zHar5vV3xQ2TkgEw6hDCcU5F272JjUylpiVgBrZNQHnfjkLabTfb92Q== - os-locale@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" @@ -7081,12 +7055,10 @@ pretty-format@^23.6.0: ansi-regex "^3.0.0" ansi-styles "^3.2.0" -prismjs@1.6: - version "1.6.0" - resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.6.0.tgz#118d95fb7a66dba2272e343b345f5236659db365" - integrity sha1-EY2V+3pm26InLjQ7NF9SNmWds2U= - optionalDependencies: - clipboard "^1.5.5" +prism-react-renderer@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.0.2.tgz#3bb9a6a42f76fc049b03266298c7068fdd4b7ea9" + integrity sha512-0++pJyRfu4v2OxI/Us/5RLui9ESDkTiLkVCtKuPZYdpB8UQWJpnJQhPrWab053XtsKW3oM0sD69uJ6N9exm1Ag== prismjs@^1.17.1: version "1.17.1" @@ -7384,18 +7356,19 @@ react-lifecycles-compat@^3.0.0: resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== -react-live@^1.6: - version "1.12.0" - resolved "https://registry.yarnpkg.com/react-live/-/react-live-1.12.0.tgz#2876d4e913331002b66dfa73cf58051376bc2518" - integrity sha512-zFEpY01fJORF0IiyONqvjwPLBBDp155Ive6tU8ZmetmT2p4XWUKHstnlu4Cayia+n7iu58Owytztu43yvSin8g== +react-live@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/react-live/-/react-live-2.2.2.tgz#834edf1c11204e49fa7468166316b2e70da1a6b0" + integrity sha512-kJYAzKnPsR4oXleAX9lLsJA330BhTmSWHhr3ienZA2E/0eFDRodGl3I7sge8pp1vjc2K5Aaz73KpFUnV7Lq/DQ== dependencies: - buble "^0.19.3" + buble "0.19.6" core-js "^2.4.1" - create-react-context "^0.2.3" + create-react-context "0.2.2" dom-iterator "^1.0.0" - prismjs "1.6" + prism-react-renderer "^1.0.1" prop-types "^15.5.8" - unescape "^0.2.0" + react-simple-code-editor "^0.10.0" + unescape "^1.0.1" react-redux@^5.1.1: version "5.1.1" @@ -7410,6 +7383,11 @@ react-redux@^5.1.1: react-is "^16.6.0" react-lifecycles-compat "^3.0.0" +react-simple-code-editor@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/react-simple-code-editor/-/react-simple-code-editor-0.10.0.tgz#73e7ac550a928069715482aeb33ccba36efe2373" + integrity sha512-bL5W5mAxSW6+cLwqqVWY47Silqgy2DKDTR4hDBrLrUqC5BXc29YVx17l2IZk5v36VcDEq1Bszu2oHm1qBwKqBA== + react-test-renderer@^16.0.0-0, react-test-renderer@^16.7.0: version "16.9.0" resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.9.0.tgz#7ed657a374af47af88f66f33a3ef99c9610c8ae9" @@ -7635,7 +7613,7 @@ regexpp@^1.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" integrity sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw== -regexpu-core@^4.5.4, regexpu-core@^4.6.0: +regexpu-core@^4.2.0, regexpu-core@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== @@ -8970,10 +8948,12 @@ uglify-js@^3.1.4: commander "~2.20.0" source-map "~0.6.1" -unescape@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/unescape/-/unescape-0.2.0.tgz#b78b9b60c86f1629df181bf53eee3bc8d6367ddf" - integrity sha1-t4ubYMhvFinfGBv1Pu47yNY2fd8= +unescape@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/unescape/-/unescape-1.0.1.tgz#956e430f61cad8a4d57d82c518f5e6cc5d0dda96" + integrity sha512-O0+af1Gs50lyH1nUu3ZyYS1cRh01Q/kUKatTOkSs7jukXE6/NebucDVxyiDsA9AQ4JC1V1jUH9EO8JX2nMDgGQ== + dependencies: + extend-shallow "^2.0.1" unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" @@ -9187,6 +9167,11 @@ victory-core@^33.0.6: prop-types "^15.5.8" react-fast-compare "^2.0.0" +vlq@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-1.0.1.tgz#c003f6e7c0b4c1edd623fd6ee50bbc0d6a1de468" + integrity sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w== + vm-browserify@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" From fa3a54fb7905f55b633a6dec28740a61985bf831 Mon Sep 17 00:00:00 2001 From: Kylie Stewart Date: Mon, 13 Jan 2020 17:37:56 -0700 Subject: [PATCH 2/5] 5.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 483c781c3..a9fbe1855 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spectacle", - "version": "5.7.2", + "version": "5.8.0", "description": "ReactJS Powered Presentation Framework", "main": "lib/index.js", "module": "es/index.js", From a6cfe7d2c38142e29e4fa799659e53884989ac78 Mon Sep 17 00:00:00 2001 From: Kylie Stewart Date: Thu, 16 Jan 2020 11:05:43 -0700 Subject: [PATCH 3/5] Add correct sub-dir to Readme link paths, fixes #801 (#803) --- README.md | 92 +++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index a10423b5c..db30422ae 100644 --- a/README.md +++ b/README.md @@ -11,52 +11,52 @@ Have a question about Spectacle? Submit an issue in this repository using the "Q ## Contents -- [Getting Started](./docs/getting-started.md) - - [Classic Spectacle](./docs/getting-started.md#classic-spectacle) - - [Spectacle MDX](./docs/getting-started.md#spectacle-mdx) - - [One Page](./docs/getting-started.md#one-page) -- [Basic Concepts](./docs/basic-concepts.md) - - [Main file](./docs/basic-concepts.md#main-file) - - [Themes](./docs/basic-concepts.md#themes) - - [createTheme(colors, fonts)](./docs/basic-concepts.md#createthemecolors-fonts) - - [Development](./docs/basic-concepts.md#development) - - [Build & Deployment](./docs/basic-concepts.md#build--deployment) - - [Presenting](./docs/basic-concepts.md#presenting) - - [Controls](./docs/basic-concepts.md#controls) - - [Fullscreen](./docs/basic-concepts.md#fullscreen) - - [PDF Export](./docs/basic-concepts.md#pdf-export) -- [Tag API](./docs/tag-api.md) - - [Main Tags](./docs/tag-api.md#main-tags) - - [Deck](./docs/tag-api.md#deck) - - [Slide (Base)](./docs/tag-api.md#slide-base) - - [Notes](./docs/tag-api.md#notes) - - [MarkdownSlides](./docs/tag-api.md#markdown-slides) - - [Layout Tags](./docs/tag-api.md#layout-tags) - - [Layout](./docs/tag-api.md#layout) - - [Fit](./docs/tag-api.md#fit) - - [Fill](./docs/tag-api.md#fill) - - [Markdown Tag](./docs/tag-api.md#markdown-tag) - - [Markdown](./docs/tag-api.md#markdown) - - [Magic Tag](./docs/tag-api.md#magic-tag) - - [Magic](./docs/tag-api.md#magic) - - [Element Tags](./docs/tag-api.md#element-tags) - - [Appear](./docs/tag-api.md#appear) - - [Anim](./docs/tag-api.md#anim) - - [BlockQuote, Quote and Cite (Base)](./docs/tag-api.md#blockquote-quote-and-cite-base) - - [CodePane (Base)](./docs/tag-api.md#codepane-base) - - [Code (Base)](./docs/tag-api.md#code-base) - - [ComponentPlayground](./docs/tag-api.md#component-playground) - - [GoToAction (Base)](./docs/tag-api.md#go-to-action) - - [Heading (Base)](./docs/tag-api.md#heading-base) - - [Image (Base)](./docs/tag-api.md#image-base) - - [Link (Base)](./docs/tag-api.md#link-base) - - [List & ListItem (Base)](./docs/tag-api.md#list--listitem-base) - - [S (Base)](./docs/tag-api.md#s-base) - - [Table, TableRow, TableBody, TableHeader, TableHeaderItem and TableItem (Base)](./docs/tag-api.md#table-tablerow-tableheaderitem-and-tableitem-base) - - [Text (Base)](./docs/tag-api.md#text-base) - - [Typeface](./docs/tag-api.md#typeface) - - [Base Props](./docs/tag-api.md#base-props) -- [Third Party Extensions](./docs/extensions.md) +- [Getting Started](./docs/content/getting-started.md) + - [Classic Spectacle](./docs/content/getting-started.md#classic-spectacle) + - [Spectacle MDX](./docs/content/getting-started.md#spectacle-mdx) + - [One Page](./docs/content/getting-started.md#one-page) +- [Basic Concepts](./docs/content/basic-concepts.md) + - [Main file](./docs/content/basic-concepts.md#main-file) + - [Themes](./docs/content/basic-concepts.md#themes) + - [createTheme(colors, fonts)](./docs/content/basic-concepts.md#createthemecolors-fonts) + - [Development](./docs/content/basic-concepts.md#development) + - [Build & Deployment](./docs/content/basic-concepts.md#build--deployment) + - [Presenting](./docs/content/basic-concepts.md#presenting) + - [Controls](./docs/content/basic-concepts.md#controls) + - [Fullscreen](./docs/content/basic-concepts.md#fullscreen) + - [PDF Export](./docs/content/basic-concepts.md#pdf-export) +- [Tag API](./docs/content/tag-api.md) + - [Main Tags](./docs/content/tag-api.md#main-tags) + - [Deck](./docs/content/tag-api.md#deck) + - [Slide (Base)](./docs/content/tag-api.md#slide-base) + - [Notes](./docs/content/tag-api.md#notes) + - [MarkdownSlides](./docs/content/tag-api.md#markdown-slides) + - [Layout Tags](./docs/content/tag-api.md#layout-tags) + - [Layout](./docs/content/tag-api.md#layout) + - [Fit](./docs/content/tag-api.md#fit) + - [Fill](./docs/content/tag-api.md#fill) + - [Markdown Tag](./docs/content/tag-api.md#markdown-tag) + - [Markdown](./docs/content/tag-api.md#markdown) + - [Magic Tag](./docs/content/tag-api.md#magic-tag) + - [Magic](./docs/content/tag-api.md#magic) + - [Element Tags](./docs/content/tag-api.md#element-tags) + - [Appear](./docs/content/tag-api.md#appear) + - [Anim](./docs/content/tag-api.md#anim) + - [BlockQuote, Quote and Cite (Base)](./docs/content/tag-api.md#blockquote-quote-and-cite-base) + - [CodePane (Base)](./docs/content/tag-api.md#codepane-base) + - [Code (Base)](./docs/content/tag-api.md#code-base) + - [ComponentPlayground](./docs/content/tag-api.md#component-playground) + - [GoToAction (Base)](./docs/content/tag-api.md#go-to-action) + - [Heading (Base)](./docs/content/tag-api.md#heading-base) + - [Image (Base)](./docs/content/tag-api.md#image-base) + - [Link (Base)](./docs/content/tag-api.md#link-base) + - [List & ListItem (Base)](./docs/content/tag-api.md#list--listitem-base) + - [S (Base)](./docs/content/tag-api.md#s-base) + - [Table, TableRow, TableBody, TableHeader, TableHeaderItem and TableItem (Base)](./docs/content/tag-api.md#table-tablerow-tableheaderitem-and-tableitem-base) + - [Text (Base)](./docs/content/tag-api.md#text-base) + - [Typeface](./docs/content/tag-api.md#typeface) + - [Base Props](./docs/content/tag-api.md#base-props) +- [Third Party Extensions](./docs/content/extensions.md) - [FAQ](#faq) - [Maintenance Status](#maintenance-status) From 3bc0a04ea063d07c4631910a2201aa8c4c4793d4 Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Tue, 28 Jan 2020 16:06:55 -0800 Subject: [PATCH 4/5] Infra: Switch to spectacle-ci AWS user. (#822) - We are switching to specific AWS users for each lander (with tighter permissions) - This is against `master` to verify the deploy. Will merge into `task/rewrite` when I'm done. - Update travis keys. We'll need to merge to verify. - Minor other fixes. --- .travis.yml | 6 +++--- docs/README.md | 4 ++-- docs/scripts/deploy/aws.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index be90ba3fb..8a7f78d80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,11 @@ env: # SURGE_TOKEN - secure: "OiWkbcAfO3UwfwF3+QfZ4qC+ZZXhRnJ3HqafSXixleO2D3fbqc/loVYPgamkjb6gurFDlBzHvNo33Ykv7/ItJmMHAzNyaHOi65Dt3Ax2vCnpOZLv+7pgQ4kP3BDV0zdqpRLlCYj1NuoeAV/i1g5dlWt1q9VlT/G9uitvUlAMfL5OaeyVha7kZGaEM11AOxf6bCQfFhNvUM3c4qz2NXSI/vXtSyKMEoL1Z04VECq1ce/NqvTh9T2dfm7Lvc9ULhUOZF0ChOtc8R50XeCJvIR8SguEwY82O3gG3xiUKlDAUbcZGZK9cmtIoB5I0rZ4JXZDTsZSFEYSB8IuzqHvBzyETFwsBvKXjVuGGaObKOp/jzUetJSTGKhCxzKy56tCoepXc16JvLEjG1Eg8azU6KchMrDSf0+bRu27Yj3tb8UDz16gmCxeuJr37zgh7fR4A4rvQ8t4xIgX9dxE1/aWMOO5gOlcJlFnDpVeKVGM+EAkBMEIU6tnk9Vw0Zc/NrpFy0oaL6vfsd2cfnR4RErEyUQAWuYCt6ZKe6xIpbO6wHBgoCJXsXa1mdgAeR74nUJR86fHAe4OL8ibc8/KC4QcsftxKiFM3LAfsqGOEVklTlbD5yEhTH/2aF7z/EmYZwnTzq/7yA22m23dFPGXT043bIsGzVbNwwybtkBxrP4gFp/Mjao=" - # **Production**: AWS (`formidable-com`, "spectacle CI" keys) + # **Production**: AWS (`spectacle-ci`, "CI" keys) # AWS_ACCESS_KEY_ID - - secure: "RLNlvBN+kTJbblGyX/lAMJ8yLOPab8+pYTBpoFKJKiDUT9N+krPbUy9Hk/Qhsb5aIvFg21z3JjG8gTwYQDJc32oI61whQp71IHB96SPpx0//jUuCldnn0L+dKtNq0IrY8N7Smg2vrEkfocRd2FiEB8G6rnQEYc5HF+tIn94kcoynwbXKRiyoCofGdh9UrTVXUQ+fTu3lFMjGc/v5AWcOkvoOT84IX/Rhn+g/Z0Xur4vZ+SfOML/ue79W5gMowsclQdGnLSBJHqH1svDgwB1h6SiwZljT/nGotcbicafO1ft7O9j0jlJi3yewqjouoGCLBj/gVTeqEg+9g9+mGt1odAw4UAs5opjKjXPML7k4fmM2TPCRf6suhv9R4o4VrZHjuPFb4K0qKaqxo+BYJSjdjA1IKV4AsPV16F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h/yWOhNgMHEJVKjGm6ZppeU24cGI64xxmCfL3gOJbyJyAOSXF76h9OU2MD0X2BIauLRg8uRnD6ALspuMmXiI3EQcKhe1XXY/IGz7lMXlO8sXKxeyUjnPxvRyNwumoU1gOYGGCiv5NRQfqzL+nrsjLKiV6P+zzvIuStX1eLJD+c0DDM2B7Bjs5O0AEAxX700FtM5HiQhzs=" before_install: # Add `aws` CLI tool. diff --git a/docs/README.md b/docs/README.md index 910e10ad1..ec685e701 100644 --- a/docs/README.md +++ b/docs/README.md @@ -82,12 +82,12 @@ First, install the AWS CLI: $ brew install awscli ``` -Then, set up `aws-vault` with the AWS access and secret keys for `spectacle` CI in the `AWS IAM (formidable-com)` entry in the IC vault: +Then, set up `aws-vault` with the AWS access and secret keys for "CI" in the `AWS IAM (spectacle-ci)` entry in the IC vault: ```sh $ brew cask install aws-vault $ aws-vault add fmd-spectacle-ci -# Enter AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY values for "spectacle CI" +# Enter AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY values for AWS `spectacle-ci` user titled "CI" ``` Then build for production and deploy with dry run to check things: diff --git a/docs/scripts/deploy/aws.js b/docs/scripts/deploy/aws.js index a4f8ac550..6c7d65c96 100644 --- a/docs/scripts/deploy/aws.js +++ b/docs/scripts/deploy/aws.js @@ -23,7 +23,7 @@ const EXECA_OPTS = { }; const { log } = console; -const logMsg = msg => log(chalk`[{cyan deploy/surge}] ${msg}`); +const logMsg = msg => log(chalk`[{cyan deploy/aws}] ${msg}`); const main = async ({ isDryRun }) => { logMsg(chalk`Uploading files to {cyan ${DEST}}`); From c651697fe3a312e8a0efaeaefb4400ecff22295b Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Tue, 4 Feb 2020 15:29:33 -0800 Subject: [PATCH 5/5] Update basename (#829) We've been firing `/docs/` for things when we should fire `/open-source/spectacle/docs/` - Add `basename` option for GA wrapper. - Switch our `prod:build|serve` logic to use simplified symlink like we did in: https://github.com/FormidableLabs/renature/pull/25 --- docs/dist-prod/open-source/spectacle | 1 + docs/serve.json | 26 ++------------------------ docs/src/app.js | 6 ++++-- 3 files changed, 7 insertions(+), 26 deletions(-) create mode 120000 docs/dist-prod/open-source/spectacle diff --git a/docs/dist-prod/open-source/spectacle b/docs/dist-prod/open-source/spectacle new file mode 120000 index 000000000..7724b9223 --- /dev/null +++ b/docs/dist-prod/open-source/spectacle @@ -0,0 +1 @@ +../../dist \ No newline at end of file diff --git a/docs/serve.json b/docs/serve.json index 8079168f2..10055379f 100644 --- a/docs/serve.json +++ b/docs/serve.json @@ -1,26 +1,4 @@ { - "public": "dist", - "trailingSlash": true, - "rewrites": [ - { - "source": "open-source/spectacle", - "destination": "/index.html" - }, - { - "source": "open-source/spectacle/:file", - "destination": "/:file" - }, - { - "source": "open-source/spectacle/:one/:file", - "destination": "/:one/:file" - }, - { - "source": "open-source/spectacle/:one/:two/:file", - "destination": "/:one/:two/:file" - }, - { - "source": "open-source/spectacle/:one/:two/:three/:file", - "destination": "/:one/:two/:three/:file" - } - ] + "public": "dist-prod", + "trailingSlash": true } diff --git a/docs/src/app.js b/docs/src/app.js index 0c91b6d96..ffd16ea70 100644 --- a/docs/src/app.js +++ b/docs/src/app.js @@ -51,13 +51,15 @@ ScrollToTop.propTypes = { const WrappedScrollToTop = withRouter(ScrollToTop); let history; +let basename; if (typeof window !== 'undefined') { const createBrowserHistory = require('history').createBrowserHistory; const { stage, landerBasePath } = require('../static-config-parts/constants'); + basename = `/${landerBasePath}`; history = stage === 'development' ? createBrowserHistory() - : createBrowserHistory({ basename: `/${landerBasePath}` }); + : createBrowserHistory({ basename }); } // eslint-disable-next-line react/no-multi-comp @@ -70,7 +72,7 @@ const App = () => ( history={history} > - +