Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds parsing for objectives #86

Merged
merged 17 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 40 additions & 14 deletions README.md
unjust marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @laboratoria/curriculum-parser

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

![Node.js CI](https://github.com/Laboratoria/curriculum-parser/workflows/Node.js%20CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/Laboratoria/curriculum-parser/badge.svg?branch=main)](https://coveralls.io/github/Laboratoria/curriculum-parser?branch=main)
Expand Down Expand Up @@ -95,10 +95,11 @@ Options:

Commands:
project [options] <dir> Parse a project
topic [options] <dir> Parse a topic
part [options] <dir> Parse a part
challenge [options] <dir> Parse a challenge
help [command] display help for command
topic [options] <dir> Parse a topic
part [options] <dir> Parse a part
challenge [options] <dir> Parse a challenge
learning-objectives [options] <dir> Parse learning objectives
help [command] Display help for command

```

Expand Down Expand Up @@ -126,13 +127,13 @@ Options:

## Examples

### Parse a topic within the `Laboratoria/bootcamp` repo
### Parse a topic within the `Laboratoria/curriculum` repo
unjust marked this conversation as resolved.
Show resolved Hide resolved

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

```sh
curriculum-parser topic topics/javascript/ \
--repo Laboratoria/bootcamp \
--repo Laboratoria/curriculum \
--version 5.5.0
```

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

```sh
curriculum-parser topic topics/javascript/ \
--repo Laboratoria/bootcamp \
--repo Laboratoria/curriculum \
--version 5.5.0 \
> "build/topics/javascript.json"
```

### Parse a specific part of a topic within the `Laboratoria/bootcamp` repo
### Parse a specific part of a topic within the `Laboratoria/curriculum` repo

```sh
curriculum-parser part topics/intro-ux/00-que-es-uxd/00-que-es-uxd/ \
--repo Laboratoria/bootcamp \
--repo Laboratoria/curriculum \
--version 5.5.0
```

### Parse a challenge within the `Laboratoria/bootcamp` repo
### Parse a challenge within the `Laboratoria/curriculum` repo

```sh
curriculum-parser challenge topics/javascript/01-basics/06-exercises/01-coin-convert/ \
--repo Laboratoria/bootcamp \
--repo Laboratoria/curriculum \
--version 5.5.0
```

### Parse a project within the `Laboratoria/bootcamp` repo
### Parse a project within the `Laboratoria/curriculum` repo

```sh
curriculum-parser project projects/01-cipher/ \
--repo Laboratoria/bootcamp \
--repo Laboratoria/curriculum \
--version 5.5.0 \
--lo=./learning-objectives
```

### Parse learning objectives within `Laboratoria/curriculum`

```text
Usage: curriculum-parser learning-objectives [options] <dir>

Parse learning objectives

Arguments:
dir path to learning-objectives directory

Options:
--validate Validate and throw errors for objectives missing intl or without title
--strict Used with validate option to only throw error if an objective is missing in
all supported languages
--debug Show error stack traces
-h, --help display help for command
unjust marked this conversation as resolved.
Show resolved Hide resolved
```

```sh
curriculum-parser learning-objectives learning-objectives \
--repo Laboratoria/curriculum \
--validate \
--strict \
> "dist/learning-objectives.json"

## Known tracks

This project contains an array in [`lib/common.js`](./lib/common.js) called
Expand Down
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fs from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { program } from 'commander';
import { parseLearningObjectives } from './lib/learning-objectives.js';
import { parseProject } from './lib/project.js';
import { parseTopic } from './lib/topic.js';
import { parsePart } from './lib/part.js';
Expand Down Expand Up @@ -85,4 +86,12 @@ program.command('challenge')
.option('--debug', 'Show error stack traces')
.action(createHandler(parseChallenge));

program.command('learning-objectives')
.description('Parse learning objectives')
.argument('<dir>', 'path to learning objectives directory') // note should there be a default here?
unjust marked this conversation as resolved.
Show resolved Hide resolved
.option('--validate', 'Validate and throw errors for objectives missing intl or without title') // question: should we have repo and version ? why?
.option('--strict', 'With validate, only throw errors if objectives are missing in all languages')
.option('--debug', 'Show error stack traces')
unjust marked this conversation as resolved.
Show resolved Hide resolved
.action(createHandler(parseLearningObjectives));

program.parse();
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
browser:
- dom:
- selectors
- events
- manipulation
- routing
- storage
- fetch

js:
- data-types:
- primitive
- primitive-vs-non-primitive
- strings
- arrays
- objects
- variables
- conditionals
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# browser/dom/events

browser:
title: Web APIs

browser/dom:
title: DOM (Document Object Model)

browser/dom/selectors:
title: Uso de selectores del DOM
links:
- title: Manipulación del DOM
url: topics/browser/dom/1-dom-methods-selection
- title: Introducción al DOM - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Document_Object_Model/Introduction
- title: Localizando elementos DOM usando selectores - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors

browser/dom/manipulation:
title: Manipulación dinámica del DOM
links:
- title: Introducción al DOM
url: https://developer.mozilla.org/es/docs/Web/API/Document_Object_Model/Introduction
- title: Node.appendChild() - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Node/appendChild
- title: Document.createElement() - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Document/createElement
- title: Document.createTextNode()
url: https://developer.mozilla.org/es/docs/Web/API/Document/createTextNode
- title: Element.innerHTML - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Element/innerHTML
- title: Node.textContent - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Node/textContent

browser/routing:
title: Ruteado (History API, evento hashchange, window.location)
links:
- title: Manipulando el historial del navegador - MDN
url: https://developer.mozilla.org/es/docs/DOM/Manipulando_el_historial_del_navegador

browser/storage:
title: Browser storage (localStorage, sessionStorage)
links:
- title: Window.localStorage - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Window/localStorage

browser/fetch:
title: Fetch API
links:
- title: Fetch API - MDN
url: https://developer.mozilla.org/es/docs/Web/API/Fetch_API

js:
title: JavaScript

js/data-types:
title: Tipos de datos

js/data-types/primitive:
title: Tipos de datos primitivos
links:
- title: Valores primitivos - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Data_structures#valores_primitivos

js/data-types/strings:
title: Strings (cadenas de caracteres)
links:
- title: Strings
url: topics/javascript/strings
- title: String — Cadena de caracteres - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/String

js/data-types/arrays:
title: Arrays (arreglos)
links:
- title: Arreglos
url: topics/javascript/arrays
- title: Array - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/
- title: Array.prototype.sort() - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
- title: Array.prototype.forEach() - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
- title: Array.prototype.map() - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/map
- title: Array.prototype.filter() - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
- title: Array.prototype.reduce() - MDN
url: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce

js/data-types/objects:
title: Objetos (key, value)
links:
- title: Objetos en JavaScript
url: topics/javascript/objects/objects

js/data-types/primitive-vs-non-primitive:
title: Diferenciar entre tipos de datos primitivos y no primitivos

js/variables:
title: Variables (declaración, asignación, ámbito)
links:
- title: Valores, tipos de datos y operadores
url: topics/javascript/basics/values-variables-and-types
- title: Variables
url: topics/javascript/basics/variables

js/conditionals:
title: Uso de condicionales (if-else, switch, operador ternario, lógica booleana)
links:
- title: Estructuras condicionales y repetitivas
url: topics/javascript/flow-control/conditionals-and-loops
- title: Tomando decisiones en tu código — condicionales - MDN
url: https://developer.mozilla.org/es/docs/Learn/JavaScript/Building_blocks/conditionals
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# browser/dom/events

browser:
title: Web APIs

browser/dom:
title: DOM (Document Object Model)

browser/dom/selectors:
title: Uso de seletores de DOM
links:
- title: Modificando o DOM
url: topics/browser/dom/1-dom-methods-selection
- title: Introdução ao DOM - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Document_Object_Model/Introduction
- title: Locating DOM elements using selectors - MDN
url: https://developer.mozilla.org/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors

browser/dom/manipulation:
title: Manipulação dinâmica de DOM
links:
- title: Introdução ao DOM
url: https://developer.mozilla.org/pt-BR/docs/DOM/Referencia_do_DOM/Introdu%C3%A7%C3%A3o
- title: Node.appendChild() - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Node/appendChild
- title: Document.createElement() - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Document/createElement
- title: Document.createTextNode()
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Document/createTextNode
- title: Element.innerHTML - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Element/innerHTML
- title: Node.textContent - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Node/textContent

browser/routing:
title: Routing (History API, evento hashchange, window.location)
links:
- title: Manipulando o histórico do navegador - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/History_API

browser/storage:
title: Browser storage (localStorage, sessionStorage)
links:
- title: Window.localStorage - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Window/Window.localStorage

browser/fetch:
title: Fetch API
links:
- title: Fetch API - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/API/Fetch_API

js:
title: JavaScript

js/data-types:
title: Tipos de dados

js/data-types/primitive:
title: Tipos de dados primitivos
links:
- title: Valores Primitivos - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Data_structures#valores_primitivos

js/data-types/strings:
title: Strings (cadeias de caracteres)
links:
- title: Strings
url: topics/javascript/strings
- title: String — Cadeia de caracteres - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/String

js/data-types/arrays:
title: Arrays (arranjos)
links:
- title: Arranjos
url: topics/javascript/arrays
- title: Array - MDN
url: https://developer.mozilla.org//pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/
- title: Array.prototype.sort() - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
- title: Array.prototype.forEach() - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
- title: Array.prototype.map() - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/map
- title: Array.prototype.filter() - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
- title: Array.prototype.reduce() - MDN
url: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce

js/data-types/objects:
title: Objetos (key, value)
links:
- title: Objetos em JavaScript
url: topics/javascript/objects/objects

js/data-types/primitive-vs-non-primitive:
title: Diferenciar entre tipos de dados primitivos e não primitivos

js/variables:
title: Variáveis (declaração, atribuição, escopo)
links:
- title: Valores, tipos de dados e operadores
url: topics/javascript/basics/values-variables-and-types
- title: Variáveis
url: topics/javascript/basics/variables

js/conditionals:
title: Uso de condicionais (if-else, switch, operador ternário, lógica booleana)
links:
- title: Estruturas condicionais e repetitivas
url: topics/javascript/flow-control/conditionals-and-loops
- title: Tomando decisões no seu código — condicionais - MDN
url: https://developer.mozilla.org/pt-BR/docs/Learn/JavaScript/Building_blocks/conditionals
Loading
Loading