|
1 | 1 | # CodeRoad CLI
|
2 |
| -Command line interface for [CodeRoad](http://coderoad.github.io). |
| 2 | +Command line interface for [CodeRoad](http://coderoad.github.io). See the [docs](https://coderoad.github.io/docs) for more. |
3 | 3 |
|
4 |
| -## Setup |
| 4 | +### Install |
5 | 5 |
|
6 |
| -``` |
7 |
| -> npm install -g coderoad-cli |
8 |
| -``` |
9 |
| - |
10 |
| -## Tutorial Development |
11 |
| - |
12 |
| -##### Development |
13 |
| - |
14 |
| -* In your development directory, run `> coderoad create $NAME$` |
15 |
| -* Run `> npm link` to create a symbolic link to your project |
16 |
| -* Update changes to your tutorial by running `> coderoad build` |
| 6 | +Use [CodeRoad CLI](https://github.com/coderoad/coderoad-cli) to setup and build a project data file. |
17 | 7 |
|
18 |
| -##### Viewing/Testing your Tutorial |
| 8 | +* Install *CodeRoad-CLI*. Make sure [NodeJS](nodejs.org) is already installed |
19 | 9 |
|
20 |
| -* Open a new directory and run `> npm init` |
21 |
| -* Add your package name to the `dependencies` in `package.json`: |
22 |
| - |
23 |
| -``` |
24 |
| -"dependencies": { |
25 |
| - "coderoad-$NAME$": "^0.1.0" |
26 |
| - } |
27 |
| -``` |
| 10 | + > npm install -g coderoad-cli |
28 | 11 |
|
29 |
| -* Run `> npm link coderoad-$NAME$` & `> npm install`. This will install a package link pointing at your development tutorial. |
30 |
| -* Open [atom-coderoad](https://github.com/coderoad/atom-coderoad) to view your tutorial. Your package should appear as a loaded package. |
31 |
| -* Reload Atom if necessary (cmd + shift + P, type "reload", enter) |
32 |
| - |
33 |
| -## Commands |
34 |
| -- create [name] |
35 |
| -- build [tutorial.md] |
36 |
| -- publish [version] _currently instructions only_ |
37 |
| -- tutorials _coming soon_ |
38 |
| -- search [query] _currently instructions only_ |
39 |
| -- docs |
40 |
| -- help |
41 | 12 |
|
42 | 13 | ### Create
|
43 | 14 |
|
44 |
| -"create" gets you started building your tutorial. |
| 15 | +Get setup quickly with CodeRoad: either [clone a tutorial repo](https://git-scm.com/docs/git-clone) or use the *CodeRoad-CLI*. |
45 | 16 |
|
46 |
| -``` |
47 |
| -> coderoad create $my-tutorial-name$ |
48 |
| -``` |
| 17 | +In your development directory, run **create** with your new package name. |
49 | 18 |
|
50 |
| -"create" generates: |
| 19 | + > coderoad create $YOUR-PACKAGE-NAME$ |
51 | 20 |
|
52 |
| -* a `package.json` configuration with the following settings: |
| 21 | +Running **create** generates: |
53 | 22 |
|
54 |
| -``` |
| 23 | +* an example `tutorial.md`, which imports several tutorial files |
| 24 | +* an example `test` directory with a few example tests |
| 25 | +* a `package.json` configuration with some of the following settings: |
| 26 | + |
| 27 | +```json |
| 28 | +{ |
55 | 29 | "name": "coderoad-$TUTORIAL-NAME$",
|
| 30 | + "version": "0.1.0", |
| 31 | + "description": "Coderoad tutorial", |
| 32 | + "author": "Name <email> (site)", |
56 | 33 | "main": "coderoad.json",
|
57 | 34 | "keywords": ["coderoad", "tutorial"],
|
| 35 | + "dependencies": { |
| 36 | + "mocha-coderoad": "^0.3.1" |
| 37 | + }, |
58 | 38 | "coderoad": {
|
59 | 39 | "testDir": "test",
|
60 |
| - "testSuffix": ".spec.js" |
61 |
| - } |
| 40 | + "testSuffix": ".spec.js", |
| 41 | + "testRunner": "mocha-coderoad" |
| 42 | + } |
| 43 | +} |
62 | 44 | ```
|
63 | 45 |
|
64 |
| -* an example `tutorial.md` file & tutorial directory |
65 |
| -* an example `test` directory with a few example tests |
| 46 | +We'll learn more about these configurations when it's time to [publish](#publish). |
66 | 47 |
|
67 |
| -Feel free to fill out the "author" or "authors" field, and add any additional |
68 |
| -project related keywords. |
| 48 | +Update changes to your tutorial by running **build**. This will generate a *coderoad.json* data file used by *atom-coderoad*. |
69 | 49 |
|
70 |
| -### Build |
| 50 | + > coderoad build |
71 | 51 |
|
72 |
| -"build" compiles your markdown tutorial into a data file called `coderoad.json`. |
| 52 | +### Demo Your Tutorial |
73 | 53 |
|
74 |
| -"build" defaults to `tutorial/tutorial.md`. Optionally specify the path to your tutorial markdown file. |
| 54 | +Open a new directory for demoing your tutorial. Setup a new NPM project file. |
75 | 55 |
|
| 56 | + > npm init |
| 57 | + |
| 58 | +Add your package name to the `dependencies` in `package.json`: |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "dependencies": { |
| 63 | + "coderoad-$YOUR-PACKAGE-NAME$": "^0.1.0" |
| 64 | + } |
| 65 | +} |
76 | 66 | ```
|
77 |
| -> coderoad build |
78 |
| -> coderoad build $path/to/tutorial.md$ |
79 |
| -``` |
80 | 67 |
|
81 |
| -"build" also generates a `README.md` with an outline of your chapters & pages |
82 |
| -as well as an explanation of how to setup your tutorial. |
| 68 | +Normally you would use `npm install` to install the package, but your package isn't ready to be published yet. Instead, you need to link your tutorial package to your demo directory. |
| 69 | + |
| 70 | +### Link Your Demo & Tutorial |
| 71 | + |
| 72 | +[NPM link](https://docs.npmjs.com/cli/link) creates a symbolic link between directories. This allows your demo directory to always load your tutorial package. |
| 73 | + |
| 74 | +Inside of your tutorial root directory, run link. |
| 75 | + |
| 76 | + > npm link |
| 77 | + |
| 78 | +Inside of your demo root directory, connect the link. |
| 79 | + |
| 80 | + > npm link coderoad-$YOUR-PACKAGE-NAME$ |
| 81 | + > npm install |
| 82 | + |
| 83 | + |
| 84 | +### Using Atom |
| 85 | + |
| 86 | +Open *Atom-Coderoad* to view your tutorial. Your package should appear as a loaded package. Click on it. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +Reload *Atom* to view changes. You can use the Atom [command-palette](https://atom.io/docs/latest/getting-started-atom-basics#command-palette) to find "reload" or simply use the reload hot-key. |
| 91 | + |
| 92 | +* Windows & Linux: alt-ctrl-r |
| 93 | +* Mac: ctrl-alt-cmd-l |
0 commit comments