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

feat(scaffold-examples/slidev): create app #251

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MFarabi619
Copy link
Member

@MFarabi619 MFarabi619 commented Jan 11, 2025

Checklist

  • I've thoroughly read the latest contribution guidelines.
  • I've rebased my branch onto main before creating this PR.
  • I've added tests to cover my changes (if applicable).
  • I've verified that all new and existing tests have passed locally for mobile, tablet, and desktop screen sizes.
  • My commit messages follow guidelines
  • My change requires documentation updates.
  • I've updated the documentation accordingly.
  • My code follows existing patterns of this project and/or improves upon them.

Summary by CodeRabbit

  • New Features

    • Added a new Slidev presentation project with interactive slides
    • Introduced a reusable Counter component
    • Implemented slide importing and organization capabilities
  • Documentation

    • Created comprehensive README with project setup instructions
    • Added example slides demonstrating Slidev features
  • Configuration

    • Added deployment configurations for Netlify and Vercel
    • Set up package management and build scripts
    • Configured .gitignore to exclude unnecessary files

@MFarabi619 MFarabi619 self-assigned this Jan 11, 2025
@MFarabi619 MFarabi619 linked an issue Jan 11, 2025 that may be closed by this pull request
1 task
Copy link

coderabbitai bot commented Jan 11, 2025

📝 Walkthrough

Walkthrough

The pull request introduces a comprehensive setup for a Slidev presentation project within the scaffold-examples directory. The changes include configuration files for various deployment platforms (Netlify, Vercel), package management settings, and a complete slide deck template. The project is configured with Vue.js and Slidev, providing a ready-to-use presentation environment with interactive components, custom styling, and deployment configurations.

Changes

File Change Summary
.gitignore Added standard ignore patterns for Node.js and Vite project
.npmrc Added pnpm configuration for dependency hoisting and peer dependency management
README.md Added project startup instructions and documentation link
components/Counter.vue New Vue component with increment/decrement functionality
netlify.toml Added Netlify deployment configuration
package.json Defined project scripts, dependencies, and metadata
pages/imported-slides.md Added documentation on slide file importing
slides.md Created comprehensive slide deck template with various features
snippets/external.ts Added utility functions for array creation and logging
vercel.json Added Vercel deployment configuration

Suggested Reviewers

  • HasithDeAlwis

Poem

🐰 Slides that dance and code that sings,
A Slidev project with magical things!
Buttons click and pages turn,
With Vue components, we'll surely learn
A presentation that's simply divine! 🎉

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (6)
apps/scaffold-examples/slidev/vercel.json (1)

1-7: Consider unifying deployment configurations.

Having separate configuration files for Vercel and Netlify could lead to maintenance overhead. Consider using a unified deployment configuration approach:

  1. Create a shared build configuration that both platforms can use
  2. Use environment variables for platform-specific settings
  3. Document the deployment process for both platforms in a single place
apps/scaffold-examples/slidev/snippets/external.ts (2)

5-7: Consider initializing array elements

The emptyArray function creates an array with undefined elements. Consider providing an optional initialization value.

