Skip to content

Commit 7704326

Browse files
committed
Migrates to rollup and yarn
1 parent 0ec74a4 commit 7704326

20 files changed

+5432
-9439
lines changed

.babelrc

+7-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
{
22
"presets": [
3-
["env", { "targets": { "node": true } }],
4-
"stage-3",
5-
"react"
6-
],
7-
"env": {
8-
"commonjs": {
9-
"presets": [
10-
"latest",
11-
"stage-3",
12-
"react"
13-
],
14-
},
15-
"umd": {
16-
"presets": [
17-
["latest", { "es2015": { "modules": false } }],
18-
"stage-3",
19-
"react"
20-
],
21-
}
22-
}
23-
}
3+
["env", {
4+
"targets": {
5+
"node": true
6+
}
7+
}], "stage-3", "react"
8+
]
9+
}

.gitignore

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ npm-debug.log
1111
# Jest
1212
coverage
1313

14-
# Flow
15-
flow-coverage
16-
flow-typed
14+
# Build
15+
dist
16+
17+
# IDEs
18+
.vscode

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
sudo: false
22
language: node_js
33
cache:
4-
npm: true
4+
yarn: true
55
directories:
66
- node_modules
77
node_js:
88
- '8'
99
script:
10-
- npm run test
10+
- npm run precommit
1111
after_success:
1212
# Deploy code coverage report to codecov.io
1313
- npm run test:coverage:deploy

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ Provides the ability to execute async bootstrapper functions within your React e
1414

1515
## Introduction
1616

17-
This library is an abstraction of [`react-tree-walker`](https://github.com/ctrlplusb/react-tree-walker), that allows you to attach an `asyncBootstrap` member to your React components.
17+
This library is an abstraction of [`react-tree-walker`](https://github.com/ctrlplusb/react-tree-walker), that allows you to attach an `asyncBootstrap` method to your React "class" components.
1818

19-
Within the `asyncBootstrap` you can do any work/bootstrapping that you like and then return a `Promise` that should resolve to either `true` (which indicates back to the bootstrapping process that it should continue down the current branch of your application in order to locate and resolve any nested `asyncBootstrap` instances), or `false` (which indicates that traversal of the current branch of your application can stop).
19+
Within the `asyncBootstrap` you can do any asynchronous work you like (e.g. fetching data) that you like, returning a `Promise` to indicate when the asynchronous work has completed.
2020

2121
## Naive Example
2222

2323
```jsx
2424
import asyncBootstrapper from 'react-async-bootstrapper'
2525

26-
// Don't do this, do a proper imp
26+
// Our super naive global state. Don't copy this, it's just illustrative. You'd
27+
// likely want to use something
2728
const globalStateManager = {
2829
products: {},
2930
}
@@ -32,11 +33,10 @@ class Product extends Component {
3233
 // 👇
3334
 asyncBootstrap() {
3435
if (globalStateManager.products[this.props.productId]) {
35-
// Already have data, just return true to allow nested
36-
// asyncBootstrap instances to be located/resolved
37-
return true
36+
// Already have data
37+
return
3838
}
39-
39+
4040
// Fetch our product and load up our state
4141
return fetch(`/api/products/${this.props.productId}`)
4242
.then((response) => {

commonjs/index.js

-23
This file was deleted.

0 commit comments

Comments
 (0)