Skip to content

Commit 583f65d

Browse files
author
Dave Garwacke
committed
feat(yarn) Use Yarn workspaces
- Break everything up into packages - Add microbundle - Use Typescript everywhere
1 parent 85fbc0d commit 583f65d

30 files changed

+182
-35
lines changed

.DS_Store

6 KB
Binary file not shown.

.babelrc

-7
This file was deleted.

examples/hello/index.jsx

-4
This file was deleted.

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
"author": "Dave Garwacke <[email protected]>",
88
"license": "Apache-2.0",
99
"private": true,
10+
"workspaces": [
11+
"packages/*"
12+
],
1013
"dependencies": {
11-
"isomorphic-fetch": "^2.2.1"
14+
"isomorphic-fetch": "^2.2.1",
15+
"davi": "0.0.1",
16+
"davi-dom": "0.0.1",
17+
"davi-server": "0.0.1"
1218
},
1319
"devDependencies": {
1420
"babel-cli": "^6.26.0",

packages/.DS_Store

6 KB
Binary file not shown.

packages/davi-dom/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {default as render} from "./src/render";

packages/davi-dom/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "davi-dom",
3+
"version": "0.0.1",
4+
"description": "Dave's Alternate View Interpretation DOM helpers",
5+
"main": "./lib/index.js",
6+
"source": "./index.ts",
7+
"repository": "[email protected]:ifyoumakeit/davi.git",
8+
"author": "Dave Garwacke <[email protected]>",
9+
"license": "Apache-2.0",
10+
"devDependencies": {
11+
"microbundle": "^0.4.4"
12+
},
13+
"scripts": {
14+
"build": "microbundle",
15+
"dev": "microbundle watch"
16+
}
17+
}
File renamed without changes.

examples/hello/index.html packages/davi-examples/hello/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<body>
1212
<div id="root"></div>
13-
<script src="./index.jsx"></script>
13+
<script src="./index.tsx"></script>
1414
</body>
1515

1616
</html>
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import davi from "davi";
2+
import { render } from "davi-dom";
3+
4+
render(<h1>Hello world!</h1>, document.querySelector("#root"));

examples/isomorphic/client.jsx packages/davi-examples/isomorphic/client.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import d from "../../src/d";
2-
import render from "../../src/render";
3-
import createStore from "../../src/store";
1+
import davi from "davi";
2+
import { render } from "davi-dom";
3+
import { createStore } from "davi-store";
44
import App from "./components/App";
55
import { STATE, INITIAL_DATA } from "./constants";
6-
import fetch from "isomorphic-fetch";
6+
import * as fetch from "isomorphic-fetch";
77

