CN109460229A - Code file generation method, device, computer equipment and storage medium - Google Patents

Code file generation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109460229A
CN109460229A CN201811082833.1A CN201811082833A CN109460229A CN 109460229 A CN109460229 A CN 109460229A CN 201811082833 A CN201811082833 A CN 201811082833A CN 109460229 A CN109460229 A CN 109460229A
Authority
CN
China
Prior art keywords
file
code file
open source
source code
code
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
CN201811082833.1A
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.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology 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 OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201811082833.1A priority Critical patent/CN109460229A/en
Publication of CN109460229A publication Critical patent/CN109460229A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • 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/70Software maintenance or management
    • G06F8/73Program documentation

Abstract

This application involves development technique field, a kind of code file generation method, device, computer equipment and storage medium are provided.Method includes: scan item code, obtain the file import information that item code carries, according to file import information, the corresponding Open Source Code file of item code and exploitation code file are searched, reads Open Source Code file, and compression processing is carried out using the split source code file of corresponding compress mode, generate compression Open Source Code file, exploitation code file is read, and according to exploitation code file and compression Open Source Code file, code file needed for generating item code.The process employs the modes of partial shrinkage to generate code file, split source code file carries out compression processing, reduce code file size, improve response speed when code uses, and, compression processing is not carried out to exploitation code file, corresponding exploitation code can be directly viewable, debugging on line is easy to implement and is checked with problem.

Description

