meilisearch-js
meilisearch-js copied to clipboard
Add script for manipulating and checking code samples
Pull Request
Related issue
Fixes #1947
What does this PR do?
- adds scripts that help with authoring, linting and type checking code samples
# Generate files
yarn generate-code-sample-files
# Generate YAML file
yarn generate-code-samples-yaml
# For maintainers to generate new code samples
yarn generate-code-sample-files new_sample_one new_sample_two
- code samples are now linted and type checked in CI workflows, guaranteeing that we'll no longer get completely broken code samples
- refactors code samples
Summary by CodeRabbit
-
New Features
- Introduced automated generation of TypeScript code samples from YAML and vice versa, improving consistency and maintainability of code samples.
- Added scripts and commands to generate and manage code samples, with clear instructions in the contributing guide.
-
Documentation
- Updated the contributing guide with a new section detailing how to generate, lint, and type-check code samples.
-
Chores
- Added new scripts and dependencies to support code sample generation.
- Updated .gitignore to exclude generated code samples from version control.
- Updated TypeScript configuration for improved module resolution in tests.
-
Style
- Modernized all JavaScript/TypeScript Meilisearch code samples to use consistent async/await patterns and ES module imports.