Skip to content

Commit 445bbc7

Browse files
committed
update cookbook.
have to commit the source code as string i'm afraid because of facebook/create-react-app#1015
1 parent 8bfba4e commit 445bbc7

File tree

8 files changed

+5982
-2161
lines changed

8 files changed

+5982
-2161
lines changed

cookbook/API.json

Lines changed: 70 additions & 70 deletions
Large diffs are not rendered by default.

cookbook/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"version": "3.0.0-alpha.6",
44
"private": true,
55
"devDependencies": {
6-
"babel-preset-react-app": "^1.0.0",
6+
"babel-preset-react-app": "^2.2.0",
77
"raw-loader": "^0.5.1",
8-
"react-scripts": "0.6.1"
8+
"react-scripts": "0.9.5"
99
},
1010
"cookbook": {
1111
"githubprefix": "https://github.com/gre/gl-react/tree/master/cookbook/"
1212
},
1313
"dependencies": {
14-
"animated": "^0.1.3",
14+
"animated": "^0.2.0",
1515
"github-slugger": "^1.1.1",
1616
"gl-react": "next",
1717
"gl-react-dom": "next",
@@ -33,8 +33,8 @@
3333
"react-prism": "^4.0.0",
3434
"react-router": "^2.8.1",
3535
"react-sidebar": "^2.2.1",
36-
"remark": "^6.2.0",
37-
"remark-react": "^3.1.0"
36+
"remark": "^7.0.0",
37+
"remark-react": "^4.0.0"
3838
},
3939
"scripts": {
4040
"start": "react-scripts start",

cookbook/src/Docs/index.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ import remarkReactRenderer from "remark-react";
1212
import API from "../../API.json";
1313
import "./style.css";
1414
import Code from "../Code";
15-
import DocIntroMD from "raw!../../DocIntro.md";
15+
import DocIntroMDBase64 from "../../DocIntro.md";
16+
17+
const mdheader = "data:text/x-markdown;base64,";
18+
const DocIntroMD =
19+
DocIntroMDBase64.indexOf(mdheader)===0
20+
? atob(DocIntroMDBase64.slice(mdheader.length))
21+
: "";
1622

1723
const paths = {
1824
"Component": "https://facebook.github.io/react/docs/react-component.html",
@@ -479,6 +485,12 @@ class DocSection extends PureComponent {
479485
}
480486
}
481487

488+
class DocIntro extends Component {
489+
render() {
490+
return MD.processSync(DocIntroMD).contents;
491+
}
492+
}
493+
482494
class DocBody extends Component {
483495
render() {
484496
return (
@@ -495,13 +507,6 @@ class DocBody extends Component {
495507
}
496508
}
497509

498-
499-
class DocIntro extends Component {
500-
render() {
501-
return MD.process(DocIntroMD).contents;
502-
}
503-
}
504-
505510
class Doc extends PureComponent {
506511
render() {
507512
return (

cookbook/src/examples/gen.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!/bin/bash
2+
cd `dirname $0`
23
while read ex
34
do
45
if [ ! -z $ex ] && [ -d $ex ]
56
then
6-
echo "import ${ex}_E from './$ex';";
7-
echo "import * as ${ex}_m from './$ex/meta';";
8-
echo "import ${ex}_s from '!raw!./$ex/index.js';";
7+
echo "import ${ex}_E from \"./$ex\";";
8+
echo "import * as ${ex}_m from \"./$ex/meta\";";
9+
echo "const ${ex}_s = \`";
10+
cat ./$ex/index.js | sed 's/\\/\\\\/g' | sed 's/\`/\\\`/g';
11+
echo "\`;";
912
echo "export const $ex={ Example: ${ex}_E, source: ${ex}_s, ...${ex}_m };"
1013
else
1114
echo "$ex not found" 1>&2;

0 commit comments

Comments
 (0)