Code file generation method, device, computer equipment and storage medium
Technical field
This application involves technical field of software development, more particularly to a kind of code file generation method, device, computer Equipment and storage medium.
Background technique
With the continuous improvement and development of scientific and technological level, present web page contents are all the more abundant, and display effect is all the more complicated, preceding It holds and is carrying out relevant page development using Node.js (the JavaScript running environment based on Chrome V8 engine) When, the various front end frame having been carried out and Open Source Code library can be used, to realize the exploitation of some complexity, is reduced The development cost of oneself.
But meanwhile be also encountered by some problems, in the code file generated due to exploitation, many third party's generations for referring to Code the space occupied is very big, can be because file is larger when user browses webpage, and loading is slower, and the rendering page has Delay, response are also spun out, and user is when mobile phone terminal browsing pages, or even can also expend a large amount of flow.In order to Make code file smaller, execution efficiency is higher, code file is obtained to the code progress full dose compression entered in actual use, However such code file generation method, there are problems that not carrying out the problem of debugging is with investigation on line.
Summary of the invention
Based on this, it is necessary in view of the above technical problems, provide it is a kind of convenient for problem investigation code file generation method, Device, computer equipment and storage medium.
Scan item code obtains the file import information that the item code carries;
According to the file import information, the corresponding Open Source Code file of the item code and exploitation code text are searched Part;
The Open Source Code file is read, and the Open Source Code file is carried out at compression using corresponding compress mode Reason generates compression Open Source Code file;
The exploitation code file is read, and according to the exploitation code file and the compression Open Source Code file, it is raw At code file needed for the item code.
The item code is applied to Node.js environment in one of the embodiments, and the exploitation code file is .js file;It is described according to the file import information, search the corresponding Open Source Code file of the item code and exploitation code File, comprising:
When the file import information includes Open Framework or Open Source Code library name, determine that the item code is corresponding Code file be Open Source Code file, and the Open Source Code text is searched according to the Open Framework or Open Source Code library name Part;
When the file import information includes the store path title of .js file, determine that the item code is corresponding Code file is exploitation code file, and searches the exploitation code file according to the store path title.
It is described in one of the embodiments, to read the Open Source Code file, and using corresponding compress mode to institute It states Open Source Code file and carries out compression processing, generate compression Open Source Code file, comprising:
According to the Open Framework or Open Source Code library name, from NPM package manager (Node Package Manager, Node package manager) in read Open Source Code file;
The Open Source Code file of reading is stored in preset proprietary file catalogue;
The compress mode compressed or be partially compressed using full dose, by the proprietary file catalogue and corresponding Open Source Code text Part carries out compression processing, generates compression Open Source Code file.
It is described in one of the embodiments, to read the exploitation code file, and according to the exploitation code file with The compression Open Source Code file, code file needed for generating the item code, comprising:
The exploitation code file is read, the exploitation code file is copied into preset internal file catalogue;
The internal file catalogue and the compression Open Source Code file are subjected to packing processing, generate the item code Required code file.
The scan item code in one of the embodiments, obtains the file that the item code carries and imports letter After breath, further includes:
Sub-project quantity is determined according to the scanning result of item code;
When the sub-project quantity is one, determine that the compress mode of the Open Source Code file is Open Source Code file Full dose compression;
When the sub-project quantity is no less than 2, determine that the compress mode of the Open Source Code file is Open Source Code File part compression.
It is described to read the Open Source Code text in one of the embodiments, when the sub-project quantity is no less than 2 Part, and compression processing is carried out to the Open Source Code file using corresponding compress mode, generate compression Open Source Code file, packet It includes:
According to the file import information, the importing number of the Open Source Code file is counted;
It reads and imports the Open Source Code file that number is not less than 2;
Open Source Code file by the importing number read not less than 2 is stored in preset proprietary file catalogue;
Compression processing is carried out to the proprietary file catalogue and corresponding Open Source Code file, generates compression Open Source Code text Part.
It is described in one of the embodiments, to read the exploitation code file, and according to the exploitation code file with The compression Open Source Code file, code file needed for generating the item code, comprising:
It reads and imports Open Source Code file and the exploitation code file that number is 1;
Open Source Code file, the exploitation code file and the compression Open Source Code for being 1 by the importing number File carries out packing processing, code file needed for generating the item code.
A kind of code compaction device, described device include:
Item code scan module is used for scan item code, obtains the file import information that the item code carries;
Code file acquisition module, for searching the corresponding open source of the item code according to the file import information Code file and exploitation code file;
Open Source Code compressing file module for reading the Open Source Code file, and uses corresponding compress mode pair The Open Source Code file carries out compression processing, generates compression Open Source Code file;
Code file generation module, for reading the exploitation code file, and according to the exploitation code file and institute State compression Open Source Code file, code file needed for generating the item code.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the processing Device performs the steps of when executing the computer program
Scan item code obtains the file import information that the item code carries;
According to the file import information, the corresponding Open Source Code file of the item code and exploitation code text are searched Part;
The Open Source Code file is read, and the Open Source Code file is carried out at compression using corresponding compress mode Reason generates compression Open Source Code file;
The exploitation code file is read, and according to the exploitation code file and the compression Open Source Code file, it is raw At code file needed for the item code.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor It is performed the steps of when row
Scan item code obtains the file import information that the item code carries;
According to the file import information, the corresponding Open Source Code file of the item code and exploitation code text are searched Part;
The Open Source Code file is read, and the Open Source Code file is carried out at compression using corresponding compress mode Reason generates compression Open Source Code file;
The exploitation code file is read, and according to the exploitation code file and the compression Open Source Code file, it is raw At code file needed for the item code.
Above-mentioned code file generation method, device, computer equipment and storage medium are obtained by scan item code The file import information that item code carries further determines that the Open Source Code file that can directly quote and self-developed Exploitation code file is compressed Open Source Code file by reading Open Source Code file, and using corresponding compress mode Processing, finally according to the exploitation code file of reading and compressed Open Source Code file, code needed for generating item code File.The process employs the modes of partial shrinkage to generate code file, and split source code file carries out compression processing, reduces Code file size improves response speed when code uses, moreover, compression processing is not carried out to exploitation code file, it can To be directly viewable corresponding exploitation code, it is easy to implement debugging on line and is checked with problem.
Detailed description of the invention
Fig. 1 is the application scenario diagram of code file generation method in one embodiment;
Fig. 2 is the flow diagram of code file generation method in one embodiment;
Fig. 3 is the flow diagram of code file generation method in another embodiment;
Fig. 4 is the flow diagram of code file generation method in another embodiment;
Fig. 5 is the flow diagram of code file generation method in another embodiment;
Fig. 6 is the flow diagram of code file generation method in another embodiment;
Fig. 7 is the flow diagram of code file generation method in another embodiment;
Fig. 8 is the structural block diagram of code file generating means in one embodiment;
Fig. 9 is the internal structure chart of computer equipment in one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the purpose, technological project and advantage of the application is more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
Code file generation method provided by the present application, can be applied in application environment as shown in Figure 1.Wherein, eventually End 102 is communicated with server 104 by network by network.Developer sends from 102 cuit code of terminal To server 104, server 104 is scanned received item code, and the file for getting item code carrying imports Information searches the corresponding Open Source Code file of item code and exploitation code file, service according to the file import information of acquisition Device 104 reads Open Source Code file, and the split further compression processing of source code file polarity, generates compression Open Source Code File last reads exploitation code file with the size of code file needed for reducing project, and according to exploitation code file with Compress Open Source Code file, generate item code needed for code file be sent to terminal 102, to terminal 102 can with but it is unlimited Then various personal computers, laptop, smart phone and tablet computer etc., server 104 can use independent clothes The server cluster of business device either multiple servers composition is realized.
In one embodiment, as shown in Fig. 2, providing a kind of code file generation method, it is applied to Fig. 1 in this way In server for be illustrated, comprising the following steps:
S100: scan item code obtains the file import information that item code carries.
Item code refers to the execution code write in project development, the project generation of server receiving terminal input Code, item code includes multiple sub-projects, function needed for multiple sub-projects combine common realization project.In one embodiment In, item code can be the code using the NodeJS front end js projects developed, or assure reason using NPM Tool carries out managing the code of the js projects in third party's Open Source Code library.Front end is relevant in progress using NodeJS When page development, many front end frame having been carried out and Open Source Code library can be used, is opened in conjunction with developer oneself The code of hair, to realize the project development of some complexity, to reduce development cost.Item code is imported pair by way of calling The code file answered, file import information, which refers to, is used to indicate the corresponding Open Source Code file of item code or exploitation code file Code data, in embodiment, the file import information of Open Source Code file can be Open Framework or Open Source Code library name Claim, exploitation code file can be the store path title of .js file.
S200: according to file import information, the corresponding Open Source Code file of item code and exploitation code file are searched.
Open Source Code refer to it is a kind of provide the way of final source material in the product and exploitation of product or project, Node.js is namely based on open source Web (webpage) server item of JavaScript language and V8 engine, and Open Source Code file is Refer to some front end frames having been carried out and Open Source Code library.Exploitation code project refers to for project development demand, voluntarily compiles Write the code file of exploitation.By the file import information carried in code, determine that the item code is corresponding code file Type is Open Source Code file or exploitation code file, and according to file import information, determines Open Source Code file and exploitation The storage location of code file, to find the corresponding Open Source Code file of item code and exploitation code file.Implementing In example, when file import information includes Open Framework or Open Source Code library name, the corresponding code file of item code is to open Source code file can search Open Source Code file according to Open Framework or Open Source Code library name, when file import information packet When including the store path title of .js file, the corresponding code file of item code is exploitation code file, according to .js file Store path title can search exploitation code file.
S300: reading Open Source Code file, and carry out compression processing using the split source code file of corresponding compress mode, Generate compression Open Source Code file.
Open Source Code file is read, can be and the Open Source Code file found according to file import information is answered System, and it is moved to designated storage location, and determine the process of Open Source Code file import information, wherein import information may include Import number, import position etc., after reading completion, according to the import information of Open Source Code file, using corresponding compression The split source code file of mode carries out compression processing, and the compress mode of Open Source Code file includes full dose compression and is partially compressed, To generate compression Open Source Code file.Due to Open Source Code file versatility the features such as, generally there is failure when in use A possibility that it is smaller, by compressing Open Source Code file, reduce code file size, save flow, improve generation Response speed when code uses, is loaded into and rendering speed is all improved.
S400: reading exploitation code file, and according to exploitation code file and compression Open Source Code file, generates project generation Code file needed for code.
Exploitation code file is the code that developer is directed to that project demands are voluntarily write, and item code file needs to carry out Test and debugging processing, just can ensure that the normal operation and work of code, traditional solution generally can be in corresponding function Before upper production, a comprehensive test and debugging are done to item code file, it is ensured that after there is no problem, then carry out to all Open Source Code file and oneself internal exploitation code file carry out full dose compression, then that compressed code file is online It uses.But the testing process of standard and comprehensive test case expend greatly, do not have versatility, the related function of code file It is unavoidable for capable of going wrong in production environment.To solve this problem, it is pressed using only split source code file Processing mode is partially compressed in the code file of contracting, remains the readability of exploitation code file, is easy to implement on line and debugs and ask Topic investigation.
Above-mentioned code file generation method obtains the file import information that item code carries by scan item code, The Open Source Code file that can directly quote and self-developed exploitation code file are further determined that, by reading generation of increasing income Code file, and Open Source Code file is carried out by compression processing using corresponding compress mode, finally according to the exploitation code of reading File and compressed Open Source Code file, code file needed for generating item code.The process employs partial shrinkages Mode generates code file, and split source code file carries out compression processing, reduces code file size, improves code use When response speed, moreover, to exploitation code file do not carry out compression processing, corresponding exploitation code can be directly viewable, just It is checked in realizing to debug on line with problem.
In one embodiment, item code is applied to Node.js environment, and exploitation code file is .js file.Such as Fig. 3 It is shown, according to file import information, search the corresponding Open Source Code file of item code and exploitation code file, comprising:
S220: when file import information includes Open Framework or Open Source Code library name, code of identifying project is corresponding Code file is Open Source Code file, and searches Open Source Code file according to Open Framework or Open Source Code library name.
S240: when file import information includes the store path title of .js file, the corresponding code of code of identifying project File is exploitation code file, and searches exploitation code file according to store path title.
In embodiment, Open Framework and Open Source Code library include Ant Design, Babel, jQuery, React, React-Router, Redux, QRCode, css-loader etc..
In one embodiment, as shown in figure 4, reading Open Source Code file, and using corresponding compress mode to open source Code file carries out compression processing, generates compression Open Source Code file, comprising:
S310: according to Open Framework or Open Source Code library name, Open Source Code file is read from NPM package manager.
S320: the Open Source Code file of reading is stored in preset proprietary file catalogue.
S330: the compress mode compressed or be partially compressed using full dose, by proprietary file catalogue and corresponding Open Source Code File carries out compression processing, generates compression Open Source Code file.
NPM package manager is Node.js packet management tool, and the effect of NPM package manager includes that user is allowed to assure from NPM Reason device is downloaded the Open Source Code file packet that others writes and is used to local, allows user to download from NPM package manager and installs not The order line program that people writes is used to local, and the packet or order line program for also user being allowed to write oneself upload to NPM packet Manager is used for others.By Open Framework or Open Source Code library name, under searching and being read in NPM package manager The Open Source Code file of the Open Framework or Open Source Code library that have carried reads Open Source Code file and is uniformly transferred to the special of setting There is file directory, so that different exploration projects can be directly from proprietary file mesh when choosing Open Source Code file It is chosen in record, has saved lookup and processing time.The compress mode compressed or be partially compressed using full dose, to proprietary file catalogue And its corresponding Open Source Code file carries out compression processing, reduces document memory size, saves flow, and improve front end Page rendering speed.In embodiment, the sub-project quantity for including by code of identifying project, determines corresponding compress mode, Compress mode proprietary file catalogue and its corresponding Open Source Code file when the group number of entry is 1, using full dose compression Compression processing is carried out, when the group number of entry is no less than 2, using the compress mode proprietary file catalogue of partial shrinkage and its right The Open Source Code file answered carries out compression processing.
In one embodiment, it as shown in figure 5, reading exploitation code file, and is opened according to exploitation code file with compression Source code file, code file needed for generating item code, comprising:
S420: exploitation code file is read, exploitation code file is copied into preset internal file catalogue.
S440: internal file catalogue and compression Open Source Code file are subjected to packing processing, generated needed for item code Code file.
Internal file catalogue is for storing exploitation code file, in embodiment, internal file catalogue and proprietary file mesh When the determination of the document location of record includes: first setting, folder location is determined by specified store path, and to specified path It is saved so as to subsequent direct storage, all exploitation code files is stored in all Open Source Code files corresponding In file, it is respectively formed internal file catalogue and proprietary file catalogue, convenient for carrying out code text according to determining item code The lookup of part improves the search speed of code file.
In one embodiment, as shown in Figure 6 and Figure 7, scan item code obtains the file that item code carries and imports After information, further includes:
S120: sub-project quantity is determined according to the scanning result of item code.
S140: when the group number of entry is one, determine that the compress mode of Open Source Code file is that Open Source Code file is complete Amount compression.
S160: when the group number of entry is no less than 2, determine that the compress mode of Open Source Code file is Open Source Code file It is partially compressed.
The composition of one exploration project includes that independent composition combines composition, the pressure of split source code file with multiple sub-projects Contracting mode there is also a variety of, the group number of entry only one when, the compress mode of corresponding Open Source Code file is open source generation The corresponding Open Source Code file of item code is all carried out compression processing, obtains compression Open Source Code by code file full dose compression File.
In one embodiment, when the group number of entry is no less than 2, Open Source Code file is read, and using corresponding The split source code file of compress mode carries out compression processing, generates compression Open Source Code file, comprising:
S350: according to file import information, the importing number of split source code file is counted.
S360: it reads and imports the Open Source Code file that number is not less than 2.
S370: the Open Source Code file by the importing number read not less than 2 is stored in preset proprietary file catalogue.
S380: carrying out compression processing to proprietary file catalogue and corresponding Open Source Code file, generates compression Open Source Code File.
When exploration project is related to multiple sub-projects, the corresponding Open Source Code file of multiple sub-projects is united Meter, if it exceeds more than two Open Source Code files use a certain Open Framework or Open Source Code library, then by the open source frame Frame or Open Source Code library copy in proprietary file catalogue, after the completion of finally counting, then are opened with corresponding proprietary file catalogue Source code file is compressed.For example, a project includes three sub-projects, the Open Source Code file that sub-project 1 uses is A+B + C, the Open Source Code file that sub-project 2 uses are A+B, and the Open Source Code file that sub-project 3 uses is A+B+D, statistical result Are as follows: there are 3 Open Source Code files to use A, there are 3 Open Source Code files to use B, there is 1 Open Source Code file to make It is C, has 1 Open Source Code file to use D, according to statistical result, the corresponding Open Source Code file of A and B is put into It is compressed, the corresponding Open Source Code file of C and D is directly read, such processing mode, so that respectively in proprietary file catalogue When sub-project executes, the third party's Open Source Code for including in the proprietary file catalogue of reference is all necessary code, reduces file The size of occupied memory.When determining project is related to multiple sub-project files, can also using full dose compression by the way of into Row compression.Compress mode can be set before proprietary file compression according to actual needs, in embodiment, pass through end End provides selection interface, and the compress mode for receiving developer's selection is determined.
In one embodiment, exploitation code file is read, and according to exploitation code file and compresses Open Source Code file, Code file needed for generating item code, comprising:
S460: it reads and imports Open Source Code file and exploitation code file that number is 1.
S480: to import number be 1 Open Source Code file, exploitation code file and compression Open Source Code file into Row packing processing, code file needed for generating item code.
After the partial shrinkage of Open Source Code file and proprietary file catalogue has been run, which Open Source Code file determined Using which Open Framework or Open Source Code library arrived, but compression is not merged, i.e., only 1 Open Source Code file makes Use the Open Framework or Open Source Code library.The Open Source Code file for importing and using will be repeated several times to compress, to exploitation generation Code file and import number be 1 Open Source Code file directly read, and by import number be 1 Open Source Code file, open Hair code file and compression Open Source Code file carry out packing processing, code file needed for code of identifying project.
In an application example, three kinds of modes is respectively adopted, code file has been handled.The first for not to appoint What code file is compressed, and result is that the file that code sample file is packaged out amounts to about 12MB, all code files It is readable, but processing speed is slow;Second is to compress to all code files, and result is what code sample file was packaged out It is about 1.5MB that file, which amounts to size, and All Files are unreadable, and processing speed is very fast;The third for split source code file into Row screening compression, split fat file directly reads, and it is about 2MB that the file that example file is packaged out, which amounts to size, code can The property read is higher, and convenient investigation and orientation problem, processing speed on line are very fast.Using the third code file processing method to item Mesh code carries out packing compression, probably small an order of magnitude (12MB:2MB) compared to the size of uncompressed code file, real The compression efficiency on border can be different according to the Open Source Code file used, and the Open Source Code file used is more, optimization effect Fruit is better.Meanwhile also only more than the code file under full dose compression scheme 1/3 size (2MB:1.5MB), and exploitation code The readability of file is not destroyed, and is facilitated and is checked code on direct-on-line, and more quickly and easily positioning is gone wrong and solved Certainly problem.
It should be understood that although each step in the flow chart of Fig. 2-7 is successively shown according to the instruction of arrow, These steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly stating otherwise herein, these steps Execution there is no stringent sequences to limit, these steps can execute in other order.Moreover, at least one in Fig. 2-7 Part steps may include that perhaps these sub-steps of multiple stages or stage are not necessarily in synchronization to multiple sub-steps Completion is executed, but can be executed at different times, the execution sequence in these sub-steps or stage is also not necessarily successively It carries out, but can be at least part of the sub-step or stage of other steps or other steps in turn or alternately It executes.
In one embodiment, as shown in figure 8, providing a kind of code file generating means, comprising:
Item code scan module 100 is used for scan item code, obtains the file that the item code carries and imports letter Breath;
Code file acquisition module 200, for searching according to the file import information, the item code is corresponding to be opened Source code file and exploitation code file;
Open Source Code compressing file module 300 for reading the Open Source Code file, and uses corresponding compress mode Compression processing is carried out to the Open Source Code file, generates compression Open Source Code file;
Code file generation module 400, for reading the exploitation code file, and according to the exploitation code file with The compression Open Source Code file, code file needed for generating the item code.
In one embodiment, item code is applied to Node.js environment, and exploitation code file is .js file;Code text Part obtains module 200, comprising:
Open Source Code document determining unit, for including Open Framework or Open Source Code library name when file import information When, the corresponding code file of code of identifying project is Open Source Code file, and is looked into according to Open Framework or Open Source Code library name Change source code file;
Exploitation code document determining unit, when for including the store path title of .js file when file import information, really Determining the corresponding code file of item code is exploitation code file, and searches exploitation code file according to store path title.
In one embodiment, Open Source Code compressing file module 300, comprising:
Open Source Code document reading unit is used for according to Open Framework or Open Source Code library name, from NPM package manager Read Open Source Code file;
Open Source Code file storage unit, for the Open Source Code file of reading to be stored in preset proprietary file mesh Record;
Compression processing unit, the compress mode for being compressed or being partially compressed using full dose, by proprietary file catalogue and right The Open Source Code file answered carries out compression processing, generates compression Open Source Code file.
In one embodiment, code file generation module 400, comprising:
Exploitation code file copied cells copy to exploitation code file preset for reading exploitation code file Internal file catalogue;
It is packaged processing unit, for internal file catalogue and compression Open Source Code file to be carried out packing processing, generating item Code file needed for mesh code.
In one embodiment, item code scan module 100, further includes:
Sub-project quantity determination unit determines sub-project quantity for the scanning result according to item code;
First compress mode determination unit, for the group number of entry be one when, determine the compression of Open Source Code file Mode is the compression of Open Source Code file full dose;
Second compress mode determination unit when being no less than 2 for the group number of entry, determines the pressure of Open Source Code file Contracting mode is the compression of Open Source Code file part.
In one embodiment, when the group number of entry is no less than 2, Open Source Code compressing file module 300, comprising:
File imports number statistic unit, for according to file import information, the importing number of split source code file into Row statistics;
Open Source Code document reading unit is also used to read the Open Source Code file that importing number is not less than 2;
Open Source Code file storage unit is also used to the Open Source Code file by the importing number read not less than 2 and deposits It is stored in preset proprietary file catalogue;
Compression processing unit is also used to carry out compression processing to proprietary file catalogue and corresponding Open Source Code file, raw At compression Open Source Code file.
In one embodiment, code file generation module 400, comprising:
Reading unit imports the Open Source Code file and exploitation code file that number is 1 for reading;
Be packaged processing unit, for import number be 1 Open Source Code file, exploitation code file and compression open Source code file carries out packing processing, code file needed for generating item code.
Above-mentioned code file generating means obtain the file import information that item code carries by scan item code, The Open Source Code file that can directly quote and self-developed exploitation code file are further determined that, by reading generation of increasing income Code file, and Open Source Code file is carried out by compression processing using corresponding compress mode, finally according to the exploitation code of reading File and compressed Open Source Code file, code file needed for generating item code.The process employs partial shrinkages Mode generates code file, and split source code file carries out compression processing, reduces code file size, improves code use When response speed, moreover, to exploitation code file do not carry out compression processing, corresponding exploitation code can be directly viewable, just It is checked in realizing to debug on line with problem.
Specific about code file generating means limits the limit that may refer to above for code file generation method Fixed, details are not described herein.Modules in above-mentioned code file generating means can fully or partially through software, hardware and its Combination is to realize.Above-mentioned each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also be with It is stored in the memory in computer equipment in a software form, in order to which processor calls the above modules of execution corresponding Operation.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction Composition can be as shown in Figure 9.The computer equipment include by system bus connect processor, memory, network interface and Database.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipment Include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and data Library.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating The database of machine equipment is used for the corresponding data of store code file generated step.The network interface of the computer equipment be used for External terminal passes through network connection communication.To realize a kind of code file generation side when the computer program is executed by processor Method.
It will be understood by those skilled in the art that structure shown in Fig. 9, only part relevant to the application project is tied The block diagram of structure does not constitute the restriction for the computer equipment being applied thereon to the application project, specific computer equipment It may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, which is stored with Computer program, the processor perform the steps of when executing computer program
Scan item code obtains the file import information that item code carries;
According to file import information, the corresponding Open Source Code file of item code and exploitation code file are searched;
Open Source Code file is read, and compression processing is carried out using the split source code file of corresponding compress mode, is generated Compress Open Source Code file;
Exploitation code file is read, and according to exploitation code file and compression Open Source Code file, generates item code institute The code file needed.
In one embodiment, item code is applied to Node.js environment, and exploitation code file is .js file;Processor It is also performed the steps of when executing computer program
When file import information includes Open Framework or Open Source Code library name, the corresponding code text of code of identifying project Part is Open Source Code file, and searches Open Source Code file according to Open Framework or Open Source Code library name;
When file import information includes the store path title of .js file, the corresponding code file of code of identifying project For exploitation code file, and exploitation code file is searched according to store path title.
In one embodiment, it is also performed the steps of when processor executes computer program
According to Open Framework or Open Source Code library name, Open Source Code file is read from NPM package manager;
The Open Source Code file of reading is stored in preset proprietary file catalogue;
The compress mode compressed or be partially compressed using full dose, by proprietary file catalogue and corresponding Open Source Code file into Row compression processing generates compression Open Source Code file.
In one embodiment, it is also performed the steps of when processor executes computer program
Exploitation code file is read, exploitation code file is copied into preset internal file catalogue;
Internal file catalogue and compression Open Source Code file are subjected to packing processing, the text of code needed for generating item code Part.
In one embodiment, it is also performed the steps of when processor executes computer program
Sub-project quantity is determined according to the scanning result of item code;
When the group number of entry is one, determine that the compress mode of Open Source Code file is Open Source Code file full dose pressure Contracting;
When the group number of entry is no less than 2, determine that the compress mode of Open Source Code file is Open Source Code file part Compression.
In one embodiment, when the group number of entry is no less than 2, processor execute computer program when also realize with Lower step:
According to file import information, the importing number of split source code file is counted;
It reads and imports the Open Source Code file that number is not less than 2;
Open Source Code file by the importing number read not less than 2 is stored in preset proprietary file catalogue;
Compression processing is carried out to proprietary file catalogue and corresponding Open Source Code file, generates compression Open Source Code file.
In one embodiment, it is also performed the steps of when processor executes computer program
It reads and imports Open Source Code file and exploitation code file that number is 1;
It is packaged to the Open Source Code file that number is 1, exploitation code file and compression Open Source Code file is imported Processing, code file needed for generating item code.
The above-mentioned computer equipment for realizing code file generation method obtains project generation by scan item code The file import information that code carries, further determines that the Open Source Code file that can directly quote and self-developed exploitation generation Open Source Code file is carried out compression processing by reading Open Source Code file, and using corresponding compress mode, most by code file Afterwards according to the exploitation code file of reading and compressed Open Source Code file, code file needed for generating item code.It should Method generates code file by the way of being partially compressed, and split source code file carries out compression processing, reduces code text Part size improves response speed when code uses, moreover, compression processing is not carried out to exploitation code file, it can be direct It checks corresponding exploitation code, is easy to implement debugging on line and is checked with problem.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program performs the steps of when being executed by processor
Scan item code obtains the file import information that item code carries;
According to file import information, the corresponding Open Source Code file of item code and exploitation code file are searched;
Open Source Code file is read, and compression processing is carried out using the split source code file of corresponding compress mode, is generated Compress Open Source Code file;
Exploitation code file is read, and according to exploitation code file and compression Open Source Code file, generates item code institute The code file needed.
In one embodiment, item code is applied to Node.js environment, and exploitation code file is .js file;Computer It is also performed the steps of when program is executed by processor
When file import information includes Open Framework or Open Source Code library name, the corresponding code text of code of identifying project Part is Open Source Code file, and searches Open Source Code file according to Open Framework or Open Source Code library name;
When file import information includes the store path title of .js file, the corresponding code file of code of identifying project For exploitation code file, and exploitation code file is searched according to store path title.
In one embodiment, it is also performed the steps of when computer program is executed by processor
According to Open Framework or Open Source Code library name, Open Source Code file is read from NPM package manager;
The Open Source Code file of reading is stored in preset proprietary file catalogue;
The compress mode compressed or be partially compressed using full dose, by proprietary file catalogue and corresponding Open Source Code file into Row compression processing generates compression Open Source Code file.
In one embodiment, it is also performed the steps of when computer program is executed by processor
Exploitation code file is read, exploitation code file is copied into preset internal file catalogue;
Internal file catalogue and compression Open Source Code file are subjected to packing processing, the text of code needed for generating item code Part.
In one embodiment, it is also performed the steps of when computer program is executed by processor
Sub-project quantity is determined according to the scanning result of item code;
When the group number of entry is one, determine that the compress mode of Open Source Code file is Open Source Code file full dose pressure Contracting;
When the group number of entry is no less than 2, determine that the compress mode of Open Source Code file is Open Source Code file part Compression.
In one embodiment, it when the group number of entry is no less than 2, is also realized when computer program is executed by processor Following steps:
According to file import information, the importing number of split source code file is counted;
It reads and imports the Open Source Code file that number is not less than 2;
Open Source Code file by the importing number read not less than 2 is stored in preset proprietary file catalogue;
Compression processing is carried out to proprietary file catalogue and corresponding Open Source Code file, generates compression Open Source Code file.
In one embodiment, it is also performed the steps of when computer program is executed by processor
It reads and imports Open Source Code file and exploitation code file that number is 1;
It is packaged to the Open Source Code file that number is 1, exploitation code file and compression Open Source Code file is imported Processing, code file needed for generating item code.
The above-mentioned storage medium for realizing code file generation method obtains item code by scan item code The file import information of carrying further determines that the Open Source Code file and self-developed exploitation code that can directly quote Open Source Code file is carried out compression processing by reading Open Source Code file, and using corresponding compress mode, finally by file According to the exploitation code file of reading and compressed Open Source Code file, code file needed for generating item code.The party Method generates code file by the way of being partially compressed, and split source code file carries out compression processing, reduces code file Size improves response speed when code uses, moreover, not carrying out compression processing to exploitation code file, can directly look into It sees corresponding exploitation code, is easy to implement debugging on line and is checked with problem.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided herein, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of code file generation method, which comprises
Scan item code obtains the file import information that the item code carries;
According to the file import information, the corresponding Open Source Code file of the item code and exploitation code file are searched;
The Open Source Code file is read, and compression processing is carried out to the Open Source Code file using corresponding compress mode, Generate compression Open Source Code file;
The exploitation code file is read, and according to the exploitation code file and the compression Open Source Code file, generates institute Code file needed for stating item code.
2. code file generation method according to claim 1, which is characterized in that the item code is applied to Node.js environment, the exploitation code file are .js file;It is described according to the file import information, search the project generation The corresponding Open Source Code file of code and exploitation code file, comprising:
When the file import information includes Open Framework or Open Source Code library name, the item code corresponding generation is determined Code file is Open Source Code file, and searches the Open Source Code file according to the Open Framework or Open Source Code library name;
When the file import information includes the store path title of .js file, the corresponding code of the item code is determined File is exploitation code file, and searches the exploitation code file according to the store path title.
3. code file generation method according to claim 2, which is characterized in that described to read the Open Source Code text Part, and compression processing is carried out to the Open Source Code file using corresponding compress mode, generate compression Open Source Code file, packet It includes:
According to the Open Framework or Open Source Code library name, Open Source Code file is read from NPM package manager;
The Open Source Code file of reading is stored in preset proprietary file catalogue;
The compress mode compressed or be partially compressed using full dose, by the proprietary file catalogue and corresponding Open Source Code file into Row compression processing generates compression Open Source Code file.
4. code file generation method according to claim 1, which is characterized in that described to read the exploitation code text Part, and according to the exploitation code file and the compression Open Source Code file, the text of code needed for generating the item code Part, comprising:
The exploitation code file is read, the exploitation code file is copied into preset internal file catalogue;
The internal file catalogue and the compression Open Source Code file are subjected to packing processing, generated needed for the item code Code file.
5. code file generation method according to claim 1, which is characterized in that the scan item code obtains institute After the file import information for stating item code carrying, further includes:
Sub-project quantity is determined according to the scanning result of item code;
When the sub-project quantity is one, determine that the compress mode of the Open Source Code file is Open Source Code file full dose Compression;
When the sub-project quantity is no less than 2, determine that the compress mode of the Open Source Code file is Open Source Code file It is partially compressed.
6. code file generation method according to claim 5, which is characterized in that when the sub-project quantity is no less than 2 It is described to read the Open Source Code file when a, and the Open Source Code file is compressed using corresponding compress mode Processing generates compression Open Source Code file, comprising:
According to the file import information, the importing number of the Open Source Code file is counted;
It reads and imports the Open Source Code file that number is not less than 2;
Open Source Code file by the importing number read not less than 2 is stored in preset proprietary file catalogue;
Compression processing is carried out to the proprietary file catalogue and corresponding Open Source Code file, generates compression Open Source Code file.
7. code file generation method according to claim 6, which is characterized in that described to read the exploitation code text Part, and according to the exploitation code file and the compression Open Source Code file, the text of code needed for generating the item code Part, comprising:
It reads and imports Open Source Code file and the exploitation code file that number is 1;
Open Source Code file, the exploitation code file and the compression Open Source Code file for being 1 by the importing number Packing processing is carried out, code file needed for generating the item code.
8. a kind of code compaction device, which is characterized in that described device includes:
Item code scan module is used for scan item code, obtains the file import information that the item code carries;
Code file acquisition module, for searching the corresponding Open Source Code of the item code according to the file import information File and exploitation code file;
Open Source Code compressing file module, for reading the Open Source Code file, and using corresponding compress mode to described Open Source Code file carries out compression processing, generates compression Open Source Code file;
Code file generation module, for reading the exploitation code file, and according to the exploitation code file and the pressure Contracting Open Source Code file, code file needed for generating the item code.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists In the step of processor realizes any one of claims 1 to 7 the method when executing the computer program.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of method described in any one of claims 1 to 7 is realized when being executed by processor.
CN201811082833.1A 2018-09-17 2018-09-17 Code file generation method, device, computer equipment and storage medium Pending CN109460229A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811082833.1A CN109460229A (en) 2018-09-17 2018-09-17 Code file generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811082833.1A CN109460229A (en) 2018-09-17 2018-09-17 Code file generation method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN109460229A true CN109460229A (en) 2019-03-12