88
const store = createStore({
99
active: false,

examples/isomorphic/components/App.jsx packages/davi-examples/isomorphic/components/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import d from "../../../src/d";
1+
import davi from "davi";
22
import Button from "./Button";
33
import Article from "./Article";
44
import { STATE } from "../constants";

examples/isomorphic/components/Article.jsx packages/davi-examples/isomorphic/components/Article.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import d from "../../../src/d";
1+
import davi from "davi";
22

33
export default ({ title, body, id, fetchPost }) => {
44
return (

examples/isomorphic/components/Button.jsx packages/davi-examples/isomorphic/components/Button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import d from "../../../src/d";
1+
import davi from "davi";
22

33
export default ({ children, store, active, onClick }) => {
44
return (

examples/isomorphic/index.html packages/davi-examples/isomorphic/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ <h1>
6161
<script>
6262
var __INITIAL_DATA__={"posts":[{"userId":1,"id":1,"title":"sunt aut facere repellat provident occaecati excepturi optio reprehenderit","body":"quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"},{"userId":1,"id":2,"title":"qui est esse","body":"est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla"},{"userId":1,"id":3,"title":"ea molestias quasi exercitationem repellat qui ipsa sit aut","body":"et iusto sed quo iure\nvoluptatem occaecati omnis eligendi aut ad\nvoluptatem doloribus vel accusantium quis pariatur\nmolestiae porro eius odio et labore et velit aut"}],"state":"INITIAL"}
6363
</script>
64-
<script src="./client.jsx"></script>
64+
<script src="./client.tsx"></script>
6565
</body>
6666
</html>

examples/isomorphic/server.jsx packages/davi-examples/isomorphic/server.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import d from "../../src/d";
2-
import renderToStaticMarkup from "../../src/renderToStaticMarkup";
1+
import davi from "davi";
2+
import { renderToStaticMarkup } from "davi-server";
3+
34
import App from "./components/App";
4-
import fetch from "isomorphic-fetch";
5+
import * as fetch from "isomorphic-fetch";
56
import { STATE, INITIAL_DATA } from "./constants";
6-
import fs from "fs";
7+
import * as fs from "fs";
78

8-
const FILENAME = "./examples/isomorphic/index.html";
9+
const FILENAME = "./isomorphic/index.html";
910

1011
const fetchData = async () => {
1112
return await fetch("https://jsonplaceholder.typicode.com/posts")
@@ -35,14 +36,12 @@ export default fetchData()
3536
<App {...data} />
3637
</div>
3738
<script>{getInitialData(data)}</script>
38-
<script src="./client.jsx" />
39+
<script src="./client.tsx" />
3940
</body>
4041
</html>
4142
),
4243
err => {
43-
return console.log(
44-
err ? err : `${FILENAME} built.`
45-
);
44+
return console.log(err ? err : `${FILENAME} built.`);
4645
}
4746
)
4847
)

packages/davi-examples/package.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "davi-examples",
3+
"version": "0.0.1",
4+
"description": "DAVI Examples",
5+
"main": "./src/index.js",
6+
"repository": "[email protected]:ifyoumakeit/davi.git",
7+
"author": "Dave Garwacke <[email protected]>",
8+
"license": "Apache-2.0",
9+
"private": true,
10+
"dependencies": {
11+
"isomorphic-fetch": "^2.2.1"
12+
},
13+
"devDependencies": {
14+
"babel-cli": "^6.26.0",
15+
"babel-core": "^6.26.0",
16+
"babel-loader": "^7.1.4",
17+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
18+
"babel-plugin-transform-react-jsx": "^6.24.1",
19+
"babel-preset-env": "^1.6.1",
20+
"microbundle": "^0.4.4",
21+
"parcel-bundler": "^1.6.2",
22+
"ts-node": "^5.0.1",
23+
"typescript": "^2.7.2"
24+
},
25+
"scripts": {
26+
"build:hello": "parcel hello/index.html",
27+
"dist:hello": "parcel build hello/index.html",
28+
"build:isomorphic:client": "parcel isomorphic/index.html",
29+
"build:isomorphic:server": "ts-node isomorphic/server.tsx",
30+
"build:isomorphic":
31+
"yarn build:isomorphic:server && yarn build:isomorphic:client",
32+
"dist:isomorphic:client": "parcel build isomorphic/index.html",
33+
"dist:isomorphic:server": "ts-node isomorphic/server.tsx",
34+
"dist:isomorphic":
35+
"yarn dist:isomorphic:server && yarn dist:isomorphic:client"
36+
}
37+
}

packages/davi-server/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as renderToStaticMarkup } from "./src/renderToStaticMarkup";

packages/davi-server/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "davi-server",
3+
"version": "0.0.1",
4+
"description": "Dave's Alternate View Interpretation DOM helpers",
5+
"main": "./lib/index.js",
6+
"source": "./index.ts",
7+
"repository": "[email protected]:ifyoumakeit/davi.git",
8+
"author": "Dave Garwacke <[email protected]>",
9+
"license": "Apache-2.0",
10+
"devDependencies": {
11+
"microbundle": "^0.4.4"
12+
},
13+
"scripts": {
14+
"build": "microbundle",
15+
"dev": "microbundle watch"
16+
}
17+
}
File renamed without changes.

packages/davi-store/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as createStore } from "./src/createStore";

packages/davi-store/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "davi-store",
3+
"version": "0.0.1",
4+
"description": "Dave's Alternate View Interpretation store",
5+
"main": "./lib/index.js",
6+
"source": "./index.ts",
7+
"repository": "[email protected]:ifyoumakeit/davi.git",
8+
"author": "Dave Garwacke <[email protected]>",
9+
"license": "Apache-2.0",
10+
"devDependencies": {
11+
"microbundle": "^0.4.4"
12+
},
13+
"scripts": {
14+
"build": "microbundle",
15+
"dev": "microbundle watch"
16+
}
17+
}
File renamed without changes.

