Skip to content

Commit 2ac8c4a

Browse files
committed
progress on 01-setup
1 parent ffce83d commit 2ac8c4a

File tree

6 files changed

+63
-16
lines changed

6 files changed

+63
-16
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@ CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. L
2121

2222
##### Project Setup
2323

24-
Getting your project directory setup.
24+
Getting a project setup is rarely easy. Luckily, we have a quick script that can do the work for us.
2525

26-
1. Install package dependencies
26+
---
27+
28+
Running `> npm run setup` will do the following:
29+
30+
1. Install package dev dependencies
2731
2. Create an output directory called "dist"
2832
3. Install "concurrently" & "browser-sync" globally
2933
4. Run our app in the browser
3034

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.
35+
You'll find this "setup" script located in your *package.json*.
36+
37+
---
38+
39+
We'll be installing a lot of scripts from terminal. You may also 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.
3240

3341
##### The Store
3442

coderoad.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"pages": [
77
{
88
"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.",
9+
"description": "Getting a project setup is rarely easy. Luckily, we have a quick script that can do the work for us.\n\n---\n\nRunning `> npm run setup` will do the following:\n\n1. Install package dev dependencies\n2. Create an output directory called \"dist\"\n3. Install \"concurrently\" & \"browser-sync\" globally\n4. Run our app in the browser\n\nYou'll find this \"setup\" script located in your *package.json*.\n\n---\n\nWe'll be installing a lot of scripts from terminal. You may also 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.",
1010
"tasks": [
1111
{
12-
"description": "in a terminal run `> npm run setup`",
12+
"description": "Open a terminal in this project directory and run `npm run setup`.",
1313
"tests": [
1414
"01/01"
1515
],
1616
"hints": [
17-
"in a terminal run `npm run setup` to get setup"
17+
"Open a terminal in this project directory and run `npm run setup` to get setup"
1818
],
1919
"actions": [
2020
"open('package.json')",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
"dependencies": {
2020
"mocha-coderoad": "latest"
2121
}
22-
}
22+
}

test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { accessSync, F_OK } = require('fs');
2+
3+
function exists(path, silent = true) {
4+
try {
5+
accessSync(path, F_OK);
6+
} catch (e) {
7+
if (e) {
8+
if (!silent) {
9+
console.log(e);
10+
}
11+
return false;
12+
}
13+
}
14+
return true;
15+
}
16+
17+
console.log(exists('dist'));

tutorial/01/01.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
var expect = require('chai').expect;
2-
const { statSync } = require('fs');
2+
const { accessSync, F_OK } = require('fs');
33

4-
/// load('package.json')
4+
// must include function to check before deps are added
5+
function exists(path, silent = true) {
6+
try {
7+
accessSync(path, F_OK);
8+
} catch (e) {
9+
if (e) {
10+
if (!silent) {
11+
console.log(e);
12+
}
13+
return false;
14+
}
15+
}
16+
return true;
17+
}
518

619
describe('01 setup', () => {
720

821
it('dist directory doesn\'t exist. Run `npm run setup`', () => {
9-
expect(statSync('dist')).to.be.true;
22+
expect(exists('dist')).to.be.true;
1023
});
1124

1225
it('hasn\'t installed any dependencies. Run `npm run setup`', () => {
13-
expect(statSync('node_modules')).to.be.true;
26+
expect(exists('node_modules')).to.be.true;
1427
});
1528

1629
});

tutorial/01/index.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
## Project Setup
2-
Getting your project directory setup.
2+
Getting a project setup is rarely easy. Luckily, we have a quick script that can do the work for us.
33

4-
1. Install package dependencies
4+
---
5+
6+
Running `> npm run setup` will do the following:
7+
8+
1. Install package dev dependencies
59
2. Create an output directory called "dist"
610
3. Install "concurrently" & "browser-sync" globally
711
4. Run our app in the browser
812

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.
13+
You'll find this "setup" script located in your *package.json*.
14+
15+
---
16+
17+
We'll be installing a lot of scripts from terminal. You may also 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.
18+
1019

11-
+ in a terminal run `> npm run setup`
20+
+ Open a terminal in this project directory and run `npm run setup`.
1221
@test('01/01')
13-
@hint('in a terminal run `npm run setup` to get setup')
22+
@hint('Open a terminal in this project directory and run `npm run setup` to get setup')
1423
@action(open('package.json'))
1524
@action(set(
1625
```

0 commit comments

Comments
 (0)