Family

ID=65606707

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811082833.1A Pending CN109460229A (en) 2018-09-17 2018-09-17 Code file generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109460229A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110427212A (en) * 2019-07-11 2019-11-08 上海易点时空网络有限公司 Suitable for the code statistical method and device of git, storage medium
CN112416315A (en) * 2020-06-16 2021-02-26 上海哔哩哔哩科技有限公司 CSS code compression method, electronic device and storage medium
CN112732249A (en) * 2021-01-07 2021-04-30 北京字节跳动网络技术有限公司 Code processing method, device, system, equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110167173A1 (en) * 2010-01-05 2011-07-07 International Business Machines Corporation Optimal Compression Process Selection Methods
CN102903366A (en) * 2012-09-18 2013-01-30 重庆大学 Digital signal processor (DSP) optimization method based on G729 speech compression coding algorithm
CN103294953A (en) * 2012-12-27 2013-09-11 武汉安天信息技术有限责任公司 Detection method and system of mobile phone malicious code
CN104008148A (en) * 2014-05-19 2014-08-27 广州华多网络科技有限公司 Method and device for publishing webpage file
CN104991860A (en) * 2015-06-24 2015-10-21 深圳欧德蒙科技有限公司 WEB front-end automated development method and system
CN107704238A (en) * 2017-11-28 2018-02-16 广州市千钧网络科技有限公司 A kind of method and device packed to project

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110167173A1 (en) * 2010-01-05 2011-07-07 International Business Machines Corporation Optimal Compression Process Selection Methods
CN102903366A (en) * 2012-09-18 2013-01-30 重庆大学 Digital signal processor (DSP) optimization method based on G729 speech compression coding algorithm
CN103294953A (en) * 2012-12-27 2013-09-11 武汉安天信息技术有限责任公司 Detection method and system of mobile phone malicious code
CN104008148A (en) * 2014-05-19 2014-08-27 广州华多网络科技有限公司 Method and device for publishing webpage file
CN104991860A (en) * 2015-06-24 2015-10-21 深圳欧德蒙科技有限公司 WEB front-end automated development method and system
CN107704238A (en) * 2017-11-28 2018-02-16 广州市千钧网络科技有限公司 A kind of method and device packed to project

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ZHISHENG WANG ETC.: "An Efficient Hardware Architecture for Lossless Data Compression in Data Center", 2016 IEEE INTERNATIONAL WORKSHOP ON SIGNAL PROCESSING SYSTEMS (SIPS) *
冯菲菲 等: "基于Webpack及React技术的Scratch互动在线学习平台设计", 电脑知识与技术, vol. 14, no. 20 *
咸立文;姚幽然;赵扬;: "基于开源SDR的LTE系统对比研究与实现", 通信技术, no. 06 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110427212A (en) * 2019-07-11 2019-11-08 上海易点时空网络有限公司 Suitable for the code statistical method and device of git, storage medium
CN112416315A (en) * 2020-06-16 2021-02-26 上海哔哩哔哩科技有限公司 CSS code compression method, electronic device and storage medium
CN112732249A (en) * 2021-01-07 2021-04-30 北京字节跳动网络技术有限公司 Code processing method, device, system, equipment and medium

