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 capability of add custom metaComponents #528

Merged
merged 8 commits into from
May 31, 2024

Conversation

chilingling
Copy link
Member

@chilingling chilingling commented May 30, 2024

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

  • New Features

    • Introduced MetaInput component for customizable input fields.
    • Added MyInputConfigurator for configuring input settings.
    • Introduced MetaSelect component for customizable select dropdowns.
    • Added InputConfigurator and SelectConfigurator for property panel customization.
  • Updates

    • Renamed components in various configurations from "MetaInput" to "InputConfigurator" and "MetaSelect" to "SelectConfigurator".
    • Updated initialization scripts to register new meta components and configurators.
  • Documentation

    • Added README files for meta-components and configurator packages.

@chilingling chilingling changed the title refactor: 原子化重构框架搭建 (#497) feat(metaComponent): add capability of add custom metaComponents May 30, 2024
Copy link
Contributor

coderabbitai bot commented May 30, 2024

Warning

Rate limit exceeded

@chilingling has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 59 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 1b0ea30 and 60dda4f.

Walkthrough

The recent changes introduce new configurators and meta components for TinyEngine, enhancing customizability and functionality. Key updates include the addition of MetaInput and MetaSelect components, new configurators (InputConfigurator and SelectConfigurator), and the registration of these components and configurators within the TinyEngine framework. The updates also involve renaming components in various configuration files and improving the initialization process to support these new features.

Changes

File(s) or Path(s) Change Summary
designer-demo/src/MetaInput.vue, MyInputConfigurator.vue Added MetaInput and MyInputConfigurator components with properties for handling input types, placeholders, suffix icons, and data types.
designer-demo/src/main.js Imported and utilized metaComponents and configurators for TinyEngine initialization.
designer-demo/src/configurators.js Added new configurators (MyInputConfigurator, InputConfigurator, SelectConfigurator).
packages/common/component/ConfigItem.vue Updated to use getMetaComponent for rendering components.
packages/common/index.js Removed SearchEmpty from MetaComponents export.
packages/design-core/public/mock/bundle.json Updated component name from "MetaInput" to "meta-input-custom".
packages/design-core/src/init.js Added registerMetaComponents and registerConfigurators calls during initialization.
packages/design-core/src/registerMetaComponents.js, registerConfigurators.js Introduced functions to register meta components and configurators.
packages/design-core/vite.config.js, packages/meta-components/vite.config.js, packages/configurator/vite.config.js Added Vite configuration for building and bundling meta components and configurators.
packages/entry/README.md, src/index.js, src/metaComponents.js, src/configurators.js Added functions to manage and retrieve meta components and configurators.
packages/meta-components/README.md, package.json, src/index.js Introduced MetaInput and MetaSelect components, and configured package metadata.
packages/meta-components/src/meta-input/MetaInput.vue, meta-input/index.js Added MetaInput component with input handling features.
packages/meta-components/src/meta-select/MetaSelect.vue, meta-select/index.js Added MetaSelect component with customizable dropdown features.
packages/builtinComponent/src/meta/CanvasCol.json, CanvasRow.json, CanvasRowColContainer.json Renamed components from "MetaInput" to "InputConfigurator" and "MetaSelect" to "SelectConfigurator".
packages/canvas/src/components/builtin/builtin.json Renamed "MetaInput" to "InputConfigurator" for various widgets.
packages/configurator/README.md, package.json, src/index.js Introduced InputConfigurator and SelectConfigurator components and configured package metadata.
packages/configurator/src/input-configurator/InputConfigurator.vue, input-configurator/index.js Added InputConfigurator component for input configuration.
packages/configurator/src/select-configurator/SelectConfigurator.vue, select-configurator/index.js Added SelectConfigurator component for select dropdown configuration.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant App as Application
    participant TinyEngine as TinyEngine
    participant MetaInput as MetaInput Component
    participant InputConfigurator as InputConfigurator

    App->>TinyEngine: Initialize with metaComponents and configurators
    TinyEngine->>MetaInput: Register MetaInput component
    TinyEngine->>InputConfigurator: Register InputConfigurator component
    App->>MetaInput: Use MetaInput in form
    MetaInput->>App: Return input value
    App->>InputConfigurator: Use InputConfigurator for settings
    InputConfigurator->>App: Return configured input settings
Loading

Poem

In the world of code so bright,
Meta components take their flight,
Configurators join the scene,
Making inputs sharp and keen.
TinyEngine, now enhanced,
Dances in a new expanse.
🐇✨


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.

@chilingling chilingling changed the title feat(metaComponent): add capability of add custom metaComponents feat: add capability of add custom metaComponents May 30, 2024
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: 2

Outside diff range and nitpick comments (3)
packages/entry/README.md (1)

3-3: Please remove the extra blank lines to adhere to markdown best practices.

packages/common/index.js (1)

Line range hint 102-104: Consider replacing forEach with for...of for better performance and readability.

- props.options.forEach((item) => {
+ for (const item of props.options) {
    map[item.value] = item
- })
+ }
packages/design-core/vite.config.js (1)

Line range hint 3-3: Use the node: protocol when importing Node.js built-in modules to avoid confusion with npm packages.

- import { fileURLToPath } from 'node:url'
+ import { fileURLToPath } from 'url'
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 439992b and c7efc41.

Files selected for processing (20)
  • designer-demo/src/MetaInput.vue (1 hunks)
  • designer-demo/src/main.js (1 hunks)
  • designer-demo/src/registerCustomMetaComponents.js (1 hunks)
  • packages/common/component/ConfigItem.vue (2 hunks)
  • packages/common/index.js (1 hunks)
  • packages/design-core/public/mock/bundle.json (1 hunks)
  • packages/design-core/src/init.js (2 hunks)
  • packages/design-core/src/registerMetaComponents.js (1 hunks)
  • packages/design-core/vite.config.js (1 hunks)
  • packages/entry/README.md (1 hunks)
  • packages/entry/src/index.js (1 hunks)
  • packages/entry/src/metaComponents.js (1 hunks)
  • packages/meta-components/README.md (1 hunks)
  • packages/meta-components/package.json (1 hunks)
  • packages/meta-components/src/index.js (1 hunks)
  • packages/meta-components/src/meta-input/MetaInput.vue (1 hunks)
  • packages/meta-components/src/meta-input/index.js (1 hunks)
  • packages/meta-components/src/meta-select/MetaSelect.vue (1 hunks)
  • packages/meta-components/src/meta-select/index.js (1 hunks)
  • packages/meta-components/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (7)
  • designer-demo/src/main.js
  • packages/design-core/public/mock/bundle.json
  • packages/entry/src/index.js
  • packages/meta-components/README.md
  • packages/meta-components/package.json
  • packages/meta-components/src/meta-input/index.js
  • packages/meta-components/src/meta-select/index.js
Additional context used
Markdownlint
packages/entry/README.md

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

Biome
packages/meta-components/vite.config.js

[error] 14-14: A Node.js builtin module should be imported with the node: protocol.

packages/common/index.js

[error] 102-104: Prefer for...of instead of forEach.

packages/design-core/vite.config.js

[error] 3-3: A Node.js builtin module should be imported with the node: protocol.

Additional comments not posted (15)
packages/meta-components/src/index.js (2)

1-1: Export statement for MetaInput is correctly implemented.


2-2: Export statement for MetaSelect is correctly implemented.

designer-demo/src/registerCustomMetaComponents.js (3)

1-1: Import statement for addMetaComponents is correctly implemented.


2-2: Import statement for MetaInput is correctly implemented.


4-11: Function registerCustomMetaComponents correctly registers MetaInput with a custom name.

packages/entry/src/metaComponents.js (2)

3-8: Function addMetaComponents correctly handles an array of components and adds them to the map.


11-13: Function getMetaComponent correctly retrieves a component by name from the map.

packages/design-core/src/registerMetaComponents.js (4)

1-1: Import statement for MetaComponents is correctly implemented.


2-2: Import statement for addMetaComponents is correctly implemented.


4-4: Import statement for defaultMetaComponents is correctly implemented.


9-14: Function registerMetaComponents correctly registers both other components and default meta components.

designer-demo/src/MetaInput.vue (1)

11-51: LGTM! The MetaInput component is well-defined with proper props validation and emits.

packages/meta-components/src/meta-input/MetaInput.vue (1)

16-60: Well-implemented enhancements with the suffix slot and dynamic property updates using watchEffect.

packages/design-core/src/init.js (1)

28-28: Correct placement of registerMetaComponents ensures all meta components are available at runtime.

packages/meta-components/src/meta-select/MetaSelect.vue (1)

50-110: The MetaSelect component is well-structured to handle complex selection scenarios with excellent use of Vue's reactivity system.

packages/common/component/ConfigItem.vue Outdated Show resolved Hide resolved
packages/meta-components/vite.config.js Outdated Show resolved Hide resolved
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 (1)
designer-demo/src/metaComponents.js (1)

7-7: Consider aligning the naming convention for custom components to match the existing pattern used for other meta components.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c7efc41 and 023fc8a.

Files selected for processing (4)
  • designer-demo/src/main.js (1 hunks)
  • designer-demo/src/metaComponents.js (1 hunks)
  • packages/design-core/src/init.js (2 hunks)
  • packages/design-core/src/registerMetaComponents.js (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • designer-demo/src/main.js
  • packages/design-core/src/init.js
  • packages/design-core/src/registerMetaComponents.js
Additional comments not posted (1)
designer-demo/src/metaComponents.js (1)

1-1: Consider removing the commented-out import if it's not used elsewhere in the code.

Verification successful

Consider removing the commented-out import of addMetaComponents in designer-demo/src/metaComponents.js as it is not used in this file.

  • designer-demo/src/metaComponents.js: Commented-out import statement.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check if `addMetaComponents` is used in the project.
rg --type js 'addMetaComponents'

Length of output: 678

designer-demo/src/metaComponents.js Outdated Show resolved Hide resolved
zzcr
zzcr previously approved these changes May 30, 2024
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 023fc8a and d5590ad.

Files selected for processing (2)
  • packages/common/component/ConfigItem.vue (2 hunks)
  • packages/meta-components/vite.config.js (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • packages/common/component/ConfigItem.vue
  • packages/meta-components/vite.config.js

Copy link
Collaborator

@wenmine wenmine left a comment

Choose a reason for hiding this comment

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

根据讨论,需要区分配置组件和meta(元)的概念,避免混淆,要把 meta -> configurator

@chilingling chilingling added refactoring Refactoring ready_for_review This PR requires more reviews labels May 31, 2024
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: 0

Outside diff range and nitpick comments (1)
packages/design-core/vite.config.js (1)

Line range hint 3-3: Correct the import statement for Node.js built-in modules.

- import path from 'path'
+ import path from 'node:path'

This change ensures compliance with the latest Node.js module resolution enhancements where built-in modules should be imported with the node: protocol.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d5590ad and 637b244.

Files selected for processing (20)
  • designer-demo/package.json (1 hunks)
  • designer-demo/src/MyInputConfigurator.vue (1 hunks)
  • designer-demo/src/configurators.js (1 hunks)
  • designer-demo/src/main.js (1 hunks)
  • packages/builtinComponent/src/meta/CanvasCol.json (5 hunks)
  • packages/builtinComponent/src/meta/CanvasRow.json (5 hunks)
  • packages/builtinComponent/src/meta/CanvasRowColContainer.json (1 hunks)
  • packages/canvas/src/components/builtin/builtin.json (3 hunks)
  • packages/configurator/README.md (1 hunks)
  • packages/configurator/package.json (1 hunks)
  • packages/configurator/src/index.js (1 hunks)
  • packages/configurator/src/input-configurator/InputConfigurator.vue (1 hunks)
  • packages/configurator/src/input-configurator/index.js (1 hunks)
  • packages/configurator/src/select-configurator/SelectConfigurator.vue (1 hunks)
  • packages/configurator/src/select-configurator/index.js (1 hunks)
  • packages/configurator/vite.config.js (1 hunks)
  • packages/design-core/public/mock/bundle.json (125 hunks)
  • packages/design-core/src/init.js (2 hunks)
  • packages/design-core/src/registerMetaComponents.js (1 hunks)
  • packages/design-core/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (5)
  • designer-demo/src/configurators.js
  • packages/builtinComponent/src/meta/CanvasRowColContainer.json
  • packages/configurator/src/index.js
  • packages/configurator/src/input-configurator/index.js
  • packages/configurator/src/select-configurator/index.js
Files skipped from review as they are similar to previous changes (4)
  • designer-demo/src/main.js
  • packages/design-core/public/mock/bundle.json
  • packages/design-core/src/init.js
  • packages/design-core/src/registerMetaComponents.js
Additional context used
Biome
packages/design-core/vite.config.js

[error] 3-3: A Node.js builtin module should be imported with the node: protocol.

Additional comments not posted (10)
packages/configurator/README.md (1)

1-3: Ensure the description accurately reflects the functionalities of the meta component configurators introduced in this PR.

designer-demo/package.json (1)

14-15: Confirm the versioning and necessity of the newly added dependencies for proper integration with the TinyEngine modules.

Verification successful

The newly added dependencies related to the @opentiny/tiny-engine modules are indeed used extensively throughout the project. This confirms their necessity and proper integration.

  • The dependencies are referenced in various configuration files, scripts, and source code files.
  • They are used in multiple packages and modules within the project, indicating their importance and widespread usage.

This thorough usage across the project validates the addition of these dependencies.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the newly added dependencies are correctly versioned and necessary.
# Test: Check the package versions and their usage in the project.
cat designer-demo/package.json | grep '@opentiny/tiny-engine'

Length of output: 310



Script:

#!/bin/bash
# Description: Verify the usage of the newly added dependencies in the project files.
# Test: Search for the usage of @opentiny/tiny-engine dependencies in the project.
rg '@opentiny/tiny-engine' --glob '!node_modules/*'

Length of output: 94490

packages/configurator/package.json (1)

1-28: Review the entire package configuration to ensure all dependencies, scripts, and metadata are correctly set up and aligned with the project standards.

Verification successful

The package.json file for the configurator package is correctly configured with the necessary metadata, scripts, and dependencies.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the package configuration in package.json.
# Test: Check the dependencies, scripts, and metadata for correctness.
cat packages/configurator/package.json

Length of output: 722

packages/configurator/vite.config.js (1)

13-34: Ensure the Vite configuration is optimized for the package's needs, particularly the plugins and rollup options.

Verification successful

The Vite configuration for the configurator package includes standard plugins for Vue and Vue JSX, and the rollup options are appropriately set for a library build. The configuration appears optimized for the package's needs.

  • Plugins: vue(), vueJsx()
  • Rollup options: banner, external dependencies
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the Vite configuration is optimized.
# Test: Review the plugins and rollup options in the configuration.
cat packages/configurator/vite.config.js

Length of output: 1085

designer-demo/src/MyInputConfigurator.vue (1)

1-51: Review the implementation of the MyInputConfigurator component to ensure it follows Vue best practices and aligns with the project's component architecture.

Verification successful

The implementation of the MyInputConfigurator component follows Vue best practices and aligns with the project's component architecture. The props, emits, and setup function are correctly implemented.

  • The props are defined with appropriate types and default values.
  • The emits array correctly lists the 'update:modelValue' event.
  • The setup function uses the ref function to create a reactive value and defines a change function to emit the updated value.
  • The template binds the value to the tiny-input component and listens for the update:modelValue event.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the Vue component implementation.
# Test: Review the component definition, props, emits, and setup function.
cat designer-demo/src/MyInputConfigurator.vue

Length of output: 1168

packages/configurator/src/input-configurator/InputConfigurator.vue (1)

1-60: Review the implementation of the InputConfigurator component to ensure it follows Vue best practices and aligns with the project's component architecture.

packages/configurator/src/select-configurator/SelectConfigurator.vue (1)

50-109: Ensure proper localization and reactive state management in Vue component.

This Vue component is well-structured with clear prop definitions, emits, and reactive state management. The use of localization and computed properties for dynamic updates is commendable.

packages/builtinComponent/src/meta/CanvasRow.json (1)

37-37: Update CanvasRow component configuration to use new configurators.

The configuration updates to use InputConfigurator and SelectConfigurator for various properties are correctly implemented. This ensures that the component can utilize the newly introduced configurators effectively.

Also applies to: 53-53, 69-69, 85-85, 109-109

packages/builtinComponent/src/meta/CanvasCol.json (1)

59-59: Update CanvasCol component configuration to use new configurators.

The configuration updates to use InputConfigurator and SelectConfigurator for various properties are correctly implemented. This ensures that the component can utilize the newly introduced configurators effectively.

Also applies to: 75-75, 91-91, 107-107, 131-131

packages/canvas/src/components/builtin/builtin.json (1)

97-97: Ensure consistent use of configurators in built-in components.

The updates to use InputConfigurator for properties like name, text, and src in various built-in components are correctly implemented. This ensures that the components can utilize the newly introduced configurators effectively.

Also applies to: 259-259, 402-402

packages/common/component/ConfigItem.vue Outdated Show resolved Hide resolved
designer-demo/src/MyInputConfigurator.vue Outdated Show resolved Hide resolved
packages/configurator/README.md Outdated Show resolved Hide resolved
packages/design-core/src/registerMetaComponents.js Outdated Show resolved Hide resolved
packages/entry/README.md Show resolved Hide resolved
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 637b244 and 178d3e3.

Files selected for processing (1)
  • packages/configurator/package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/configurator/package.json

wenmine
wenmine previously approved these changes May 31, 2024
@chilingling chilingling requested a review from wenmine May 31, 2024 02:50
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: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 178d3e3 and 1b0ea30.

Files selected for processing (8)
  • designer-demo/src/MyInputConfigurator.vue (1 hunks)
  • packages/common/component/ConfigItem.vue (2 hunks)
  • packages/configurator/README.md (1 hunks)
  • packages/design-core/src/init.js (2 hunks)
  • packages/design-core/src/registerConfigurators.js (1 hunks)
  • packages/entry/README.md (1 hunks)
  • packages/entry/src/configurators.js (1 hunks)
  • packages/entry/src/index.js (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/configurator/README.md
Files skipped from review as they are similar to previous changes (4)
  • designer-demo/src/MyInputConfigurator.vue
  • packages/common/component/ConfigItem.vue
  • packages/design-core/src/init.js
  • packages/entry/src/index.js
Additional context used
Markdownlint
packages/entry/README.md

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

Additional comments not posted (2)
packages/entry/src/configurators.js (1)

11-13: This function correctly retrieves a configurator by name. Well done!

packages/design-core/src/registerConfigurators.js (1)

8-11: Ensure that addConfigurator is used correctly and that there are no duplicate names between the meta components and the user-provided configurators.

Verification successful

The verification process has confirmed that there are no duplicate names between the meta components and the user-provided configurators. The only duplicate found was MetaComponents, which is not an actual component name but rather a reference to the collection itself.

  • No duplicate names were found between the meta components and the user-provided configurators.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify no duplicate names between meta components and user-provided configurators.

# Test: Search for duplicate names. Expect: No duplicates.
rg --type javascript $'addConfigurator'

Length of output: 73



Script:

#!/bin/bash
# Correcting the search for `addConfigurator` usage in JavaScript files.
rg 'addConfigurator' --glob '*.js'

# Extracting names from MetaComponents and configurators to check for duplicates.
# Assuming MetaComponents is defined in a file, we need to locate it first.
meta_components_file=$(rg 'MetaComponents' --files-with-matches --glob '*.js')
configurators_file=$(rg 'registerConfigurators' --files-with-matches --glob '*.js')

# Extracting names from MetaComponents
meta_names=$(rg 'MetaComponents' "$meta_components_file" | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n')

# Extracting names from configurators
configurator_names=$(rg 'configurators' "$configurators_file" | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n')

# Checking for duplicates
echo "$meta_names" | sort | uniq -d
echo "$configurator_names" | sort | uniq -d

Length of output: 1842



Script:

#!/bin/bash
# Correcting the search for `addConfigurator` usage in JavaScript files.
rg 'addConfigurator' --glob '*.js'

# Extracting names from MetaComponents and configurators to check for duplicates.
# Assuming MetaComponents is defined in multiple files, we need to handle each file separately.
meta_components_files=$(rg 'MetaComponents' --files-with-matches --glob '*.js')
configurators_files=$(rg 'registerConfigurators' --files-with-matches --glob '*.js')

# Extracting names from MetaComponents
meta_names=$(echo "$meta_components_files" | xargs -I {} rg 'MetaComponents' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n')

# Extracting names from configurators
configurator_names=$(echo "$configurators_files" | xargs -I {} rg 'configurators' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n')

# Checking for duplicates
echo "$meta_names" | sort | uniq -d
echo "$configurator_names" | sort | uniq -d

Length of output: 1822



Script:

#!/bin/bash
# Correcting the search for `addConfigurator` usage in JavaScript files.
rg 'addConfigurator' --glob '*.js'

# Extracting names from MetaComponents and configurators to check for duplicates.
# Assuming MetaComponents is defined in multiple files, we need to handle each file separately.
meta_components_files=$(rg 'MetaComponents' --files-with-matches --glob '*.js')
configurators_files=$(rg 'registerConfigurators' --files-with-matches --glob '*.js')

# Extracting names from MetaComponents
meta_names=$(echo "$meta_components_files" | xargs -I {} rg 'MetaComponents' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n' | grep -oP '\w+')

# Extracting names from configurators
configurator_names=$(echo "$configurators_files" | xargs -I {} rg 'configurators' {} | gawk -F'[{}]' '{print $2}' | tr -d ' ' | tr ',' '\n' | grep -oP '\w+')

# Checking for duplicates
echo "$meta_names" | sort | uniq -d
echo "$configurator_names" | sort | uniq -d

Length of output: 1824

packages/entry/src/configurators.js Outdated Show resolved Hide resolved
packages/entry/README.md Outdated Show resolved Hide resolved
@zzcr zzcr merged commit a16e929 into opentiny:refactor/develop May 31, 2024
@coderabbitai coderabbitai bot mentioned this pull request Sep 14, 2024
14 tasks
yy-wow pushed a commit to yy-wow/tiny-engine that referenced this pull request Oct 10, 2024
* feat(metaComponent): add capability of add custom metaComponents

* feat: metaComponents pass to init fun register

* fix: refactor code by code review

* feat: rename metaComponent to configurator

* fix(configurator): add base info to package.json

* feat: rename metaxxx to configurator

* fix: rename metaxxx to configurators

* fix: refactor code by review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready_for_review This PR requires more reviews refactoring Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants