From 1631a51894f3e5e0904a73633058b2bb4d708b19 Mon Sep 17 00:00:00 2001 From: Eduardo Roth Date: Tue, 19 Dec 2023 16:47:30 -0600 Subject: [PATCH 01/15] feat(): add challenge label to support translations --- docs/src/components/PageTitle.astro | 9 +++++---- docs/src/content/config.ts | 7 ++++++- .../docs/challenges/angular/1-projection.md | 3 ++- .../docs/challenges/angular/10-pipe-utility.md | 3 ++- .../content/docs/challenges/angular/13-styling.md | 3 ++- docs/src/content/docs/challenges/angular/16-di.md | 3 ++- .../docs/challenges/angular/21-achor-scrolling.md | 3 ++- .../docs/challenges/angular/22-router-input.md | 3 ++- .../challenges/angular/3-directive-enhancement.md | 3 ++- .../challenges/angular/30-interop-rxjs-signal.md | 3 ++- .../challenges/angular/31-module-to-standalone.md | 3 ++- .../content/docs/challenges/angular/32-bug-cd.md | 3 ++- .../docs/challenges/angular/33-decoupling.md | 3 ++- .../docs/challenges/angular/39-injection-token.md | 3 ++- .../challenges/angular/4-context-outlet-typed.md | 3 ++- docs/src/content/docs/challenges/angular/5-crud.md | 3 ++- .../docs/challenges/angular/6-permissions.md | 3 ++- .../content/docs/challenges/angular/8-pipe-pure.md | 3 ++- .../docs/challenges/angular/9-pipe-wrapFn.md | 3 ++- .../challenges/forms/41-control-value-accessor.md | 3 ++- .../docs/challenges/ngrx/2-effect-selector.md | 3 ++- .../content/docs/challenges/ngrx/7-power-effect.md | 3 ++- .../docs/challenges/nx/25-generator-lib-ext.md | 3 ++- .../docs/challenges/nx/26-generator-comp.md | 3 ++- .../docs/challenges/nx/27-forbid-enum-rule.md | 3 ++- .../docs/challenges/performance/12-scroll-cd.md | 3 ++- .../challenges/performance/34-default-onpush.md | 3 ++- .../docs/challenges/performance/35-memoize.md | 3 ++- .../challenges/performance/36-ngfor-optimize.md | 3 ++- .../challenges/performance/37-ngfor-biglist.md | 3 ++- .../performance/40-christmas-web-worker.md | 3 ++- .../challenges/rxjs/11-bug-chaining-operator.md | 3 ++- .../docs/challenges/rxjs/14-race-condition.md | 3 ++- .../docs/challenges/rxjs/38-rxjs-catch-error.md | 3 ++- .../content/docs/challenges/testing/17-router.md | 3 ++- .../docs/challenges/testing/18-nested-comp.md | 3 ++- .../docs/challenges/testing/19-input-output.md | 3 ++- .../content/docs/challenges/testing/20-modal.md | 3 ++- .../content/docs/challenges/testing/23-harness.md | 3 ++- .../docs/challenges/testing/24-harness-creation.md | 3 ++- .../content/docs/challenges/testing/28-checkbox.md | 3 ++- .../docs/challenges/testing/29-real-application.md | 3 ++- .../docs/challenges/typescript/15-overload-fn.md | 3 ++- .../docs/es/challenges/angular/1-projection.md | 4 +++- .../docs/es/challenges/angular/22-router-input.md | 4 +++- .../challenges/angular/3-directive-enhancement.md | 4 +++- .../es/challenges/angular/39-injection-token.md | 4 +++- .../challenges/angular/4-context-outlet-typed.md | 4 +++- .../content/docs/es/challenges/angular/5-crud.md | 4 +++- .../docs/es/challenges/angular/6-permissions.md | 4 +++- .../docs/es/challenges/performance/12-scroll-cd.md | 4 +++- .../es/challenges/performance/34-default-onpush.md | 4 +++- .../docs/es/challenges/performance/35-memoize.md | 4 +++- .../es/challenges/performance/36-ngfor-optimize.md | 4 +++- .../es/challenges/performance/37-ngfor-biglist.md | 4 +++- .../docs/pt-br/challenges/angular/1-projection.md | 3 ++- .../__challengeNumber__-__projectName__.md__tmpl__ | 4 +++- libs/cli/src/generators/challenge/generator.ts | 14 +++++++------- 58 files changed, 141 insertions(+), 67 deletions(-) diff --git a/docs/src/components/PageTitle.astro b/docs/src/components/PageTitle.astro index 78cccce..6ed177c 100644 --- a/docs/src/components/PageTitle.astro +++ b/docs/src/components/PageTitle.astro @@ -2,12 +2,13 @@ import type { Props } from '@astrojs/starlight/props'; import Default from '@astrojs/starlight/components/PageTitle.astro'; -const challengeNumber = Astro.props.entry.data.challengeNumber; +const {label: challengeLabel, number: challengeNumber} = Astro.props.entry.data.challenge; + ---
- {challengeNumber &&
Challenge #{challengeNumber}
} + {challengeNumber &&
{challengeLabel} #{challengeNumber}
}
\ No newline at end of file + diff --git a/docs/src/content/config.ts b/docs/src/content/config.ts index 7b74a62..f8d9e14 100644 --- a/docs/src/content/config.ts +++ b/docs/src/content/config.ts @@ -15,7 +15,12 @@ const docs = defineCollection({ schema: (ctx) => docsSchema()(ctx).extend({ noCommentSection: z.boolean().optional().default(false), - challengeNumber: z.union([z.number(), z.boolean()]).default(false), + challenge: z + .object({ + label: z.string().default('Challenge'), + number: z.union([z.number(), z.boolean()]).default(false), + }) + .optional(), author: reference('authors').optional(), command: z.string().optional(), blogLink: z.string().optional(), diff --git a/docs/src/content/docs/challenges/angular/1-projection.md b/docs/src/content/docs/challenges/angular/1-projection.md index 1602510..0c9c46b 100644 --- a/docs/src/content/docs/challenges/angular/1-projection.md +++ b/docs/src/content/docs/challenges/angular/1-projection.md @@ -2,7 +2,8 @@ title: 🟢 Projection description: Challenge 1 is about learning how to project DOM element through components author: thomas-laforge -challengeNumber: 1 +challenge: + number: 1 command: angular-projection blogLink: https://medium.com/@thomas.laforge/create-a-highly-customizable-component-cc3a9805e4c5 videoLink: diff --git a/docs/src/content/docs/challenges/angular/10-pipe-utility.md b/docs/src/content/docs/challenges/angular/10-pipe-utility.md index f8688dd..005ea2e 100644 --- a/docs/src/content/docs/challenges/angular/10-pipe-utility.md +++ b/docs/src/content/docs/challenges/angular/10-pipe-utility.md @@ -2,7 +2,8 @@ title: 🔴 Utility Wrapper Pipe description: Challenge 10 is about creating a pipe to wrap utilities author: thomas-laforge -challengeNumber: 10 +challenge: + number: 10 command: angular-pipe-hard sidebar: order: 202 diff --git a/docs/src/content/docs/challenges/angular/13-styling.md b/docs/src/content/docs/challenges/angular/13-styling.md index fa38f8b..adffacf 100644 --- a/docs/src/content/docs/challenges/angular/13-styling.md +++ b/docs/src/content/docs/challenges/angular/13-styling.md @@ -2,7 +2,8 @@ title: 🟠 Highly Customizable CSS description: Challenge 13 is about creating highly customizable CSS styles author: thomas-laforge -challengeNumber: 13 +challenge: + number: 13 command: angular-styling sidebar: order: 104 diff --git a/docs/src/content/docs/challenges/angular/16-di.md b/docs/src/content/docs/challenges/angular/16-di.md index 0157970..2e16af3 100644 --- a/docs/src/content/docs/challenges/angular/16-di.md +++ b/docs/src/content/docs/challenges/angular/16-di.md @@ -2,7 +2,8 @@ title: 🔴 Master Dependancy Injection description: Challenge 16 is about masjering how dependancy injection works author: thomas-laforge -challengeNumber: 16 +challenge: + number: 16 command: angular-di sidebar: order: 203 diff --git a/docs/src/content/docs/challenges/angular/21-achor-scrolling.md b/docs/src/content/docs/challenges/angular/21-achor-scrolling.md index fb2f693..f49b744 100644 --- a/docs/src/content/docs/challenges/angular/21-achor-scrolling.md +++ b/docs/src/content/docs/challenges/angular/21-achor-scrolling.md @@ -2,7 +2,8 @@ title: 🟢 Anchor Navigation description: Challenge 21 is about navigating inside the page with anchor author: thomas-laforge -challengeNumber: 21 +challenge: + number: 21 command: angular-anchor-scrolling sidebar: order: 4 diff --git a/docs/src/content/docs/challenges/angular/22-router-input.md b/docs/src/content/docs/challenges/angular/22-router-input.md index 75ac297..3ff1c22 100644 --- a/docs/src/content/docs/challenges/angular/22-router-input.md +++ b/docs/src/content/docs/challenges/angular/22-router-input.md @@ -2,7 +2,8 @@ title: 🟢 @RouterInput() description: Challenge 22 is about using the @Input decorator to retreive router params. author: thomas-laforge -challengeNumber: 22 +challenge: + number: 22 command: angular-router-input blogLink: https://medium.com/ngconf/accessing-route-params-in-angular-1f8e12770617 sidebar: diff --git a/docs/src/content/docs/challenges/angular/3-directive-enhancement.md b/docs/src/content/docs/challenges/angular/3-directive-enhancement.md index 41a0cad..4cda327 100644 --- a/docs/src/content/docs/challenges/angular/3-directive-enhancement.md +++ b/docs/src/content/docs/challenges/angular/3-directive-enhancement.md @@ -2,7 +2,8 @@ title: 🟠 Directive Enhancement description: Challenge 3 is about enhancing a built-in directive author: thomas-laforge -challengeNumber: 3 +challenge: + number: 3 command: angular-ngfor-enhancement blogLink: https://medium.com/@thomas.laforge/ngfor-enhancement-716b44656a6c sidebar: diff --git a/docs/src/content/docs/challenges/angular/30-interop-rxjs-signal.md b/docs/src/content/docs/challenges/angular/30-interop-rxjs-signal.md index 67d84b4..396e7f5 100644 --- a/docs/src/content/docs/challenges/angular/30-interop-rxjs-signal.md +++ b/docs/src/content/docs/challenges/angular/30-interop-rxjs-signal.md @@ -2,7 +2,8 @@ title: 🔴 Interoperability Rxjs/Signal description: Challenge 30 is about learning how to mix signal with Rxjs author: thomas-laforge -challengeNumber: 30 +challenge: + number: 30 command: angular-interop-rxjs-signal sidebar: order: 204 diff --git a/docs/src/content/docs/challenges/angular/31-module-to-standalone.md b/docs/src/content/docs/challenges/angular/31-module-to-standalone.md index 0d7f77a..413c9f0 100644 --- a/docs/src/content/docs/challenges/angular/31-module-to-standalone.md +++ b/docs/src/content/docs/challenges/angular/31-module-to-standalone.md @@ -2,7 +2,8 @@ title: 🟢 Module to Standalone description: Challenge 31 is about migrating a module based application to a standalone application. author: thomas-laforge -challengeNumber: 31 +challenge: + number: 31 command: angular-module-to-standalone sidebar: order: 6 diff --git a/docs/src/content/docs/challenges/angular/32-bug-cd.md b/docs/src/content/docs/challenges/angular/32-bug-cd.md index f4a424c..587dd3d 100644 --- a/docs/src/content/docs/challenges/angular/32-bug-cd.md +++ b/docs/src/content/docs/challenges/angular/32-bug-cd.md @@ -2,7 +2,8 @@ title: 🟠 Change Detection Bug description: Challenge 32 is about debugging an application that has issue when change detection is triggered author: thomas-laforge -challengeNumber: 32 +challenge: + number: 32 command: angular-bug-cd blogLink: https://medium.com/ngconf/function-calls-inside-template-are-dangerous-15f9822a6629 sidebar: diff --git a/docs/src/content/docs/challenges/angular/33-decoupling.md b/docs/src/content/docs/challenges/angular/33-decoupling.md index 78bf040..dd46e0a 100644 --- a/docs/src/content/docs/challenges/angular/33-decoupling.md +++ b/docs/src/content/docs/challenges/angular/33-decoupling.md @@ -2,7 +2,8 @@ title: 🟠 Decoupling Components description: Challenge 33 is about decoupling two strongly coupled components using Injection Token author: thomas-laforge -challengeNumber: 33 +challenge: + number: 33 command: angular-decoupling sidebar: order: 106 diff --git a/docs/src/content/docs/challenges/angular/39-injection-token.md b/docs/src/content/docs/challenges/angular/39-injection-token.md index 36aab19..e5d6aae 100644 --- a/docs/src/content/docs/challenges/angular/39-injection-token.md +++ b/docs/src/content/docs/challenges/angular/39-injection-token.md @@ -2,7 +2,8 @@ title: 🟠 InjectionToken description: Challenge 39 is about learning the power of dependancy injection author: thomas-laforge -challengeNumber: 39 +challenge: + number: 39 command: angular-injection-token sidebar: order: 118 diff --git a/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md b/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md index 43f8a2d..6f42bd0 100644 --- a/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md +++ b/docs/src/content/docs/challenges/angular/4-context-outlet-typed.md @@ -2,7 +2,8 @@ title: 🔴 Typed ContextOutlet description: Challenge 4 is about strongly typing ngContextOutlet directives author: thomas-laforge -challengeNumber: 4 +challenge: + number: 4 command: angular-context-outlet-type blogLink: https://medium.com/@thomas.laforge/ngtemplateoutlet-type-checking-5d2dcb07a2c6 sidebar: diff --git a/docs/src/content/docs/challenges/angular/5-crud.md b/docs/src/content/docs/challenges/angular/5-crud.md index dfc909f..58b3aaa 100644 --- a/docs/src/content/docs/challenges/angular/5-crud.md +++ b/docs/src/content/docs/challenges/angular/5-crud.md @@ -2,7 +2,8 @@ title: 🟢 Crud application description: Challenge 5 is about refactoring a crud application author: thomas-laforge -challengeNumber: 5 +challenge: + number: 5 command: angular-crud sidebar: order: 2 diff --git a/docs/src/content/docs/challenges/angular/6-permissions.md b/docs/src/content/docs/challenges/angular/6-permissions.md index 2524c2c..17fa8a9 100644 --- a/docs/src/content/docs/challenges/angular/6-permissions.md +++ b/docs/src/content/docs/challenges/angular/6-permissions.md @@ -2,7 +2,8 @@ title: 🟠 Structural Directive description: Challenge 6 is about creating a structural directive to handle permissions author: thomas-laforge -challengeNumber: 6 +challenge: + number: 6 command: angular-permissions blogLink: https://medium.com/@thomas.laforge/create-a-custom-structural-directive-to-manage-permissions-like-a-pro-11a1acad30ad sidebar: diff --git a/docs/src/content/docs/challenges/angular/8-pipe-pure.md b/docs/src/content/docs/challenges/angular/8-pipe-pure.md index 384b0af..1b9c562 100644 --- a/docs/src/content/docs/challenges/angular/8-pipe-pure.md +++ b/docs/src/content/docs/challenges/angular/8-pipe-pure.md @@ -2,7 +2,8 @@ title: 🟢 Pure Pipe description: Challenge 8 is about creating a pure pipe author: thomas-laforge -challengeNumber: 8 +challenge: + number: 8 command: angular-pipe-easy blogLink: https://medium.com/ngconf/deep-dive-into-angular-pipes-c040588cd15d sidebar: diff --git a/docs/src/content/docs/challenges/angular/9-pipe-wrapFn.md b/docs/src/content/docs/challenges/angular/9-pipe-wrapFn.md index a50aa09..c9e604e 100644 --- a/docs/src/content/docs/challenges/angular/9-pipe-wrapFn.md +++ b/docs/src/content/docs/challenges/angular/9-pipe-wrapFn.md @@ -2,7 +2,8 @@ title: 🟠 Wrap Function Pipe description: Challenge 9 is about creating a pipe to wrap component fonctions author: thomas-laforge -challengeNumber: 9 +challenge: + number: 9 command: angular-pipe-intermediate blogLink: https://medium.com/ngconf/boost-your-apps-performance-by-wrapping-your-functions-inside-a-pipe-7e889a901d1d sidebar: diff --git a/docs/src/content/docs/challenges/forms/41-control-value-accessor.md b/docs/src/content/docs/challenges/forms/41-control-value-accessor.md index 54aa1cc..4a003ee 100644 --- a/docs/src/content/docs/challenges/forms/41-control-value-accessor.md +++ b/docs/src/content/docs/challenges/forms/41-control-value-accessor.md @@ -2,7 +2,8 @@ title: 🟠 Control Value Accessor description: Challenge 41 is about creating a custom form control that implements Control Value Accessor interface. author: stanislav-gavrilov -challengeNumber: 41 +challenge: + number: 41 command: forms-control-value-accessor sidebar: order: 1 diff --git a/docs/src/content/docs/challenges/ngrx/2-effect-selector.md b/docs/src/content/docs/challenges/ngrx/2-effect-selector.md index f571bbf..98d7d20 100644 --- a/docs/src/content/docs/challenges/ngrx/2-effect-selector.md +++ b/docs/src/content/docs/challenges/ngrx/2-effect-selector.md @@ -2,7 +2,8 @@ title: 🟠 Effect vs Selector description: Challenge 2 is about learning the difference between effects and selectors in NgRx author: thomas-laforge -challengeNumber: 2 +challenge: + number: 2 command: ngrx-effect-selector blogLink: https://medium.com/@thomas.laforge/ngrx-effect-vs-reducer-vs-selector-58337ab59043 sidebar: diff --git a/docs/src/content/docs/challenges/ngrx/7-power-effect.md b/docs/src/content/docs/challenges/ngrx/7-power-effect.md index 6785402..21703b0 100644 --- a/docs/src/content/docs/challenges/ngrx/7-power-effect.md +++ b/docs/src/content/docs/challenges/ngrx/7-power-effect.md @@ -2,7 +2,8 @@ title: 🔴 Power of Effect description: Challenge 7 is about creating an Ngrx effect with another Rxjs Hot observable author: thomas-laforge -challengeNumber: 7 +challenge: + number: 7 command: ngrx-notification sidebar: order: 206 diff --git a/docs/src/content/docs/challenges/nx/25-generator-lib-ext.md b/docs/src/content/docs/challenges/nx/25-generator-lib-ext.md index 5119fc6..b29ed8b 100644 --- a/docs/src/content/docs/challenges/nx/25-generator-lib-ext.md +++ b/docs/src/content/docs/challenges/nx/25-generator-lib-ext.md @@ -2,7 +2,8 @@ title: 🔴 Extend Lib Generator description: Challenge 25 is about creating a Nx generator to extend the built-in Library Generator author: thomas-laforge -challengeNumber: 25 +challenge: + number: 25 sidebar: order: 207 --- diff --git a/docs/src/content/docs/challenges/nx/26-generator-comp.md b/docs/src/content/docs/challenges/nx/26-generator-comp.md index 8cc6945..f57e404 100644 --- a/docs/src/content/docs/challenges/nx/26-generator-comp.md +++ b/docs/src/content/docs/challenges/nx/26-generator-comp.md @@ -2,7 +2,8 @@ title: 🟠 Component Generator description: Challenge 26 is about creating a Nx generator to create a custom component author: thomas-laforge -challengeNumber: 26 +challenge: + number: 26 sidebar: order: 116 --- diff --git a/docs/src/content/docs/challenges/nx/27-forbid-enum-rule.md b/docs/src/content/docs/challenges/nx/27-forbid-enum-rule.md index 5748b0d..36896c8 100644 --- a/docs/src/content/docs/challenges/nx/27-forbid-enum-rule.md +++ b/docs/src/content/docs/challenges/nx/27-forbid-enum-rule.md @@ -2,7 +2,8 @@ title: 🟢 Custom Eslint Rule description: Challenge 27 is about creating a custom Eslint Rule to forbid enums author: thomas-laforge -challengeNumber: 27 +challenge: + number: 27 sidebar: order: 12 --- diff --git a/docs/src/content/docs/challenges/performance/12-scroll-cd.md b/docs/src/content/docs/challenges/performance/12-scroll-cd.md index b6dc265..951baa8 100644 --- a/docs/src/content/docs/challenges/performance/12-scroll-cd.md +++ b/docs/src/content/docs/challenges/performance/12-scroll-cd.md @@ -2,7 +2,8 @@ title: 🟠 Optimize Change Detection description: Challenge 12 about optimizing the number of change detection cycle while scrolling author: thomas-laforge -challengeNumber: 12 +challenge: + number: 12 command: performance-scroll-cd sidebar: order: 107 diff --git a/docs/src/content/docs/challenges/performance/34-default-onpush.md b/docs/src/content/docs/challenges/performance/34-default-onpush.md index 1b23db5..6313b72 100644 --- a/docs/src/content/docs/challenges/performance/34-default-onpush.md +++ b/docs/src/content/docs/challenges/performance/34-default-onpush.md @@ -2,7 +2,8 @@ title: 🟢 Default vs OnPush description: Challenge 34 is about learning the difference between Default and OnPush Change Detection Strategy. author: thomas-laforge -challengeNumber: 34 +challenge: + number: 34 command: performance-default-onpush sidebar: order: 7 diff --git a/docs/src/content/docs/challenges/performance/35-memoize.md b/docs/src/content/docs/challenges/performance/35-memoize.md index f9a2cd8..f8c81ef 100644 --- a/docs/src/content/docs/challenges/performance/35-memoize.md +++ b/docs/src/content/docs/challenges/performance/35-memoize.md @@ -2,7 +2,8 @@ title: 🟢 Memoization description: Challenge 35 is about learning how pure pipe works author: thomas-laforge -challengeNumber: 35 +challenge: + number: 35 command: performance-memoized sidebar: order: 8 diff --git a/docs/src/content/docs/challenges/performance/36-ngfor-optimize.md b/docs/src/content/docs/challenges/performance/36-ngfor-optimize.md index 9d6b627..24c7dff 100644 --- a/docs/src/content/docs/challenges/performance/36-ngfor-optimize.md +++ b/docs/src/content/docs/challenges/performance/36-ngfor-optimize.md @@ -2,7 +2,8 @@ title: 🟢 NgFor Optimization description: Challenge 36 is about learning how trackby works author: thomas-laforge -challengeNumber: 36 +challenge: + number: 36 command: performance-ngfor-optimize sidebar: order: 13 diff --git a/docs/src/content/docs/challenges/performance/37-ngfor-biglist.md b/docs/src/content/docs/challenges/performance/37-ngfor-biglist.md index 261490e..09637c0 100644 --- a/docs/src/content/docs/challenges/performance/37-ngfor-biglist.md +++ b/docs/src/content/docs/challenges/performance/37-ngfor-biglist.md @@ -2,7 +2,8 @@ title: 🟠 Optimize Big List description: Challenge 37 is about learning how virtualization optimize big list rendering author: thomas-laforge -challengeNumber: 37 +challenge: + number: 37 command: performance-ngfor-biglist sidebar: order: 117 diff --git a/docs/src/content/docs/challenges/performance/40-christmas-web-worker.md b/docs/src/content/docs/challenges/performance/40-christmas-web-worker.md index a24e9c9..66280ac 100644 --- a/docs/src/content/docs/challenges/performance/40-christmas-web-worker.md +++ b/docs/src/content/docs/challenges/performance/40-christmas-web-worker.md @@ -2,7 +2,8 @@ title: 🟠 Web workers description: Challenge 40 is about learning how to create and use a web worker author: thomas-laforge -challengeNumber: 40 +challenge: + number: 40 command: performance-christmas-web-worker sidebar: order: 119 diff --git a/docs/src/content/docs/challenges/rxjs/11-bug-chaining-operator.md b/docs/src/content/docs/challenges/rxjs/11-bug-chaining-operator.md index dcebd67..0965533 100644 --- a/docs/src/content/docs/challenges/rxjs/11-bug-chaining-operator.md +++ b/docs/src/content/docs/challenges/rxjs/11-bug-chaining-operator.md @@ -2,7 +2,8 @@ title: 🟠 High Order Operator Bug description: Challenge 11 is about resolving a Rxjs bug because of high order operators author: thomas-laforge -challengeNumber: 11 +challenge: + number: 11 command: rxjs-pipe-bug sidebar: order: 114 diff --git a/docs/src/content/docs/challenges/rxjs/14-race-condition.md b/docs/src/content/docs/challenges/rxjs/14-race-condition.md index bc5cafa..8acde4c 100644 --- a/docs/src/content/docs/challenges/rxjs/14-race-condition.md +++ b/docs/src/content/docs/challenges/rxjs/14-race-condition.md @@ -2,7 +2,8 @@ title: 🟢 Race Condition description: Challenge 14 is about race condition in Rxjs author: thomas-laforge -challengeNumber: 14 +challenge: + number: 14 command: rxjs-race-condition sidebar: order: 11 diff --git a/docs/src/content/docs/challenges/rxjs/38-rxjs-catch-error.md b/docs/src/content/docs/challenges/rxjs/38-rxjs-catch-error.md index 298152b..9a239a5 100644 --- a/docs/src/content/docs/challenges/rxjs/38-rxjs-catch-error.md +++ b/docs/src/content/docs/challenges/rxjs/38-rxjs-catch-error.md @@ -3,7 +3,8 @@ title: 🟢 catchError description: Challenge 38 is about learning obervable completion. author: devesh-chaudhari command: rxjs-catch-error -challengeNumber: 38 +challenge: + number: 38 sidebar: order: 14 --- diff --git a/docs/src/content/docs/challenges/testing/17-router.md b/docs/src/content/docs/challenges/testing/17-router.md index 65afe81..96b70f6 100644 --- a/docs/src/content/docs/challenges/testing/17-router.md +++ b/docs/src/content/docs/challenges/testing/17-router.md @@ -2,7 +2,8 @@ title: 🟠 Router description: Challenge 17 is about testing the router author: thomas-laforge -challengeNumber: 17 +challenge: + number: 17 command: testing-router-outlet sidebar: order: 108 diff --git a/docs/src/content/docs/challenges/testing/18-nested-comp.md b/docs/src/content/docs/challenges/testing/18-nested-comp.md index 945650b..60f3763 100644 --- a/docs/src/content/docs/challenges/testing/18-nested-comp.md +++ b/docs/src/content/docs/challenges/testing/18-nested-comp.md @@ -2,7 +2,8 @@ title: 🟠 Nested Components description: Challenge 18 is about testing nested components author: thomas-laforge -challengeNumber: 18 +challenge: + number: 18 command: testing-nested sidebar: order: 109 diff --git a/docs/src/content/docs/challenges/testing/19-input-output.md b/docs/src/content/docs/challenges/testing/19-input-output.md index 56456d4..e721519 100644 --- a/docs/src/content/docs/challenges/testing/19-input-output.md +++ b/docs/src/content/docs/challenges/testing/19-input-output.md @@ -2,7 +2,8 @@ title: 🟠 Input Output description: Challenge 19 is about testing inputs and ouputs author: thomas-laforge -challengeNumber: 19 +challenge: + number: 19 command: testing-input-output sidebar: order: 110 diff --git a/docs/src/content/docs/challenges/testing/20-modal.md b/docs/src/content/docs/challenges/testing/20-modal.md index c3d7c3f..2737997 100644 --- a/docs/src/content/docs/challenges/testing/20-modal.md +++ b/docs/src/content/docs/challenges/testing/20-modal.md @@ -2,7 +2,8 @@ title: 🟠 Modal description: Challenge 20 is about testing modals author: thomas-laforge -challengeNumber: 20 +challenge: + number: 20 command: testing-modal sidebar: order: 111 diff --git a/docs/src/content/docs/challenges/testing/23-harness.md b/docs/src/content/docs/challenges/testing/23-harness.md index 5ea9834..0354bb0 100644 --- a/docs/src/content/docs/challenges/testing/23-harness.md +++ b/docs/src/content/docs/challenges/testing/23-harness.md @@ -2,7 +2,8 @@ title: 🟢 Harness description: Challenge 23 is about testing with component harnesses author: thomas-laforge -challengeNumber: 23 +challenge: + number: 23 command: testing-harness sidebar: order: 9 diff --git a/docs/src/content/docs/challenges/testing/24-harness-creation.md b/docs/src/content/docs/challenges/testing/24-harness-creation.md index acfbc86..61b47e2 100644 --- a/docs/src/content/docs/challenges/testing/24-harness-creation.md +++ b/docs/src/content/docs/challenges/testing/24-harness-creation.md @@ -2,7 +2,8 @@ title: 🟠 Harness Creation description: Challenge 24 is about creating a component harness. author: thomas-laforge -challengeNumber: 24 +challenge: + number: 24 command: testing-create-harness sidebar: order: 112 diff --git a/docs/src/content/docs/challenges/testing/28-checkbox.md b/docs/src/content/docs/challenges/testing/28-checkbox.md index 2d1d73e..41dd2a4 100644 --- a/docs/src/content/docs/challenges/testing/28-checkbox.md +++ b/docs/src/content/docs/challenges/testing/28-checkbox.md @@ -2,7 +2,8 @@ title: 🟢 Checkbox description: Challenge 28 is about testing a simple checkbox author: thomas-laforge -challengeNumber: 28 +challenge: + number: 28 command: testing-checkbox sidebar: order: 10 diff --git a/docs/src/content/docs/challenges/testing/29-real-application.md b/docs/src/content/docs/challenges/testing/29-real-application.md index 1d64fb9..49785a2 100644 --- a/docs/src/content/docs/challenges/testing/29-real-application.md +++ b/docs/src/content/docs/challenges/testing/29-real-application.md @@ -2,7 +2,8 @@ title: 🔴 Real-life Application description: Challenge 29 is about testing a real-life application author: thomas-laforge -challengeNumber: 29 +challenge: + number: 29 command: testing-todos-list sidebar: order: 205 diff --git a/docs/src/content/docs/challenges/typescript/15-overload-fn.md b/docs/src/content/docs/challenges/typescript/15-overload-fn.md index 4f629ed..7f1e841 100644 --- a/docs/src/content/docs/challenges/typescript/15-overload-fn.md +++ b/docs/src/content/docs/challenges/typescript/15-overload-fn.md @@ -2,7 +2,8 @@ title: 🟠 Function Overload description: Challenge 15 is about creating overload functions author: thomas-laforge -challengeNumber: 15 +challenge: + number: 15 command: typescript-overload blogLink: https://medium.com/ngconf/function-overloading-in-typescript-8236706b2c05 sidebar: diff --git a/docs/src/content/docs/es/challenges/angular/1-projection.md b/docs/src/content/docs/es/challenges/angular/1-projection.md index 6da5366..327daf0 100644 --- a/docs/src/content/docs/es/challenges/angular/1-projection.md +++ b/docs/src/content/docs/es/challenges/angular/1-projection.md @@ -2,7 +2,9 @@ title: 🟢 Proyección description: Desafio 1 trata sobre aprender a proyectar elementos del DOM a través de componentes, author: thomas-laforge -challengeNumber: 1 +challenge: + label: Reto + number: 1 command: angular-projection blogLink: https://medium.com/@thomas.laforge/create-a-highly-customizable-component-cc3a9805e4c5 videoLink: diff --git a/docs/src/content/docs/es/challenges/angular/22-router-input.md b/docs/src/content/docs/es/challenges/angular/22-router-input.md index 6450719..c010156 100644 --- a/docs/src/content/docs/es/challenges/angular/22-router-input.md +++ b/docs/src/content/docs/es/challenges/angular/22-router-input.md @@ -2,7 +2,9 @@ title: 🟢 @RouterInput() description: El desafío 22 trata sobre el uso del decorador @Input para utilizar parámetros del router. author: thomas-laforge -challengeNumber: 22 +challenge: + label: Reto + number: 22 command: angular-router-input blogLink: https://medium.com/ngconf/accessing-route-params-in-angular-1f8e12770617 sidebar: diff --git a/docs/src/content/docs/es/challenges/angular/3-directive-enhancement.md b/docs/src/content/docs/es/challenges/angular/3-directive-enhancement.md index e4514ac..b237144 100644 --- a/docs/src/content/docs/es/challenges/angular/3-directive-enhancement.md +++ b/docs/src/content/docs/es/challenges/angular/3-directive-enhancement.md @@ -2,7 +2,9 @@ title: 🟠 Mejorar Directiva description: El desafío 3 se trata de una directive incorporada. author: thomas-laforge -challengeNumber: 3 +challenge: + label: Reto + number: 3 command: angular-ngfor-enhancement blogLink: https://medium.com/@thomas.laforge/ngfor-enhancement-716b44656a6c sidebar: diff --git a/docs/src/content/docs/es/challenges/angular/39-injection-token.md b/docs/src/content/docs/es/challenges/angular/39-injection-token.md index 01eeb8d..9557c27 100644 --- a/docs/src/content/docs/es/challenges/angular/39-injection-token.md +++ b/docs/src/content/docs/es/challenges/angular/39-injection-token.md @@ -2,7 +2,9 @@ title: 🟠 InjectionToken description: Desafio de Angular 39 para aprender sobre el poder del InjectionToken author: thomas-laforge -challengeNumber: 39 +challenge: + label: Reto + number: 39 command: angular-injection-token sidebar: order: 118 diff --git a/docs/src/content/docs/es/challenges/angular/4-context-outlet-typed.md b/docs/src/content/docs/es/challenges/angular/4-context-outlet-typed.md index 0196812..228247d 100644 --- a/docs/src/content/docs/es/challenges/angular/4-context-outlet-typed.md +++ b/docs/src/content/docs/es/challenges/angular/4-context-outlet-typed.md @@ -2,7 +2,9 @@ title: 🔴 ContextOutlet en forma de tipo description: El desafío 4 se trata de tipificar de manera fuerte las directivas de ngContextOutlet author: thomas-laforge -challengeNumber: 4 +challenge: + label: Reto + number: 4 command: angular-context-outlet-type blogLink: https://medium.com/@thomas.laforge/ngtemplateoutlet-type-checking-5d2dcb07a2c6 sidebar: diff --git a/docs/src/content/docs/es/challenges/angular/5-crud.md b/docs/src/content/docs/es/challenges/angular/5-crud.md index d0c5903..890ec3a 100644 --- a/docs/src/content/docs/es/challenges/angular/5-crud.md +++ b/docs/src/content/docs/es/challenges/angular/5-crud.md @@ -2,7 +2,9 @@ title: 🟢 Aplicación CRUD description: El desafío 5 se trata de refactorizar una aplicación CRUD. author: thomas-laforge -challengeNumber: 5 +challenge: + label: Reto + number: 5 command: angular-crud sidebar: order: 2 diff --git a/docs/src/content/docs/es/challenges/angular/6-permissions.md b/docs/src/content/docs/es/challenges/angular/6-permissions.md index d6613b3..0588d4c 100644 --- a/docs/src/content/docs/es/challenges/angular/6-permissions.md +++ b/docs/src/content/docs/es/challenges/angular/6-permissions.md @@ -2,7 +2,9 @@ title: 🟠 Directiva Estructural description: El Desafío 6 se trata de generar una Directiva Estructural que manipule los permisos author: thomas-laforge -challengeNumber: 6 +challenge: + label: Reto + number: 6 command: angular-permissions blogLink: https://medium.com/@thomas.laforge/create-a-custom-structural-directive-to-manage-permissions-like-a-pro-11a1acad30ad sidebar: diff --git a/docs/src/content/docs/es/challenges/performance/12-scroll-cd.md b/docs/src/content/docs/es/challenges/performance/12-scroll-cd.md index 4e7c9f4..73e37ca 100644 --- a/docs/src/content/docs/es/challenges/performance/12-scroll-cd.md +++ b/docs/src/content/docs/es/challenges/performance/12-scroll-cd.md @@ -2,7 +2,9 @@ title: 🟠 Optimizar el Change Detection al desplazarse description: Desafío 12 sobre la optimización del número de ciclos de detección de cambios al desplazarse author: thomas-laforge -challengeNumber: 12 +challenge: + label: Reto + number: 12 command: performance-scroll-cd sidebar: order: 107 diff --git a/docs/src/content/docs/es/challenges/performance/34-default-onpush.md b/docs/src/content/docs/es/challenges/performance/34-default-onpush.md index 941f72c..7076aa1 100644 --- a/docs/src/content/docs/es/challenges/performance/34-default-onpush.md +++ b/docs/src/content/docs/es/challenges/performance/34-default-onpush.md @@ -2,7 +2,9 @@ title: 🟢 Default vs OnPush description: El desafío 34 trata sobre aprender la diferencia entre las estrategias de detección de cambios Default y OnPush. author: thomas-laforge -challengeNumber: 34 +challenge: + label: Reto + number: 34 command: performance-default-onpush sidebar: order: 7 diff --git a/docs/src/content/docs/es/challenges/performance/35-memoize.md b/docs/src/content/docs/es/challenges/performance/35-memoize.md index 60aeeb9..7be928b 100644 --- a/docs/src/content/docs/es/challenges/performance/35-memoize.md +++ b/docs/src/content/docs/es/challenges/performance/35-memoize.md @@ -2,7 +2,9 @@ title: 🟢 Memoización description: El desafío 35 trata sobre cómo funcionan las tuberías puras author: thomas-laforge -challengeNumber: 35 +challenge: + label: Reto + number: 35 command: performance-memoized sidebar: order: 8 diff --git a/docs/src/content/docs/es/challenges/performance/36-ngfor-optimize.md b/docs/src/content/docs/es/challenges/performance/36-ngfor-optimize.md index 463c72a..5978a42 100644 --- a/docs/src/content/docs/es/challenges/performance/36-ngfor-optimize.md +++ b/docs/src/content/docs/es/challenges/performance/36-ngfor-optimize.md @@ -2,7 +2,9 @@ title: 🟢 Optimización de NgFor description: El Desafío 36 trata sobre como funciona trackby author: thomas-laforge -challengeNumber: 36 +challenge: + label: Reto + number: 36 command: performance-ngfor-optimize sidebar: order: 13 diff --git a/docs/src/content/docs/es/challenges/performance/37-ngfor-biglist.md b/docs/src/content/docs/es/challenges/performance/37-ngfor-biglist.md index e944c61..4cd38a6 100644 --- a/docs/src/content/docs/es/challenges/performance/37-ngfor-biglist.md +++ b/docs/src/content/docs/es/challenges/performance/37-ngfor-biglist.md @@ -2,7 +2,9 @@ title: 🟠 Optimizando una lista larga description: El desafio 37 trata sobre como optimizar una lista grande de elementos author: thomas-laforge -challengeNumber: 37 +challenge: + label: Reto + number: 37 command: performance-ngfor-biglist sidebar: order: 117 diff --git a/docs/src/content/docs/pt-br/challenges/angular/1-projection.md b/docs/src/content/docs/pt-br/challenges/angular/1-projection.md index 352c175..1260dee 100644 --- a/docs/src/content/docs/pt-br/challenges/angular/1-projection.md +++ b/docs/src/content/docs/pt-br/challenges/angular/1-projection.md @@ -2,7 +2,8 @@ title: 🟢 Projeção description: Desafio 1 é sobre aprender a projetar elementos DOM através de componentes author: thomas-laforge -challengeNumber: 1 +challenge: + number: 1 command: angular-projection blogLink: https://medium.com/@thomas.laforge/create-a-highly-customizable-component-cc3a9805e4c5 videoLink: diff --git a/libs/cli/src/generators/challenge/files/docs/__challengeNumber__-__projectName__.md__tmpl__ b/libs/cli/src/generators/challenge/files/docs/__challengeNumber__-__projectName__.md__tmpl__ index 40bc795..5b480f2 100644 --- a/libs/cli/src/generators/challenge/files/docs/__challengeNumber__-__projectName__.md__tmpl__ +++ b/libs/cli/src/generators/challenge/files/docs/__challengeNumber__-__projectName__.md__tmpl__ @@ -2,7 +2,9 @@ title: <%= difficulty %> <%= title %> description: Challenge <%= challengeNumber %> is about ... author: <%= author %> -challengeNumber: <%= challengeNumber %> +challenge: + label: Challenge + number: <%= challengeNumber %> command: <%= appProjectName %> sidebar: order: <%= order %> diff --git a/libs/cli/src/generators/challenge/generator.ts b/libs/cli/src/generators/challenge/generator.ts index 6dc5c1a..c97a70f 100644 --- a/libs/cli/src/generators/challenge/generator.ts +++ b/libs/cli/src/generators/challenge/generator.ts @@ -42,7 +42,7 @@ function findPreviousChallengeFilePath(tree, path, number) { export async function challengeGenerator(tree: Tree, options: Schema) { const { appProjectName, appDirectory } = getProjectDir( options.name, - `apps/${options.category}` + `apps/${options.category}`, ); const difficulty = options.challengeDifficulty; @@ -65,7 +65,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) { const challengeNumberPath = 'challenge-number.json'; const challangeNumberJson = JSON.parse( - tree.read(challengeNumberPath).toString() + tree.read(challengeNumberPath).toString(), ); const challengeNumber = challangeNumberJson.total + 1; const order = challangeNumberJson[difficulty] + 1; @@ -97,7 +97,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) { challengeNumber, difficulty, order, - } + }, ); if (options.addTest) { @@ -111,7 +111,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) { const readmeRegex = new RegExp(`all ${challengeNumber - 1} challenges`); const readmeReplace = readme.replace( readmeRegex, - `all ${challengeNumber} challenges` + `all ${challengeNumber} challenges`, ); tree.write('./README.md', readmeReplace); @@ -126,7 +126,7 @@ export async function challengeGenerator(tree: Tree, options: Schema) { linkRegex, `link: /challenges/${options.category}/${challengeNumber}-${ names(options.name).name - }/\n` + }/\n`, ); tree.write('./docs/src/content/docs/index.mdx', replacedLink); @@ -134,14 +134,14 @@ export async function challengeGenerator(tree: Tree, options: Schema) { const previousChallengeFilePath = findPreviousChallengeFilePath( tree, `./docs/src/content/docs/challenges`, - String(challengeNumber - 1) + String(challengeNumber - 1), ); const previousChallenge = tree.read(previousChallengeFilePath).toString(); tree.write( previousChallengeFilePath, - previousChallenge.replace(`badge: New`, ``) + previousChallenge.replace(`badge: New`, ``), ); updateJson(tree, challengeNumberPath, (json) => { From 33b63f4e135f598f7c1978d735de3c5ae90acbdd Mon Sep 17 00:00:00 2001 From: Eduardo Roth Date: Tue, 19 Dec 2023 17:00:39 -0600 Subject: [PATCH 02/15] fix(): fallback value when object is not set --- docs/src/components/PageTitle.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/components/PageTitle.astro b/docs/src/components/PageTitle.astro index 6ed177c..3b6cb5f 100644 --- a/docs/src/components/PageTitle.astro +++ b/docs/src/components/PageTitle.astro @@ -2,7 +2,7 @@ import type { Props } from '@astrojs/starlight/props'; import Default from '@astrojs/starlight/components/PageTitle.astro'; -const {label: challengeLabel, number: challengeNumber} = Astro.props.entry.data.challenge; +const {label: challengeLabel, number: challengeNumber} = Astro.props.entry.data.challenge ?? {}; --- From 0f5a452142eccdc6fc8dc871c6b669573e4ab9dd Mon Sep 17 00:00:00 2001 From: Eduardo Roth Date: Tue, 19 Dec 2023 17:29:20 -0600 Subject: [PATCH 03/15] fix(): missing challengeNumber properties --- docs/src/components/ChallengeFooter.astro | 8 ++++---- docs/src/components/Content.astro | 8 ++++---- docs/src/components/PageTitle.astro | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/src/components/ChallengeFooter.astro b/docs/src/components/ChallengeFooter.astro index f11b636..3292bba 100644 --- a/docs/src/components/ChallengeFooter.astro +++ b/docs/src/components/ChallengeFooter.astro @@ -3,11 +3,11 @@ import VideoButton from './VideoButton.astro' import ClipboardCopy from './ClipboardCopy.astro' -const {author, challengeNumber, title, blogLink, videoLink, command} = Astro.props.entry.data; +const {author, challenge, title, blogLink, videoLink, command} = Astro.props.entry.data; -const authorLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challengeNumber}+label%3A"answer+author"`; +const authorLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challenge?.number}+label%3A"answer+author"`; const authorDescription = `${title} solution author`; -const communityLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challengeNumber}+label%3Aanswer`; +const communityLink = `https://github.com/tomalaforge/angular-challenges/pulls?q=label%3A${challenge?.number}+label%3Aanswer`; const communityDescription = `${title} community solutions`; const npxCommand = `npx nx serve ${command}`; --- @@ -22,7 +22,7 @@ const npxCommand = `npx nx serve ${command}`; } +

Your PR title must start with Answer:{challenge?.number}.