Similar Documents

Publication Publication Date Title
CN108874926A (en) Mass data inquiry method, device, computer equipment and storage medium
CN108377240A (en) Exceptional interface detection method, device, computer equipment and storage medium
CN109977389A (en) List input method, device, computer equipment and storage medium
CN108804548B (en) Test data query method, device, computer equipment and storage medium
CN109634654A (en) A kind of page packaging method, device, system, computer equipment and storage medium
CN109460229A (en) Code file generation method, device, computer equipment and storage medium
CN109446173A (en) Daily record data processing method, device, computer equipment and storage medium
US20090007081A1 (en) System and Method of Generating Applications for Mobile Devices
CN109144799A (en) Integrated testing method, apparatus, computer equipment and storage medium
CN110221967A (en) Test data building method, device, computer equipment and storage medium
CN111813629A (en) Method, device and equipment for generating monitoring data of Web page
CN114372006A (en) Method and system for automatically generating test case, computer equipment and storage medium
CN109033316A (en) Data processing method, device, system, equipment and storage medium
CN109783457A (en) CGI interface managerial method, device, computer equipment and storage medium
CN109992506A (en) Scheduling tests method, apparatus, computer equipment and storage medium
CN109325058A (en) Regular batch comparison method, device, computer equipment and storage medium
CN110119490A (en) Web browser method, device, computer equipment and storage medium
CN109359176A (en) Data extraction method, device, computer equipment and storage medium
CN116911588A (en) Business process execution method, device, equipment and storage medium
CN109918114A (en) Comment information acquisition methods, device, computer equipment and the storage medium of code
CN113485919B (en) Test method, test device, and computer-readable storage medium
CN109857662A (en) Case data processing method, device, computer equipment and storage medium
CN112433778B (en) Mobile device page display method and device, electronic device and storage medium
CN114443447A (en) Webpage operation playback method and device, computer equipment and medium
CN109492144B (en) Association relation analysis method, device and storage medium for software system

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