Skip to content

Commit bc9d44c

Browse files
Ivy Feracomfdebian
Ivy Feraco
andauthored
feat: adds parsing for learning-objectives (#86)
* fist attempt to add parsing for objectives * changing objectives to behave more like API, adding readme * adding strict * Update README.md Co-authored-by: Alfredo González <[email protected]> * change command to learning-objectives add repo to options * renaming archive * removing unneeded options from command and readme * Apply suggestions from code review Co-authored-by: Alfredo González <[email protected]> * update readme validate instructions * Update README.md Co-authored-by: Alfredo González <[email protected]> * clearer output, exit status fix * options default * adding objectives tests and ixtures * readme correction * take out .only * Apply suggestions from code review Co-authored-by: Alfredo González <[email protected]> --------- Co-authored-by: Alfredo González <[email protected]>
1 parent ea34dc1 commit bc9d44c

File tree

16 files changed

+1281
-14
lines changed

16 files changed

+1281
-14
lines changed

README.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# @laboratoria/curriculum-parser
22

33
Command line tool used to parse content written in markdown at
4-
@Laboratoria (See [Laboratoria/bootcamp](https://github.com/Laboratoria/bootcamp)).
4+
@Laboratoria (See [Laboratoria/curriculum](https://github.com/Laboratoria/curriculum)).
55

66
![Node.js CI](https://github.com/Laboratoria/curriculum-parser/workflows/Node.js%20CI/badge.svg)
77
[![Coverage Status](https://coveralls.io/repos/github/Laboratoria/curriculum-parser/badge.svg?branch=main)](https://coveralls.io/github/Laboratoria/curriculum-parser?branch=main)
@@ -95,10 +95,11 @@ Options:
9595
9696
Commands:
9797
project [options] <dir> Parse a project
98-
topic [options] <dir> Parse a topic
99-
part [options] <dir> Parse a part
100-
challenge [options] <dir> Parse a challenge
101-
help [command] display help for command
98+
topic [options] <dir> Parse a topic
99+
part [options] <dir> Parse a part
100+
challenge [options] <dir> Parse a challenge
101+
learning-objectives [options] <dir> Parse learning objectives
102+
help [command] Display help for command
102103
103104
```
104105

@@ -126,13 +127,13 @@ Options:
126127

127128
## Examples
128129

129-
### Parse a topic within the `Laboratoria/bootcamp` repo
130+
### Parse a topic within the `Laboratoria/curriculum` repo
130131

131132
Parsing a _topic_ and printing the resulting JSON output to `stdout`.
132133

133134
```sh
134135
curriculum-parser topic topics/javascript/ \
135-
--repo Laboratoria/bootcamp \
136+
--repo Laboratoria/curriculum \
136137
--version 5.5.0
137138
```
138139

@@ -141,36 +142,61 @@ Parsing a _topic_ and writing the parser's output (`stdout`) to a file (using
141142

142143
```sh
143144
curriculum-parser topic topics/javascript/ \
144-
--repo Laboratoria/bootcamp \
145+
--repo Laboratoria/curriculum \
145146
--version 5.5.0 \
146147
> "build/topics/javascript.json"
147148
```
148149

149-
### Parse a specific part of a topic within the `Laboratoria/bootcamp` repo
150+
### Parse a specific part of a topic within the `Laboratoria/curriculum` repo
150151

151152
```sh
152153
curriculum-parser part topics/intro-ux/00-que-es-uxd/00-que-es-uxd/ \
153-
--repo Laboratoria/bootcamp \
154+
--repo Laboratoria/curriculum \
154155
--version 5.5.0
155156
```
156157

157-
### Parse a challenge within the `Laboratoria/bootcamp` repo
158+
### Parse a challenge within the `Laboratoria/curriculum` repo
158159

159160
```sh
160161
curriculum-parser challenge topics/javascript/01-basics/06-exercises/01-coin-convert/ \
161-
--repo Laboratoria/bootcamp \
162+
--repo Laboratoria/curriculum \
162163
--version 5.5.0
163164
```
164165

165-
### Parse a project within the `Laboratoria/bootcamp` repo
166+
### Parse a project within the `Laboratoria/curriculum` repo
166167

167168
```sh
168169
curriculum-parser project projects/01-cipher/ \
169-
--repo Laboratoria/bootcamp \
170+
--repo Laboratoria/curriculum \
170171
--version 5.5.0 \
171172
--lo=./learning-objectives
172173
```
173174

175+
### Parse learning objectives within `Laboratoria/curriculum`
176+
177+
```text
178+
Usage: curriculum-parser learning-objectives [options] <dir>
179+
180+
Parse learning objectives
181+
182+
Arguments:
183+
dir path to learning-objectives directory
184+
185+
Options:
186+
--validate Validate and throw errors for objectives missing intl or without title
187+
--strict Used with validate option to only throw error if an objective is missing in
188+
all supported languages
189+
--debug Show error stack traces
190+
-h, --help display help for command
191+
```
192+
193+
```sh
194+
curriculum-parser learning-objectives learning-objectives \
195+
--repo Laboratoria/curriculum \
196+
--validate \
197+
--strict \
198+
> "dist/learning-objectives.json"
199+
174200
## Known tracks
175201

176202
This project contains an array in [`lib/common.js`](./lib/common.js) called

index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import fs from 'node:fs/promises';
44
import path from 'node:path';
55
import { fileURLToPath } from 'node:url';
66
import { program } from 'commander';
7+
import { parseLearningObjectives } from './lib/learning-objectives.js';
78
import { parseProject } from './lib/project.js';
89
import { parseTopic } from './lib/topic.js';
910
import { parsePart } from './lib/part.js';
@@ -85,4 +86,12 @@ program.command('challenge')
8586
.option('--debug', 'Show error stack traces')
8687
.action(createHandler(parseChallenge));
8788

89+
program.command('learning-objectives')
90+
.description('Parse learning objectives')
91+
.argument('<dir>', 'path to learning objectives directory') // note should there be a default here?
92+
.option('--validate', 'Validate and throw errors for objectives missing intl or without title') // question: should we have repo and version ? why?
93+
.option('--strict', 'With validate, only throw errors if objectives are missing in all languages')
94+
.option('--debug', 'Show error stack traces')
95+
.action(createHandler(parseLearningObjectives));
96+
8897
program.parse();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
browser:
2+
- dom:
3+
- selectors
4+
- events
5+
- manipulation
6+
- routing
7+
- storage
8+
- fetch
9+
10+
js:
11+
- data-types:
12+
- primitive
13+
- primitive-vs-non-primitive
14+
- strings
15+
- arrays
16+
- objects
17+
- variables
18+
- conditionals
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# browser/dom/events
2+
3+
browser:
4+
title: Web APIs
5+
6+
browser/dom:
7+
title: DOM (Document Object Model)
8+
9+
browser/dom/selectors:
10+
title: Uso de selectores del DOM
11+
links:
12+
- title: Manipulación del DOM
13+
url: topics/browser/dom/1-dom-methods-selection
14+
- title: Introducción al DOM - MDN
15+
url: https://developer.mozilla.org/es/docs/Web/API/Document_Object_Model/Introduction
16+
- title: Localizando elementos DOM usando selectores - MDN
17+
url: https://developer.mozilla.org/es/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors
18+
19+
browser/dom/manipulation:
20+
title: Manipulación dinámica del DOM
21+
links:
22+
- title: Introducción al DOM
23+
url: https://developer.mozilla.org/es/docs/Web/API/Document_Object_Model/Introduction
24+
- title: Node.appendChild() - MDN
25+
url: https://developer.mozilla.org/es/docs/Web/API/Node/appendChild
26+
- title: Document.createElement() - MDN
27+
url: https://developer.mozilla.org/es/docs/Web/API/Document/createElement
28+
- title: Document.createTextNode()
29+
url: https://developer.mozilla.org/es/docs/Web/API/Document/createTextNode
30+
- title: Element.innerHTML - MDN
31+
url: https://developer.mozilla.org/es/docs/Web/API/Element/innerHTML
32+
- title: Node.textContent - MDN
33+
url: https://developer.mozilla.org/es/docs/Web/API/Node/textContent
34+
35+
browser/routing:
36+
title: Ruteado (History API, evento hashchange, window.location)
37+
links:
38+
- title: Manipulando el historial del navegador - MDN
39+
url: https://developer.mozilla.org/es/docs/DOM/Manipulando_el_historial_del_navegador
40+
41+
browser/storage:
42+
title: Browser storage (localStorage, sessionStorage)
43+
links:
44+
- title: Window.localStorage - MDN
45+
url: https://developer.mozilla.org/es/docs/Web/API/Window/localStorage
46+
47+
browser/fetch:
48+
title: Fetch API
49+
links:
50+
- title: Fetch API - MDN
51+
url: https://developer.mozilla.org/es/docs/Web/API/Fetch_API
52+
53+
js:
54+
title: JavaScript
55+
56+
js/data-types:
57+
title: Tipos de datos
58+
59+
js/data-types/primitive:
60+
title: Tipos de datos primitivos
61+
links:
62+
- title: Valores primitivos - MDN
63+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Data_structures#valores_primitivos
64+
65+
js/data-types/strings:
66+
title: Strings (cadenas de caracteres)
67+
links:
68+
- title: Strings
69+
url: topics/javascript/strings
70+
- title: String — Cadena de caracteres - MDN
71+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/String
72+
73+
js/data-types/arrays:
74+
title: Arrays (arreglos)
75+
links:
76+
- title: Arreglos
77+
url: topics/javascript/arrays
78+
- title: Array - MDN
79+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/
80+
- title: Array.prototype.sort() - MDN
81+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
82+
- title: Array.prototype.forEach() - MDN
83+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
84+
- title: Array.prototype.map() - MDN
85+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/map
86+
- title: Array.prototype.filter() - MDN
87+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
88+
- title: Array.prototype.reduce() - MDN
89+
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
90+
91+
js/data-types/objects:
92+
title: Objetos (key, value)
93+
links:
94+
- title: Objetos en JavaScript
95+
url: topics/javascript/objects/objects
96+
97+
js/data-types/primitive-vs-non-primitive:
98+
title: Diferenciar entre tipos de datos primitivos y no primitivos
99+
100+
js/variables:
101+
title: Variables (declaración, asignación, ámbito)
102+
links:
103+
- title: Valores, tipos de datos y operadores
104+
url: topics/javascript/basics/values-variables-and-types
105+
- title: Variables
106+
url: topics/javascript/basics/variables
107+
108+
js/conditionals:
109+
title: Uso de condicionales (if-else, switch, operador ternario, lógica booleana)
110+
links:
111+
- title: Estructuras condicionales y repetitivas
112+
url: topics/javascript/flow-control/conditionals-and-loops
113+
- title: Tomando decisiones en tu código — condicionales - MDN
114+
url: https://developer.mozilla.org/es/docs/Learn/JavaScript/Building_blocks/conditionals
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# browser/dom/events
2+
3+
browser:
4+
title: Web APIs
5+
6+
browser/dom:
7+
title: DOM (Document Object Model)
8+
9+
browser/dom/selectors:
10+
title: Uso de seletores de DOM
11+
links:
12+
- title: Modificando o DOM
13+
url: topics/browser/dom/1-dom-methods-selection
14+
- title: Introdução ao DOM - MDN
15+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Document_Object_Model/Introduction
16+
- title: Locating DOM elements using selectors - MDN
17+
url: https://developer.mozilla.org/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors
18+
19+
browser/dom/manipulation:
20+
title: Manipulação dinâmica de DOM
21+
links:
22+
- title: Introdução ao DOM
23+
url: https://developer.mozilla.org/pt-BR/docs/DOM/Referencia_do_DOM/Introdu%C3%A7%C3%A3o
24+
- title: Node.appendChild() - MDN
25+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Node/appendChild
26+
- title: Document.createElement() - MDN
27+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Document/createElement
28+
- title: Document.createTextNode()
29+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Document/createTextNode
30+
- title: Element.innerHTML - MDN
31+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Element/innerHTML
32+
- title: Node.textContent - MDN
33+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Node/textContent
34+
35+
browser/routing:
36+
title: Routing (History API, evento hashchange, window.location)
37+
links:
38+
- title: Manipulando o histórico do navegador - MDN
39+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/History_API
40+
41+
browser/storage:
42+
title: Browser storage (localStorage, sessionStorage)
43+
links:
44+
- title: Window.localStorage - MDN
45+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Window/Window.localStorage
46+
47+
browser/fetch:
48+
title: Fetch API
49+
links:
50+
- title: Fetch API - MDN
51+
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Fetch_API
52+
53+
js:
54+
title: JavaScript
55+
56+
js/data-types:
57+
title: Tipos de dados
58+
59+
js/data-types/primitive:
60+
title: Tipos de dados primitivos
61+
links:
62+
- title: Valores Primitivos - MDN
63+
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Data_structures#valores_primitivos
64+
65+
js/data-types/strings:
66+
title: Strings (cadeias de caracteres)
67+
links:
68+
- title: Strings
69+
url: topics/javascript/strings
70+
- title: String — Cadeia de caracteres - MDN
71+
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/String
72+
73+
js/data-types/arrays:
74+
title: Arrays (arranjos)
75+
links:
76+
- title: Arranjos
77+
url: topics/javascript/arrays
78+
- title: Array - MDN
79+
url: https://developer.mozilla.org//pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/
80+
- title: Array.prototype.sort() - MDN
81+
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
82+
- title: Array.prototype.forEach() - MDN
83+
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
84+
- title: Array.prototype.map() - MDN
85+
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/map
86+
- title: Array.prototype.filter() - MDN
87+
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
88+
- title: Array.prototype.reduce() - MDN
89+
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
90+
91+
js/data-types/objects:
92+
title: Objetos (key, value)
93+
links:
94+
- title: Objetos em JavaScript
95+
url: topics/javascript/objects/objects
96+
97+
js/data-types/primitive-vs-non-primitive:
98+
title: Diferenciar entre tipos de dados primitivos e não primitivos
99+
100+
js/variables:
101+
title: Variáveis (declaração, atribuição, escopo)
102+
links:
103+
- title: Valores, tipos de dados e operadores
104+
url: topics/javascript/basics/values-variables-and-types
105+
- title: Variáveis
106+
url: topics/javascript/basics/variables
107+
108+
js/conditionals:
109+
title: Uso de condicionais (if-else, switch, operador ternário, lógica booleana)
110+
links:
111+
- title: Estruturas condicionais e repetitivas
112+
url: topics/javascript/flow-control/conditionals-and-loops
113+
- title: Tomando decisões no seu código — condicionais - MDN
114+
url: https://developer.mozilla.org/pt-BR/docs/Learn/JavaScript/Building_blocks/conditionals

0 commit comments

Comments
 (0)