CN113626067A - Component publishing method and device - Google Patents

Component publishing method and device Download PDF

Info

Publication number
CN113626067A
CN113626067A CN202010382443.7A CN202010382443A CN113626067A CN 113626067 A CN113626067 A CN 113626067A CN 202010382443 A CN202010382443 A CN 202010382443A CN 113626067 A CN113626067 A CN 113626067A
Authority
CN
China
Prior art keywords
component
code
test
data
assembly
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010382443.7A
Other languages
Chinese (zh)
Inventor
贾豪繁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010382443.7A priority Critical patent/CN113626067A/en
Publication of CN113626067A publication Critical patent/CN113626067A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application discloses a method and a device for releasing a component; the method and the device for creating the component can acquire attribute information of the component needing to be created, wherein the attribute information comprises an item type and a component type to which the component belongs; determining a creation template of the component based on the item type and the component type; injecting component code into a creation template for the component to create the component; testing the created component based on the test case of the component; when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly; and issuing the data packet of the component based on the demonstration prototype of the component. According to the scheme, high-degree automation can be realized in the assembly release, and the release efficiency of the assembly is improved.

Description

Component publishing method and device
Technical Field
The application relates to the technical field of computers, in particular to a component publishing method and device.
Background
With the development of computer technology, the development mode of software programs is also continuously improved, for example, front-end development is performed based on the idea of front-end componentization, which can improve the reusability and flexibility of components, thereby greatly improving the efficiency of front-end development.
In the research and practice process of the related technology, the inventor of the application finds that in the process from component development to component platform release, a large amount of complicated operations are required to be carried out in the stages of component construction, release and the like to ensure the smooth release of the components, so that the release efficiency of the components is low; in addition, for the built component to be published, the document structure of the component to be published has diversity, so that the chaos of component management is increased when the component is published, and further the low efficiency of component publishing is aggravated; in addition, although component screenshots are provided during component publishing, the components with high similarity in the user interface level are not easy to screen and screen, and therefore the component publishing efficiency is reduced.
Disclosure of Invention
The embodiment of the application provides a method and a device for issuing a component, which can realize high-degree automation in component issuing and improve the issuing efficiency of the component.
The embodiment of the application provides a component publishing method, which comprises the following steps:
acquiring attribute information of a component needing to be created, wherein the attribute information comprises an item type and a component type to which the component belongs;
determining a creation template of the component based on the item type and the component type;
injecting component code into a creation template for the component to create the component;
testing the created component based on the test case of the component;
when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly;
and issuing the data packet of the component based on the demonstration prototype of the component.
Correspondingly, this application embodiment still provides a subassembly issuing device, includes:
the device comprises an acquisition unit, a storage unit and a display unit, wherein the acquisition unit is used for acquiring attribute information of a component needing to be created, and the attribute information comprises an item type and a component type to which the component belongs;
the determining unit is used for determining a creation template of the component based on the item type and the component type;
an injection unit, configured to inject component code into the creation template of the component to create the component;
the testing unit is used for testing the created component based on the test case of the component;
the compiling unit is used for compiling the component to obtain a component data packet of the component when the test of the component passes;
and the issuing unit is used for issuing the data packet of the component based on the demonstration prototype of the component.
In one embodiment, the injection unit includes:
the display subunit is used for displaying a code debugging interface of the component when detecting an instruction of code debugging of the command line tool;
the code determining subunit is used for determining the component code of the component according to the code debugging result of the user on the code debugging interface;
a code injection subunit for injecting the determined component code into the creation template of the component;
and the template triggering subunit is used for triggering the creation template of the component to create the component according to the determined component code.
In one embodiment, the test unit includes:
the test acquisition subunit is used for acquiring a component test case of the component;
the test determining subunit is used for determining the test data of the component based on the component test case;
and the component testing subunit is used for testing the component according to the test data.
In an embodiment, the test acquisition subunit is configured to:
the triggering hook function obtains component module information of the component through incremental information analysis; and extracting the component test case of the component from the component module information.
In one embodiment, the compiling unit includes:
the code compiling subunit is used for compiling the code of the tested component to obtain the code data of the component;
the prototype compiling subunit is used for performing prototype compiling on the assembly passing the test to obtain prototype data of the assembly;
and the data generation subunit is used for generating the component data packet of the component by utilizing the code data and the prototype data.
In an embodiment, the code compiling subunit is configured to:
performing semantic analysis on the component to obtain an abstract syntax tree of the component; performing structure conversion on the abstract syntax tree to obtain a converted abstract syntax tree; generating code data for the component by traversing the converted abstract syntax tree.
In one embodiment, the issue unit includes:
the release verification subunit is used for performing release verification on the component data packet;
a prototype determining subunit, configured to determine a prototype for presentation of the component when the release verification passes;
and the release execution subunit is used for releasing the component data packet based on the demonstration prototype of the component.
In an embodiment, the issue verification subunit is configured to:
performing version analysis on the component data packet to obtain version information of the component; carrying out format check on the version information of the component according to the component release format; and when the format check passes, determining that the issuing verification passes.
In an embodiment, the obtaining unit includes:
the display subunit is used for displaying the command line interactive interface by calling the command line tool;
and the information acquisition subunit is used for acquiring the attribute information input in the command line interactive interface.
The method and the device for creating the component can acquire attribute information of the component needing to be created, wherein the attribute information comprises an item type and a component type to which the component belongs; determining a creation template of the component based on the item type and the component type; injecting component code into a creation template for the component to create the component; testing the created component based on the test case of the component; when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly; and issuing the data packet of the component based on the demonstration prototype of the component.
The scheme can determine the template for creating the component based on the attribute information of the component, so that the development and debugging of the component are more convenient and efficient, and the structural specification of the component can be restrained through the template, so that different components all follow the unified specification, and the management of the component is facilitated when the component is submitted and released. And after the codes of the components are submitted, high-degree automation is realized for subsequent links of testing, constructing, releasing and the like of the components, so that the development efficiency and the release efficiency of the components are greatly improved. In addition, when the components are released, interactive demonstration prototypes are deployed, so that the components can be effectively screened and screened, and the release efficiency and the user experience of the components are improved. In the continuous integration phase of the components, for the condition of frequent code submission, because the submission passes automatic test, compilation and verification before final release, potential problems can be exposed in advance, and the quality of continuous integration is guaranteed. In addition, in the continuous delivery stage of the assembly, because the automatic release flow is realized, the release and the deployment of the assembly application can be realized at any time and any place, thereby not only improving the quality of continuous delivery, but also improving the efficiency of the assembly release.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of a scenario of a component publishing method provided in an embodiment of the present application;
FIG. 2 is a flow chart of a component publishing method provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of a componentization development of a component publishing method provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a command line interactive interface of a component issuing method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a command line tool of a component publishing method provided by an embodiment of the present application;
FIG. 6 is a component submission diagram of a component publishing method provided by an embodiment of the application;
FIG. 7 is a code compiling schematic diagram of a component publishing method provided by an embodiment of the present application;
FIG. 8 is another schematic flow chart diagram of a component publishing method provided by an embodiment of the present application;
FIG. 9 is a diagram illustrating an example component publishing process according to an embodiment of the present disclosure;
FIG. 10 is a component push diagram of a component publishing method provided by an embodiment of the present application;
fig. 11 is a schematic structural diagram of a component issuing device provided in an embodiment of the present application;
fig. 12 is another schematic structural diagram of a component issuing device provided in an embodiment of the present application;
fig. 13 is another schematic structural diagram of a component issuing device provided in an embodiment of the present application;
fig. 14 is another schematic structural diagram of a component issuing device provided in an embodiment of the present application;
fig. 15 is another schematic structural diagram of a component issuing device provided in an embodiment of the present application;
fig. 16 is another schematic structural diagram of a component issuing device provided in an embodiment of the present application;
fig. 17 is a schematic structural diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the invention provides a component publishing method and device. Specifically, the embodiment of the present invention provides a component issuing apparatus (for distinction, may be referred to as a first component issuing apparatus) suitable for a first computer device, where the first computer device may be a device such as a terminal, and the terminal may be a device such as a mobile phone, a tablet computer, and a notebook computer. The embodiment of the present invention further provides a component publishing apparatus (for distinction, may be referred to as a second component publishing apparatus) suitable for a second computer device, where the second computer device may be a network side device such as a server, and the server may be a single server, a server cluster composed of multiple servers, an entity server, or a virtual server.
For example, the first component issuing device may be integrated in a terminal, and the second component issuing device may be integrated in a server.
The embodiment of the invention introduces the component publishing method by taking the first computer device as a terminal and the second computer device as a server as an example.
Referring to fig. 1, an embodiment of the present invention provides a component distribution system including a terminal 10, a server 20, and the like; the terminal 10 and the server 20 are connected via a network, for example, a wired or wireless network, and the like, wherein the first component issuing device is integrated in the terminal, for example, in the form of a client.
The terminal 10 may be configured to obtain attribute information of a component that needs to be created, where the attribute information includes an item type and a component type to which the component belongs; determining a creation template of the component based on the item type and the component type; injecting component code into a creation template for the component to create the component; testing the created component based on the test case of the component; when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly; and issuing the data packet of the component based on the demonstration prototype of the component.
The issuing of the component may be performed by the terminal 10, or may be performed by the server 20 based on the obtained component data packet, for example, the terminal 10 may push the component data packet of the component to the server 20, and trigger the server 20 to issue the component; the server 20 may be specifically configured to: performing release verification on the component data packet; when the release verification passes, determining a demonstration prototype of the component; and issuing the component data packet based on the demonstration prototype of the component.
In one embodiment, after the release of the component is completed, the terminal 10 may download, install, and use the released component in the actual project through a command line tool; furthermore, the use condition and the project information of the component can be reported through the command line tool, and the reusability requirement of the component can also be acquired, and the like.
The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
The component publishing method provided by the embodiment of the application can be executed by a terminal or a server, or can be executed by the terminal and the server together; in the embodiment of the present application, a component publishing method is executed by a terminal as an example, specifically, executed by a component publishing device integrated in the terminal, as shown in fig. 2, a specific flow of the component publishing method may be as follows:
101. acquiring attribute information of a component needing to be created, wherein the attribute information comprises an item type and a component type to which the component belongs.
Wherein a component may be a reusable software unit for performing a specific function and providing a number of reusable software units using the functional interface to the outside. For example, in front-end development, a component can be a highly reusable module in the front-end page. For example, in front-end application development, a component may be a reusable pure logic code providing a business service, or may be a reusable User Interface (UI) component.
In one embodiment, referring to fig. 3, in the development of the front-end page, 5 UI components, i.e., component a, component b, component c, component d, and component e, can be selected to design and develop the page 1 based on the idea of front-end componentization; when the page 2 is designed and developed, the page navigation bar can be designed for the page 2 through the multiplexing component a, and the page tail part can be designed for the page 2 through the multiplexing component e, so that the page 2 and the page 1 can be designed according to the same format.
The attribute information of the component is information required for describing the creation of the component. For example, the attribute information of the component may include an item type, a component alias, and the like. For example, project types may include an instant development type project, a progressive development type project, and so forth; the component type may be a UI component, a service component, or the like; the component alias may be a Chinese string with no more than ten characters, such as a "extendible navigation bar," or the like.
The method for acquiring the attribute information of the component may be various, for example, the attribute information input by the user may be acquired by setting different information acquisition controls by using a preset graphical user interface, or the attribute information input by the user may be directly acquired by a command line tool in a question-and-answer manner.
In this embodiment, the attribute information of the component that needs to be created may be acquired, so as to execute subsequent flows such as component creation and component release based on the attribute information, specifically, the step "acquiring the attribute information of the component that needs to be created" may include:
displaying a command line interactive interface by calling a command line tool;
and acquiring attribute information input in the command line interactive interface.
A Command-line interface (CLI) is a kind of user interface in a computer system, and a user may use a device such as a keyboard and a mouse to input information, for example, an instruction to be executed, into the computer system through the CLI.
For example, a command line interactive interface may be displayed by calling a command line tool, so that an instruction set in the command line tool or other information required to execute the instruction may be input in the command line interactive interface, and so on. For example, referring to FIG. 4, a computer device may utilize the interface as a conduit for obtaining instructions and other information.
In one embodiment, a distributed version control system may be used in the period from creation to release of a component, for example, git (a type of distributed version control system) may be used to create a version library for managing development of a component, which is also called a component repository; and then, the command line instruction can be used for entering a root directory of the component warehouse, and steps such as creating and debugging the component are carried out under the root directory.
In practical applications, the CLI tool may include instructions for a plurality of functions, and referring to fig. 5, the init instruction may be used to initialize the component template; debugging a demo (demo) of the component using the dev instruction; running a test case of the component by using a test instruction; install the component using the install instruction; delete instructions using uninstantall instructions; report instructions are used to report project information, and so on. Wherein lego is a program instruction defined by a CLI tool, and the instruction can also be other character strings, which is not limited in the application; < component-name > is the component name that needs to be attached when the instruction is called.
In an embodiment, referring to fig. 4, based on an initialization (init) instruction in the command line interactive interface, user guidance information may be displayed to guide a user to input an item type, a component type, and a component alias of a component through question-and-answer, where, based on the input of the user, the attribute information correspondingly obtained by the terminal is: the item type is instant (now) type, the component type is WebUI component, and the component category is "this is a case".
102. Based on the item type and the component type, a creation template for the component is determined.
The creation template of the component is a reusable code block for creating the component, and a component developer can further develop the component based on the creation template to generate the component conforming to the preset specification. For example, the creation template of the group price may include the specification of the logical methods, data, attributes, and the like that the developer needs to follow when developing the component; provisions for the file structure, file type, component submission specification, test case specification, component specification document specification, etc. of the component development project may also be included.
There may be various methods for determining the component to create the template based on the attribute information.
In an embodiment, a creation template for a component may be determined based on the component type. For example, the component types may include a UI component type and a service component type; the UI component may be a component having a user interface display function, such as a button component, an input box component, a text field component, and the like; the service component may be a component that provides a specific service or business function, such as a logging component, a cross-browser Asynchronous JavaScript And XML (Ajax, Asynchronous JavaScript And XML) support component, And a data persistence support component, And the like. The creation template for the UI component may include a code block and associated component structure for the user interface design; the creation template for the service component need not include the code blocks of the user interface design. In practical application, different creation templates can be designed correspondingly based on different steps of creating, debugging, testing, constructing and the like of the UI component and the business component, so that the creation template for determining the component based on the component type can be realized.
In another embodiment, a creation template for a component may be determined based on the item type. For example, the item types may include a now type and a progressive type; the new type component development project can use multiple functions provided by the CLI tool to develop and release components in a component warehouse; a pro-type component development project may abstract a publishable component into a component repository during an existing project development process for publishing the component. In practical application, for the project types of the now type and the pro type, different creation templates can be designed according to different steps of creating, debugging, testing, constructing and the like of components in different projects, so that the creation templates of the components can be determined based on the project types.
In another embodiment, the creation template for a component may be determined in connection with the case of the item type and the component type. For example, if the item type is a now type and the component type is a UI component, the creation template may be determined to be a component creation template suitable for developing a user interface component in the component repository; if the project type is a pro type and the component type is a service component, the creation template may be a component creation template that follows the specification of the component repository and is suitable for service component development in other projects, specifically, a developer may develop a component in other projects based on the component creation template, and then synchronize the component to be published to the component repository by means of copying or the like.
In this embodiment, referring to fig. 4, in the attribute information of the component, the item type is a now type, and the component type is a UI component, so that the creation template of the component may be determined to be a now-UI-demo in combination with the item type and the component type, that is, the creation template is a preset component suitable for developing a user interface component in the component repository.
103. And injecting component code into the creation template of the component to create the component.
The component code may include, among other things, logic code for the component, test code for the component, and demo code for the component. The steps of creating, debugging, testing, compiling and the like of the component can be carried out by injecting component codes into the creating template of the component, and then the component to be released is generated. Specifically, the step "inject component code into a creation template of a component to create the component", may include:
when an instruction of code debugging of the command line tool is detected, displaying a code debugging interface of the component;
determining the component code of the component according to the code debugging result of the user on the code debugging interface;
injecting the determined component code into a creation template of the component;
the creation template of the trigger component creates a component according to the determined component code.
The code debugging may be a process of adjusting the component code based on the generated effect of the component in the creation process of the component. For example, code debugging of the UI component during the creation process of the UI component can be performed by writing the component code and viewing the running effect of the current component code on the browser in real time so as to adjust and try the component code in time.
The code debugging instruction may be an instruction that triggers code debugging. In this embodiment, referring to fig. 5, the format of the code debugging instruction is legodev < component-name >, and the code debugging interface can be invoked to debug the code through the instruction. For example, for a component named "component 1", code debugging for the component may be performed by entering "legodev < component1 >" in the command line interactive interface.
The code debugging interface is an interface for code debugging, for example, the code debugging interface can be a debugging interface provided in a software development kit, and can also be a console of a browser, and the like; the developer of the component can perform code debugging of the component in the code debugging interface.
In one embodiment, the browser console may be invoked by the legodev < UIcomponent1> instruction to debug the code for the UI component named "UIcomponent 1"; specifically, in the browser, a user or a component developer may write code on the browser and view the effect of the UI component in real time, and finally, when the debugging is completed, the component code of the UI component may be determined, and then, the component creation based on the component code of the UI component may be triggered.
104. And testing the created component based on the component test case.
After the component code of the component is determined, the generated component can be automatically tested by using the test case in the component code, and a component developer is not required to test the component by performing the test case through the traditional manual operation.
For example, the generated component may be treated as a testable unit, and the component may be subjected to unit testing. In unit testing, a component developer can determine a Test case of a component before developing functional code of the component according to the principle of Test-driven development (TDD); the test case of the component can also be written based on the requirements and behaviors of the component user, and the like, according to the principle of Behavior Driven Development (BDD). The test case of a component may specifically define the functions that the component needs to support, the reactions that should be made, the boundary conditions and expected results that need to be considered, and so on. Therefore, after the test case is determined, the generated component can be tested based on the test case. Specifically, the step "testing the created component based on the component test case" may include:
acquiring a component test case of the component;
determining the test data of the component based on the component test case;
and testing the component according to the test data.
The test case is a concrete expression form of software requirements, and can describe a test task of the software, for example, describe test input, execution conditions, expected results and the like of the test task; accordingly, the component test case is a concrete representation form of the component requirement, and the component can be tested based on the component test case, so that the quality of the component is ensured before the component is released.
The test data of the component is data required for executing the automated component test in the component test case, and may include test input, execution conditions, expected results, and the like, for example. For example, a test case of a text box component may include test data such as the content of an input text field, the length limit of the text field, the expected effect of the text box, and the result of a test decision; the text box component may then be tested based on the test data.
In an embodiment, after a component developer determines a component code including a test case, the component test case of the component may be obtained, then, the component test case is automatically executed according to test data in the component test case, and an execution result of the component test case is evaluated based on the test data to determine whether the component passes the test, thereby implementing an automated test on the component. Specifically, the step "obtaining a component test case of the component" may include:
the hook triggering function obtains component module information of the component through incremental information analysis;
and extracting the component test case of the component from the component module information.
The hook function is a custom script triggered when a specific behavior occurs in the computer, and may include, for example, a pre-processing script and a post-processing script. For example, in the distributed version control system git, for the commit (commit) action of the version code, there may be a pre-commit hook and a post-commit hook accordingly, and the hooks may be used to perform some custom processing operations before and after commit.
In this embodiment, referring to fig. 6, after completing the development of the component, the user may submit a commit instruction of the code to trigger the hook, and then execute the customized script in the hook function.
In practical applications, the incremental information analysis may be implemented in various ways, for example, in the distributed version control system git, the difference between files may be compared through a gitdiff command, so as to obtain the incremental information.
In this embodiment, referring to fig. 6, after the component developer or user completes the determination of the component code, the component code may be submitted through a commit command. Since the commit command is set with the corresponding hook function, before the code is submitted, a plurality of operations can be performed on the code by executing the script preset in the hook function, for example, after the static code check (lint check) on the component code passes, the module information of the component can be acquired by triggering the gitdiff instruction. Since the component module information includes the test case of the component, the component test case of the component can be extracted based on the obtained component module information.
105. And when the test of the component passes, compiling the component to obtain a component data packet of the component.
In the process of compiling to generate the target program from the source program written in the source language by using the compiling tool, for example, the source program in the high-version syntax can be converted into the source program in the low-version syntax by using the compiling tool, for example, in front-end development, a component written in the JavaScript language in the high-version syntax can be converted into a backward compatible JavaScript syntax by using the compiling tool, so that the compiled component can run in the environment of the low version.
In this embodiment, after the test of the component passes, the compiling process performed on the component may include a code compiling process and a demo compiling process, so that the generated component data packet correspondingly includes a component code after compiling and a component demo after compiling, which may be issued; notably, the compilation process is an automated process, i.e., does not require manual intervention by the component developer or administrator of the component management platform. Specifically, the step "when the test of the component passes, compiling the component to obtain a component data packet of the component" may include:
compiling the code of the tested component to obtain the code data of the component;
performing prototype compilation on the assembly passing the test to obtain prototype data of the assembly;
a component data package for the component is generated using the code data and the prototype data.
The compiling may include lexical analysis, syntax analysis, semantic inspection, code optimization, byte code generation, and the like. For example, in front-end development, a babel compiling tool can be used to convert a high-version JavaScript code into backward-compatible JavaScript code data, so that the compiled code can also run in a low-version browser environment.
In one embodiment, the following code may be compiled from the code:
let user="Tom";
`Welcome back${user}!`;
the following code data were converted:
var user="Tom";
"Welcome back".concat(user,"!");
so that the compiled code can also realize the output character string "Welcometbacktom!under the environment of a browser with a low version! "function of.
In another embodiment, the code "[ 2,4,6]. map (n ═ n × 2) may be compiled by code compilation; "convert to backward compatible code" [2,4,6]. map (function (n) { return Math. pow (n, 2); such that the compiled code may also implement the function of mapping numbers 2,4,6 to 4, 16, 36, respectively, in a low-version browser environment.
And performing prototype compilation on the tested assembly, converting the demo code of the assembly into a demo code suitable for release, and then releasing the demo of the assembly based on the compiled demo code.
In this embodiment, referring to fig. 6, after the test case of the component is run to determine that the test of the component passes, a compiling tool babel may be used to perform code compilation on the component and obtain compiled code data accordingly; after the code is successfully compiled, the demo of the component can be compiled and compiled demo data can be obtained dependently. In practical application, after the demo is successfully compiled, the version number of the component can be changed before submission, so that the version number of the component after release is correspondingly updated. To this end, a component data package of the component may be generated based on the compiled code data and the compiled demo data, and the component data package may be submitted. It should be noted that failure in any of the steps of running the test case, compiling the code, or demo compiling may result in a failed commit.
In an embodiment, when the component passes the test, the component passing the test may be subjected to code compiling and demo compiling, so that a component data packet including code data and demo data of the component may be obtained, and specifically, the step "performing code compiling on the component passing the test to obtain code data of the component" may include:
performing semantic analysis on the component to obtain an abstract syntax tree of the component;
performing structure conversion on the abstract syntax tree to obtain a converted abstract syntax tree;
code data for the component is generated by traversing the translated abstract syntax tree.
The semantic parsing is a process of parsing a code character string of a component into an abstract syntax tree, and specifically, the semantic parsing may include lexical analysis and syntax analysis; the code character strings can be converted into syntactic units through lexical analysis, and then on the basis of the lexical analysis, the relations among the syntactic units are obtained through the syntactic analysis, so that the corresponding abstract syntactic tree is generated.
Wherein the abstract syntax tree is an abstract representation of the syntax structure of the source code of the programming language. For example, the abstract syntax tree may represent the syntax structure of the source code in the form of a tree, where each node on the tree represents a structure of the source code.
There are many ways to generate the abstract syntax tree by semantic parsing the component, for example, in front-end development, a compiling tool babel can be used to convert the code string of the component into a token (token) stream in a lexical analysis stage, and convert the token stream into a corresponding abstract syntax tree in a syntax analysis stage.
The structure conversion of the abstract syntax tree may be a process of converting the structure of the abstract syntax tree by performing operations such as node addition, node update, and node removal on nodes in the abstract syntax tree. For example, the abstract syntax tree obtained by semantic parsing may be subjected to depth-first traversal, and in the process, nodes in the abstract syntax tree may be added, updated, and removed to generate a new abstract syntax tree. After the abstract syntax tree is subjected to structure conversion, the abstract syntax tree after the structure conversion can be correspondingly generated.
Specifically, depth-first traversal may be performed on the converted abstract syntax tree, and a code character string that can represent the converted abstract syntax tree is constructed, thereby generating the code data of the component.
In this embodiment, referring to fig. 7, semantic parsing may be performed on the component to obtain an abstract syntax tree of the component; further, the abstract syntax tree is subjected to structure conversion to obtain a converted abstract syntax tree, and finally, the code data of the component can be generated based on the converted abstract syntax tree.
106. And issuing the data packet of the component based on the demonstration prototype of the component.
After the data packet of the component is determined, the data packet of the component can be issued based on the demonstration prototype of the component, so that a user can acquire the information of the component, interact with the demo of the component, download and install the component, report information related to the use of the component and the like through a network and the like. For example, the data package of the component may be published to a common component sharing platform, and both a component developer and a component user may share and communicate with the component on the component sharing platform; notably, publishing the package of components does not require the developer or other user of the component to manually perform, the publishing step being an automated process. Specifically, the step "publishing the data package of the component based on the prototype of the component" may include:
issuing and verifying the component data packet;
when the release verification passes, determining a demonstration prototype of the component;
and issuing the component data packet based on the demonstration prototype of the component.
The release verification performed on the component data packet may be used to verify whether the component data packet has a version number and whether the version number meets a relevant rule, and may obtain the relevant authority information of the component through the verification. Further, the component packet that passes the release verification may be determined as the component packet to be released.
In practical applications, the method for verifying the component data package may be adjusted according to the distribution method of the component, for example, the distribution of the component may be implemented by a software package management and distribution platform, so that the verification of the component data package may also be performed by the software package management and distribution platform.
After the component data packet to be issued is determined, since the compiled demo data is included in the component data packet, the demo of the component can be determined accordingly. And then the release of the component can be completed by releasing the demo of the component and the determined component data packet.
In this embodiment, the component data packet is subjected to release verification, and the component data packet to be released can be determined; further, when the publishing verification passes, the demo of the component may be determined, so that the component data packet may be published based on the demo of the component, and specifically, the step "verifying the component data packet and determining the component data packet to be published" may include:
performing version analysis on the component data packet to obtain version information of the component;
format verification is carried out on the version information of the component according to the component release format;
and when the format check passes, determining that the issuing verification passes.
The version analysis of the component data packet can be used for acquiring the version information determined when the component is submitted; for example, the version number of the component can be obtained through version resolution; for example, through version resolution, the version number of the component is determined to be 1.0.1 version.
The version information may be checked according to a preset format check rule, for example, the format check rule may be: the version number of the component needs to be in the form of X.Y.Z, wherein X represents a main version number, and when the compatibility of an application program interface is realized, X needs to be increased; y represents a minor version number, and when the function is added and the compatibility of an application program interface is not influenced, Y needs to be increased progressively; z represents a revision number, and is increased when software bugs are repaired and the compatibility of the application program interface is not affected.
For example, if it is determined through version analysis that the version number of the component is 1.0.1 and the last version number is 1.0.0, it may be determined that the component passes format check, and further, it may be determined that the component packet of the component is a to-be-issued component packet. For another example, if it is determined through version analysis that the version number of the component is 1.0.1 and the last version number is also 1.0.1, it may be determined that the component does not pass format verification because the version number does not comply with a preset format verification rule, and thus it is determined that the component packet of the component is not the component packet to be issued.
In practical application, the format check rule can be adjusted according to different service requirements to judge whether the component data packet exists or not and whether the version number accords with the release rule or not, and acquire related authority information.
As can be seen from the above, the present embodiment may acquire attribute information of a component that needs to be created, where the attribute information includes an item type and a component type to which the component belongs; determining a creation template of the component based on the item type and the component type; injecting component code into a creation template for the component to create the component; testing the created component based on the test case of the component; when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly; and issuing the data packet of the component based on the demonstration prototype of the component.
According to the method and the device, the template for creating the component can be determined based on the attribute information of the component, so that the development and debugging of the component are more convenient and efficient, the structural specification of the component can be restrained through the template, different components can follow the unified specification, and the management of the component is facilitated when the component is submitted and released. Moreover, after the codes of the components are submitted, high-degree automation is realized for subsequent testing, building and releasing links of the components, so that the development efficiency and the releasing efficiency of the components are greatly improved. In addition, when the components are released, interactive demonstration prototypes are deployed, so that the components can be effectively screened and screened, and the release efficiency and the user experience of the components are improved. In the continuous integration phase of the components, for the condition of frequent code submission, because the submission passes automatic test, compilation and verification before final release, potential problems can be exposed in advance, and the quality of continuous integration is guaranteed. In the continuous delivery stage of the assembly, due to the fact that automatic release flow is achieved, release and deployment of assembly application can be achieved anytime and anywhere, the quality of continuous delivery is improved, and the efficiency of assembly release is improved.
In addition, the command for creating a component through the command line tool can enable creation of a component under the component repository, and also support creation of a component in a business project. And directly migrating the components into a component warehouse to submit and release after the project test is on-line. The support of the progressive development component in the project business provides additional feasible options for a component developer to create the component, so that the flow from creation to release of the component has more selectivity, and the efficiency of component release is indirectly improved.
In addition, for the component user, since an interactive demo is generated when the component contributor submits the code and is deployed in the online environment when the component is released, the component user can learn about the component based on the interaction with the demo, rather than only referring to the prototype screenshot, so that the component user can more truly experience the component and effectively select the component.
The method described in the above examples is further described in detail below by way of example.
In this embodiment, a description will be given by taking an example in which a component issuing apparatus is integrated in a server and a terminal, where the server may be a single server or a server cluster composed of a plurality of servers; the terminal can be a mobile phone, a tablet computer, a notebook computer and other equipment.
As shown in fig. 8, a component publishing method specifically includes the following processes:
201. the terminal acquires attribute information of a component to be created, wherein the attribute information comprises an item type and a component type to which the component belongs.
The method comprises the steps that attribute information of a component to be created can be obtained through a question-and-answer mode in a command line interactive interface by calling a CLI tool; for example, referring to FIG. 9, a component contributor can determine attribute information for a component that needs to be created by using a CLI tool; based on the attribute information, the creation and debugging of the component can be further realized.
In one embodiment, a component initialization command, such as "init", provided by the CLI tool may trigger the component interactive interface to display the attribute information options that need to be entered, such as item type, component alias, and so on, in the root directory of the terminal component repository. The component contributors can answer the various attribute information option questions through a question-and-answer mode, so that the terminal correspondingly obtains the attribute information of the component needing to be created.
202. The terminal determines a creation template for the component based on the item type and the component type.
The manner of determining the creation template based on the item type and the component type may be various, for example, the creation template of the component may be determined based on the item type; as another example, a creation template for a component can be determined in connection with the item type and the component type in the attribute information, and so on. In practical application, the determination rule of the created template can be adjusted according to business requirements.
For example, when the creation template of the component is determined by combining the project type and the component type, for the component of which the project type is pro type and the component type is UI type, the creation template of the component can be initialized to the development framework of the UI type component, and the dependency of the creation template on the development environment is reduced, so that the component can be developed in the actual project, and the component is not developed after jumping to the component debugging interface only through the CLI tool; in addition, after the actual project test where the component is located passes the online, the component can be directly migrated into the component warehouse for submission and release.
For example, referring to FIG. 9, a component user may perform development of a component in an actual project and publish the component to a component management platform.
203. And the terminal injects component codes into the creation template of the component to create the component.
Specifically, a code debugging interface of the component can be displayed through a code debugging instruction provided by the CLI tool, the component code of the component is determined according to a code debugging result of a user on the code debugging interface, and the determined component code is injected into the creation template of the component so as to trigger the creation template of the component to generate the component according to the determined component code.
In one embodiment, for a component with a component name of "ServiceComponent 1", under the terminal component repository root directory, the browser's console may be invoked for code debugging by calling a component debug command "legodev < ServiceComponent1 >" provided by the CLI tool in the command line interactive interface. In particular, development of a component and adjustment of code may be performed in code debugging to determine the component code for the component. Further, the terminal may inject the determined component code into a creation template of the component to create the component.
In another embodiment, referring to FIG. 9, a component contributor can implement the creation of a component by conducting the debugging of the component at the terminal using CLI tools; after the component code is determined, the component contributors can use the distributed version control system git to submit the component code locally, and further, the submitted operation can trigger the corresponding git hook, so as to trigger the subsequent automation module.
204. And the terminal tests the created component based on the test case of the component.
Specifically, a component test case of the component may be obtained, and based on the test case, the test data of the component may be determined, so that the component may be tested according to the test data.
In one embodiment, the terminal may obtain the module information of the component through incremental information analysis, and extract the test case of the component from the module information of the component, so as to test the component based on the test data in the test case; for example, after the script is set based on the execution condition in the test data, the test input in the test data is input to the component and the output or the performance of the component is obtained, and then the output or the performance of the component is judged according to the expected effect in the test data to determine whether the component passes the test.
In another embodiment, referring to FIG. 9, after the trigger git hook is locally submitted, the automation module may be triggered to test the generated component based on the test case of the component, wherein the test is an automation program, i.e., the component is tested without manual or manual work by the component contributors.
205. And when the test of the component passes, the terminal compiles the component to obtain a component data packet of the component.
Specifically, after the test of the component passes, the compiling process performed by the terminal on the component may include code compiling and prototype compiling, and accordingly, the code data and the prototype data of the component may be obtained, and further, the component data packet of the component may be generated by using the code data and the prototype data.
The code compiling can convert the high-version programming language code into backward compatible programming language code data, so that the compiled code can run under the low-version browser link. And prototype compilation can obtain demo codes suitable for release, so that the demo can be subsequently released based on the demo codes suitable for release.
In an embodiment, referring to fig. 9, after the component passes the test, the automation module may be triggered to perform a compiling process on the component to obtain a component data packet to be submitted to the server, where the compiling is an automated process, that is, the component is compiled without manual work or manual work by a component contributor.
206. And the server performs release verification on the component data packet.
Specifically, the version information of the component can be obtained by performing version analysis on the component data packet, format verification is performed on the version information of the component according to the component release format, and the component data packet passing the format verification is determined as the component data packet to be released.
In one embodiment, the server may obtain the version number of the component as "1.1.1.20200323 _ beta" through version resolution. If the preset component release format is specified as: the module version number is composed of four parts, wherein the first part is a main version number, the second part is a sub-version number, the third part is a revision version number, and the fourth part is a date version number plus a Greek letter version number; then, since the version number of the component conforms to the component publishing format, the component packet of the component may be determined to be a component packet to be published.
In another embodiment, referring to FIG. 9, the component Package may be verified by an automation module before being published to a private Node Package Manager (npm, Node Package Manager) without the component developer manually.
As an alternative, before the server performs the publishing verification on the component data packet, the following steps may be included:
the terminal synchronizes the component to the component set of the publishing component;
and the server analyzes the data of the component set to obtain a component data packet of the component.
The component set of the published component may receive the component data package in step 205, and perform steps of constructing a publication for the corresponding component based on the component data package. For example, in the distributed version control system git, the component set may be a remote repository, and the component developer may push the code of each component development branch to the remote repository through a push instruction, thereby implementing synchronization of the components. In addition, a component manager can make a management specification for the component warehouse so as to realize the efficient management of different types of components in the component warehouse; for example, the management specification may include a component code submission specification, a component test case design specification, a component specification documentation writing specification, and the like.
In an embodiment, referring to fig. 9, after the automation module performs the automated testing and automated compiling on the component passing the testing, the terminal may invoke another automation module to perform the building and publishing of the component by triggering the git hook when the component data in the development branch is merged into the development backbone by packaging the component data of the component into the corresponding development branch submitted to the remote component repository.
For example, incremental data analysis may be performed on the component set, and the component data package may be obtained by obtaining incremental data of the component set, for example, in the distributed version control system git, the incremental data of a remote repository may be obtained through a gitdiff instruction, so that the obtained component data package may be determined based on the incremental data.
In one embodiment, referring to FIG. 9, after merging a development branch of a component into a development backbone, a git hook may be triggered to invoke an automation module that may obtain a component package for the component by performing incremental data parsing on a component repository.
In another embodiment, referring to FIG. 10, a distributed version control system git may be used to push (push) the component package to the component set of the publishing component, thereby enabling the component to be synchronized to the component set of the publishing component, wherein the push instruction triggers a Continuous Integration (CI). Specifically, the component set may be subjected to data parsing through a gitdiff instruction, so as to obtain component module information by obtaining incremental data of the component set; in practical applications, the gitdiff may be performed after static code checking (linet checking) of the component code. Based on the acquired component module information, a component data packet of the component can be obtained. Then, pre-release verification can be performed via npm and release can be performed via npm. In practical application, the component can be recorded into a component management platform so as to manage the component, and finally, the demo of the component can be published. It is noted that in practical applications, failure of npm verification may affect the publishing process of the component.
207. When the release verification passes, the server determines a prototype of the component for presentation.
For example, after a component package passes release verification, domo data of the component can be determined from the component package, and a prototype of the component can be determined based on the demo data.
In an embodiment, referring to FIG. 9, when the component build is published by the automation module to private npm, this step may be performed before the demo is deployed, so that the demo to be deployed may be determined before the demo is deployed to the online environment.
208. The server publishes the component data packet based on the demonstration prototype of the component.
For example, referring to FIG. 9, the component package for the component may be published through private npm and, further, the determined demo is deployed to the online environment. In practical application, the component data package of the component can be further submitted to a private git warehouse to realize further management of the component.
In actual practice, referring to FIG. 9, both the component contributors and the component users can download components into the actual project through instructions provided by the CLI tool after the components are published. For example, the published components may be downloaded to the actual project via the install instruction of the CLI tool, which by default will unify the downloaded components into a common directory while also providing the option of custom paths.
In addition, referring to fig. 9, the usage of the component can be entered into the component management platform through the instruction provided by the CLI tool; for example, the use condition of the component in the actual project is input into the component management platform through a report instruction of the CLI tool. The component user can also filter the components by looking at their demo on the component management platform.
Furthermore, for product operators of the component management platform, precipitated components and historical services can be referenced based on reported information on the component management platform, reusability requirements of the components can be provided for component users, and the like.
Therefore, the template for creating the component can be determined based on the attribute information of the component, the development and debugging of the component are more convenient and efficient, the structural specification of the component can be restrained through the template, and different components can follow the unified specification and can be managed conveniently when the component is submitted and published. Moreover, after the codes of the components are submitted, high-degree automation is realized for subsequent testing, building and releasing links of the components, so that the development efficiency and the releasing efficiency of the components are greatly improved. In addition, when the components are released, interactive demonstration prototypes are deployed, so that the components can be effectively screened and screened, and the release efficiency and the user experience of the components are improved. In the continuous integration phase of the components, for the condition of frequent code submission, because the submission passes automatic test, compilation and verification before final release, potential problems can be exposed in advance, and the quality of continuous integration is guaranteed. In the continuous delivery stage of the assembly, due to the fact that automatic release flow is achieved, release and deployment of assembly application can be achieved anytime and anywhere, the quality of continuous delivery is improved, and the efficiency of assembly release is improved.
In addition, the command for creating the component through the command line tool can realize the creation of the component from zero under the component warehouse, and also supports the creation of the component in the business project, and the component can be directly migrated into the component warehouse to be submitted and issued after the project test passes the online. The support of the progressive development component in the project business provides additional feasible options for a component developer to create the component, so that the flow from creation to release of the component has more selectivity, and the efficiency of component release is indirectly improved.
In addition, for a component manager, aiming at different component types, all components in a single component warehouse are restricted through a set of specifications, so that the component management is facilitated; for a component user, after a proper component is screened out, the component can be quickly installed through a CLI tool, so that secondary development and reuse of the component can be carried out, and the development efficiency is improved; for product operation, along with continuous precipitation of services and components, a play method or a local function can be quickly reused for scenes with higher similarity, and then the updating iteration efficiency is improved.
In order to better implement the method, correspondingly, the embodiment of the application also provides a component issuing device, wherein the component issuing device can be integrated in a server or a terminal. The server can be a single server or a server cluster consisting of a plurality of servers; the terminal can be a mobile phone, a tablet computer, a notebook computer and other equipment.
For example, as shown in fig. 11, the component issuing apparatus may include an obtaining unit 301, a determining unit 302, an injecting unit 303, a testing unit 304, a compiling unit 305, and an issuing unit 306, as follows:
an obtaining unit 301, configured to obtain attribute information of a component that needs to be created, where the attribute information includes an item type and a component type to which the component belongs;
a determining unit 302, configured to determine a creation template of the component based on the item type and the component type;
an injection unit 303, configured to inject component code into the creation template of the component to create the component;
a testing unit 304, configured to test the created component based on the test case of the component;
a compiling unit 305, configured to, when the test of the component passes, perform compiling processing on the component to obtain a component data packet of the component;
the publishing unit 306 is configured to publish the data packet of the component based on the prototype of the component.
In an embodiment, referring to fig. 12, the injection unit 303 includes:
a display subunit 3031, configured to display a code debugging interface of the component when an instruction for code debugging of the command line tool is detected;
the code determination subunit 3032 is configured to determine the component code of the component according to the code debugging result of the user on the code debugging interface;
a code injection subunit 3033, configured to inject the determined component code into the creation template of the component;
a template triggering subunit 3034, configured to trigger the creation template of the component to create a component according to the determined component code.
In one embodiment, referring to fig. 13, the test unit 304 includes:
a test obtaining subunit 3041, configured to obtain a component test case of the component;
a test determination subunit 3042, configured to determine test data of the component based on the component test case;
a component testing subunit 3043, configured to test the component according to the test data.
In an embodiment, the test acquiring subunit 3041 is configured to:
the triggering hook function obtains component module information of the component through incremental information analysis; and extracting the component test case of the component from the component module information.
In an embodiment, referring to fig. 14, the compiling unit 305 includes:
a code compiling subunit 3051, configured to perform code compiling on the component that passes the test, so as to obtain code data of the component;
a prototype compiling subunit 3052, configured to perform prototype compiling on the component passing the test, so as to obtain prototype data of the component;
a data generation subunit 3053, configured to generate a component data package of the component by using the code data and the prototype data.
In an embodiment, the code compiling subunit 3051 is configured to:
performing semantic analysis on the component to obtain an abstract syntax tree of the component; performing structure conversion on the abstract syntax tree to obtain a converted abstract syntax tree; generating code data for the component by traversing the converted abstract syntax tree.
In one embodiment, referring to fig. 15, the issue unit 306 includes:
the issuing verification subunit 3061 is configured to perform issuing verification on the component data packet;
a prototype determination subunit 3062, configured to determine a demonstration prototype for the component when the release verification passes;
the publishing execution subunit 3063 is configured to publish the component data package based on the prototype of the component.
In one embodiment, the issue verification subunit 3063 is configured to:
performing version analysis on the component data packet to obtain version information of the component; carrying out format check on the version information of the component according to the component release format; and when the format check passes, determining that the issuing verification passes.
In an embodiment, referring to fig. 16, the obtaining unit 301 includes:
a display subunit 3011, configured to display a command line interaction interface by calling a command line tool;
and the information acquisition subunit 3012 is configured to acquire the attribute information input in the command line interactive interface.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
As can be seen from the above, the obtaining unit 301 in the component publishing device of this embodiment obtains the attribute information of the component that needs to be created, where the attribute information includes the item type and the component type to which the component belongs; determining, by the determining unit 302, a creation template of the component based on the item type and the component type; injecting component code into the creation template of the component by an injection unit 303 to create the component; testing, by the test unit 304, the created component based on the test case of the component; when the test of the component passes, the compiling unit 305 compiles the component to obtain a component data packet of the component; the data package of the component is published by the publishing unit 306 based on the prototype of the component.
According to the scheme, the template for creating the assembly can be determined based on the attribute information of the assembly, so that the assembly is more convenient and efficient to develop and debug, and the structural specification of the assembly can be restrained through the template, so that different assemblies can follow the unified specification, and the assembly can be managed conveniently when the assembly is submitted and released. Moreover, after the codes of the components are submitted, high-degree automation is realized for subsequent testing, building and releasing links of the components, so that the development efficiency and the releasing efficiency of the components are greatly improved. In addition, when the components are released, interactive demonstration prototypes are deployed, so that the components can be effectively screened and screened, and the release efficiency and the user experience of the components are improved. In the continuous integration phase of the components, for the condition of frequent code submission, because the submission passes automatic test, compilation and verification before final release, potential problems can be exposed in advance, and the quality of continuous integration is guaranteed. In addition, in the continuous delivery stage of the assembly, due to the fact that automatic release flow is achieved, release and deployment of assembly application can be achieved anytime and anywhere, the quality of continuous delivery is improved, and the efficiency of assembly release is improved.
In addition, an embodiment of the present application further provides a computer device, where the computer device may be a server or a terminal, and as shown in fig. 17, a schematic structural diagram of the computer device according to the embodiment of the present application is shown, specifically:
the computer device may include components such as a memory 401 having one or more computer-readable storage media, an input unit 402, a display unit 403, a processor 404 including one or more processing cores, and a power supply 405. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 17 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. Wherein:
the memory 401 may be used to store software programs and modules, and the processor 404 executes various functional applications and data processing by operating the software programs and modules stored in the memory 401. The memory 401 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the computer device, and the like. Further, the memory 401 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 401 may also include a memory controller to provide the processor 404 and the input unit 402 access to the memory 401.
The input unit 402 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, in one particular embodiment, input unit 402 may include a touch-sensitive surface as well as other input devices. The touch-sensitive surface, also referred to as a touch display screen or a touch pad, may collect touch operations by a user (e.g., operations by a user on or near the touch-sensitive surface using a finger, a stylus, or any other suitable object or attachment) thereon or nearby, and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface may comprise two parts, a touch detection means and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 404, and can receive and execute commands sent by the processor 404. In addition, touch sensitive surfaces may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. The input unit 402 may include other input devices in addition to a touch-sensitive surface. In particular, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 403 may be used to display information input by or provided to a user and various graphical user interfaces of the computer device, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 403 may include a Display panel, and optionally, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch-sensitive surface may overlay the display panel, and when a touch operation is detected on or near the touch-sensitive surface, the touch operation is transmitted to the processor 404 to determine the type of touch event, and then the processor 404 provides a corresponding visual output on the display panel according to the type of touch event. Although in FIG. 17 the touch sensitive surface and the display panel are two separate components to implement input and output functions, in some embodiments the touch sensitive surface may be integrated with the display panel to implement input and output functions.
The processor 404 is a control center of the computer device, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the computer device and processes data by operating or executing software programs and/or modules stored in the memory 401 and calling data stored in the memory 401, thereby performing overall monitoring of the mobile phone. Optionally, processor 404 may include one or more processing cores; preferably, the processor 404 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 404.
The computer device also includes a power source 405 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 404 via a power management system that may be used to manage charging, discharging, and power consumption. The power supply 405 may also include any component including one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown, the computer device may further include a camera, a bluetooth module, etc., which will not be described herein. Specifically, in this embodiment, the processor 404 in the computer device loads the executable file corresponding to the process of one or more application programs into the memory 401 according to the following instructions, and the processor 404 runs the application program stored in the memory 401, so as to implement various functions as follows:
acquiring attribute information of a component needing to be created, wherein the attribute information comprises an item type and a component type to which the component belongs; determining a creation template of the component based on the item type and the component type; injecting component code into a creation template for the component to create the component; testing the created component based on the test case of the component; when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly; and issuing the data packet of the component based on the demonstration prototype of the component.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
As can be seen from the above, the computer device of this embodiment may determine the template for creating the component based on the attribute information of the component, so that development and debugging of the component are more convenient and efficient, and the structural specification of the component can be constrained through the template, so that different components all follow a uniform specification, and management of the component is facilitated when the component is submitted and released. Moreover, after the codes of the components are submitted, high-degree automation is realized for subsequent testing, building and releasing links of the components, so that the development efficiency and the releasing efficiency of the components are greatly improved. In addition, when the components are released, interactive demonstration prototypes are deployed, so that the components can be effectively screened and screened, and the release efficiency and the user experience of the components are improved. In the continuous integration phase of the components, for the condition of frequent code submission, because the submission passes automatic test, compilation and verification before final release, potential problems can be exposed in advance, and the quality of continuous integration is guaranteed. In addition, in the continuous delivery stage of the assembly, due to the fact that automatic release flow is achieved, release and deployment of assembly application can be achieved anytime and anywhere, the quality of continuous delivery is improved, and the efficiency of assembly release is improved.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the embodiments of the present application provide a storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the component issuing methods provided in the embodiments of the present application. For example, the instructions may perform the steps of:
acquiring attribute information of a component needing to be created, wherein the attribute information comprises an item type and a component type to which the component belongs; determining a creation template of the component based on the item type and the component type; injecting component code into a creation template for the component to create the component; testing the created component based on the test case of the component; when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly; and issuing the data packet of the component based on the demonstration prototype of the component.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium can execute the steps in any component issuing method provided in the embodiments of the present application, beneficial effects that can be achieved by any component issuing method provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
The above details are provided for a method and an apparatus for issuing a component provided in the embodiments of the present application, and a specific example is applied in the present application to explain the principle and the embodiments of the present application, and the above description of the embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method for publishing a component, comprising:
acquiring attribute information of a component needing to be created, wherein the attribute information comprises an item type and a component type to which the component belongs;
determining a creation template of the component based on the item type and the component type;
injecting component code into a creation template for the component to create the component;
testing the created component based on the test case of the component;
when the test of the assembly passes, compiling the assembly to obtain an assembly data packet of the assembly;
and issuing the data packet of the component based on the demonstration prototype of the component.
2. The component publishing method according to claim 1, wherein injecting component code into a creation template of the component to create the component comprises:
when an instruction of code debugging of the command line tool is detected, displaying a code debugging interface of the component;
determining the component code of the component according to the code debugging result of the user on the code debugging interface;
injecting the determined component code into a creation template of the component;
and triggering the creation template of the component to create the component according to the determined component code.
3. The component publishing method according to claim 1, wherein testing the created component based on the test case of the component comprises:
acquiring a component test case of the component;
determining test data of the component based on the component test case;
and testing the assembly according to the test data.
4. The component publishing method according to claim 3, wherein obtaining the component test case of the component comprises:
the triggering hook function obtains component module information of the component through incremental information analysis;
and extracting the component test case of the component from the component module information.
5. The component issuing method according to claim 1, wherein when the component passes the test, performing a compiling process on the component passing the test to obtain a component data packet of the component, includes:
compiling the code of the assembly passing the test to obtain code data of the assembly;
performing prototype compilation on the assembly passing the test to obtain prototype data of the assembly;
generating a component data package for the component using the code data and the prototype data.
6. The component issuing method according to claim 5, wherein code compiling the tested component to obtain the code data of the component includes:
performing semantic analysis on the component to obtain an abstract syntax tree of the component;
performing structure conversion on the abstract syntax tree to obtain a converted abstract syntax tree;
generating code data for the component by traversing the converted abstract syntax tree.
7. The component publishing method according to claim 1, wherein publishing the data package of the component based on the prototype of the component includes:
performing release verification on the component data packet;
when the release verification passes, determining a demonstration prototype of the component;
and issuing the component data packet based on the demonstration prototype of the component.
8. The component publishing method of claim 7, wherein publishing validation of the component package comprises:
performing version analysis on the component data packet to obtain version information of the component;
carrying out format check on the version information of the component according to the component release format;
and when the format check passes, determining that the issuing verification passes.
9. The component publishing method according to claim 1, wherein attribute information of a component to be created is obtained, wherein the attribute information includes an item type and a component type to which the component belongs, and comprises:
displaying a command line interactive interface by calling a command line tool;
and acquiring the attribute information input in the command line interactive interface.
10. A component management apparatus, comprising:
the device comprises an acquisition unit, a storage unit and a display unit, wherein the acquisition unit is used for acquiring attribute information of a component needing to be created, and the attribute information comprises an item type and a component type to which the component belongs;
the determining unit is used for determining a creation template of the component based on the item type and the component type;
an injection unit, configured to inject component code into the creation template of the component to create the component;
the testing unit is used for testing the created component based on the test case of the component;
the compiling unit is used for compiling the component to obtain a component data packet of the component when the test of the component passes;
and the issuing unit is used for issuing the data packet of the component based on the demonstration prototype of the component.
CN202010382443.7A 2020-05-08 2020-05-08 Component publishing method and device Pending CN113626067A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010382443.7A CN113626067A (en) 2020-05-08 2020-05-08 Component publishing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010382443.7A CN113626067A (en) 2020-05-08 2020-05-08 Component publishing method and device

