|
1 |
| -# Challenges |
2 | 1 |
|
3 |
| -The `seed` directory contains all the challenges that appear on the freeCodeCamp learning platform. |
| 2 | +This directory contains code and data to "seed" the Mongo database with challenges. |
4 | 3 |
|
5 |
| -For each challenge section, there is a JSON file (fields documented below) containing its name, seed HTML, tests, and so on. |
6 |
| - |
7 |
| -## Usage |
8 |
| - |
9 |
| -|command|description| |
10 |
| -|---|---| |
11 |
| -| `npm run test-challenges` | run all challenge tests (for each challenge JSON file, run all `tests` against all `solutions`) | |
12 |
| -| `npm run test` | run all JS tests in the system, including client, server, lint and challenge tests | |
13 |
| -| `npm run seed` <br> (<small>or</small> `node seed`) | parses all the challenge JSON files and saves them into MongoDB (code is inside [index.js](index.js)) | |
14 |
| -| `npm run commit` | interactive tool to help you build a good commit message | |
15 |
| -| `npm run unpack` | extract challenges from `seed/challenges` into `unpacked` subdirectory, one HTML page per challenge | |
16 |
| -| `npm run repack` | repack challenges from `unpacked` subdirectory into `seed/challenges` | |
17 |
| - |
18 |
| -### unpack and repack |
19 |
| - |
20 |
| -`npm run unpack` extracts challenges into separate files for easier viewing and editing. The files are `.gitignore`d and will *not* be checked in, and all mongo seed importing will keep using the existing system; this is essentially a tool for editing `challenge.json` files. These HTML files are self-contained and run their own tests -- open a browser JS console to see the test results. |
21 |
| - |
22 |
| -`npm run repack` gathers up the unpacked/edited HTML files into challenge-block JSON files. Use `git diff` to see the changes. |
23 |
| - |
24 |
| -When editing the unpacked files, you must only edit lines between comment fences like `<!--description-->` and `<!--end-->`. In descriptions, you can insert a paragraph break with `<!--break-->`. |
25 |
| - |
26 |
| -Unpacked lines that begin with `//--JSON:` are parsed and inserted verbatim. |
27 |
| - |
28 |
| -## Links |
29 |
| - |
30 |
| -* [Challenge Style Guide](challenge-style-guide.md) - how to create and format challenges |
31 |
| -* [Contributing to FreeCodeCamp - Writing ES6 Challenge Tests |
32 |
| -](https://www.youtube.com/watch?v=iOdD84OSfAE#t=2h49m55s) - a video following [Ethan Arrowood](https://twitter.com/ArrowoodTech) as he contributes to the curriculum |
33 |
| -* [Challenge schema](../common/models/challenge.json) - lists all of the fields inside challenge, and describes some of them |
34 |
| -* [Challenge types](../common/ap/utils/challengeTypes.js) - what the numeric challenge type values mean (enum) |
35 |
| - |
36 |
| - |
37 |
| -## Challenge Template |
38 |
| - |
39 |
| -``` |
40 |
| -{ |
41 |
| - "id": "unique identifier (alphanumerical, mongodb id)", |
42 |
| - "title": "Challenge Title", |
43 |
| - "description": [ |
44 |
| - "Challenge description.", |
45 |
| - "An new string in the array will create a new paragraph." |
46 |
| - ], |
47 |
| - "releasedOn": "date formatted like: January 1, 2016", |
48 |
| - "challengeSeed": [ |
49 |
| - "// code displayed in the editor by default", |
50 |
| - "// a new string in the array is a new line" |
51 |
| - ], |
52 |
| - "solutions": [ |
53 |
| - "at least one code solution that passes the tests below, used for automated testing (and inspiration for students)." |
54 |
| - ], |
55 |
| - "tests": [ |
56 |
| - "an array of assert tests that check if the user's solution is working", |
57 |
| - "assert(aFunction('argument') === 'result', 'message: This message explains what the test is testing');", |
58 |
| - ], |
59 |
| - "type": "string identifying type of challenge. takes priority for viewType", |
60 |
| - "challengeType": "number identifying type of challenge (step, project, normal). takes priority for submitType", |
61 |
| - "isRequired": "boolean value that indicates whether challenge is required for certificate", |
62 |
| - "translations": { |
63 |
| - "language-code": { |
64 |
| - "title": "The Title in a Different Language", |
65 |
| - "description": [ |
66 |
| - "The description in a different language." |
67 |
| - ] |
68 |
| - } |
69 |
| - } |
70 |
| -}, |
71 |
| -``` |
| 4 | +See the main [CONTRIBUTING](../CONTRIBUTING.md) file for instructions and details. |
0 commit comments