packages/davi/.DS_Store

6 KB
Binary file not shown.

src/d.js packages/davi/index.ts

File renamed without changes.

packages/davi/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "davi",
3+
"version": "0.0.1",
4+
"description": "Dave's Alternate View Interpretation",
5+
"main": "./lib/index.js",
6+
"source": "./index.ts",
7+
"repository": "[email protected]:ifyoumakeit/davi.git",
8+
"author": "Dave Garwacke <[email protected]>",
9+
"license": "Apache-2.0",
10+
"devDependencies": {
11+
"microbundle": "^0.4.4"
12+
},
13+
"scripts": {
14+
"build": "microbundle",
15+
"dev": "microbundle watch"
16+
}
17+
}

src/index.js

-3
This file was deleted.

tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"sourceMap": true,
6+
"jsx": "react",
7+
"jsxFactory": "davi"
8+
}
9+
}

yarn.lock

+37-2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ array-unique@^0.3.2:
136136
version "0.3.2"
137137
resolved "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
138138

139+
arrify@^1.0.0:
140+
version "1.0.1"
141+
resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
142+
139143
asn1.js@^4.0.0:
140144
version "4.10.1"
141145
resolved "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0"
@@ -1477,6 +1481,10 @@ detect-libc@^1.0.2:
14771481
version "1.0.3"
14781482
resolved "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
14791483

1484+
diff@^3.1.0:
1485+
version "3.5.0"
1486+
resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
1487+
14801488
diffie-hellman@^5.0.0:
14811489
version "5.0.2"
14821490
resolved "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e"
@@ -2627,6 +2635,10 @@ make-dir@^1.0.0:
26272635
dependencies:
26282636
pify "^3.0.0"
26292637

2638+
make-error@^1.1.1:
2639+
version "1.3.4"
2640+
resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz#19978ed575f9e9545d2ff8c13e33b5d18a67d535"
2641+
26302642
map-cache@^0.2.2:
26312643
version "0.2.2"
26322644
resolved "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf"
@@ -4181,11 +4193,17 @@ source-map-support@^0.4.15:
41814193
dependencies:
41824194
source-map "^0.5.6"
41834195

4196+
source-map-support@^0.5.3:
4197+
version "0.5.4"
4198+
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.4.tgz#54456efa89caa9270af7cd624cc2f123e51fbae8"
4199+
dependencies:
4200+
source-map "^0.6.0"
4201+
41844202
source-map-url@^0.4.0:
41854203
version "0.4.0"
41864204
resolved "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
41874205

4188-
[email protected], source-map@^0.6.1, source-map@~0.6.1:
4206+
[email protected], source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
41894207
version "0.6.1"
41904208
resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
41914209

@@ -4442,6 +4460,19 @@ truncate-utf8-bytes@^1.0.0:
44424460
dependencies:
44434461
utf8-byte-length "^1.0.1"
44444462

4463+
ts-node@^5.0.1:
4464+
version "5.0.1"
4465+
resolved "https://registry.npmjs.org/ts-node/-/ts-node-5.0.1.tgz#78e5d1cb3f704de1b641e43b76be2d4094f06f81"
4466+
dependencies:
4467+
arrify "^1.0.0"
4468+
chalk "^2.3.0"
4469+
diff "^3.1.0"
4470+
make-error "^1.1.1"
4471+
minimist "^1.2.0"
4472+
mkdirp "^0.5.1"
4473+
source-map-support "^0.5.3"
4474+
yn "^2.0.0"
4475+
44454476
tslib@^1.9.0:
44464477
version "1.9.0"
44474478
resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
@@ -4470,7 +4501,7 @@ typedarray@^0.0.6:
44704501
version "0.0.6"
44714502
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
44724503

4473-
typescript@^2.6.2:
4504+
typescript@^2.6.2, typescript@^2.7.2:
44744505
version "2.7.2"
44754506
resolved "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836"
44764507

@@ -4678,3 +4709,7 @@ yargs@~3.10.0:
46784709
cliui "^2.1.0"
46794710
decamelize "^1.0.0"
46804711
window-size "0.1.0"
4712+
4713+
yn@^2.0.0:
4714+
version "2.0.0"
4715+
resolved "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"

0 commit comments

Comments
 (0)