Skip to content

Commit 9d666b2

Browse files
jthegedusDeMoorJasper
authored andcommitted
update Hyperapp example (parcel-bundler#32)
* add prettier & husky precommit * update hyperapp example * Update readme * add readme link
1 parent f34b550 commit 9d666b2

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ yarn start
3636

3737
### [HyperApp](https://hyperapp.js.org/)
3838

39-
- [Simple example](hyperapp)
39+
- [Simple JS example](hyperapp)

hyperapp/.babelrc

-5
This file was deleted.

hyperapp/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Parcel Hyperapp Example
2+
3+
Since Parcel has out of the box support for JSX there's no added config required for Hyperapp to work
4+
5+
The only special thing in this example is the use of Parcel's Absolute Path Module Resolution to avoid relative imports.
6+
7+
## Further Reading
8+
9+
- [Hyperapp docs](https://github.com/jorgebucaran/hyperapp#hyperapp)
10+
- [Parcel's Absolute Path Module Resolution](https://parceljs.org/module_resolution.html)

hyperapp/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"name": "parcel-hyperapp-example",
3-
"version": "1.0.0",
43
"description": "Simple Hyperapp example",
4+
"version": "1.0.0",
5+
"main": "src/App.js",
6+
"license": "MIT",
57
"scripts": {
6-
"start": "parcel index.html --open"
8+
"start": "parcel src/index.html --open",
9+
"build": "parcel build src/index.html"
710
},
811
"dependencies": {
9-
"hyperapp": "^1.0.1"
12+
"hyperapp": "^1.2.9"
1013
},
1114
"devDependencies": {
12-
"babel-preset-env": "^1.6.1",
13-
"babel-preset-hyperapp": "^2.3.0",
14-
"parcel-bundler": "^1.6.1"
15+
"parcel-bundler": "^1.10.3"
1516
}
1617
}

hyperapp/index.html hyperapp/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<meta charset="UTF-8"/>
55
</head>
66
<body>
7-
<script src="src/main.js"></script>
7+
<script src="/main.js"></script>
88
</body>
99
</html>

hyperapp/src/main.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { app } from 'hyperapp';
2-
import view from './App';
1+
import { app } from 'hyperapp'
2+
import view from '/App'
33

44
const state = {
55
count: 0
6-
};
6+
}
77

88
const actions = {
99
down: () => state => ({ count: state.count - 1 }),
1010
up: () => state => ({ count: state.count + 1 })
11-
};
11+
}
1212

13-
app(state, actions, view, document.body);
13+
app(state, actions, view, document.body)

0 commit comments

Comments
 (0)