Publications (1)

Publication Number Publication Date
CN113626067A true CN113626067A (en) 2021-11-09

Family

ID=78377402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010382443.7A Pending CN113626067A (en) 2020-05-08 2020-05-08 Component publishing method and device

Country Status (1)

Country Link
CN (1) CN113626067A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070150855A1 (en) * 2003-05-12 2007-06-28 Jeong An M Method and system of developing a software with utilizing extended metadata of component under component-based development environment
WO2015096661A1 (en) * 2013-12-26 2015-07-02 北京奇虎科技有限公司 Project creation method and device based on configuration system, project test method and device, and background test method and device for configuration system
CN109101225A (en) * 2017-06-20 2018-12-28 腾讯科技(深圳)有限公司 Component building method and device, Component Gallery framework and computer readable storage medium
CN110471666A (en) * 2019-07-18 2019-11-19 五八有限公司 Code automatic switching method and device, code converter and medium
CN111104179A (en) * 2019-12-05 2020-05-05 紫光云(南京)数字技术有限公司 Method for supporting developer mode to self-define component

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070150855A1 (en) * 2003-05-12 2007-06-28 Jeong An M Method and system of developing a software with utilizing extended metadata of component under component-based development environment
WO2015096661A1 (en) * 2013-12-26 2015-07-02 北京奇虎科技有限公司 Project creation method and device based on configuration system, project test method and device, and background test method and device for configuration system
CN109101225A (en) * 2017-06-20 2018-12-28 腾讯科技(深圳)有限公司 Component building method and device, Component Gallery framework and computer readable storage medium
CN110471666A (en) * 2019-07-18 2019-11-19 五八有限公司 Code automatic switching method and device, code converter and medium
CN111104179A (en) * 2019-12-05 2020-05-05 紫光云(南京)数字技术有限公司 Method for supporting developer mode to self-define component

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
尚学堂前端大师: "React UI组件库Antd", pages 1 - 2, Retrieved from the Internet <URL:《https://www.bilibili.com/video/BV1PJ411n7eh/?spm_id_from=333.337.search-card.all.click&vd_source=9c9d62158d7a804d06ba824800af5e0a》> *
志航: "【React总结(三)】React 组件自动化测试与持续集成指北(1)", pages 1 - 2, Retrieved from the Internet <URL:《https://cloud.tencent.com/developer/article/1406234》> *

