CN112486490B - Front-end code packaging method and device, electronic equipment and storage medium - Google Patents
Front-end code packaging method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112486490B CN112486490B CN202011478743.1A CN202011478743A CN112486490B CN 112486490 B CN112486490 B CN 112486490B CN 202011478743 A CN202011478743 A CN 202011478743A CN 112486490 B CN112486490 B CN 112486490B
- Authority
- CN
- China
- Prior art keywords
- code
- service
- calling
- codes
- file
- 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.)
- Active
Links
- 238000004806 packaging method and process Methods 0.000 title claims abstract description 121
- 238000000034 method Methods 0.000 title claims abstract description 45
- 230000011218 segmentation Effects 0.000 claims abstract description 26
- 238000012545 processing Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 9
- 238000000605 extraction Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 claims description 5
- 238000011161 development Methods 0.000 abstract description 10
- 230000018109 developmental process Effects 0.000 abstract description 10
- 230000006870 function Effects 0.000 description 12
- 238000012856 packing Methods 0.000 description 11
- 230000008676 import Effects 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000005012 migration Effects 0.000 description 3
- 238000013508 migration Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- VOZKAJLKRJDJLL-UHFFFAOYSA-N 2,4-diaminotoluene Chemical compound CC1=CC=C(N)C=C1N VOZKAJLKRJDJLL-UHFFFAOYSA-N 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/37—Compiler construction; Parser generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention relates to the technical field of webpage development, and discloses a front-end code packaging method, which comprises the following steps: acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code; identifying the file length of the service code and the calling code, and configuring code division points of the service code and the calling code according to the file length of the service code and the calling code; according to the code division points of the service codes, the service codes are packaged into files by utilizing a code packaging tool to generate service code files; introducing and generalizing the calling code to generate a universal introduced code, and packaging the universal introduced code by utilizing a code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a universal code file. Furthermore, the present invention relates to blockchain techniques, wherein the front end code may be stored in the blockchain. The invention can improve the development efficiency of the front-end page.
Description
Technical Field
The present invention relates to the field of web page development technologies, and in particular, to a front end code packaging method, a front end code packaging device, an electronic device, and a computer readable storage medium.
Background
In the current front-end page development technology, in order to meet efficient development, front-end codes written by developers are packed by scaffolds and then released to online operation. The method generally used in the industry is vue-cli scaffold, the existing code is packed and optimized automatically during compiling and packing, the vue-cli scaffold is not required to be configured manually in general, and the weback scaffold is packed inside to form a general basic function, so that front-end code packing can be completed.
But packing the front end code through the vue-cli scaffold is not enough: 1. the packaged front-end code general configuration lacks flexibility, and the packaged front-end code is a default name plus a number, so that a developer cannot know which code file is divided by specific logic written by the developer, and the development efficiency of a front-end page is affected; 2. it is highly likely that the business logic portion of the front-end code will be packaged into a code file, and any change in any point will require the code file of the entire business logic to be re-downloaded, thereby also affecting the development efficiency of the front-end page.
Disclosure of Invention
The invention provides a front-end code packaging method, a front-end code packaging device, electronic equipment and a computer readable storage medium, and mainly aims to improve development efficiency of a front-end page.
In order to achieve the above object, the present invention provides a front end code packaging method, including:
acquiring a front end code, and carrying out service logic classification on the front end code to obtain a service code and a calling code;
identifying the file lengths of the service codes and the calling codes, and configuring code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes;
according to the code division points of the service codes, a preset code packaging tool is utilized to package the service codes into files, and service code files are generated;
and introducing and generalizing the calling code to generate a universal introduced code, and packaging the universal introduced code by utilizing the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a universal code file.
Optionally, the classifying the service logic of the front end code to obtain a service code and a calling code includes:
and identifying the service type of the front-end code, and executing service logic classification of the front-end code by using a preset code classification tool according to the service type to obtain a service code and a calling code.
Optionally, the identifying the file length of the service code and the calling code includes:
acquiring code lines, code parameters and configuration files of the service codes and the calling codes;
calculating code running values of the service code and the calling code according to the code row, the code parameters and the configuration file;
and identifying the storage spaces of the service codes and the calling codes according to the code running values to obtain the file lengths of the service codes and the calling codes.
Optionally, the root calculates code running values of the service code and the calling code according to the code row, the code parameters and the configuration file, including:
calculating code running values of the service code and the calling code by using the following method;
ρ X =E(X+μ X +σ X )
ρ Y =E(Y+μ Y +σ Y )
wherein ρ is X Code run value representing service code, X represents code line of service code, mu X Code parameters, sigma, representing service codes X Configuration file representing service code ρ Y Representing the code run value of the calling code, Y represents the code line of the calling code, μ Y Code parameters, sigma, representing calling code Y Representing a configuration file of the calling code, E represents the expectations of the code run value.
Optionally, the configuring the code division points of the service code and the calling code according to the file lengths of the service code and the calling code includes:
setting a segmentation critical value of a code segment in the service code and the calling code according to the file length of the service code and the calling code, and identifying whether a code segmentation limiting point exists in the service code and the calling code;
if the code division limiting point does not exist, marking the code division limiting point in the service code and the calling code by utilizing a code division statement according to the division critical value;
if the code division limiting point exists, marking the code division limiting point at the tail end of the code line of the service code and the calling code by utilizing the code division statement according to the division critical value.
Optionally, the step of performing file packing on the service code by using a preset code packing tool according to the code division point of the service code to generate a service code file includes:
acquiring a code compiling environment of the service code, and establishing storage dependence of the service code and a local warehouse in the code compiling environment by utilizing the code packaging tool;
according to the code division points of the service codes, the code division is carried out on the service codes by utilizing the division components in the code packaging tool, so as to generate code files;
and storing the code file into the local warehouse according to the storage dependence to form a service code file.
Optionally, the file packaging of the universal code is performed by using the code packaging tool according to a preset code packaging rule and a code division point of the calling code, so as to generate a universal code file, which includes:
acquiring a code compiling environment of the universal introduced code, and establishing storage dependence of the universal introduced code with a local warehouse in the code compiling environment of the universal introduced code by utilizing the code packaging tool;
according to the code division points of the universal introduced codes, the code division of the universal introduced codes is carried out by utilizing the division components in the code packaging tool, so that universal code files are generated;
identifying whether the universal code file is extracted or not according to the code packaging rule;
if the general code file does not need to be extracted, the general code file is sent to the local warehouse according to the storage dependence to form a calling code file;
and if the universal code file needs to be extracted, extracting the universal code file by using a code file extracting tool to obtain an extracted code file, and according to the storage dependence, transmitting the extracted code file to the local warehouse to form a calling code file.
In order to solve the above problems, the present invention also provides a front end code packaging apparatus, the apparatus comprising:
the classifying module is used for acquiring a front-end code, and carrying out service logic classification on the front-end code to obtain a service code and a calling code;
the configuration module is used for identifying the file lengths of the service codes and the calling codes and configuring code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes;
the packing module is used for packing the service codes by utilizing a preset code packing tool according to the code division points of the service codes to generate service code files;
the packaging module is further used for introducing and universalization processing to the calling code, generating a universal introduced code, and packaging the universal introduced code by utilizing the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code, and generating a universal code file.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to implement the front end code packaging method described above.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the front-end code packaging method described above.
The embodiment of the invention firstly acquires the front-end code, carries out service logic classification on the front-end code to obtain the service code and the calling code, can realize the purpose classification of the front-end code and improves the processing efficiency of the front-end code; secondly, the embodiment of the invention identifies the file lengths of the service codes and the calling codes, and configures the code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes so as to better realize the configuration of the division points of the codes in packing, thereby helping users to better find the corresponding code segment positions; further, according to the embodiment of the invention, according to the code division points of the service codes, the preset code packaging tool is utilized to package the service codes to generate service code files, the call codes are introduced into the generalized processing to generate the universal introduction codes, and according to the preset code packaging rules and the code division values of the call codes, the code packaging tool is utilized to package the universal introduction codes to generate the universal code files, so that flexible configuration during code packaging is ensured, and a developer can quickly inquire the compiled code positions and avoid packaging the service logic parts of the front-end codes into one code file. Therefore, the front-end code packaging method, the front-end code packaging device, the electronic equipment and the storage medium can improve the development efficiency of the front-end page.
Drawings
FIG. 1 is a flowchart of a front end code packaging method according to an embodiment of the present invention;
FIG. 2 is a detailed flowchart illustrating one of the steps of the front end code packaging method of FIG. 1 according to a first embodiment of the present invention;
FIG. 3 is a schematic block diagram of a front end code packaging apparatus according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an internal structure of an electronic device for implementing a front end code packaging method according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a front-end code packaging method. The execution body of the front-end code packaging method includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiment of the application. In other words, the front end code packaging method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, a flow chart of a front end code packaging method according to an embodiment of the invention is shown. In the embodiment of the invention, the front-end code packaging method comprises the following steps:
s1, acquiring a front-end code, and carrying out service logic classification on the front-end code to obtain a service code and a calling code.
In the embodiment of the invention, the front-end code is a front-end page source code which is used for running in a browser, and different front-end pages, such as a mall order page, an information input page, a user login page and the like, can be displayed by compiling different front-end codes. In the invention, the front-end code is compiled by a developer and comprises the following steps: html code, css code, javaScript code, and the like.
Further, since the front-end code compiled by the developer is also used in different actual services in different service scenarios, for example, the front-end code compiled by the developer a is used for editing a front-end page, and the front-end code compiled by the developer B is used for calling other developers. Therefore, the embodiment of the invention realizes the purpose classification of the front-end codes by carrying out service logic classification on the front-end codes, and improves the processing efficiency of the front-end codes.
In detail, the classifying the service logic of the front-end code to obtain a service code and a calling code includes: and identifying the service type of the front-end code, and executing service logic classification of the front-end code by using a preset code classification tool according to the service type to obtain a service code and a calling code.
The service type of the front-end code is identified according to the user requirement, for example, the user requirement is to develop a mall page, the corresponding service type is to develop a service code, and the preset code classification tool may be a git tool.
Further, to ensure privacy and security of the front-end code, the front-end code may also be stored in a blockchain node.
S2, identifying the file lengths of the service codes and the calling codes, and configuring code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes.
In the embodiment of the present invention, the file length refers to the code size of the corresponding code, that is, the required storage space size. The embodiment of the invention can better realize the configuration of the dividing points of the codes in packing by identifying the file lengths of the service codes and the calling codes, thereby helping users to better find the corresponding code segment positions.
In detail, the identifying the file length of the service code and the calling code includes: acquiring code lines, code parameters and configuration files of the service codes and the calling codes; calculating code running values of the service code and the calling code according to the code row, the code parameters and the configuration file; and identifying the storage spaces of the service codes and the calling codes according to the code running values to obtain the file lengths of the service codes and the calling codes.
The code lines are used for marking the lines of code where the code of the instrumentation is, the code parameters refer to code content, and the configuration file is used for representing code logic.
In one optional embodiment of the present invention, the code running values of the service code and the calling code are calculated by the following method:
ρ X =E(X+μ X +σ X )
ρ Y =E(Y+μ Y +σ Y )
wherein ρ is X Code run value representing service code, X represents code line of service code, mu X The code parameters representing the service code are provided,σ X configuration file representing service code ρ Y Representing the code run value of the calling code, Y represents the code line of the calling code, μ Y Code parameters, sigma, representing calling code Y Representing a configuration file of the calling code, E represents the expectations of the code run value.
In an alternative embodiment, the memory space is obtained by an identification statement, the identification statement comprising a select statement.
Further, according to the file length of the service code and the calling code, the code division points of the service code and the calling code are configured, so that flexibility in the process of dividing and packaging the subsequent service code and the calling code is realized, and a corresponding developer can quickly inquire the code positions compiled by the developer.
Specifically, the configuring the code division points of the service code and the calling code according to the file lengths of the service code and the calling code includes: setting a segmentation critical value of a code segment in the service code and the calling code according to the file length of the service code and the calling code, and identifying whether a code segmentation limiting point exists in the service code and the calling code; if the code division limiting point does not exist, marking the code division limiting point in the service code and the calling code by utilizing a code division statement according to the division critical value; if the code division limiting point exists, marking the code division limiting point at the tail end of the code line of the service code and the calling code by utilizing the code division statement according to the division critical value.
The partition threshold is set by an optimization property, such as 150KB.
In a preferred embodiment, the code division limiting point includes: functions, objects, classes, etc., the code division limit points are identified by query statements, the code instrumentation statements include insert insertion statements, and the code division limit points are used to mark the locations of code divisions.
S3, according to the code division points of the service codes, packaging the service codes by using a preset code packaging tool to generate service code files.
It should be appreciated that, if the service code is very large in size, if the service code is directly packaged into files, the loading time of the front-end page is very long, which results in very poor user interaction experience, so that according to the code division points of the service code, the embodiment of the invention uses a preset code packaging tool to package the service code into small file packages, so that the loading speed of the front-end page is improved, and the user interaction experience is enhanced.
In detail, referring to fig. 2, the step of performing file packaging on the service code by using a preset code packaging tool according to the code division point of the service code to generate a service code file includes:
s20, acquiring a code compiling environment of the service code, and establishing storage dependence of the service code and a local warehouse in the code compiling environment by utilizing the code packaging tool;
s21, according to code division points of the service codes, code division is carried out on the service codes by using a division component in the code packaging tool, and a code file is generated;
s22, storing the code file into the local warehouse according to the storage dependence to form a service code file.
The code packaging tool may be a weback tool, and the code compiling environment is used for compiling an integrated environment of the service code, for example Myeclipse, eclipse, subtime and the like; the storage dependence refers to a directory location where the business code is stored in a local repository; the local warehouse can be a maven warehouse, the segmentation component can be a common component, and the business code file is in the format of jar package and can be run in a front-end browser.
S4, introducing and generalizing the calling code to generate a universal introduced code, and packaging the universal introduced code by using the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a universal code file.
The embodiment of the invention realizes the introduction mode of the call code universalization by introducing the call code universalization process so as to realize the compatibility with other call components and avoid the complexity of reintroducing the call code once when different code components are called, wherein the introduction mode comprises the following steps: < script > tag import, import (ES 6 mode), request (command js mode), AMD mode, etc.
In detail, the step of introducing the call code into the generalized processing to generate the generalized introduction code includes: and storing the calling codes under the same directory by using a code migration tool to form general introduction codes, for example, three calling codes of functions, classes and attributes exist, and migrating the three calling codes of the functions, the classes and the attributes under the directory of src by using the code migration tool to form the general introduction codes of the functions, the classes and the attributes.
In an alternative embodiment, the code migration tool is compiled by a script, which may be a JavaScript script.
Further, the embodiment of the invention utilizes the code packaging tool to package the file of the general introduced code based on the preset code packaging rule and the code division point of the calling code, and generates a general code file.
In the embodiment of the present invention, the preset code packaging rule includes: if the calling code of the general introduced code is cited for 2 times or more, a new calling code is extracted to avoid that the same calling code is packaged to different places for multiple times, so that the packaging volume of the code is reduced, for example, calling parties A and B both need to call a general code C, if C is directly introduced into A and B, AC and BC are obtained, the general code C is easily led to be repeatedly packaged, the packaging volume of the code is increased, and the page loading speed is influenced. Optionally, the preset code packaging rule is set through a minChunks attribute.
In detail, the step of performing file packaging on the universal lead-in code by using the code packaging tool according to a preset code packaging rule and a code division point of the calling code to generate a universal code file comprises the following steps: acquiring a code compiling environment of the universal introduced code, and establishing storage dependence of the universal introduced code with a local warehouse in the code compiling environment of the universal introduced code by utilizing the code packaging tool; according to the code division points of the universal introduced codes, the code division of the universal introduced codes is carried out by utilizing the division components in the code packaging tool, so that universal code files are generated; identifying whether the universal code file is extracted or not according to the code packaging rule; if the general code file does not need to be extracted, the general code file is sent to the local warehouse according to the storage dependence to form a calling code file; and if the universal code file needs to be extracted, extracting the universal code file by using a code file extracting tool to obtain an extracted code file, and according to the storage dependence, transmitting the extracted code file to the local warehouse to form a calling code file.
In an alternative embodiment of the present invention, the code file extraction tool is compiled by Java speech.
The embodiment of the invention firstly acquires the front-end code, carries out service logic classification on the front-end code to obtain the service code and the calling code, can realize the purpose classification of the front-end code and improves the processing efficiency of the front-end code; secondly, the embodiment of the invention identifies the file lengths of the service codes and the calling codes, and configures the code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes so as to better realize the configuration of the division points of the codes in packing, thereby helping users to better find the corresponding code segment positions; further, according to the embodiment of the invention, according to the code division points of the service codes, the preset code packaging tool is utilized to package the service codes to generate service code files, the call codes are introduced into the generalized processing to generate the universal introduction codes, and according to the preset code packaging rules and the code division values of the call codes, the code packaging tool is utilized to package the universal introduction codes to generate the universal code files, so that flexible configuration during code packaging is ensured, and a developer can quickly inquire the compiled code positions and avoid packaging the service logic parts of the front-end codes into one code file. Therefore, the invention can improve the development efficiency of the front-end page.
As shown in fig. 3, a functional block diagram of the front end code packaging apparatus of the present invention is shown.
The front end code packaging apparatus 100 of the present invention may be installed in an electronic device. The front end code packaging apparatus may include a classification module 101, a configuration module 102, and a packaging module 103, depending on the functions implemented. The module of the present invention may also be referred to as a unit, meaning a series of computer program segments capable of being executed by the processor of the electronic device and of performing fixed functions, stored in the memory of the electronic device.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the classifying module 101 is configured to obtain a front end code, and perform service logic classification on the front end code to obtain a service code and a calling code;
the configuration module 102 is configured to identify file lengths of the service code and the calling code, and configure code division points of the service code and the calling code according to the file lengths of the service code and the calling code;
the packaging module 103 is configured to package the service code by using a preset code packaging tool according to the code division points of the service code, so as to generate a service code file;
the packaging module 103 is further configured to perform an import generalized process on the calling code, generate a generic import code, and package the generic import code by using the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code, so as to generate a generic code file.
In detail, the modules in the front-end code packaging apparatus 100 in the embodiment of the present invention use the same technical means as the front-end code packaging method described in fig. 1 and 2 and can produce the same technical effects, which are not described herein.
Fig. 4 is a schematic structural diagram of an electronic device implementing the front-end code packaging method according to the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a front end code wrapper 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of a front-end code packaging program, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects respective components of the entire electronic device using various interfaces and lines, executes programs or modules stored in the memory 11 (for example, executes a front end code packaging program or the like), and invokes data stored in the memory 11 to perform various functions of the electronic device 1 and process data.
The bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
Fig. 4 shows only an electronic device with components, it being understood by a person skilled in the art that the structure shown in fig. 4 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
Further, the electronic device 1 may also comprise a network interface, optionally the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the electronic device 1 and other electronic devices.
The electronic device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The front-end code packaging program 12 stored in the memory 11 in the electronic device 1 is a combination of programs that, when run in the processor 10, can implement:
acquiring a front end code, and carrying out service logic classification on the front end code to obtain a service code and a calling code;
identifying the file lengths of the service codes and the calling codes, and configuring code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes;
according to the code division points of the service codes, a preset code packaging tool is utilized to package the service codes into files, and service code files are generated;
and introducing and generalizing the calling code to generate a universal introduced code, and packaging the universal introduced code by utilizing the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a universal code file.
Specifically, the specific implementation method of the above program by the processor 10 may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
Further, the integrated modules/units of the electronic device 1 may be stored in a non-volatile computer readable storage medium if implemented in the form of software functional units and sold or used as a stand alone product. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
acquiring a front end code, and carrying out service logic classification on the front end code to obtain a service code and a calling code;
identifying the file lengths of the service codes and the calling codes, and configuring code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes;
according to the code division points of the service codes, a preset code packaging tool is utilized to package the service codes into files, and service code files are generated;
and introducing and generalizing the calling code to generate a universal introduced code, and packaging the universal introduced code by utilizing the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a universal code file.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.
Claims (7)
1. A method of front end code packaging, the method comprising:
acquiring a front end code, and carrying out service logic classification on the front end code to obtain a service code and a calling code;
acquiring code lines, code parameters and configuration files of the service codes and the calling codes, calculating code running values of the service codes and the calling codes according to the code lines, the code parameters and the configuration files, identifying storage spaces of the service codes and the calling codes according to the code running values to obtain file lengths of the service codes and the calling codes, setting segmentation critical values of the service codes and the calling codes according to the file lengths of the service codes and the calling codes, and marking code segmentation points in the service codes and the calling codes according to the segmentation critical values, wherein the calculating of the code running values of the service codes and the calling codes according to the code lines, the code parameters and the configuration files comprises the following steps:
the code running values of the service code and the call code are calculated using the following method,
=E(X+/>+/>)
=E(Y+/>+/>)
wherein,code run value representing service code, X representing code line of service code,/for the service code>Code parameters representing the service code,/->Configuration file representing service code +.>Code run value representing calling code, Y representing code line of calling code, +.>Code parameters representing the calling code,/->Representing a configuration file of the calling code, E representing a desire of a code running value;
dividing the service code into a plurality of code files by using a preset code packaging tool according to the code division points of the service code, and storing the plurality of code files into a local warehouse to form the service code file;
introducing generalized processing is carried out on the calling code, a universal introduced code is generated, and according to a preset code packaging rule and a code segmentation value of the calling code, the universal introduced code is subjected to file packaging by utilizing the code packaging tool, so that a universal code file is generated, and the method comprises the following steps: the method comprises the steps of obtaining a code compiling environment of a general lead-in code, utilizing a code packaging tool to establish storage dependence of the general lead-in code and a local warehouse in the code compiling environment of the general lead-in code, utilizing a segmentation component in the code packaging tool to conduct code segmentation on the general lead-in code according to code segmentation points of the general lead-in code, generating a general code file, identifying whether the general code file is extracted according to the code packaging rule, if the general code file does not need to be extracted, sending the general code file to the local warehouse according to the storage dependence to form a calling code file, if the general code file needs to be extracted, utilizing a code file extraction tool to extract the general code file to obtain an extraction code file, and sending the extraction code file to the local warehouse according to the storage dependence to form the calling code file.
2. The method for packaging front-end codes according to claim 1, wherein said classifying the front-end codes for service logic to obtain service codes and call codes comprises:
identifying the service type of the front-end code;
and according to the service type, executing service logic classification of the front-end code by using a preset code classification tool to obtain a service code and a calling code.
3. The front-end code packaging method according to any one of claims 1 to 2, wherein the marking code division points in the service code and the call code according to the division threshold value includes:
identifying whether code division points exist in the service codes and the calling codes;
and if the code division points exist, marking the code division points at the tail ends of the code lines of the service code and the calling code by utilizing code division sentences according to the division critical value.
4. The front-end code packaging method as claimed in claim 1, wherein the dividing the service code into a plurality of code files using a preset code packaging tool according to the code division points of the service code, storing the plurality of code files in a local repository to form the service code file, comprises:
acquiring a code compiling environment of the service code, and establishing storage dependence of the service code and a local warehouse in the code compiling environment by utilizing the code packaging tool;
according to the code division points of the service codes, the code division is carried out on the service codes by utilizing a division component in the code packaging tool, so as to generate a plurality of code files;
and storing the plurality of code files into the local warehouse according to the storage dependence to form service code files.
5. A front end code packaging apparatus, the apparatus comprising:
the classifying module is used for acquiring a front-end code, and carrying out service logic classification on the front-end code to obtain a service code and a calling code;
the configuration module is used for acquiring code rows, code parameters and configuration files of the service codes and the calling codes, calculating code running values of the service codes and the calling codes according to the code rows, the code parameters and the configuration files, identifying storage spaces of the service codes and the calling codes according to the code running values to obtain file lengths of the service codes and the calling codes, setting segmentation critical values of the service codes and the calling codes according to the file lengths of the service codes and the calling codes, and marking code segmentation points in the service codes and the calling codes according to the segmentation critical values, wherein the calculating of the code running values of the service codes and the calling codes according to the code rows, the code parameters and the configuration files comprises the following steps:
the code running values of the service code and the call code are calculated using the following method,
=E(X+/>+/>)
=E(Y+/>+/>)
wherein,code run value representing service code, X representing code line of service code,/for the service code>Code parameters representing the service code,/->Configuration file representing service code +.>Code run value representing calling code, Y representing code line of calling code, +.>Code parameters representing the calling code,/->Representing a configuration file of the calling code, E representing a desire of a code running value;
the packaging module is used for dividing the service code into a plurality of code files by utilizing a preset code packaging tool according to the code division points of the service code, and storing the plurality of code files into a local warehouse to form the service code file;
the packaging module is further configured to perform an introduction and generalization process on the calling code, generate a general introduction code, package the general introduction code into a file by using the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code, and generate a general code file, including: the method comprises the steps of obtaining a code compiling environment of a general lead-in code, utilizing a code packaging tool to establish storage dependence of the general lead-in code and a local warehouse in the code compiling environment of the general lead-in code, utilizing a segmentation component in the code packaging tool to conduct code segmentation on the general lead-in code according to code segmentation points of the general lead-in code, generating a general code file, identifying whether the general code file is extracted according to the code packaging rule, if the general code file does not need to be extracted, sending the general code file to the local warehouse according to the storage dependence to form a calling code file, if the general code file needs to be extracted, utilizing a code file extraction tool to extract the general code file to obtain an extraction code file, and sending the extraction code file to the local warehouse according to the storage dependence to form the calling code file.
6. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the front end code packaging method of any one of claims 1 to 4.
7. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the front end code packaging method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011478743.1A CN112486490B (en) | 2020-12-15 | 2020-12-15 | Front-end code packaging method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011478743.1A CN112486490B (en) | 2020-12-15 | 2020-12-15 | Front-end code packaging method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112486490A CN112486490A (en) | 2021-03-12 |
CN112486490B true CN112486490B (en) | 2024-03-19 |
Family
ID=74917939
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011478743.1A Active CN112486490B (en) | 2020-12-15 | 2020-12-15 | Front-end code packaging method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112486490B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113032003B (en) * | 2021-04-08 | 2024-04-02 | 深圳赛安特技术服务有限公司 | Development file export method, development file export device, electronic equipment and computer storage medium |
CN113377376A (en) * | 2021-06-09 | 2021-09-10 | 中国工商银行股份有限公司 | Data packet generation method, data packet generation device, electronic device, and storage medium |
CN113608746B (en) * | 2021-08-16 | 2023-10-27 | 北京字节跳动网络技术有限公司 | Code conversion processing method, device, computer equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103135976A (en) * | 2011-11-30 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Code automatic generation method and device |
CN110825369A (en) * | 2019-11-07 | 2020-02-21 | 四川长虹电器股份有限公司 | Method for automatically generating codes based on java language |
CN111459497A (en) * | 2020-04-10 | 2020-07-28 | 深圳市盟天科技有限公司 | WebPack-based resource package compiling method, system, server and storage medium |
CN111552640A (en) * | 2020-04-24 | 2020-08-18 | 北京字节跳动网络技术有限公司 | Code detection method, device, equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106980504B (en) * | 2017-03-28 | 2022-07-01 | 腾讯科技(深圳)有限公司 | Application program development method and tool and equipment thereof |
-
2020
- 2020-12-15 CN CN202011478743.1A patent/CN112486490B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103135976A (en) * | 2011-11-30 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Code automatic generation method and device |
CN110825369A (en) * | 2019-11-07 | 2020-02-21 | 四川长虹电器股份有限公司 | Method for automatically generating codes based on java language |
CN111459497A (en) * | 2020-04-10 | 2020-07-28 | 深圳市盟天科技有限公司 | WebPack-based resource package compiling method, system, server and storage medium |
CN111552640A (en) * | 2020-04-24 | 2020-08-18 | 北京字节跳动网络技术有限公司 | Code detection method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112486490A (en) | 2021-03-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112486490B (en) | Front-end code packaging method and device, electronic equipment and storage medium | |
CN113239106B (en) | Excel file export method and device, electronic equipment and storage medium | |
CN112506779A (en) | Software interface testing method and device, electronic equipment and storage medium | |
CN113238929B (en) | Code testing method and device based on Mock data, electronic equipment and storage medium | |
CN113377661A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN113032275A (en) | Method and device for testing field, electronic equipment and storage medium | |
CN112650909A (en) | Product display method and device, electronic equipment and storage medium | |
CN113890712A (en) | Data transmission method and device, electronic equipment and readable storage medium | |
CN113806434A (en) | Big data processing method, device, equipment and medium | |
CN114398282A (en) | Test script generation method, device, equipment and storage medium | |
CN112541688B (en) | Service data verification method and device, electronic equipment and computer storage medium | |
CN114385497A (en) | Test environment generation method and device, electronic equipment and storage medium | |
CN113434542A (en) | Data relation identification method and device, electronic equipment and storage medium | |
CN112579475A (en) | Code testing method, device, equipment and readable storage medium | |
CN115827115A (en) | H5 page jump method, device, equipment and storage medium of WeChat applet | |
CN114911479A (en) | Interface generation method, device, equipment and storage medium based on configuration | |
CN115174555A (en) | File transmission method and device, electronic equipment and storage medium | |
CN115174541A (en) | H5 resource loading method and device, electronic equipment and storage medium | |
CN114461531A (en) | Platform adaptability test method, device, equipment and storage medium of test case | |
CN112527443A (en) | Prompt box display method and device, electronic equipment and computer readable storage medium | |
CN113672483B (en) | Device log storage method and device, electronic device and medium | |
CN113438221B (en) | Local end file loading method and device, electronic equipment and medium | |
CN113032003B (en) | Development file export method, development file export device, electronic equipment and computer storage medium | |
CN113704109B (en) | Front-end and back-end data interaction method and device, electronic equipment and storage medium | |
CN114564413B (en) | Synchronous equipment testing method and device |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |