-
Notifications
You must be signed in to change notification settings - Fork 11
Update the glossary to generate from glossary.ts #73
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1d7b01a
init
samfreund 76bf616
remove highlighting from glossary page
samfreund e16e11a
cut what it is
samfreund e681fe3
cull glossary
samfreund 032f5a8
format
samfreund ba79e54
oh noes, forgot to regen. CI works tho
samfreund dba5cbb
remove browser tooltips
samfreund bd018f6
remove colon
samfreund c72368f
regen
samfreund af24724
Apply suggestions from code review
samfreund 82c2ece
rewrite glossary
samfreund 5bc1acf
format
samfreund 39b1da1
regen (again)
samfreund 50fd152
address some comments
samfreund 9386fa2
regen glossary
samfreund 63cc909
more rewording
samfreund 637a306
dammit
samfreund e321881
format
samfreund File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { execSync } from 'child_process'; | ||
| import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'fs'; | ||
| import { join, resolve } from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
| import { glossaryTerms } from '../src/data/glossary'; | ||
|
|
||
| const ROOT = fileURLToPath(new URL('..', import.meta.url)); | ||
| const OUTPUT = resolve(ROOT, 'src/content/docs/resources/glossary.mdx'); | ||
| const CHECK = process.argv.includes('--check'); | ||
|
|
||
| const sorted = [...glossaryTerms].sort((a, b) => | ||
| a.term.toLowerCase().localeCompare(b.term.toLowerCase()), | ||
| ); | ||
|
|
||
| const frontmatter = ['---', 'title: Glossary', '---']; | ||
|
|
||
| const body = [ | ||
| '{/* This file is auto-generated by scripts/generate-glossary.ts. Do not edit directly. */}', | ||
| '', | ||
| '', | ||
| ]; | ||
|
|
||
| for (const { term, definition } of sorted) { | ||
| body.push(`**${term}**`); | ||
| body.push(''); | ||
| body.push(`${definition}`); | ||
| body.push(''); | ||
| } | ||
|
|
||
| const content = [...frontmatter, '', ...body].join('\n'); | ||
|
|
||
| function formatFile(filePath: string) { | ||
| execSync(`pnpm prettier --write "${filePath}"`, { | ||
| cwd: ROOT, | ||
| stdio: 'pipe', | ||
| }); | ||
| } | ||
|
|
||
| if (CHECK) { | ||
| const existing = readFileSync(OUTPUT, 'utf-8'); | ||
| const tmpDir = mkdtempSync( | ||
| join(ROOT, 'src', 'content', 'docs', 'glossary-'), | ||
| ); | ||
| const tmpFile = join(tmpDir, 'glossary.mdx'); | ||
| writeFileSync(tmpFile, content); | ||
| formatFile(tmpFile); | ||
| const formatted = readFileSync(tmpFile, 'utf-8'); | ||
| rmSync(tmpDir, { recursive: true }); | ||
| if (formatted !== existing) { | ||
| console.error( | ||
| 'src/content/docs/resources/glossary.mdx is out of date.\n' + | ||
| 'Run `pnpm generate:glossary` to regenerate it.', | ||
| ); | ||
| process.exit(1); | ||
| } | ||
| } else { | ||
| writeFileSync(OUTPUT, content); | ||
| formatFile(OUTPUT); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,51 @@ | ||
| --- | ||
| title: Welcome to the Glossary | ||
| description: A compiled list of words and definitions to help you understand FRC programming terminology. | ||
| title: Glossary | ||
| --- | ||
|
|
||
| ## Why this exists. | ||
| {/* This file is auto-generated by scripts/generate-glossary.ts. Do not edit directly. */} | ||
|
|
||
| We know it can be hard learning each and every term thrown around in FRC programming, so we have compiled a list of words and definitions to aid you throughout your learning. | ||
| **CAN** | ||
|
|
||
| ## Terms | ||
| Controller Area Network: typically yellow and green cable used to communicate with motor controllers and sensors, can be run in various topographies instead of each cable needing to connect to SystemCore | ||
|
|
||
| **PDH** | ||
| **Limit Switch** | ||
|
|
||
| : Power Distribution Hub. | ||
| Type of sensor that triggers when physically or magnetically hit. | ||
| Can be used to trigger actions on a rising or falling edge, or check state of a mechanism | ||
|
|
||
| **SparkMAX** | ||
| **Magnetic Encoder** | ||
|
|
||
| : Motor controller for REV motors. | ||
| An encoder that uses a receiver and a magnet to measure position and motion | ||
|
|
||
| **Main Breaker** | ||
|
|
||
| : Switch for the robot. | ||
| Power switch for the robot | ||
|
|
||
| **PWM** | ||
|
|
||
| : Pulse Width Modulation cable. | ||
|
|
||
| **RIO** | ||
| **PDH** | ||
|
|
||
| : RoboRIO, brain of the robot. | ||
| Power Distribution Hub | ||
|
|
||
| **Blinkn** | ||
| **PWM** | ||
|
|
||
| : LED controller for REV. | ||
| Pulse Width Modulation: A communication spec used to communicate with motor controllers and sensors, needs to connect back to SystemCore | ||
|
|
||
| **Radio** | ||
| **Repository** | ||
|
|
||
| : Device that helps the robot communicate with the driver station. | ||
| A storage location for software packages, often used in version control systems like Git. | ||
| Repositories are just folders that contain files and subfolders, and they can be hosted on platforms like GitHub to facilitate collaboration and version tracking | ||
|
|
||
| **Limit Switch** | ||
| **Spark MAX** | ||
|
|
||
| : Type of sensor that acts as a soft limit when physically or magnetically hit. | ||
| Motor controller for REV motors | ||
|
|
||
| **Throughbore Encoder** | ||
| **SystemCore** | ||
|
|
||
| : An encoder that allows shafts to pass through its center to record position. | ||
| Main processor for robot code, contains various IO | ||
|
|
||
| **Magnetic Encoder** | ||
| **Talon FX** | ||
|
|
||
| : An encoder that uses magnetic fields to measure position or motion. | ||
| Motor controller for CTRE motors | ||
|
|
||
| **Repository** | ||
| **Throughbore Encoder** | ||
|
|
||
| : A storage location for software packages, often used in version control systems like Git. | ||
| Repositories are just folders that contain files and subfolders, and they can be hosted on platforms like GitHub to facilitate collaboration and version tracking. | ||
| An encoder that allows shafts to pass through its center to record angular position |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.