Similar Documents

Publication Publication Date Title
US9501594B2 (en) Graphical design verification environment generator
Visser WebDSL: A case study in domain-specific language engineering
US8656352B2 (en) System and method for synchronized workflow management
US8949772B1 (en) Dynamic model based software application development
Osherove The Art of Unit Testing: with examples in C
CN102696012B (en) Creating inferred symbols from code usage
US9952837B1 (en) Reusable component in a modeling environment
US9311077B2 (en) Identification of code changes using language syntax and changeset data
CN106484389B (en) Action stream segment management
Kaswan et al. Python for Beginners
CN115113850A (en) Cross-platform application construction and operation method, server, terminal and system
Anderson Xcode 4 unleashed
Oliveira pytest Quick Start Guide: Write better Python code with simple and maintainable tests
CN113626067A (en) Component publishing method and device
Williamson Ant developer's handbook
Santiago et al. Towards Domain-Specific Testing Languages for Software-as-a-Service.
Kratchanov et al. Control network programming development environments
Pulido Applying behavior driven development practices and tools to low-code technology
Vendome et al. How do I model my system? A Qualitative Study on the Challenges that Modelers Experience
Wehrmeister et al. Framework to simulate the behavior of embedded real-time systems specified in UML models
Hauptmann et al. Utilizing user interface models for automated instantiation and execution of system tests
Clarke et al. A common computational science environment for high performance computing centers
Anderson Xcode 5 Start to Finish: IOS and OS X Development
Duldulao et al. Spring Boot and Angular: Hands-on full stack web development with Java, Spring, and Angular
Hauser Test-Driven iOS Development with Swift 4: Write Swift code that is maintainable, flexible, and easily extensible

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination