Skip to content

Commit c227ecc

Browse files
ryan-roemerkenwheeler
authored andcommitted
[WIP] Infrastructure + misc fixes and such. (#343)
* A potpouri of fixes and updates for the underlying infrastructure. * Publish `dist/spectacle.js` and `dist/spectacle.min.js` as UMD bundles. Fixes #333 * Only publish specific files and bundles per whitelist `.npmignore`. * Switch to `npm version` publishing workflow. * Add `CONTRINBUTING.md` with COC and instructions for publishing. * Travis: Use yarn, update node versions. * Minor touchups: * Rename `README.markdown` to `README.md` since all other docs use that suffix. * Fix trailing commas in `.babelrc` * Add Travis CI badge. * Remove tests from src publishing. * Add peerDeps to externals * fixing snapshots * lint
1 parent e1d4dc3 commit c227ecc

File tree

12 files changed

+248
-37
lines changed

12 files changed

+248
-37
lines changed

.babelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"react"
66
],
77
"plugins": [
8-
"transform-decorators-legacy",
8+
"transform-decorators-legacy"
99
],
1010
"env": {
1111
"production": {
@@ -15,8 +15,8 @@
1515
"transform-react-constant-elements",
1616
"transform-react-inline-elements",
1717
"transform-runtime",
18-
"transform-decorators-legacy",
19-
],
18+
"transform-decorators-legacy"
19+
]
2020
},
2121
"test": {
2222
"plugins": [

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ dist
33
lib
44
*.log
55
.DS_Store
6-
.vscode
6+
.vscode

.npmignore

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
node_modules
2-
src
3-
*.log
1+
/*
2+
!/dist/spectacle*
3+
dist/*.map
4+
!/docs
5+
!/lib
6+
!/src
7+
__snapshots__
8+
*.test.js
9+
!LICENSE
10+
!README.md
11+
!package.json

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ language: node_js
22

33
node_js:
44
- 4
5-
- 5
65
- 6
7-
- 7
6+
- 8
87

98
# Use container-based Travis infrastructure.
109
sudo: false
@@ -19,10 +18,9 @@ notifications:
1918
on_failure: always
2019

2120
before_install:
22-
- npm install -g npm@3
2321
- export DISPLAY=:99.0
2422
- sh -e /etc/init.d/xvfb start
2523

2624
script:
27-
- npm run lint
28-
- npm run test
25+
- yarn run lint
26+
- yarn run test

CONTRIBUTING.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
Thanks for contributing!
2+
3+
## Development
4+
5+
### Installing dependencies
6+
7+
```bash
8+
yarn install
9+
```
10+
11+
You will find all building blocks that make up Spectacle in the [`src`](src) folder.
12+
13+
### Testing
14+
15+
You will find tests for files colocated with `*.test.js` suffixes. Whenever making any changes, ensure that all existing tests pass by running `yarn run test`.
16+
17+
If you are adding a new feature or some extra functionality, you should also make sure to accompany those changes with appropriate tests.
18+
19+
### Linting
20+
21+
Before commiting any changes, be sure to do `yarn run lint`; this will lint all relevant files using [ESLint](http://eslint.org/) and report on any changes that you need to make.
22+
23+
### Before submitting a PR...
24+
25+
Thanks for taking the time to help us make Spectacle even better! Before you go ahead and submit a PR, make sure that you have done the following:
26+
27+
- Run the tests using `yarn run test`.
28+
- Run lint and flow using `yarn run lint`
29+
30+
## Releasing a new version to NPM (only for project administrators):
31+
32+
1. Run `npm version patch` (or `minor`, `major` as appropriate) to run tests and lint, build the `lib` ands `dist` directories, , then update `package.json` and add a git tag.
33+
2. Run `npm publish` and publish to npm if all is well.
34+
3. Run `git push && git push --tags`
35+
36+
## Contributor Covenant Code of Conduct
37+
38+
### Our Pledge
39+
40+
In the interest of fostering an open and welcoming environment, we as
41+
contributors and maintainers pledge to making participation in our project and
42+
our community a harassment-free experience for everyone, regardless of age, body
43+
size, disability, ethnicity, gender identity and expression, level of experience,
44+
nationality, personal appearance, race, religion, or sexual identity and
45+
orientation.
46+
47+
### Our Standards
48+
49+
Examples of behavior that contributes to creating a positive environment
50+
include:
51+
52+
* Using welcoming and inclusive language
53+
* Being respectful of differing viewpoints and experiences
54+
* Gracefully accepting constructive criticism
55+
* Focusing on what is best for the community
56+
* Showing empathy towards other community members
57+
58+
Examples of unacceptable behavior by participants include:
59+
60+
* The use of sexualized language or imagery and unwelcome sexual attention or
61+
advances
62+
* Trolling, insulting/derogatory comments, and personal or political attacks
63+
* Public or private harassment
64+
* Publishing others' private information, such as a physical or electronic
65+
address, without explicit permission
66+
* Other conduct which could reasonably be considered inappropriate in a
67+
professional setting
68+
69+
### Our Responsibilities
70+
71+
Project maintainers are responsible for clarifying the standards of acceptable
72+
behavior and are expected to take appropriate and fair corrective action in
73+
response to any instances of unacceptable behavior.
74+
75+
Project maintainers have the right and responsibility to remove, edit, or
76+
reject comments, commits, code, wiki edits, issues, and other contributions
77+
that are not aligned to this Code of Conduct, or to ban temporarily or
78+
permanently any contributor for other behaviors that they deem inappropriate,
79+
threatening, offensive, or harmful.
80+
81+
### Scope
82+
83+
This Code of Conduct applies both within project spaces and in public spaces
84+
when an individual is representing the project or its community. Examples of
85+
representing a project or community include using an official project e-mail
86+
address, posting via an official social media account, or acting as an appointed
87+
representative at an online or offline event. Representation of a project may be
88+
further defined and clarified by project maintainers.
89+
90+
### Enforcement
91+
92+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
93+
reported by contacting the project team at [email protected]. All
94+
complaints will be reviewed and investigated and will result in a response that
95+
is deemed necessary and appropriate to the circumstances. The project team is
96+
obligated to maintain confidentiality with regard to the reporter of an incident.
97+
Further details of specific enforcement policies may be posted separately.
98+
99+
Project maintainers who do not follow or enforce the Code of Conduct in good
100+
faith may face temporary or permanent repercussions as determined by other
101+
members of the project's leadership.
102+
103+
### Attribution
104+
105+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
106+
available at [http://contributor-covenant.org/version/1/4][version]
107+
108+
[homepage]: http://contributor-covenant.org
109+
[version]: http://contributor-covenant.org/version/1/4/

README.markdown renamed to README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Spectacle
22

33
[![Join the chat at https://gitter.im/FormidableLabs/spectacle](https://badges.gitter.im/FormidableLabs/spectacle.svg)](https://gitter.im/FormidableLabs/spectacle?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
[![Travis Status][trav_img]][trav_site]
45
ReactJS based Presentation Library
56

67
[Spectacle Boilerplate](https://github.com/FormidableLabs/spectacle-boilerplate/)
@@ -57,7 +58,9 @@ ReactJS based Presentation Library
5758

5859
The best way to get started is by using the [Spectacle Boilerplate](https://github.com/FormidableLabs/spectacle-boilerplate).
5960

60-
Alternatively, you can `npm install spectacle` and write your own build configurations.
61+
Alternatively, you can `npm install spectacle` and write your own build configurations. We also provide full UMD builds (with a `Spectacle` global variable) of the library at `dist/spectacle.js` and `dist/spectacle.min.js` for more general use cases. You could, for example, include the library via a script tag with: `https://unpkg.com/spectacle@VERSION/dist/spectacle.min.js`.
62+
63+
Note that we have webpack externals for `react`, `react-dom`, and `prop-types`, so you will need to provide them in your upstream build or something like linking in via `script` tages in your HTML page for all three libraries. This comports with our project dependencies which place these three libraries in `peerDependencies`.
6164

6265
But really, it is SO much easier to just use the boilerplate. Trust me.
6366

@@ -75,7 +78,7 @@ Open a browser and hit [http://localhost:3000](http://localhost:3000), and we ar
7578
<a name="build--deployment"></a>
7679
## Build & Deployment
7780

78-
Building the dist version of the project is as easy as running `npm run build`
81+
Building the dist version of the slides is as easy as running `npm run build:dist`
7982

8083
If you want to deploy the slideshow to surge, run `npm run deploy`
8184

@@ -563,3 +566,6 @@ The `Typeface` tag is used to apply a specific font to text content. It can eith
563566
- [Spectacle Code Slide](https://github.com/thejameskyle/spectacle-code-slide) - Step through lines of code using this awesome slide extension by @thejameskyle
564567
- [Spectacle Terminal Slide](https://github.com/elijahmanor/spectacle-terminal) - Terminal component that can be used in a spectacle slide deck by @elijahmanor
565568
- [Spectacle Image Slide](https://github.com/FezVrasta/spectacle-image-slide) - Show a slide with a big image and a title on top
569+
570+
[trav_img]: https://api.travis-ci.org/FormidableLabs/spectacle.svg
571+
[trav_site]: https://travis-ci.org/FormidableLabs/spectacle

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from "react";
2-
import { render } from "react-dom";
1+
import React from 'react';
2+
import { render } from 'react-dom';
33

4-
import Presentation from "./example/src";
4+
import Presentation from './example/src';
55

6-
render(<Presentation/>, document.getElementById("root"));
6+
render(<Presentation/>, document.getElementById('root'));

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
"description": "ReactJS Powered Presentation Framework",
55
"main": "lib/index.js",
66
"scripts": {
7+
"preversion": "npm run test && npm run lint",
8+
"version": "npm run build:publish",
79
"clean:lib": "rimraf lib",
810
"clean:dist": "rimraf dist",
9-
"build:lib": "cross-env NODE_ENV=production babel src -d lib --copy-files && babel example/src -d example/lib --copy-files",
11+
"clean": "npm run clean:lib && npm run clean:dist",
12+
"build:lib": "cross-env NODE_ENV=production babel src -d lib --copy-files && rimraf 'lib/**/__snapshots__' 'lib/**/*.test.js'",
1013
"build:dist": "cross-env NODE_ENV=production webpack --config webpack.config.production.js",
11-
"lint": "eslint --ext .js,.jsx src",
14+
"build:dist-umd": "webpack --config webpack.config.umd.js",
15+
"build:dist-umd-prod": "cross-env NODE_ENV=production webpack --config webpack.config.umd.production.js",
16+
"build:publish": "npm run clean && npm run build:lib && npm run build:dist-umd && npm run build:dist-umd-prod",
17+
"lint": "eslint src *.js",
1218
"deploy": "npm run build:dist && surge -p .",
1319
"start": "node server.js",
1420
"test": "jest --verbose"

src/components/__snapshots__/presenter.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ exports[`<Presenter /> should render correctly 1`] = `
139139
</styled.div>
140140
<styled.div>
141141
<div
142-
className="hiNnBp"
142+
className="haajbE"
143143
/>
144144
</styled.div>
145145
</div>
@@ -314,7 +314,7 @@ exports[`<Presenter /> should render timer when set in params. 1`] = `
314314
</styled.div>
315315
<styled.div>
316316
<div
317-
className="hiNnBp"
317+
className="haajbE"
318318
>
319319
<div
320320
dangerouslySetInnerHTML={
@@ -474,7 +474,7 @@ exports[`<Presenter /> should render with notes when slides have them. 1`] = `
474474
</styled.div>
475475
<styled.div>
476476
<div
477-
className="hiNnBp"
477+
className="haajbE"
478478
>
479479
<div
480480
dangerouslySetInnerHTML={

webpack.config.production.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
var path = require("path");
2-
var webpack = require("webpack");
1+
const path = require('path');
2+
const webpack = require('webpack');
33

44
module.exports = {
5-
devtool: "source-map",
5+
devtool: 'source-map',
66
entry: [
7-
"babel-polyfill",
8-
"./index"
7+
'babel-polyfill',
8+
'./index'
99
],
1010
output: {
11-
path: path.join(__dirname, "dist"),
12-
filename: "bundle.js",
13-
publicPath: "/dist/"
11+
path: path.join(__dirname, 'dist'),
12+
filename: 'bundle.js',
13+
publicPath: '/dist/'
1414
},
1515
plugins: [
1616
new webpack.optimize.OccurrenceOrderPlugin(),
1717
new webpack.DefinePlugin({
18-
"process.env": {
19-
"NODE_ENV": JSON.stringify("production")
18+
'process.env': {
19+
'NODE_ENV': JSON.stringify('production')
2020
}
2121
}),
2222
new webpack.optimize.UglifyJsPlugin({
@@ -29,16 +29,16 @@ module.exports = {
2929
loaders: [{
3030
test: /\.js$/,
3131
exclude: /node_modules/,
32-
loader: "babel-loader"
32+
loader: 'babel-loader'
3333
}, {
3434
test: /\.css$/,
35-
loader: "style-loader!css-loader"
35+
loader: 'style-loader!css-loader'
3636
}, {
3737
test: /\.(png|jpg)$/,
38-
loader: "url-loader?limit=8192"
38+
loader: 'url-loader?limit=8192'
3939
}, {
4040
test: /\.svg$/,
41-
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
41+
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
4242
}]
4343
}
4444
};

0 commit comments

Comments
 (0)