diff --git a/lib/__tests__/__fixtures__/00-part-with-challenges/01-coin-convert/README.md b/lib/__tests__/__fixtures__/00-part-with-challenges/01-coin-convert/README.md index 895a370..8eb2d29 100644 --- a/lib/__tests__/__fixtures__/00-part-with-challenges/01-coin-convert/README.md +++ b/lib/__tests__/__fixtures__/00-part-with-challenges/01-coin-convert/README.md @@ -1,5 +1,6 @@ --- -tracks: web-dev +tracks: + - web-dev env: cjs --- diff --git a/lib/__tests__/__fixtures__/00-part-with-challenges/02-restaurant-bill/README.md b/lib/__tests__/__fixtures__/00-part-with-challenges/02-restaurant-bill/README.md index e04a4f1..7b503cc 100644 --- a/lib/__tests__/__fixtures__/00-part-with-challenges/02-restaurant-bill/README.md +++ b/lib/__tests__/__fixtures__/00-part-with-challenges/02-restaurant-bill/README.md @@ -1,5 +1,6 @@ --- -tracks: web-dev +tracks: + - web-dev env: cjs --- diff --git a/lib/__tests__/__fixtures__/01-a-project-with-learning-objectives/project.yml b/lib/__tests__/__fixtures__/01-a-project-with-learning-objectives/project.yml index 46b7517..054e07b 100644 --- a/lib/__tests__/__fixtures__/01-a-project-with-learning-objectives/project.yml +++ b/lib/__tests__/__fixtures__/01-a-project-with-learning-objectives/project.yml @@ -1,5 +1,6 @@ track: web-dev -tracks: web-dev +tracks: + - web-dev learningObjectives: - html/semantics - css/selectors diff --git a/lib/__tests__/__fixtures__/01-a-project-with-lo-needing-expansion/project.yml b/lib/__tests__/__fixtures__/01-a-project-with-lo-needing-expansion/project.yml index bdd5a65..6ccc4fd 100644 --- a/lib/__tests__/__fixtures__/01-a-project-with-lo-needing-expansion/project.yml +++ b/lib/__tests__/__fixtures__/01-a-project-with-lo-needing-expansion/project.yml @@ -1,5 +1,6 @@ track: web-dev -tracks: web-dev +tracks: + - web-dev learningObjectives: - html/semantics - css diff --git a/lib/__tests__/__fixtures__/01-a-project-with-pt-translation/README.pt.md b/lib/__tests__/__fixtures__/01-a-project-with-pt-translation/README.pt.md index 6da7bea..c656cba 100644 --- a/lib/__tests__/__fixtures__/01-a-project-with-pt-translation/README.pt.md +++ b/lib/__tests__/__fixtures__/01-a-project-with-pt-translation/README.pt.md @@ -1,6 +1,7 @@ --- track: web-dev -tracks: web-dev +tracks: + - web-dev learningObjectives: - html/semantics - css/selectors diff --git a/lib/__tests__/__fixtures__/01-a-project-with-summary/README.md b/lib/__tests__/__fixtures__/01-a-project-with-summary/README.md index 29384f3..2ee6105 100644 --- a/lib/__tests__/__fixtures__/01-a-project-with-summary/README.md +++ b/lib/__tests__/__fixtures__/01-a-project-with-summary/README.md @@ -1,6 +1,7 @@ --- track: web-dev -tracks: web-dev +tracks: + - web-dev --- # Tarjeta de crédito válida diff --git a/lib/__tests__/__fixtures__/01-a-project-with-unknown-learning-objective/project.yml b/lib/__tests__/__fixtures__/01-a-project-with-unknown-learning-objective/project.yml index d76a76f..9c05f52 100644 --- a/lib/__tests__/__fixtures__/01-a-project-with-unknown-learning-objective/project.yml +++ b/lib/__tests__/__fixtures__/01-a-project-with-unknown-learning-objective/project.yml @@ -1,5 +1,6 @@ track: web-dev -tracks: web-dev +tracks: + - web-dev learningObjectives: - html/foo - css/selectors diff --git a/lib/__tests__/__fixtures__/01-a-project-without-thumb/README.md b/lib/__tests__/__fixtures__/01-a-project-without-thumb/README.md index 29384f3..2ee6105 100644 --- a/lib/__tests__/__fixtures__/01-a-project-without-thumb/README.md +++ b/lib/__tests__/__fixtures__/01-a-project-without-thumb/README.md @@ -1,6 +1,7 @@ --- track: web-dev -tracks: web-dev +tracks: + - web-dev --- # Tarjeta de crédito válida diff --git a/lib/__tests__/__fixtures__/challenge-cjs/README.md b/lib/__tests__/__fixtures__/challenge-cjs/README.md index 68fe1f1..1d63dd9 100644 --- a/lib/__tests__/__fixtures__/challenge-cjs/README.md +++ b/lib/__tests__/__fixtures__/challenge-cjs/README.md @@ -1,6 +1,7 @@ --- track: web-dev -tracks: web-dev +tracks: + - web-dev env: cjs --- diff --git a/lib/__tests__/__fixtures__/challenge-form-question-no-heading/challenge.yml b/lib/__tests__/__fixtures__/challenge-form-question-no-heading/challenge.yml index 9a2a98a..eb0621f 100644 --- a/lib/__tests__/__fixtures__/challenge-form-question-no-heading/challenge.yml +++ b/lib/__tests__/__fixtures__/challenge-form-question-no-heading/challenge.yml @@ -1,3 +1,4 @@ track: data -tracks: data +tracks: + - data env: form diff --git a/lib/__tests__/__fixtures__/challenge-form-with-multiline-question/challenge.yml b/lib/__tests__/__fixtures__/challenge-form-with-multiline-question/challenge.yml index 73c8f1e..7fa4f8f 100644 --- a/lib/__tests__/__fixtures__/challenge-form-with-multiline-question/challenge.yml +++ b/lib/__tests__/__fixtures__/challenge-form-with-multiline-question/challenge.yml @@ -1,3 +1,4 @@ track: ux -tracks: ux +tracks: + - ux env: form diff --git a/lib/__tests__/__fixtures__/challenge-form/challenge.yml b/lib/__tests__/__fixtures__/challenge-form/challenge.yml index 9a2a98a..eb0621f 100644 --- a/lib/__tests__/__fixtures__/challenge-form/challenge.yml +++ b/lib/__tests__/__fixtures__/challenge-form/challenge.yml @@ -1,3 +1,4 @@ track: data -tracks: data +tracks: + - data env: form diff --git a/lib/__tests__/__fixtures__/topic-duplicate-part-slugs/README.md b/lib/__tests__/__fixtures__/topic-duplicate-part-slugs/README.md index c48396a..9d475ce 100644 --- a/lib/__tests__/__fixtures__/topic-duplicate-part-slugs/README.md +++ b/lib/__tests__/__fixtures__/topic-duplicate-part-slugs/README.md @@ -1,6 +1,7 @@ --- track: ux -tracks: ux +tracks: + - ux --- # Prototipado diff --git a/lib/__tests__/__fixtures__/topic-duplicate-unit-slugs/README.md b/lib/__tests__/__fixtures__/topic-duplicate-unit-slugs/README.md index 661e9e1..bc28989 100644 --- a/lib/__tests__/__fixtures__/topic-duplicate-unit-slugs/README.md +++ b/lib/__tests__/__fixtures__/topic-duplicate-unit-slugs/README.md @@ -1,6 +1,7 @@ --- track: ux -tracks: ux +tracks: + - ux --- # Prototipado diff --git a/lib/__tests__/__fixtures__/topic-with-bad-part/README.md b/lib/__tests__/__fixtures__/topic-with-bad-part/README.md index c48396a..9d475ce 100644 --- a/lib/__tests__/__fixtures__/topic-with-bad-part/README.md +++ b/lib/__tests__/__fixtures__/topic-with-bad-part/README.md @@ -1,6 +1,7 @@ --- track: ux -tracks: ux +tracks: + - ux --- # Prototipado diff --git a/lib/__tests__/__fixtures__/topic-with-bad-part/README.pt.md b/lib/__tests__/__fixtures__/topic-with-bad-part/README.pt.md index c48396a..9d475ce 100644 --- a/lib/__tests__/__fixtures__/topic-with-bad-part/README.pt.md +++ b/lib/__tests__/__fixtures__/topic-with-bad-part/README.pt.md @@ -1,6 +1,7 @@ --- track: ux -tracks: ux +tracks: + - ux --- # Prototipado diff --git a/lib/__tests__/__fixtures__/topic-with-translations/README.md b/lib/__tests__/__fixtures__/topic-with-translations/README.md index c48396a..9d475ce 100644 --- a/lib/__tests__/__fixtures__/topic-with-translations/README.md +++ b/lib/__tests__/__fixtures__/topic-with-translations/README.md @@ -1,6 +1,7 @@ --- track: ux -tracks: ux +tracks: + - ux --- # Prototipado diff --git a/lib/__tests__/__fixtures__/topic-with-translations/README.pt.md b/lib/__tests__/__fixtures__/topic-with-translations/README.pt.md index c48396a..9d475ce 100644 --- a/lib/__tests__/__fixtures__/topic-with-translations/README.pt.md +++ b/lib/__tests__/__fixtures__/topic-with-translations/README.pt.md @@ -1,6 +1,7 @@ --- track: ux -tracks: ux +tracks: + - ux --- # Prototipado diff --git a/lib/challenge.js b/lib/challenge.js index c42dcc3..7404838 100644 --- a/lib/challenge.js +++ b/lib/challenge.js @@ -220,7 +220,7 @@ export const parseChallenge = async (dir, opts, pkg) => { // TODO: Validate files (boilerplate, tests and solution) const files = flattenTree(await dirToTree(dir)); - const tracks = meta.tracks?.split(/[ ,]+/); + const { track, tracks } = meta; if (!tracks) { throw new Error('No tracks found. Expected at least one.'); @@ -234,7 +234,7 @@ export const parseChallenge = async (dir, opts, pkg) => { version: opts?.version, parserVersion: pkg?.version, createdAt: new Date(), - track: meta.track, + track, tracks, env: meta.env, intl: langs.reduce( diff --git a/lib/project.js b/lib/project.js index 779c6af..a0aec18 100644 --- a/lib/project.js +++ b/lib/project.js @@ -154,9 +154,7 @@ export const parseProject = async (dir, opts, pkg) => { }), ); - const { track, cover, thumb } = meta; - - const tracks = meta.tracks?.split(/[ ,]+/); + const { track, tracks, cover, thumb } = meta; if (!['web-dev', 'ux', 'data'].includes(track)) { throw new Error(`Invalid track "${track}". Expected "web-dev", "ux" or "data".`); diff --git a/lib/topic.js b/lib/topic.js index 09ff86b..b9fe1e0 100644 --- a/lib/topic.js +++ b/lib/topic.js @@ -166,9 +166,7 @@ export const parseTopic = async (dir, opts, pkg) => { }), ); - const { track, cover, thumb } = meta; - - const tracks = meta.tracks?.split(/[ ,]+/); + const { track, tracks, cover, thumb } = meta; if (!['web-dev', 'ux', 'data'].includes(track)) { throw new Error(`Invalid track "${track}". Expected "web-dev", "ux" or "data".`);