I'd *really* like to use python for this, but python in the browser just isn't a thing yet. I looked at ipython notebook and bokeh, but they both seem to need a server running python for the page to work. I really want this to be a static html page, with *all* the logic client-side.
Given that I have to use javascript (boo) and that I'm not very experienced in that realm, I took some time to research tooling. I think yeoman is a pretty good indicator of what the frontend community considers to be a good toolset, and I very much like the ideas behind the react project (state mutation is constrained to tiny parts of the data flow), so I looked for a yeoman react generator. There were a whole bunch: http://yeoman.io/generators/. I filtered on "react", sorted by stars, opened up the top ten or so. I then evaluated on these criteria:
- Recent commits? I want to use a project that's alive, in case I want to submit fixes.
- Project age? I don't really want to use someone's weekend project.
- Issue count? This is a rough gauge of user engagement. People don't file tickets against projects they don't use.
- Issue close ratio? I've noticed that well-loved projects always have below a 1:2 open/closed ratio.
If I had familiarity with the node/react ecosystem, I'd be more discerning by feature set, but since I'm a complete newcomer, I'm aiming for the very lowest-common-denominator. Even given all those criteria, I still have four projects left:
These differ a bit in tooling, so I'll research a bit there:
I use homebrew to get my project started on OSX. On linux I use linuxbrew which seems to work just as well.
brew install nvm
source $(brew --prefix nvm)/nvm.sh
nvm install iojs
nvm use iojs
node --version
# v2.0.1
node -h
# Usage: iojs ...
npm install yo generator-react-webpack
export PATH=$PWD/node_modules/.bin:$PATH
yo react-webpack simplish-webpage
# I chose: react-router, reflux, scss npm install grunt-cli
grunt serve
This brings up a little, mostly empty webpage. Cool. This seems like a fair basis for a project. Let's check it in.
git init
git commit --allow-empty -m '(empty)'
git add .
git commit -m 'generated via yo react-webpack'
- node vs io.js: This is basically corporate vs developer, so I'm going with the developer fork (io.js).
- grunt vs gulp: Gulp is newer and the API seems better designed. The only drawback is it might be too new, but I see the version is up to 3.0 already.
- flux vs reflux: Reflux is newer and the API seems better designed.
- mocha vs jasmine vs jest: Jest is newest and by the same people as React (facebook). It has built-in support for JSX (the language also invented by facebook/React), but it's auto-mock-everything and fake-dom features seem like terrible ideas I've seen before. I'd rather use phantomjs and less mocking. Mocha is more of a do-one-thing-well test runner while Jasmine also has mocking and assertions built in. I'd prefer Mocha, but Jasmine seems fine.
I use homebrew to get my project started on OSX. On linux I use linuxbrew which seems to work just as well.
brew install nvm
source $(brew --prefix nvm)/nvm.sh
nvm install iojs
nvm use iojs
node --version
# v2.0.1
node -h
# Usage: iojs ...
npm install yo generator-react-webpack
export PATH=$PWD/node_modules/.bin:$PATH
yo react-webpack simplish-webpage
# I chose: react-router, reflux, scss npm install grunt-cli
grunt serve
This brings up a little, mostly empty webpage. Cool. This seems like a fair basis for a project. Let's check it in.
git init
git commit --allow-empty -m '(empty)'
git add .
git commit -m 'generated via yo react-webpack'
(To Be Continued...)
No comments:
Post a Comment