freecodecamp-cn-challenges-diff-parser is a simple tool, primarily targeted for freeCodeCamp China developers, contributors and maintainers.
- It takes in two commits hash for comparison. By default, one is from local history, while the other one is from the latest
freecodecamp/curriculumdevbranch.- Note that the earlier commit (i.e. the one from local history) is currently static. Will use the commit off which the latest translation is based from tag tree
- After retrieving the diff of two commits, iterate through the related
.jsonchallenge files, looking for id/title corresponding to the diffs. Then, generate output. - The output includes the following information:
- File path (
new,oldor both) of modified challenges idortitleof modified challenges- Line changes (old code and new cold) of modified challenges, resembles that of
git diff(alternative)
- File path (
// TODO: Publish via npm
git clone https://github.com/FreeCodeCampChina/curriculum-cngit clone https://github.com/FreeCodeCampChina/freecodecamp-cn-challenges-diff-parser
cd freecodecamp-cn-challenges-diff-parsernpm ioryarn install
!important
cd ../curriculum-cngit checkout -b dev-track-en origin/dev-track-en
- Diff parser is within the same level of curriculum-cn
.
├── curriculum-cn
| ├── challenges/
| └── index.js
├── freecodecamp-cn-challenges-diff-parser
| ├── lib/
| └── index.js
|
...
- Diff parser is within the same level of curriculum-cn parent folder
cn(has to becn)
.
├── cn
| ├── curriculum-cn/
| ├── challenges/
| └── index.js
| ...
├── freecodecamp-cn-challenges-diff-parser
| ├── lib/
| └── index.js
|
...
// TODO: Publish via npm
node index.jsnode ${path_to_freecodecamp-cn-challenges-diff-parser}/index.jsnode index.js [--type] [--path] [--debug]- Determine output type, possible values are
titleandid - Defaults to
titlewhen not passed in - Note: when type is given, detailed line changes are suppressed (consider
--typeas--type-only)
- Determine output path type, possible values are
newandold - Defaults to 'both' when not passed in
- Determine whether to show line number for each hunk of code change
node index.jswill output:- Detailed line changes
- Title corresponding to the line changes
- Both new and old file path corresponding to the line changes
node index.js --type=idwill output:- ID corresponding to the line changes
- Both new and old file path corresponding to the line changes
node index.js --type=title --path=newwill output:- Title corresponding to the line changes
- New file path corresponding to the line changes
node index.js --type=title --debugwill output:- Title corresponding to the line changes
- Both new and old file path corresponding to the line changes
- Line number corresponding to the line changes of both old file path and new file path
DiffObjectobject for output
newPath: String<Path>
oldPath: String<Path>
oldFile: Array<String> # The old JSON file split with \n
newFile: Array<String> # The new JSON file split with \n
diffs: Array<ParsedHunk> # Array that contains all parsed diff contentParsedHunk
oldStart: Number # The line number (of old json file) where change happens
newStart: Number # The line number (of old json file) where change happens
data: Array<DiffContent>DiffContent
sign: String # Possible values are ' ', '+' or '-', where ' ' denotes unchanged line of code, '+' denotes code addition and '-' denotes code subtraction
content: String # Line diff- Add eslint
- Verify Node.js version 6.3.0
- Verify corresponding NPM version
- Generate HTML output, pug?
- Add babel
- Set up build process