Skip to content

Commit ffce83d

Browse files
committed
init
0 parents  commit ffce83d

File tree

10 files changed

+275
-0
lines changed

10 files changed

+275
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
tutorial/.tmp.*

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# CodeRoad Redux JS Tutorial
2+
3+
A [CodeRoad](https://coderoad.github.io) tutorial for learning Redux.
4+
5+
6+
## CodeRoad
7+
8+
CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. Learn more at [CodeRoad.io](http://coderoad.io).
9+
10+
11+
## Setup
12+
13+
* install the tutorial package
14+
15+
`npm install --save coderoad-redux-js`
16+
17+
* install and run the [atom-coderoad](https://github.com/coderoad/atom-coderoad) plugin
18+
19+
20+
## Outline
21+
22+
##### Project Setup
23+
24+
Getting your project directory setup.
25+
26+
1. Install package dependencies
27+
2. Create an output directory called "dist"
28+
3. Install "concurrently" & "browser-sync" globally
29+
4. Run our app in the browser
30+
31+
You may want to consider installing the atom package ["platformio-ide-terminal"](https://github.com/platformio/platformio-atom-ide-terminal), which provides a terminal inside your editor.
32+
33+
##### The Store
34+
35+
The "single source of truth".

coderoad.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"info": {
3+
"title": "CodeRoad Redux JS Tutorial",
4+
"description": "A [CodeRoad](https://coderoad.github.io) tutorial for learning Redux."
5+
},
6+
"pages": [
7+
{
8+
"title": "Project Setup",
9+
"description": "Getting your project directory setup.\n\n1. Install package dependencies\n2. Create an output directory called \"dist\"\n3. Install \"concurrently\" & \"browser-sync\" globally\n4. Run our app in the browser\n\nYou may want to consider installing the atom package [\"platformio-ide-terminal\"](https://github.com/platformio/platformio-atom-ide-terminal), which provides a terminal inside your editor.",
10+
"tasks": [
11+
{
12+
"description": "in a terminal run `> npm run setup`",
13+
"tests": [
14+
"01/01"
15+
],
16+
"hints": [
17+
"in a terminal run `npm run setup` to get setup"
18+
],
19+
"actions": [
20+
"open('package.json')",
21+
"set('{\n \"name\": \"coderoad-redux-js\",\n \"version\": \"0.1.0\",\n \"description\": \"Coderoad tutorial for using redux with raw javascript\",\n \"bugs\": {\n \"url\": \"https://github.com/shmck/coderoad-redux-js\"\n },\n \"license\": \"ISC\",\n \"author\": \"Shawn McKay <shawn.j.mckay@gmail.com>\",\n \"main\": \"index.js\",\n \"repository\": \"https://github.com/shmck/coderoad-redux-js\",\n \"scripts\": {\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"config\": {\n \"language\": \"JS\",\n \"runner\": \"mocha-coderoad\"\n },\n \"dependencies\": {\n \"mocha-coderoad\": \"latest\"\n },\n \"devDependencies\": {\n \"babel-preset-es2015\": \"^6.9.0\",\n \"babel-preset-react\": \"^6.11.1\",\n \"babelify\": \"^7.3.0\",\n \"browser-sync\": \"^2.13.0\",\n \"concurrently\": \"^2.2.0\",\n \"npm-watch\": \"^0.1.5\"\n },\n \"watch\": {\n \"reload\": {\n \"patterns\": [\n \"src\"\n ],\n \"extensions\": \"js,jsx,css,html,scss\",\n \"ignore\": \"node_modules\",\n \"quiet\": false\n }\n },\n \"scripts\": {\n \"browserify\": \"browserify src/index.js --extension=.jsx -o dist/bundle.js -t [ babelify --presets [ es2015 react ] ]\",\n \"browsersync:reload\": \"browser-sync reload\",\n \"browsersync:start\": \"browser-sync start --server --files 'index.html dist/bundle.js'\",\n \"build\": \"npm run browserify\",\n \"reload\": \"npm run browserify && npm run browsersync:reload\",\n \"start\": \"concurrently --kill-others 'npm run build' 'npm run browsersync:start' 'npm run watch'\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n \"watch\": \"npm-watch\",\n \"setup\": \"npm install && mkdir -p dist && npm i -g concurrently browser-sync && npm start\"\n }\n}\n')"
22+
]
23+
}
24+
],
25+
"onPageComplete": "Continue to start working with Redux"
26+
},
27+
{
28+
"title": "The Store",
29+
"description": "The \"single source of truth\".",
30+
"tasks": [
31+
{
32+
"description": "write a function `divideOne` divides a number by 1",
33+
"tests": [
34+
"02/01"
35+
],
36+
"actions": [
37+
"open('page-02.js')",
38+
"set('// divideOne\nfunction divideOne(x) {\n return ::>\n}\n')"
39+
]
40+
},
41+
{
42+
"description": "write a function `mutiplyone` that multiplies a number by 1",
43+
"tests": [
44+
"02/02"
45+
],
46+
"actions": [
47+
"insert('\n// multiplyOne\nfunction multiplyOne(x) {\n return ::>\n}\n')"
48+
]
49+
}
50+
]
51+
}
52+
]
53+
}

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "coderoad-redux-js",
3+
"version": "0.1.0",
4+
"description": "Coderoad tutorial for using redux with raw javascript",
5+
"bugs": {
6+
"url": "https://github.com/shmck/coderoad-redux-js"
7+
},
8+
"license": "ISC",
9+
"author": "Shawn McKay <shawn.j.mckay@gmail.com>",
10+
"main": "index.js",
11+
"repository": "https://github.com/shmck/coderoad-redux-js",
12+
"scripts": {
13+
"test": "echo \"Error: no test specified\" && exit 1"
14+
},
15+
"config": {
16+
"language": "JS",
17+
"runner": "mocha-coderoad"
18+
},
19+
"dependencies": {
20+
"mocha-coderoad": "latest"
21+
}
22+
}

tutorial/01/01.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var expect = require('chai').expect;
2+
const { statSync } = require('fs');
3+
4+
/// load('package.json')
5+
6+
describe('01 setup', () => {
7+
8+
it('dist directory doesn\'t exist. Run `npm run setup`', () => {
9+
expect(statSync('dist')).to.be.true;
10+
});
11+
12+
it('hasn\'t installed any dependencies. Run `npm run setup`', () => {
13+
expect(statSync('node_modules')).to.be.true;
14+
});
15+
16+
});

tutorial/01/index.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## Project Setup
2+
Getting your project directory setup.
3+
4+
1. Install package dependencies
5+
2. Create an output directory called "dist"
6+
3. Install "concurrently" & "browser-sync" globally
7+
4. Run our app in the browser
8+
9+
You may want to consider installing the atom package ["platformio-ide-terminal"](https://github.com/platformio/platformio-atom-ide-terminal), which provides a terminal inside your editor.
10+
11+
+ in a terminal run `> npm run setup`
12+
@test('01/01')
13+
@hint('in a terminal run `npm run setup` to get setup')
14+
@action(open('package.json'))
15+
@action(set(
16+
```
17+
{
18+
"name": "coderoad-redux-js",
19+
"version": "0.1.0",
20+
"description": "Coderoad tutorial for using redux with raw javascript",
21+
"bugs": {
22+
"url": "https://github.com/shmck/coderoad-redux-js"
23+
},
24+
"license": "ISC",
25+
"author": "Shawn McKay <shawn.j.mckay@gmail.com>",
26+
"main": "index.js",
27+
"repository": "https://github.com/shmck/coderoad-redux-js",
28+
"scripts": {
29+
"test": "echo \"Error: no test specified\" && exit 1"
30+
},
31+
"config": {
32+
"language": "JS",
33+
"runner": "mocha-coderoad"
34+
},
35+
"dependencies": {
36+
"mocha-coderoad": "latest"
37+
},
38+
"devDependencies": {
39+
"babel-preset-es2015": "^6.9.0",
40+
"babel-preset-react": "^6.11.1",
41+
"babelify": "^7.3.0",
42+
"browser-sync": "^2.13.0",
43+
"concurrently": "^2.2.0",
44+
"npm-watch": "^0.1.5"
45+
},
46+
"watch": {
47+
"reload": {
48+
"patterns": [
49+
"src"
50+
],
51+
"extensions": "js,jsx,css,html,scss",
52+
"ignore": "node_modules",
53+
"quiet": false
54+
}
55+
},
56+
"scripts": {
57+
"browserify": "browserify src/index.js --extension=.jsx -o dist/bundle.js -t [ babelify --presets [ es2015 react ] ]",
58+
"browsersync:reload": "browser-sync reload",
59+
"browsersync:start": "browser-sync start --server --files 'index.html dist/bundle.js'",
60+
"build": "npm run browserify",
61+
"reload": "npm run browserify && npm run browsersync:reload",
62+
"start": "concurrently --kill-others 'npm run build' 'npm run browsersync:start' 'npm run watch'",
63+
"test": "echo \"Error: no test specified\" && exit 1",
64+
"watch": "npm-watch",
65+
"setup": "npm install && mkdir -p dist && npm i -g concurrently browser-sync && npm start"
66+
}
67+
}
68+
```
69+
))
70+
71+
@onPageComplete('Continue to start working with Redux')

tutorial/02/01.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var expect = require('chai').expect;
2+
3+
/// load('page-02.js')
4+
5+
describe('01 divideOne', function() {
6+
7+
it('doesn\'t exist', function () {
8+
expect(divideOne).to.be.defined;
9+
});
10+
11+
it('should take a parameter', function() {
12+
expect(divideOne).to.have.length(1);
13+
});
14+
15+
it('doesn\'t output a number', function () {
16+
expect(divideOne(1)).to.be.a('number');
17+
});
18+
19+
it('returns the same number', function() {
20+
expect(divideOne(1)).to.equal(1);
21+
expect(divideOne(10)).to.equal(10);
22+
});
23+
24+
});

tutorial/02/02.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
describe('02 multiplyOne', function() {
2+
3+
it('doesn\'t exist', function () {
4+
expect(multiplyOne).to.be.defined;
5+
});
6+
7+
it('should take a parameter', function() {
8+
expect(multiplyOne).to.have.length(1);
9+
});
10+
11+
it('should output a number', function () {
12+
expect(multiplyOne(1)).to.be.a('number');
13+
});
14+
15+
it('returns the multiplied number by one', function() {
16+
expect(multiplyOne(1)).to.equal(1);
17+
expect(multiplyOne(10)).to.equal(10);
18+
});
19+
20+
});

tutorial/02/index.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## The Store
2+
The "single source of truth".
3+
4+
+ write a function `divideOne` divides a number by 1
5+
@test('02/01')
6+
@action(open('page-02.js'))
7+
@action(set(
8+
```
9+
// divideOne
10+
function divideOne(x) {
11+
return ::>
12+
}
13+
```
14+
))
15+
16+
+ write a function `mutiplyone` that multiplies a number by 1
17+
@test('02/02')
18+
@action(insert(
19+
```
20+
21+
// multiplyOne
22+
function multiplyOne(x) {
23+
return ::>
24+
}
25+
```
26+
))

tutorial/tutorial.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# CodeRoad Redux JS Tutorial
2+
3+
A [CodeRoad](https://coderoad.github.io) tutorial for learning Redux.
4+
5+
@import('01')
6+
@import('02')

0 commit comments

Comments
 (0)