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: add simple plugin template #615

Merged
merged 3 commits into from
Jun 30, 2024

Conversation

chilingling
Copy link
Member

@chilingling chilingling commented Jun 30, 2024

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Documentation

    • Updated engine-cli tool's README to clarify and improve usage instructions for creating platforms and plugins.
  • New Features

    • Introduced a plugin system for TinyEngine, providing an entry point for UI rendering, API access, and core plugin services.
  • Dependencies

    • Updated package.json to include new dependencies (esbuild, @inquirer/prompts) and updated existing ones (chalk, commander). Added publishConfig for public access and updated repository details.

Copy link
Contributor

coderabbitai bot commented Jun 30, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The engine-cli tool in the tiny-engine repository has undergone significant updates. The README has been clarified and commands standardized for creating platforms and plugins. The package.json has been enhanced with updated metadata, refined files list, and added dependencies. A new index.js file in the plugin template directory introduces a foundational plugin system, expediting UI, API, and core plugin services integration.

Changes

Files Summary
packages/engine-cli/README.md Updated usage instructions for creating platforms and plugins with clarified commands.
packages/engine-cli/package.json Enhanced metadata, updated files field, new dependencies, and publish config for public access.
packages/engine-cli/template/plugin/index.js Introduced a new plugin system providing an entry point for UI rendering, API access, and core services.

Poem

In the realm of code, where engines hum,
We crafted tools to make you hum.
With new commands, so clear and bright,
Platforms and plugins take flight.
From README to package.json's heart,
A smoother journey, a brand new start.
🐇✨🚀


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are always opted into early access features.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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
Contributor

@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: 1

Outside diff range and nitpick comments (3)
packages/engine-cli/template/plugin/README.md (1)

Line range hint 4-4: Remove multiple consecutive blank lines.

There are multiple consecutive blank lines which should be reduced to a single blank line for better readability.

- 
- 
+ 
Tools
Markdownlint

3-3: Expected: 1; Actual: 2
Multiple consecutive blank lines

(MD012, no-multiple-blanks)

packages/engine-cli/README.md (1)

Line range hint 3-3: Fix grammatical issue.

The phrase "for create new designer/plugin/..." should be corrected to "for creating new designers/plugins/..." for better readability.

- tiny-engine cli for create new designer/plugin/...
+ tiny-engine cli for creating new designers/plugins/...
packages/engine-cli/src/commands/create.js (1)

[!TIP]
Codebase Verification

Missing template directories

The directories template/designer and template/plugin do not exist in the repository. This will cause the createPlatform and createPlugin functions to fail when attempting to copy the template files. Please ensure that these directories and their contents are added to the repository.

  • template/designer directory is missing.
  • template/plugin directory is missing.
Analysis chain

Line range hint 18-36: LGTM!

The functions createPlatform and createPlugin are straightforward and correctly handle file copying and logging.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the paths and commands in createPlatform and createPlugin functions.

# Test: Check if the template directories exist and contain necessary files.
# Expect: Directories and files should exist.

fd --type d 'template/designer' --exec ls
fd --type d 'template/plugin' --exec ls

Length of output: 81



Script:

#!/bin/bash
# Description: Re-verify the existence of the template directories and list their contents.

# Check if the 'template/designer' directory exists and list its contents
fd --type d 'template/designer'

# Check if the 'template/plugin' directory exists and list its contents
fd --type d 'template/plugin'

# List files inside 'template/designer' if it exists
if [ -d "template/designer" ]; then
  echo "Contents of template/designer:"
  ls template/designer
else
  echo "Directory template/designer does not exist."
fi

# List files inside 'template/plugin' if it exists
if [ -d "template/plugin" ]; then
  echo "Contents of template/plugin:"
  ls template/plugin
else
  echo "Directory template/plugin does not exist."
fi

Length of output: 311

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5ad227b and d224d25.

Files selected for processing (14)
  • packages/design-core/index.js (1 hunks)
  • packages/engine-cli/README.md (1 hunks)
  • packages/engine-cli/README.zh-CN.md (1 hunks)
  • packages/engine-cli/package.json (1 hunks)
  • packages/engine-cli/src/commands/create.js (2 hunks)
  • packages/engine-cli/src/index.js (1 hunks)
  • packages/engine-cli/template/plugin/README.md (1 hunks)
  • packages/engine-cli/template/plugin/index.js (1 hunks)
  • packages/engine-cli/template/plugin/meta.js (1 hunks)
  • packages/engine-cli/template/plugin/package.json (1 hunks)
  • packages/engine-cli/template/plugin/src/Main.vue (1 hunks)
  • packages/engine-cli/template/plugin/src/composable/index.js (1 hunks)
  • packages/engine-cli/template/plugin/src/composable/usePluginDemo.js (1 hunks)
  • packages/engine-cli/template/plugin/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (4)
  • packages/engine-cli/README.zh-CN.md
  • packages/engine-cli/template/plugin/meta.js
  • packages/engine-cli/template/plugin/package.json
  • packages/engine-cli/template/plugin/src/composable/usePluginDemo.js
Additional context used
Markdownlint
packages/engine-cli/template/plugin/README.md

3-3: Expected: 1; Actual: 2
Multiple consecutive blank lines

(MD012, no-multiple-blanks)


4-4: Expected: 1; Actual: 3
Multiple consecutive blank lines

(MD012, no-multiple-blanks)

LanguageTool
packages/engine-cli/README.md

[uncategorized] ~3-~3: This verb may not be in the correct form. Consider using a different form for this context.
Context: # engine-cli tiny-engine cli for create new designer/plugin/... ## dev ```sh ...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)

Additional comments not posted (10)
packages/engine-cli/template/plugin/src/Main.vue (1)

1-13: LGTM!

The Vue component is well-structured and correctly uses the PluginPanel component with scoped slots for header and content.

packages/engine-cli/template/plugin/src/composable/index.js (1)

15-19: LGTM!

The PluginDemoService is well-defined and correctly imports the necessary dependencies.

packages/engine-cli/template/plugin/index.js (1)

1-28: LGTM!

The default export object is well-structured, including metadata, API, UI entry, and plugin services.

packages/engine-cli/package.json (1)

13-36: LGTM!

The package configuration updates are straightforward and include necessary dependencies and repository information.

packages/engine-cli/template/plugin/vite.config.js (1)

1-36: LGTM!

The Vite configuration is standard and includes necessary plugins and build options.

packages/engine-cli/src/index.js (4)

13-14: LGTM!

The import statements for input, select, createPlatform, and createPlugin are correct.


19-23: LGTM!

The create-platform command is well-defined with a clear description in both English and Chinese.


25-30: LGTM!

The create-plugin command is well-defined with a clear description in both English and Chinese.


32-68: LGTM!

The create command is well-defined and prompts the user for input to create either a platform or a plugin. The descriptions and validation are clear and include both English and Chinese. The use of typeMapper to map the selected type to the corresponding function is a good practice.

packages/design-core/index.js (1)

36-36: LGTM!

The export statement correctly adds PluginPanel to the exports, enabling its use in other modules.

packages/engine-cli/template/plugin/README.md Show resolved Hide resolved
@hexqi hexqi merged commit 48cd8f5 into opentiny:refactor/develop Jun 30, 2024
yy-wow pushed a commit to yy-wow/tiny-engine that referenced this pull request Oct 10, 2024
* feat: add simple plugin template

* fix: change by code review

* fix: includes template and bind file to npm
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.

2 participants