An integration method of component documents and related device
Patent Information
- Application Number
- CN202310751352.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-25
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-06-25
AI Technical Summary
但这种生成UI文档的方式,由于是在隔离环境下生成的,没有可以持续集成(也即持续输出)的工具链,故无法在UI组件更新时,实现UI文档的同步更新
[0062]本申请实施例中,检查组件的更新,以确定更新后组件的代码;将所述更新后组件的代码转换为脚本识别的语法树;利用所述脚本从所述语法树中获取更新后组件的参数,其中,所述更新后组件的参数包括更新后组件的名称、引用路径、默认参数、更新后组件的依赖和更新后组件的依赖说明中的至少一项;利用所述脚本将所述更新后组件的参数转换为符合组件使用文档输出标准的代码;将所述符合组件使用文档输出标准的代码写入至组件的使用文档中。
Smart Images

Figure CN116775115B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer component technology, and in particular to a method and apparatus for integrating component documentation. Background Technology
[0002] UI cards, also known as UI components, are used to break down a page into multiple UI components. This can improve the reusability of UI components, increase code reuse, and reduce development costs. Each UI component is used to display a small part of the page. The specific area of the page that a UI component corresponds to and the size of that area are designed by the UI component developers, which is quite flexible.
[0003] In modern front-end development, web pages are primarily created by developing UI components and then assembling these components to build a complete page for users to browse and use. Each UI component requires a user documentation (UI documentation) to describe the component's detailed usage information.
[0004] Existing technologies can generate a UI document in an isolated environment by writing code based on UI components, making it convenient for external output. However, because this method of generating UI documents is done in an isolated environment, there is no toolchain for continuous integration (i.e., continuous output), so it is impossible to achieve synchronous updates of the UI document when the UI components are updated. Summary of the Invention
[0005] This invention provides a method and apparatus for integrating component documentation, which is used to synchronously output the component's usage documentation when the component is updated, so as to achieve synchronous updates of the component's usage documentation and the component.
[0006] The first aspect of this application provides a method for integrating component documents, including:
[0007] Check the component updates to determine the code of the updated component;
[0008] The code of the updated component is converted into a syntax tree that the script can recognize;
[0009] The updated component's parameters are obtained from the syntax tree using the script, wherein the updated component's parameters include at least one of the following: the updated component's name, reference path, default parameters, the updated component's dependencies, and the updated component's dependency description.
[0010] The script is used to convert the parameters of the updated component into code that conforms to the output standards of the component usage documentation.
[0011] Write the code that conforms to the component usage documentation output standard into the component's usage documentation.
[0012] In some embodiments, checking for updates to the component to determine the code of the updated component includes:
[0013] The code submission tool is used to automatically intercept the code flow, and the difference determination tool is used to determine the differences between the components before and after the update.
[0014] Based on the differences between the component before and after the update, the code of the updated component is determined.
[0015] In some embodiments, the method further includes, before converting the code of the updated component into a syntax tree that the script can recognize:
[0016] Determine the development framework for the component, wherein the development framework includes the React framework, Vue framework, or Angular framework;
[0017] Using the language under the development framework, the code of the updated component is converted into a syntax tree that the script can recognize.
[0018] In some embodiments, after retrieving the parameters of the updated component from the syntax tree using the script, the method further includes:
[0019] According to the preset specification library, check whether the parameters of the updated component conform to the specification. The preset specification library supports user-defined settings.
[0020] If so, then the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0021] In some embodiments, the method further includes:
[0022] If the parameters of the updated component conform to the specification, then determine whether the usage documentation of the updated component exists in the component's usage documentation;
[0023] If the updated component's usage documentation is not present in the component's documentation, then the step of using the script to convert the updated component's parameters into code that conforms to the component's usage documentation output standard is triggered.
[0024] In some embodiments, the method further includes:
[0025] If the parameters of the updated component meet the specifications, a prompt instruction is sent to the user, wherein the prompt instruction is used to instruct the user to complete the usage documentation of the updated component;
[0026] If the user inputs a completion command, the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0027] In some embodiments, the method further includes:
[0028] Generate updated component documentation based on code that conforms to component usage documentation output standards.
[0029] In some embodiments, the code submission tool includes Git tools and Husky workflows, the difference determination tool includes Gitdiff, and the code that conforms to the component usage documentation output standard includes code that storybook can parse and code that Vitepress can parse.
[0030] A second aspect of this application provides an integration apparatus for component documentation, comprising:
[0031] The inspection unit is used to inspect component updates in order to determine the code of the updated component;
[0032] A conversion unit is used to convert the code of the updated component into a syntax tree that the script can recognize;
[0033] The acquisition unit is used to acquire parameters of the updated component from the syntax tree using the script, wherein the parameters of the updated component include at least one of the following: the name of the updated component, the reference path, the default parameters, the dependencies of the updated component, and the dependency description of the updated component.
[0034] The conversion unit is also used to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation using the script;
[0035] The writing unit is used to write the code that conforms to the component usage document output standard into the component's usage document.
[0036] In some embodiments, the inspection unit is specifically used for:
[0037] The code submission tool is used to automatically intercept the code flow, and the difference determination tool is used to determine the differences between the components before and after the update.
[0038] Based on the differences between the component before and after the update, the code of the updated component is determined.
[0039] In some embodiments, the apparatus further includes:
[0040] The determining unit is used to determine the development framework of the component before converting the code of the updated component into a syntax tree that the script can recognize, wherein the development framework includes the React framework, the Vue framework, or the Angular framework.
[0041] In some embodiments, the conversion unit is specifically used for:
[0042] Using the language under the development framework, the code of the updated component is converted into a syntax tree that the script can recognize.
[0043] In some embodiments, the inspection unit is further configured to:
[0044] After obtaining the updated component's parameters from the syntax tree using the script, the updated component's parameters are checked against the preset specification library to see if they conform to the specification. The preset specification library supports user-defined settings.
[0045] In some embodiments, the apparatus further includes:
[0046] A triggering unit is used to trigger a step of converting the parameters of the updated component into code that conforms to the output standard of the component usage documentation if the parameters of the updated component conform to the specification.
[0047] In some embodiments, the determining unit is further configured to:
[0048] If the parameters of the updated component conform to the specification, then determine whether the usage documentation of the updated component exists in the component's usage documentation;
[0049] In some embodiments, the apparatus further includes:
[0050] A triggering unit is configured to, if the updated component's usage documentation does not exist in the component's usage documentation, trigger a step of using the script to convert the parameters of the updated component into code that conforms to the component's usage documentation output standard.
[0051] In some embodiments, the apparatus further includes:
[0052] The sending unit is used to send a prompt instruction to the user if the parameters of the updated component meet the specifications, wherein the prompt instruction is used to instruct the user to complete the usage documentation of the updated component;
[0053] The triggering unit is also used for:
[0054] If the user inputs a completion command, the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0055] In some embodiments, the apparatus further includes:
[0056] The generation unit is used to generate updated component annotation documentation based on code that conforms to the component usage documentation output standard.
[0057] In some embodiments, the code submission tool includes Git tools and Husky workflows, the difference determination tool includes Gitdiff, and the code that conforms to the component usage documentation output standard includes code that storybook can parse and code that Vitepress can parse.
[0058] A third aspect of this application provides a computer device including a processor, which, when executing a computer program stored in a memory, implements the component document integration method provided in the first aspect of this application.
[0059] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is used to implement the component document integration method provided in the first aspect of this application.
[0060] The fifth aspect of this application provides a computer program product having a computer program stored thereon. When executed by a computer device, the computer program is used to implement the component document integration method provided in the first aspect of this application.
[0061] As can be seen from the above technical solutions, the embodiments of the present invention have the following advantages:
[0062] In this embodiment, the update of the component is checked to determine the code of the updated component; the code of the updated component is converted into a syntax tree that can be recognized by the script; the parameters of the updated component are obtained from the syntax tree using the script, wherein the parameters of the updated component include at least one of the following: the name of the updated component, the reference path, the default parameters, the dependencies of the updated component, and the dependency description of the updated component; the parameters of the updated component are converted into code that conforms to the component usage documentation output standard using the script; and the code that conforms to the component usage documentation output standard is written into the component's usage documentation.
[0063] Because the embodiments of this application can use a script to convert the code of the updated component into code that conforms to the output standard of the component usage document after the component is updated, and write the code that conforms to the output standard of the component usage document into the component's usage document, thus realizing the synchronous update of the component usage document and the component. Attached Figure Description
[0064] Figure 1 This is a schematic diagram of one embodiment of the method for integrating component documents in this application.
[0065] Figure 2 This is a schematic diagram of another embodiment of the component document integration method in this application;
[0066] Figure 3 This is a schematic diagram of one embodiment of the component document integration device in this application. Detailed Implementation
[0067] This invention provides a method and apparatus for integrating component documentation, which is used to synchronously output the component's usage documentation when the component is updated, so as to achieve synchronous updates of the component's usage documentation and the component.
[0068] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0069] The terms "first," "second," "third," "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0070] As components of the front-end page display, each UI component requires a user document (UI document) to describe the detailed usage information of the component during the application development process. However, the UI documents in the current technology are generated in an isolated environment, which makes it impossible to achieve synchronous updates of the UI documents when the UI components are updated.
[0071] For ease of understanding, the method of component document integration in the embodiments of this application is described below. Please refer to [link / reference]. Figure 1 One embodiment of the component document integration method in this application includes:
[0072] 101. Check the component updates to determine the code of the updated component;
[0073] In existing technologies, when the common business code of the front-end component is updated, users need to manually synchronize and update the usage documentation related to the front-end component code, which causes the component usage documentation to be unable to be continuously integrated (i.e., continuously output).
[0074] To address this issue, embodiments of this application can detect component updates via a built-in code inspection module when front-end components are updated, thereby determining the updated component code.
[0075] Specifically, in this embodiment of the application, the code inspection module can automatically intercept the code flow through the code submission tool, so as to determine the differences between the component before and after the update through the difference determination tool, and finally determine the code of the updated component based on the difference.
[0076] Furthermore, the code submission tools in this embodiment include Git tools and Husky workflows, and the difference determination tool includes Gitdiff. Users can manage code through Git repositories. Furthermore, when detecting component updates, all newly added and modified files in this component update are obtained through the gitdiff command in the Husky workflow of the Git repository.
[0077] The gitdiff command, by default, displays all file differences between the working directory and the staging area.
[0078] 102. Convert the code of the updated component into a syntax tree that the script can recognize;
[0079] To quickly convert the updated component code into code that conforms to the component usage documentation output standard, this embodiment converts the updated component code into a syntax tree that the script can recognize. Because a syntax tree, as a syntax format, allows the script to easily retrieve the parameters of the updated component, thus improving the convenience of obtaining these parameters.
[0080] 103. Use the script to obtain the parameters of the updated component from the syntax tree, wherein the parameters of the updated component include at least one of the following: the name of the updated component, the reference path, the default parameters, the dependencies of the updated component, and the dependency description of the updated component.
[0081] After converting the updated component's code into a syntax tree that the script can recognize, the script can then retrieve the updated component's parameters from the syntax tree. The updated component's parameters include at least one of the following: the updated component's name, reference path, default parameters, the updated component's dependencies, and the updated component's dependency description.
[0082] Specifically, component dependency refers to the mutual need between components. For example, component A implements the basic API for controlling the WS2812 LED strip, and you are writing component B whose goal is to control the WS2812 via WiFi. In this case, component B can depend on component A. The updated dependency description of the components can then indicate whether the dependency is public or private. If only component B can depend on component A, this dependency is considered private. If component B can be depended on by other components, this dependency is considered public.
[0083] 104. Use the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation;
[0084] After the script retrieves the updated component's parameters from the syntax tree, it can then further convert these parameters into code that conforms to the component's usage documentation output standards.
[0085] Because scripts can quickly convert between syntax trees and code, this embodiment first converts the code of the updated component into a syntax tree, then obtains the parameters of the updated component from the syntax tree, and finally uses a script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation, thereby improving the convenience of converting the code of the updated component into code that conforms to the output standard of the component usage documentation.
[0086] 105. Write the code that conforms to the component usage documentation output standard into the component's usage documentation.
[0087] After obtaining the code for the standard output of the composite component's usage documentation, this code is written into the component's usage documentation, thereby improving the convenience and automation of generating component usage documentation when the component is updated, and realizing continuous integration of component usage documentation.
[0088] In this embodiment, the update of the component is checked to determine the code of the updated component; the code of the updated component is converted into a syntax tree that can be recognized by the script; the parameters of the updated component are obtained from the syntax tree using the script, wherein the parameters of the updated component include at least one of the following: the name of the updated component, the reference path, the default parameters, the dependencies of the updated component, and the dependency description of the updated component; the parameters of the updated component are converted into code that conforms to the component usage documentation output standard using the script; and the code that conforms to the component usage documentation output standard is written into the component's usage documentation.
[0089] Because the embodiments of this application can use a script to convert the code of the updated component into code that conforms to the output standard of the component usage document after the component is updated, and write the code that conforms to the output standard of the component usage document into the component's usage document, the synchronous update of the component usage document and the component is realized, and the continuous integration of the component usage document is also realized.
[0090] based on Figure 1 The embodiments described above will be followed by a detailed description of the component document integration method in this application. Please refer to [link to relevant documentation]. Figure 2 Another embodiment of the component document integration method in this application includes:
[0091] 201. Check the component updates to determine the code of the updated component;
[0092] It should be noted that step 201 in this embodiment is different from... Figure 1 The description of step 101 in the embodiments is similar and will not be repeated here.
[0093] 202. Determine the development framework of the component, wherein the development framework includes the React framework, Vue framework, or Angular framework;
[0094] As we all know, when developing UI components, we can develop them based on different development frameworks, such as React, Vue, or Angular. Different development frameworks use different programming languages. Therefore, before converting the updated component code into a syntax tree that the script can recognize, it is necessary to determine the programming language under each development framework.
[0095] 203. Using the language under the development framework, convert the code of the updated component into a syntax tree that the script can recognize;
[0096] Once the language for each development framework is determined, the updated component code can be converted into a syntax tree that the script can recognize using the corresponding development language of the development framework.
[0097] 204. Use the script to obtain the parameters of the updated component from the syntax tree, wherein the parameters of the updated component include at least one of the following: the name of the updated component, the reference path, the default parameters, the dependencies of the updated component, and the dependency description of the updated component.
[0098] It should be noted that step 204 in the embodiments of this application is different from... Figure 1 The description of step 103 in the embodiments is similar and will not be repeated here.
[0099] 205. According to the preset specification library, check whether the parameters of the updated component conform to the specification. The preset specification library supports user-defined settings. If yes, proceed to step 206; otherwise, prompt a code error.
[0100] To ensure that the parameters of the updated component conform to the settings of the specification library, this embodiment of the application obtains the parameters of the updated component and then matches the parameters of the updated component with the preset specification library to check whether the parameters of the updated component conform to the specification. If yes, step 206 is executed; otherwise, a code error is prompted.
[0101] 206. Determine whether the updated component's usage documentation exists in the component's usage documentation. If not, proceed to step 207; if yes, end the process.
[0102] If the updated component's parameters conform to the specifications in the preset specification library, then further verification is performed. Does the updated component's usage documentation exist in the component's documentation? If not, proceed to step 207; otherwise, end the current process.
[0103] Specifically, when determining whether an updated version of the component's documentation exists in the component's documentation, the document identifier of the updated component (such as the document name of the updated component) can be used to search for the updated component's documentation. If the document name of the updated component exists in the component's documentation, then it is determined that an updated version of the component's documentation exists in the component's documentation; otherwise, it is determined that an updated version of the component's documentation does not exist in the component's documentation.
[0104] 207. Send a prompt instruction to the user, wherein the prompt instruction is used to instruct the user to complete the usage documentation of the updated component;
[0105] If the updated component's documentation is missing from the component's documentation, a prompt instruction is sent to the user, instructing the user to complete the updated component's documentation.
[0106] Specifically, the prompt could be something like "Please complete the updated component's documentation," "Please continue integrating the documentation," or "Please confirm whether you want to complete the updated component's documentation," etc. There are no specific restrictions here.
[0107] 208. If the user inputs a completion command, the script is used to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation;
[0108] If the user inputs completion commands, the script converts the updated component's parameters into code that conforms to the component's documentation output standards. This code conforming to the documentation's output standards includes code that Storybook and Vitepress can parse; Storybook and Vitepress are the component's development tools, respectively.
[0109] The specific conversion process is consistent with that described in existing technologies, and will not be repeated here.
[0110] 209. Write the code that conforms to the component usage documentation output standard into the component's usage documentation.
[0111] Once the code that conforms to the component usage documentation output standard is obtained, the code is written into the component usage documentation to generate the modified component usage documentation (UI usage documentation).
[0112] 210. Generate the updated component's comment documentation based on the standard code output that conforms to the component usage documentation.
[0113] Furthermore, to facilitate other developers (excluding those updating the component) in reviewing the component's documentation, an updated component comment document can be generated based on code that conforms to the component's documentation output standard. This comment document can include, in addition to the content in the documentation, the component's modifier, modification date, etc.
[0114] In this embodiment of the application, the process of generating the updated component's usage documentation and annotation documentation is described in detail. Furthermore, before generating the component's usage documentation, this embodiment of the application performs a standardization check on the changes to the updated component and enables the component development tool to continuously integrate the component's usage documentation, maintaining the continuous output of the component and improving the convenience of learning component development.
[0115] The integration method of component documents in the embodiments of this application has been described in detail above. The integration apparatus of component documents in the embodiments of this application will be described below. Please refer to [link / reference]. Figure 3 One embodiment of the document integration device in this application includes:
[0116] Inspection unit 301 is used to inspect the update of the component in order to determine the code of the updated component;
[0117] The conversion unit 302 is used to convert the code of the updated component into a syntax tree that can be recognized by the script;
[0118] The acquisition unit 303 is used to acquire the parameters of the updated component from the syntax tree using the script, wherein the parameters of the updated component include at least one of the following: the name of the updated component, the reference path, the default parameters, the dependencies of the updated component, and the dependency description of the updated component.
[0119] The conversion unit 302 is also used to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation using the script;
[0120] The writing unit 304 is used to write the code that conforms to the component usage document output standard into the component's usage document.
[0121] In some embodiments, the inspection unit 301 is specifically used for:
[0122] The code submission tool is used to automatically intercept the code flow, and the difference determination tool is used to determine the differences between the components before and after the update.
[0123] Based on the differences between the component before and after the update, the code of the updated component is determined.
[0124] In some embodiments, the apparatus further includes:
[0125] The determining unit 305 is used to determine the development framework of the component before converting the code of the updated component into a syntax tree that the script can recognize, wherein the development framework includes the React framework, the Vue framework, or the Angular framework.
[0126] In some embodiments, the conversion unit 302 is specifically used for:
[0127] Using the language under the development framework, the code of the updated component is converted into a syntax tree that the script can recognize.
[0128] In some embodiments, the inspection unit 301 is further configured to:
[0129] After obtaining the updated component's parameters from the syntax tree using the script, the updated component's parameters are checked against the preset specification library to see if they conform to the specification. The preset specification library supports user-defined settings.
[0130] In some embodiments, the apparatus further includes:
[0131] Triggering unit 306 is used to trigger the step of converting the parameters of the updated component into code that conforms to the output standard of the component usage documentation if the parameters of the updated component conform to the specification.
[0132] In some embodiments, the determining unit 305 is further configured to:
[0133] If the parameters of the updated component conform to the specification, then determine whether the usage documentation of the updated component exists in the component's usage documentation;
[0134] In some embodiments, the triggering unit 306 is further configured to:
[0135] If the updated component's usage documentation is not present in the component's documentation, then the step of using the script to convert the updated component's parameters into code that conforms to the component's usage documentation output standard is triggered.
[0136] In some embodiments, the apparatus further includes:
[0137] Sending unit 307 is used to send a prompt instruction to the user if the parameters of the updated component meet the specifications, wherein the prompt instruction is used to instruct the user to complete the usage documentation of the updated component;
[0138] The triggering unit 306 is also used for:
[0139] If the user inputs a completion command, the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0140] In some embodiments, the apparatus further includes:
[0141] Generation unit 308 is used to generate the updated component's annotation documentation based on code that conforms to the component usage documentation output standard.
[0142] In some embodiments, the code submission tool includes Git tools and Husky workflows, the difference determination tool includes Gitdiff, and the code that conforms to the component usage documentation output standard includes code that storybook can parse and code that Vitepress can parse.
[0143] Because in this embodiment of the application, after a component is updated, the conversion unit 302 can use a script to convert the code of the updated component into code that conforms to the component usage document output standard, and write the code that conforms to the component usage document output standard into the component's usage document, thus realizing the synchronous update of the component usage document and the component, and also realizing the continuous integration of the component usage document.
[0144] This application also provides a computer program product, on which a computer program is stored. When executed by a processor, the computer program is used to implement the embodiments of this application. Figures 1 to 2 The method for integrating the component files described above.
[0145] The above description of the component document integration device in the embodiments of the present invention is from the perspective of modular functional entities. The following description of the computer device in the embodiments of the present invention is from the perspective of hardware processing:
[0146] This computer device is used to implement the functions of a component document integration device. One embodiment of the computer device in this invention includes:
[0147] Processor and memory;
[0148] When a memory is used to store computer programs, and a processor executes the computer programs stored in the memory, the following steps can be achieved:
[0149] Check the component updates to determine the code of the updated component;
[0150] The code of the updated component is converted into a syntax tree that the script can recognize;
[0151] The updated component's parameters are obtained from the syntax tree using the script, wherein the updated component's parameters include at least one of the following: the updated component's name, reference path, default parameters, the updated component's dependencies, and the updated component's dependency description.
[0152] The script is used to convert the parameters of the updated component into code that conforms to the output standards of the component usage documentation.
[0153] Write the code that conforms to the component usage documentation output standard into the component's usage documentation.
[0154] In some embodiments of the present invention, the processor may also be used to implement the following steps:
[0155] The code submission tool is used to automatically intercept the code flow, and the difference determination tool is used to determine the differences between the components before and after the update.
[0156] Based on the differences between the component before and after the update, the code of the updated component is determined.
[0157] In some embodiments of the present invention, before converting the code of the updated component into a syntax tree that the script can recognize, the processor may also perform the following steps:
[0158] Determine the development framework for the component, wherein the development framework includes the React framework, Vue framework, or Angular framework;
[0159] Using the language under the development framework, the code of the updated component is converted into a syntax tree that the script can recognize.
[0160] In some embodiments of the present invention, after obtaining the parameters of the updated component from the syntax tree using the script, the processor may further be configured to perform the following steps:
[0161] According to the preset specification library, check whether the parameters of the updated component conform to the specification. The preset specification library supports user-defined settings.
[0162] If so, then the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0163] In some embodiments of the present invention, the processor may also be used to implement the following steps:
[0164] If the parameters of the updated component conform to the specification, then determine whether the usage documentation of the updated component exists in the component's usage documentation;
[0165] If the updated component's usage documentation is not present in the component's documentation, then the step of using the script to convert the updated component's parameters into code that conforms to the component's usage documentation output standard is triggered.
[0166] In some embodiments of the present invention, the processor may also be used to implement the following steps:
[0167] If the parameters of the updated component meet the specifications, a prompt instruction is sent to the user, wherein the prompt instruction is used to instruct the user to complete the usage documentation of the updated component;
[0168] If the user inputs a completion command, the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0169] In some embodiments of the present invention, the processor may also be used to implement the following steps:
[0170] Generate updated component documentation based on code that conforms to component usage documentation output standards.
[0171] In some embodiments of the present invention, the code submission tool includes Git tools and Husky workflows, the difference determination tool includes Gitdiff, and the code that conforms to the component usage documentation output standard includes code that storybook can parse and code that Vitepress can parse.
[0172] It is understood that when the processor in the computer device described above executes the computer program, it can also implement the functions of each unit in the corresponding device embodiments described above, which will not be repeated here. For example, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the component document integration device. For example, the computer program can be divided into units in the component document integration device described above, and each unit can implement the specific functions described in the corresponding component document integration device.
[0173] The computer device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the processor and memory are merely examples of a computer device and do not constitute a limitation on the computer device. It may include more or fewer components, or a combination of certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.
[0174] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device, connecting various parts of the computer device via various interfaces and lines.
[0175] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, SmartMediaCard (SMC), Secure Digital (SD) card, FlashCard, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0176] The present invention also provides a computer-readable storage medium for implementing the function of an integration device for component documents, wherein a computer program is stored thereon, and when the computer program is executed by a processor, the processor can perform the following steps:
[0177] Check the component updates to determine the code of the updated component;
[0178] The code of the updated component is converted into a syntax tree that the script can recognize;
[0179] The updated component's parameters are obtained from the syntax tree using the script, wherein the updated component's parameters include at least one of the following: the updated component's name, reference path, default parameters, the updated component's dependencies, and the updated component's dependency description.
[0180] The script is used to convert the parameters of the updated component into code that conforms to the output standards of the component usage documentation.
[0181] Write the code that conforms to the component usage documentation output standard into the component's usage documentation.
[0182] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor, the processor may also be used to perform the following steps:
[0183] The code submission tool is used to automatically intercept the code flow, and the difference determination tool is used to determine the differences between the components before and after the update.
[0184] Based on the differences between the component before and after the update, the code of the updated component is determined.
[0185] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor before the code of the updated component is converted into a syntax tree recognizable by a script, the processor may also perform the following steps:
[0186] Determine the development framework for the component, wherein the development framework includes the React framework, Vue framework, or Angular framework;
[0187] Using the language under the development framework, the code of the updated component is converted into a syntax tree that the script can recognize.
[0188] In some embodiments of the present invention, after obtaining the parameters of the updated component from the syntax tree using the script, the processor may further be configured to perform the following steps:
[0189] According to the preset specification library, check whether the parameters of the updated component conform to the specification. The preset specification library supports user-defined settings.
[0190] If so, then the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0191] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor, the processor may also be used to perform the following steps:
[0192] If the parameters of the updated component conform to the specification, then determine whether the usage documentation of the updated component exists in the component's usage documentation;
[0193] If the updated component's usage documentation is not present in the component's documentation, then the step of using the script to convert the updated component's parameters into code that conforms to the component's usage documentation output standard is triggered.
[0194] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor, the processor may also be used to perform the following steps:
[0195] If the parameters of the updated component meet the specifications, a prompt instruction is sent to the user, wherein the prompt instruction is used to instruct the user to complete the usage documentation of the updated component;
[0196] If the user inputs a completion command, the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
[0197] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor, the processor may also be used to perform the following steps:
[0198] Generate updated component documentation based on code that conforms to component usage documentation output standards.
[0199] In some embodiments of the present invention, the code submission tool includes Git tools and Husky workflows, the difference determination tool includes Gitdiff, and the code that conforms to the component usage documentation output standard includes code that storybook can parse and code that Vitepress can parse.
[0200] It is understood that if the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a corresponding computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above-described method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0201] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0202] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0203] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0204] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0205] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for integrating component documentation, characterized in that, The method includes: Check the component updates to determine the code of the updated component; The code of the updated component is converted into a syntax tree that the script can recognize; The updated component's parameters are obtained from the syntax tree using the script, wherein the updated component's parameters include at least one of the following: the updated component's name, reference path, default parameters, the updated component's dependencies, and the updated component's dependency description. According to the preset specification library, check whether the parameters of the updated component conform to the specification. The preset specification library supports user-defined settings. If so, use the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation. Write the code that conforms to the component usage documentation output standard into the component's usage documentation; The process of checking component updates to determine the updated component's code includes: The code submission tool is used to automatically intercept the code flow, and the difference determination tool is used to determine the differences between the components before and after the update. Based on the differences between the component before and after the update, the code of the updated component is determined.
2. The method according to claim 1, characterized in that, Before converting the code of the updated component into a syntax tree that the script can recognize, the method further includes: Determine the development framework for the component, wherein the development framework includes the React framework, Vue framework, or Angular framework; Using the language under the development framework, the code of the updated component is converted into a syntax tree that the script can recognize.
3. The method according to claim 1, characterized in that, The method further includes: If the parameters of the updated component conform to the specification, then determine whether the usage documentation of the updated component exists in the component's usage documentation; If not, then the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
4. The method according to claim 1, characterized in that, The method further includes: If the parameters of the updated component meet the specifications, a prompt instruction is sent to the user, wherein the prompt instruction is used to instruct the user to complete the usage documentation of the updated component; If the user inputs a completion command, the step of using the script to convert the parameters of the updated component into code that conforms to the output standard of the component usage documentation is triggered.
5. The method according to claim 1, characterized in that, The method further includes: Generate updated component documentation based on code that conforms to component usage documentation output standards.
6. The method according to any one of claims 1 to 5, characterized in that, The code submission tools include Git tools and Husky workflows, the difference determination tools include Gitdiff, and the code that conforms to the component usage documentation output standards includes code that can be parsed by storybook and code that can be parsed by Vitepress.
7. A computer device comprising a processor, characterized in that, When the processor executes a computer program stored in the memory, it is used to implement the component document integration method as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it is used to implement the integration method of component documents as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Component document generation method, device and equipment and readable storage medium
CN113971044A