Skip to content

Commit 34d7870

Browse files
Kylie Stewartboygirlryan-roemer
authored
Upgrade to react-static v7 (#885)
* Upgrade to react-static v7 (#882) * Add a trailing slash for prod routes * Use local paths instead of general strings * remove double slashes * Update formidable-oss-badges * Infra/Docs: Have one build/basepath for staging/prod/dev (#884) - Switch dev + staging + prod **all** to one basepath (always `/open-source/spectacle`) - Collapse build/serve commands to `build` and `serve` and remove / replace config / symlink files now no longer needed. - Make the static build served from 4000 so dev can serve on 3000 - Rename deploy commands. - Have AWS deploy go off `dist/open-source/spectacle` instead of `dist`. (Surge build stays the same file-location-wise). * Badges should route to project docs * button as external a tag rather than react-router Link Co-authored-by: boygirl <[email protected]> Co-authored-by: Ryan Roemer <[email protected]> Co-authored-by: boygirl <[email protected]> Co-authored-by: Ryan Roemer <[email protected]>
1 parent b01c359 commit 34d7870

File tree

117 files changed

+2381
-2505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2381
-2505
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ jobs:
5858
- yarn run check-ci
5959
# Build and deploy to staging.
6060
- yarn run clean
61-
- yarn run stage:build
62-
- yarn run stage:deploy
61+
- yarn run build
62+
- yarn run deploy:stage
6363
deploy:
6464
# Deploy master to production
6565
- provider: script
6666
# Build and deploy to production.
6767
# _Note_: `deploy.script` must be a **single** command string
6868
script: >-
6969
yarn run clean &&
70-
yarn run prod:build &&
71-
yarn run prod:deploy
70+
yarn run build &&
71+
yarn run deploy:prod
7272
skip_cleanup: true
7373
on:
7474
branch: master

README.md

Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p align="center"><img src="https://raw.githubusercontent.com/FormidableLabs/spectacle/master/docs/src/static/bg_hero_badge.png" width=250></p>
1+
<p align="center"><img src="https://raw.githubusercontent.com/FormidableLabs/spectacle/master/docs/src/assets/logo_spectacle.png" width=250></p>
22
<h2 align="center">Spectacle</h2>
33
<p align="center">
44
<strong>✨ A ReactJS based Presentation Library ✨</strong>
@@ -12,69 +12,15 @@
1212
</a>
1313
</p>
1414

15-
Looking for a quick preview of what you can do with Spectacle? Check out our Live Demo deck [here](https://raw.githack.com/FormidableLabs/spectacle/master/examples/one-page.html).
15+
Looking for a quick preview of what you can do with Spectacle? Check out our Live Demo deck
16+
[here](https://raw.githack.com/FormidableLabs/spectacle/master/examples/one-page.html).
1617

17-
Have a question about Spectacle? Submit an issue in this repository using the "Question" template.
18+
Have a question about Spectacle? Submit an issue in this repository using the
19+
["Question" template](https://github.com/FormidableLabs/spectacle/issues/new?template=question.md).
1820

19-
## Table of Contents
21+
## Documentation
2022

21-
- [Getting Started: A Tutorial](./docs/content/tutorial.md)
22-
- [Basic Concepts](./docs/content/basic-concepts.md#basic-concepts)
23-
- [Installation](./docs/content/basic-concepts.md#installation)
24-
- [Getting Started with Development](./docs/content/basic-concepts.md#development)
25-
- [Writing your Presentation](./docs/content/basic-concepts.md#writing-your-presentation)
26-
- [MDX/Markdown](./docs/content/basic-concepts.md#mdx--markdown)
27-
- [JSX](./docs/content/basic-concepts.md#jsx)
28-
- [One Page/HTML](./docs/content/basic-concepts.md#one-html-page)
29-
- [Presenting](./docs/content/basic-concepts.md#presenting)
30-
- [Advanced Concepts](./docs/content/advanced-concepts.md#advanced-concepts)
31-
- [Build & Deployment](./docs/content/advanced-concepts.md#build--deployment)
32-
- [Keyboard Controls](./docs/content/advanced-concepts.md#keyboard-controls)
33-
- [Query Parameters](./docs/content/advanced-concepts.md#query-parameters)
34-
- [Base Props](./docs/content/props.md)
35-
- [Transition Object](./docs/content/props.md#transition-object)
36-
- [Color](./docs/content/props.md#color)
37-
- [Space](./docs/content/props.md#space)
38-
- [Typography](./docs/content/props.md#typography)
39-
- [Layout](./docs/content/props.md#layout)
40-
- [Flex](./docs/content/props.md#flex)
41-
- [Position](./docs/content/props.md#position)
42-
- [Border](./docs/content/props.md#border)
43-
- [Theme System](./docs/content/themes.md)
44-
- [Theme Object](./docs/content/themes.md#theme-object)
45-
- [Usage](./docs/content/themes.md#usage)
46-
- [Theme Keys](./docs/content/themes.md#theme-keys-css-props)
47-
- [Deck Templates](./docs/content/themes.md#deck-templates)
48-
- [Scaled Spacing](./docs/content/themes.md#scaled-spacing)
49-
- [API Reference](./docs/content/api-reference.md#api-reference)
50-
- [Main Tags](./docs/content/api-reference.md#main-tags)
51-
- [Deck](./docs/content/api-reference.md#deck)
52-
- [Slide](./docs/content/api-reference.md#slide)
53-
- [Typography Tags](./docs/content/api-reference.md#typography-tags)
54-
- [Text](./docs/content/api-reference.md#text)
55-
- [Heading](./docs/content/api-reference.md#heading)
56-
- [Link](./docs/content/api-reference.md#link)
57-
- [Quote](./docs/content/api-reference.md#quote)
58-
- [OrderedList](./docs/content/api-reference.md#ordered-list)
59-
- [UnorderedList](./docs/content/api-reference.md#unordered-list)
60-
- [ListItem](./docs/content/api-reference.md#list-item)
61-
- [CodeSpan](./docs/content/api-reference.md#code-span)
62-
- [Layout Tags](./docs/content/api-reference.md#layout-tags)
63-
- [Box](./docs/content/api-reference.md#box)
64-
- [FlexBox](./docs/content/api-reference.md#flex-box)
65-
- [Grid](./docs/content/api-reference.md#grid)
66-
- [Appear](./docs/content/api-reference.md#appear)
67-
- [CodePane](./docs/content/api-reference.md#codepane)
68-
- [FullScreen](./docs/content/api-reference.md#fullscreen)
69-
- [Image](./docs/content/api-reference.md#image)
70-
- [Markdown](./docs/content/api-reference.md#markdown)
71-
- [Notes](./docs/content/api-reference.md#notes)
72-
- [Progress](./docs/content/api-reference.md#progress)
73-
- [Extensions](./docs/content/extensions.md)
74-
- [Third Party Extensions](./docs/content/extensions.md#third-party)
75-
- [Formidable Extensions](./docs/content/extensions.md#formidable)
76-
- [`spectacle-cli`](./docs/content/extensions.md#spectacle-cli)
77-
- [`spectacle-mdx-loader`](./docs/content/extensions.md#spectacle-mdx-loader)
78-
- [Frequently Asked Questions](./docs/content/faq.md#frequently-asked-questions)
79-
- [Can I export my slides for use elsewhere?](./docs/content/faq.md#faq-1)
80-
- [Can I write my presentation in TypeScript?](./docs/content/faq.md#faq-2)
23+
Spectacle's documentation lives on our [docs site](https://www.formidable.com/open-source/spectacle).
24+
Notice something inaccurate or confusing? Feel free to [open an issue](https://github.com/FormidableLabs/spectacle/issues)
25+
or [make a pull request](https://github.com/FormidableLabs/spectacle/pulls) to help improve the documentation for everyone!
26+
The source for our docs site lives in this repo in the [`docs`](https://github.com/FormidableLabs/spectacle/blob/master/docs/README.md) folder.

docs/README.md

Lines changed: 13 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,23 @@ $ yarn install
1212
$ yarn start
1313
```
1414

15-
Note that paths in local development are based on a root of "/" but be careful when defining relative and absolute paths
16-
inline or doing url parsing, as the production output root will be "open-source/spectacle."
15+
Then visit: http://localhost:3000/open-source/spectacle/
1716

1817
## Building the site for deployment
1918

20-
### Build and check the staging site
21-
22-
The staging build is served from a root path, e.g. `http://example/com`. This is typically used for CI / per-PR previews.
23-
24-
```bash
25-
$ cd docs
26-
$ yarn stage:build
27-
$ yarn stage:serve
28-
```
29-
30-
This build creates `dist/open-source/spectacle` simulating the directory style output.
31-
32-
Then visit: http://localhost:3000/open-source/spectacle/
33-
3419
### Build and check the production site
3520

36-
The production site is served from a nested path, e.g. `https://formidable.com/open-source/spectacle`.
21+
The staging and production sites are served from a nested path, e.g. `https://formidable.com/open-source/spectacle`.
3722

3823
```bash
3924
$ cd docs
40-
$ yarn prod:build
41-
$ yarn prod:serve
25+
$ yarn build
26+
$ yarn serve
4227
```
4328

44-
This build creates `dist` but the `serve` dev server remaps paths to make it appear at `open-source/spectacle`. This build **is** the appropriate, full production build.
29+
Then visit: http://localhost:4000/open-source/spectacle/
4530

46-
Then visit: http://localhost:3000/open-source/spectacle/
47-
48-
Both of these steps are important for validating that both the `basePath` used by the static HTML output and the `basename` used
49-
by the client-side router are working as expected. This is also where you'll want to validate that there are no hardcoded, inlined, or malformed asset paths that worked locally but will not resolve correctly in production!
31+
Both of these steps are important for validating that both the `basePath` used by the static HTML output and the `basename` used by the client-side router are working as expected. This is also where you'll want to validate that there are no hardcoded, inlined, or malformed asset paths that worked locally but will not resolve correctly in production!
5032

5133
## Deployment
5234

@@ -62,12 +44,12 @@ To test things out locally find the `Surge.sh` entry in 1password in the IC vaul
6244

6345
```bash
6446
$ cd docs
65-
$ yarn clean
66-
$ yarn stage:build
47+
$ yarn clean && \
48+
yarn build
6749
$ SURGE_LOGIN=<SNIPPED> \
6850
SURGE_TOKEN=<SNIPPED> \
6951
TRAVIS_PULL_REQUEST=12 \
70-
yarn stage:deploy
52+
yarn deploy:stage
7153
```
7254

7355
### Production
@@ -94,52 +76,16 @@ Then build for production and deploy with dry run to check things:
9476

9577
```bash
9678
$ cd docs
97-
$ yarn clean
98-
$ yarn prod:build
79+
$ yarn clean && \
80+
yarn build
9981
$ aws-vault exec fmd-spectacle-ci --no-session -- \
100-
yarn prod:deploy --dryrun
82+
yarn deploy:prod --dryrun
10183
```
10284

10385
## Tips for developing
10486

10587
- Almost all of your code will be executed in two contexts: first in node for server-side rendering and static html generation, then client-side as a PWA. In addition to writing [node-safe code](https://github.com/nozzle/react-static/blob/master/docs/concepts.md#writing-universal-node-safe-code), this also means that it's necessary to validate that both contexts are working as expected.
10688

107-
- In addition to two execution contexts, there are three stages: development, staging, and production. `yarn start` uses a local dev server with live reload that takes about one second to rebuild. This is a good choice for most local development, but it's important to keep in mind that **the development server does not build the static html.** For that, you will want to use `yarn stage:build && yarn stage:serve`.
89+
- In addition to two execution contexts, there are three stages: development, staging, and production. `yarn start` uses a local dev server with live reload that takes about one second to rebuild. This is a good choice for most local development, but it's important to keep in mind that **the development server does not build the static html.** For that, you will want to use `yarn build && yarn serve` used for staging and production deploys.
10890

10991
- When debugging an issue with the static html output, don't be shy about cracking open the `dist` folder and looking at the output!
110-
111-
- When debugging an issue with the PWA or SSR-PWA coordination, consider using `yarn stage-debug` -- this builds the staging output without minification/uglification and propagates warnings/errors.
112-
113-
- We have seen errors related to minification, uglification, and codesplitting before, please do not treat the debug build or the local dev server as 1:1 with production output!
114-
115-
## Tips for getting the most out of react-static + webpack tooling
116-
117-
We are on react-static v5 due to painful upgrade issues with v7, which means...
118-
119-
- You'll want to make sure that when you refer to the docs you're in the v5 branch.
120-
121-
- When you install the react-static CLI tool globally, you'll want to use the v5 version (`npm install -g react-static@^5.9.12`) which currently has a wider selection of working templates that can be very useful as executable canonical references.
122-
123-
- If you're looking for the client-side router documentation for react-static to see how to implement a certain behavior, the best place to start is in the [react-router docs](https://reacttraining.com/react-router/web/api/), which react-static v5 uses under the hood. There are a few additional react-static specific properties for [Router](https://github.com/nozzle/react-static/blob/v5/docs/components.md#router), [Routes](https://github.com/nozzle/react-static/blob/v5/docs/components.md#routes), and [Link](https://github.com/nozzle/react-static/blob/v5/docs/components.md#link), but if you need something from the routing that doesn't seem to covered in the react-static api, the react-router docs are pretty likely to have you covered.
124-
125-
- You'll ~~want~~ need to use Webpack 3 plugins. Webpack has an [interesting approach](https://github.com/webpack/webpack.js.org/issues/1854) to documenting old versions. The existing documentation is broadly usable but you may want to familiarize yourself with this [introductory v3 to v4 migration guide](https://webpack.js.org/migrate/4/) and the relevant [react-static docs](https://github.com/nozzle/react-static/blob/v5/docs/config.md#webpack).
126-
127-
- Interestingly, some webpack v4 loaders still work with v3, while some webpack v3 loaders _don't_ work with webpack v3. Version-twiddling or using a different loader for reasons that are unclear may be required. When tweaking webpack, it's extra-important to validate both PWA and static html output and clear out cached files.
128-
129-
## Using this project as a template:
130-
131-
This lander is designed to be easily re-used as a template for other projects.
132-
133-
What to change:
134-
135-
- Docs Content
136-
- markdown content lives in `/docs/content`
137-
- _Note:_ Any markdown files placed here will be rendered as separate pages, and header tags will be rendered into a hierarchical sidebar. Please make sure header tags do not include any special symbols as they will be used to create anchor tags and hashes.
138-
- Main Page Content
139-
- `src/screens/home/_content.js` includes section titles, descriptions, and assets urls
140-
- `src/screens/home/hero.js`
141-
- Constants
142-
- client constants live in `src/constants.js`
143-
- static constants live in `static-config-parts/constants.js`
144-
- Assets
145-
- Logos, sidebar svgs and favicons (TODO: These are all very similar svgs, and could some day live in a separate repo, and take props like color, name etc)

docs/content/advanced-concepts.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,16 @@ title: Advanced Concepts
33
order: 2
44
---
55

6-
<a name="advanced-concepts"></a>
7-
86
# Advanced Concepts
97

10-
<a name="build--deployment"></a>
11-
128
## Build & Deployment
139

1410
There are a variety of ways to host your Spectacle presentation.
1511

16-
1. If you are integrating this lib yourself, take your build and follow the linked instructions from any of (but not limited to) this list of providers:
17-
18-
- [Heroku](https://devcenter.heroku.com/articles/git#deploying-code)
19-
- [Zeit](https://zeit.co/docs/v2/platform/deployments)
20-
- [Surge](https://surge.sh/help/deploying-continuously-using-git-hooks)
12+
1. If you are integrating this lib yourself, take your build and follow the linked instructions from any of (but not limited to) the following providers: [Heroku](https://devcenter.heroku.com/articles/git#deploying-code), [Zeit](https://zeit.co/docs/v2/platform/deployments), or [Surge](https://surge.sh/help/deploying-continuously-using-git-hooks).
2113

2214
2. If using `spectacle-cli` (either `spectacle --action build` or `spectacle-boilerplate` with `yarn clean && yarn build`) your output is `dist/` and upload that directory to any of the above static hosting providers.
2315

24-
<a name="keyboard-controls"></a>
25-
2616
## Keyboard Controls
2717

2818
| Key Combination | Function |
@@ -33,16 +23,14 @@ There are a variety of ways to host your Spectacle presentation.
3323
| Alt/Option + P | Toggle Presenter Mode |
3424
| Alt/Option + F | Toggle Fullscreen Mode |
3525

36-
<a name="query-parameters"></a>
37-
3826
## Query Parameters
3927

4028
A handful of query parameters are supported within your Spectacle presentation.
4129
Append your URL with one of the following parameters, like so: `&<parameter>=true`.
4230
To combine parameters, use multiple `&` to separate the parameters, e.g.: `&exportMode=true&printMode=true`
4331

44-
| Parameter | Description of Use |
45-
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
46-
| `exportMode` | For exporting your presentation as a PDF. Add it to your project URL and "Save to PDF" directly from the browser |
47-
| `printMode` | Turns your slideshow into a printer-friendly, black & white version. Meant for use concurrently with `?exportMode` e.g. `?exportMode&printMode` |
48-
| `presenterMode` | Displays a Presenter Mode for ease of presentation. For more info on this mode, please see [Presenting](/docs/basic-concepts#presenting) in our Basic Concepts doc |
32+
| Parameter | Description of Use |
33+
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34+
| `exportMode` | For exporting your presentation as a PDF. Add it to your project URL and "Save to PDF" directly from the browser |
35+
| `printMode` | Turns your slideshow into a printer-friendly, black & white version. Meant for use concurrently with `?exportMode` e.g. `?exportMode&printMode` |
36+
| `presenterMode` | Displays a Presenter Mode for ease of presentation. For more info on this mode, please see [Presenting](./basic-concepts#presenting) in our Basic Concepts doc |

0 commit comments

Comments
 (0)