-export function emptyArray<T>(length: number) {
-  return Array.from<T>({ length })
+export function emptyArray<T>(length: number, initialValue?: T) {
+  return Array.from<T>({ length }, () => initialValue as T)
+}

10-12: Consider adding JSDoc comments

Add documentation to explain the purpose of this utility function.

+/**
+ * Logs a greeting message indicating the source file.
+ */
 export function sayHello() {
   console.log('Hello from snippets/external.ts')
 }
apps/scaffold-examples/slidev/components/Counter.vue (2)

4-8: Add type and validation to count prop

The count prop should have a type and validation for better type safety and runtime checks.

 const props = defineProps({
   count: {
+    type: Number,
     default: 0,
+    validator: (value: number) => Number.isFinite(value)
   },
 })

14-36: Add ARIA labels for better accessibility

The increment/decrement buttons should have ARIA labels for screen readers.

   <button
     border="r main"
     p="2"
     font="mono"
     outline="!none"
     hover:bg="gray-400 opacity-20"
+    aria-label="Decrement counter"
     @click="counter -= 1"
   >
     -
   </button>
   <span m="auto" p="2">{{ counter }}</span>
   <button
     border="l main"
     p="2"
     font="mono"
     outline="!none"
     hover:bg="gray-400 opacity-20"
+    aria-label="Increment counter"
     @click="counter += 1"
   >
     +
   </button>
apps/scaffold-examples/slidev/slides.md (1)

94-94: Fix grammar in navigation instruction

Change "Hover on the bottom-left corner" to "Hover in the bottom-left corner" for correct preposition usage.

🧰 Tools
🪛 LanguageTool

[grammar] ~94-~94: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the bottom-left corner”?
Context: ...de-up level: 2 --- # Navigation Hover on the bottom-left corner to see the navigation's controls panel,...

(ON_IN_THE_CORNER_2)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 447389e and 1a916ca.

⛔ Files ignored due to path filters (1)
  • apps/scaffold-examples/slidev/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • apps/scaffold-examples/slidev/.gitignore (1 hunks)
  • apps/scaffold-examples/slidev/.npmrc (1 hunks)
  • apps/scaffold-examples/slidev/README.md (1 hunks)
  • apps/scaffold-examples/slidev/components/Counter.vue (1 hunks)
  • apps/scaffold-examples/slidev/netlify.toml (1 hunks)
  • apps/scaffold-examples/slidev/package.json (1 hunks)
  • apps/scaffold-examples/slidev/pages/imported-slides.md (1 hunks)
  • apps/scaffold-examples/slidev/slides.md (1 hunks)
  • apps/scaffold-examples/slidev/snippets/external.ts (1 hunks)
  • apps/scaffold-examples/slidev/vercel.json (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • apps/scaffold-examples/slidev/README.md
  • apps/scaffold-examples/slidev/.npmrc
  • apps/scaffold-examples/slidev/netlify.toml
  • apps/scaffold-examples/slidev/.gitignore
🧰 Additional context used
🪛 Markdownlint (0.37.0)
apps/scaffold-examples/slidev/pages/imported-slides.md

5-5: Expected: h2; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)

apps/scaffold-examples/slidev/slides.md

563-563: Expected: h2; Actual: h6
Heading levels should only increment by one level at a time

(MD001, heading-increment)


47-47: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


88-88: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


115-115: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


134-134: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


188-188: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


304-304: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


552-552: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


597-597: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


628-628: Expected: atx; Actual: setext
Heading style

(MD003, heading-style)


135-135: null
Bare URL used

(MD034, no-bare-urls)


586-586: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

🪛 LanguageTool
apps/scaffold-examples/slidev/slides.md

[grammar] ~94-~94: The usual preposition to use with “corner” is “in”, not “on”. Did you mean “in the bottom-left corner”?
Context: ...de-up level: 2 --- # Navigation Hover on the bottom-left corner to see the navigation's controls panel,...

(ON_IN_THE_CORNER_2)


[uncategorized] ~128-~128: Loose punctuation mark.
Context: ...itleandlevel` in your frontmatter. ::right:: <Toc text-sm minDepth="1" maxD...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (3)
apps/scaffold-examples/slidev/package.json (1)

1-16: Add viewport testing configuration

The PR objectives mention ensuring tests pass across different screen sizes (mobile, tablet, desktop). Consider adding Vitest UI or Playwright configuration for viewport testing.

Would you like me to provide an example configuration for viewport testing?

apps/scaffold-examples/slidev/vercel.json (2)

5-6: Verify build script configuration.

The build command references "npm run build". Let's ensure this script is properly configured in your package.json.

Run this script to verify the build configuration:

✅ Verification successful

Build configuration is correctly set up

The build command and output directory in vercel.json are properly configured for this Slidev project:

  • npm run build correctly maps to the slidev build script in package.json
  • The dist output directory is properly gitignored
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify build script configuration

# Check if package.json exists and contains the build script
fd -t f "package.json" -x jq -r '.scripts.build // empty'

# Check if the dist directory is properly gitignored
rg -l "^dist/?$" .gitignore

Length of output: 173


Script:

#!/bin/bash
# Check the package.json in the same directory as vercel.json
cat apps/scaffold-examples/slidev/package.json | jq -r '.scripts'

# Verify if this is indeed a Slidev project
fd -p "apps/scaffold-examples/slidev/slides.*"

Length of output: 239


2-4: Verify static asset handling with the catch-all rewrite rule.

While the catch-all rewrite rule is necessary for client-side routing, ensure that static assets (images, fonts, etc.) are served correctly and not unnecessarily rewritten to index.html.

Run this script to check for static asset references in your Slidev project:

✅ Verification successful

The catch-all rewrite rule is safe for this Slidev implementation

The implementation only uses external assets (from sli.dev and GitHub), with no local static assets that could be affected by the rewrite rule. The catch-all rewrite to index.html will correctly handle client-side routing without interfering with asset serving.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for static asset references that might be affected by the rewrite rule

# Look for static asset references in the project
rg -g '!{dist,node_modules}' -t html -t vue -t js -t ts '\.(jpg|jpeg|png|gif|svg|woff2?|ttf|eot)' 

# Check if there's a public directory with static assets
fd -t d '^public$'

Length of output: 412


Script:

#!/bin/bash
# Search for asset references without file type restrictions in Slidev directory
cd apps/scaffold-examples/slidev && \
rg -g '!{dist,node_modules}' '\.(jpg|jpeg|png|gif|svg|woff2?|ttf|eot)' .

# Check for Slidev-specific asset directories and configuration
ls -la apps/scaffold-examples/slidev/

# Look for any asset-related configuration in package.json
cat apps/scaffold-examples/slidev/package.json

Length of output: 989

@@ -0,0 +1,16 @@
{
"name": "slidev",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use a more specific package name

The current package name "slidev" is too generic and could potentially conflict with the actual Slidev package. Consider using a more specific name that reflects its purpose as an example/scaffold, such as "@scaffold-examples/slidev" or "slidev-scaffold-example".

-  "name": "slidev",
+  "name": "@scaffold-examples/slidev",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"name": "slidev",
"name": "@scaffold-examples/slidev",

Comment on lines +12 to +13
"@slidev/theme-default": "latest",
"@slidev/theme-seriph": "latest",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid using 'latest' tag for dependencies

Using "latest" for theme packages can lead to unexpected breaks when new versions are released. It's better to specify exact versions or version ranges.

-    "@slidev/theme-default": "latest",
-    "@slidev/theme-seriph": "latest",
+    "@slidev/theme-default": "^0.25.0",
+    "@slidev/theme-seriph": "^0.25.0",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@slidev/theme-default": "latest",
"@slidev/theme-seriph": "latest",
"@slidev/theme-default": "^0.25.0",
"@slidev/theme-seriph": "^0.25.0",

"@slidev/cli": "^51.0.0",
"@slidev/theme-default": "latest",
"@slidev/theme-seriph": "latest",
"vue": "^3.5.13"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect Vue.js version

The specified Vue.js version (3.5.13) doesn't exist yet. The latest stable version is in the 3.4.x range.

-    "vue": "^3.5.13"
+    "vue": "^3.4.0"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"vue": "^3.5.13"
"vue": "^3.4.0"

Comment on lines +5 to +9
"scripts": {
"build": "slidev build",
"dev": "slidev --open",
"export": "slidev export"
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add essential development scripts

The current scripts configuration lacks some essential development tools:

  • No test script despite PR objectives mentioning test coverage
  • No lint/format scripts for code quality

Consider adding these scripts:

   "scripts": {
     "build": "slidev build",
     "dev": "slidev --open",
-    "export": "slidev export"
+    "export": "slidev export",
+    "test": "vitest",
+    "lint": "eslint .",
+    "format": "prettier --write ."
   },

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +10 to +15
"dependencies": {
"@slidev/cli": "^51.0.0",
"@slidev/theme-default": "latest",
"@slidev/theme-seriph": "latest",
"vue": "^3.5.13"
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add development dependencies

The package is missing essential development dependencies for testing, linting, and formatting that would be needed for the scripts suggested earlier.

Add a devDependencies section:

   "dependencies": {
     "@slidev/cli": "^51.0.0",
     "@slidev/theme-default": "^0.25.0",
     "@slidev/theme-seriph": "^0.25.0",
     "vue": "^3.4.0"
+  },
+  "devDependencies": {
+    "vitest": "^1.0.0",
+    "eslint": "^8.0.0",
+    "prettier": "^3.0.0"
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"dependencies": {
"@slidev/cli": "^51.0.0",
"@slidev/theme-default": "latest",
"@slidev/theme-seriph": "latest",
"vue": "^3.5.13"
}
"dependencies": {
"@slidev/cli": "^51.0.0",
"@slidev/theme-default": "latest",
"@slidev/theme-seriph": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
"vitest": "^1.0.0",
"eslint": "^8.0.0",
"prettier": "^3.0.0"
}


You can split your slides.md into multiple files and organize them as you want using the `src` attribute.

#### `slides.md`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fix heading hierarchy

The heading levels should only increment by one level at a time. Change h4 headings to h2 for proper document structure.

-#### `slides.md`
+## `slides.md`

 ...

-#### `subpage.md`
+## `subpage.md`

Also applies to: 19-19

🧰 Tools
🪛 Markdownlint (0.37.0)

5-5: Expected: h2; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)

</div>
</v-drag>

<img v-drag="'square'" src="https://sli.dev/logo.png">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add alt text to logo image

Images should have descriptive alt text for accessibility.

-<img v-drag="'square'" src="https://sli.dev/logo.png">
+<img v-drag="'square'" src="https://sli.dev/logo.png" alt="Slidev logo">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<img v-drag="'square'" src="https://sli.dev/logo.png">
<img v-drag="'square'" src="https://sli.dev/logo.png" alt="Slidev logo">
🧰 Tools
🪛 Markdownlint (0.37.0)

586-586: null
Images should have alternate text (alt text)

(MD045, no-alt-text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(slides): scaffold app
1 participant