Front-end program development method and related hardware
By packaging the front-end program building tools and dependencies into binary files, the second development end is compiled and packaged in the container, which solves the problem of confidentiality of front-end program dependencies in cross-team development, realizes the development and compilation of front-end engineering code, and ensures security of dependencies.
Patent Information
- Application Number
- CN202410939026.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-29
AI Technical Summary
In the cross-team development process of computer front-end programs, there is a lack of effective solutions on how to keep the front-end program dependencies confidential while allowing other development teams to smoothly proceed with subsequent code development.
By packaging the front-end program building tools and dependencies into binary files and providing them to the second development end, the second development end compiles and packages them in the container to generate the final front-end program file, ensuring that others except the first developer cannot Obtain the source code of dependencies by decompiling.
It realizes the development and compilation of front-end engineering code based on dependencies without obtaining the source code of front-end program dependencies, effectively keeping the front-end program dependencies confidential and ensuring its business secrets and information security.
Smart Images

Figure CN118860409A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of front-end program development, and in particular to a front-end program development method and related hardware. Background Art
[0002] At present, the need for cross-team development has emerged in computer program development projects. A computer program that is finally launched may involve the collaborative development of multiple development teams / developers, and different development teams / developers are responsible for developing different parts of the computer program. In this process, for some reasons, the source code of a specific part of the computer program may need to be prevented from being directly obtained by the development team / developer responsible for other parts, such as the source code of a specific part is a trade secret of the corresponding development team / developer, or the source code of a specific part is related to information security, etc.
[0003] For example, for a computer front-end program, if the code such as the dependencies of the front-end program is source code that needs to be kept confidential, there is currently no good solution on how to keep this part of the source code confidential while allowing other development teams to smoothly develop subsequent codes. Summary of the invention
[0004] The embodiment of the present invention provides a front-end program development method and related hardware to solve the problem that during the cross-team development of a computer front-end program, while the source code of the dependencies including the front-end program needs to be kept confidential, other development teams / authors corresponding to other parts except the dependencies of the front-end program can smoothly develop subsequent codes.
[0005] In a first aspect, an embodiment of the present invention provides a front-end program development method, which is applied to a first development end and includes:
[0006] Obtain a target image configuration file, and build a target image according to the target image configuration file; the target image includes a front-end program construction tool, target acquisition path information, and front-end program dependencies; the target acquisition path is a preset file path outside the target container corresponding to the target image;
[0007] Packaging the target image into a target binary file;
[0008] The target binary file is provided to the second development end; so that the second development end loads the target binary file to obtain a target container, obtains the code engineering file corresponding to the front-end program from the target acquisition path through the target container, and copies it to the target container, and compiles and packages the front-end program dependencies and the code engineering file in the target container through the front-end program construction tool to obtain a target front-end program file.
[0009] Further optionally, providing the target binary file to the second development end includes:
[0010] Encrypting the target binary file into a target encrypted file, and determining a decryption key corresponding to the target encrypted file;
[0011] The target encrypted file and the decryption key are provided to the second development terminal.
[0012] In a second aspect, an embodiment of the present invention provides a front-end program development method, which is applied to a second development end and includes:
[0013] Obtain a target binary file provided by the first development end; the target binary file is a package file of the target image;
[0014] The target binary file is loaded to generate a target container corresponding to the target image; the target container includes a front-end program construction tool, target acquisition path information and front-end program dependencies; the target acquisition path is a preset file path outside the target container;
[0015] Acquire the code engineering file corresponding to the front-end program from the target acquisition path, and copy it to the target container;
[0016] The front-end program dependencies and the code engineering files in the target container are compiled and packaged by the front-end program building tool to obtain a target front-end program file.
[0017] Further optionally, obtaining the target binary file provided by the first development end includes:
[0018] Obtaining a target encrypted file provided by the first development end and a decryption key corresponding to the target encrypted file;
[0019] The target encrypted file is decrypted using the decryption key to obtain the target binary file.
[0020] Further optionally, compiling and packaging the front-end program dependencies and the code engineering files in the target container by the front-end program building tool to obtain a target front-end program file includes:
[0021] By means of the front-end program building tool, a packaging configuration file is called to determine an input directory of the code engineering file and an output directory of the target front-end program file, and a project configuration file is called to determine dependency configuration information of the code engineering file;
[0022] The code engineering file is obtained according to the input directory, and the front-end program dependencies and the code engineering file in the target container are compiled and packaged based on the dependency configuration information to obtain the target front-end program file and output it in the structure of the output directory.
[0023] Further optionally, the front-end program building tool includes Webpack, the packaging configuration file includes webpack.config.js, and the project configuration file includes package.json;
[0024] The front-end program building tool is used to compile and package the front-end program dependencies and the code engineering files in the target container to obtain a target front-end program file, including:
[0025] Parse webpack.config.js through webpack, and initialize the compiler according to the webpack.config.js; wherein, obtain the input directory of the code engineering file and the output directory of the target front-end program file from webpack.config.js;
[0026] Register the target compilation plug-in to the compiler by calling the apply method of the target compilation plug-in;
[0027] When the enhanced-resolve hook event is triggered by the target compilation plug-in listener, the node command line configured in package.json is executed to obtain the code engineering file from the input directory, and the front-end program dependencies and the code engineering file are compiled and packaged to obtain the target front-end program file and output it in the structure of the output directory; wherein the node command line configured in the package.json indicates the dependency configuration information.
[0028] In a third aspect, an embodiment of the present invention provides a development end, including:
[0029] An image building module, used to obtain a target image configuration file, and build a target image according to the target image configuration file; the target image includes a front-end program building tool, target acquisition path information and front-end program dependencies; the target acquisition path is a preset file path outside the target container corresponding to the target image;
[0030] An image binary file generation module, used for packaging the target image into a target binary file;
[0031] The image providing module is used to provide the target binary file to the second development end; so that the second development end loads the target binary file to obtain the target container, obtains the code engineering file corresponding to the front-end program from the target acquisition path through the target container, and copies it to the target container, and compiles and packages the front-end program dependencies and the code engineering file in the target container through the front-end program building tool to obtain the target front-end program file.
[0032] In a fourth aspect, an embodiment of the present invention provides a development end, including:
[0033] An image acquisition module is used to acquire a target binary file provided by the first development end; the target binary file is a package file of the target image;
[0034] A container loading module, used to load the target binary file to generate a target container corresponding to the target image; the target container includes a front-end program construction tool, target acquisition path information and front-end program dependencies; the target acquisition path is a preset file path outside the target container;
[0035] A project file extraction module, used to obtain the code project file corresponding to the front-end program from the target acquisition path, and copy it to the target container;
[0036] A compiling module is used to compile and package the front-end program dependencies and the code engineering files in the target container through the front-end program building tool to obtain a target front-end program file.
[0037] In a fifth aspect, an embodiment of the present invention provides an electronic device, comprising: a processor and a memory for storing instructions executable by the processor;
[0038] The processor is configured to execute the instructions to implement the front-end program development method applied to the first development end or the second development end.
[0039] In a sixth aspect, an embodiment of the present invention provides a front-end program development system, comprising a first development end for implementing the front-end program development method described in the first aspect and a second development end for implementing the front-end program development method described in the second aspect.
[0040] In the seventh aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program code. When the computer program code runs on a computer, the computer implements the front-end program development method applied to the first development end or the second development end.
[0041] In an eighth aspect, an embodiment of the present invention provides a computer program product, which includes: a computer program code, when the computer program code runs on a computer, enables the computer to implement the front-end program development method applied to the first development end or the second development end.
[0042] The beneficial effects of the present invention are as follows:
[0043] The front-end program development method and related hardware provided by the embodiment of the present invention use container technology to package the front-end program construction tool and the front-end program dependencies into an image in the form of a binary file by the first development end, and then the first development end provides the image in the form of a binary file to the second development end, and the second development end obtains a container containing the front-end program construction tool and the front-end program dependencies by loading the image in the form of a binary file, and compiles and packages the front-end program dependencies and code engineering files in the container to obtain the final front-end program file, so that the second development end can perform subsequent front-end engineering code development based on the front-end program dependencies and compile to obtain the final front-end program file without obtaining the source code of the front-end program dependencies. It is difficult for other people (including the second developer) except the first developer to obtain the source code of the front-end program dependencies whose code working principle can be understood by people by decompiling the binary file, which effectively realizes the confidentiality of the front-end program dependencies. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is the corresponding relationship diagram for the development process of front-end program engineering;
[0045] Figure 2 A schematic diagram showing the relationship between some data of the front-end program engineering in an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of a flow chart of a front-end program development method applied to a first development terminal provided by an embodiment of the present invention;
[0047] Figure 4 A schematic diagram of the structure of a front-end program development system is provided for an embodiment of the present invention;
[0048] Figure 5 A schematic diagram of a flow chart of a front-end program development method applied to a second development terminal provided by an embodiment of the present invention;
[0049] Figure 6 A partial flow chart of a front-end program development method applied to a first development terminal provided by an embodiment of the present invention;
[0050] Figure 7 One of the partial flow diagrams of the front-end program development method applied to the second development end provided by the embodiment of the present invention;
[0051] Figure 8 A second partial flow chart of a front-end program development method applied to a second development terminal provided by an embodiment of the present invention;
[0052] Fig. 9 A schematic diagram of the structure of a first development terminal provided by an embodiment of the present invention;
[0053] Fig.10 A schematic diagram of the structure of a second development terminal provided by an embodiment of the present invention;
[0054] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, the present invention will be further described below with reference to the accompanying drawings and examples. However, the exemplary embodiments can be implemented in various forms and should not be understood as being limited to the embodiments described herein; on the contrary, these embodiments are provided to make the present invention more comprehensive and complete, and to fully convey the concepts of the exemplary embodiments to those skilled in the art. The same figure marks in the figures represent the same or similar structures, and thus their repeated descriptions will be omitted. The words expressing position and direction described in the present invention are all explained using the accompanying drawings as examples, but changes can be made as needed, and the changes made are all included in the scope of protection of the present invention. The drawings of the present invention are only used to illustrate the relative position relationship and do not represent the true proportions.
[0056] It should be noted that specific details are described in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in a variety of other ways different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. The subsequent description of the specification is a preferred embodiment of the present application, but the description is for the purpose of illustrating the general principles of the present application and is not intended to limit the scope of the present application. The scope of protection of the present application shall be determined by the definition of the attached claims.
[0057] The following is a detailed description of the front-end program development method and related hardware provided by the embodiment of the present invention in conjunction with the accompanying drawings.
[0058] The front-end program development method provided in the embodiment of the present invention is applied to the cross-team front-end program development scenario. Figure 1As shown, the front-end program project can be divided into at least two parts, wherein the front-end program dependencies (including but not limited to dependency libraries, business logic module files, operating environment files, front-end program framework files, etc.) that are biased towards the bottom layer in the front-end program project are developed by a bottom-layer development team / developer, and the upper-layer codes other than the dependencies in the front-end program project are developed by other development teams / developers. In this process, the source code of the bottom-layer front-end program dependencies may be kept confidential due to the commercial secrets of the corresponding development team / developer, or the source code of the front-end program dependencies is related to information security, so other development teams should not obtain the source code of the front-end program dependencies when developing other parts of the front-end program. Based on this purpose, an embodiment of the present invention provides a front-end program development method to enable other development teams / developers to develop front-end programs without obtaining the front-end program dependencies.
[0059] For the development team / developer corresponding to the front-end program dependencies (hereinafter referred to as the first developer), if Figure 2 and Figure 3 As shown, the first development terminal used by the first developer specifically performs the following steps:
[0060] S110, obtaining a target image configuration file, and constructing a target image according to the target image configuration file. The target image includes a front-end program construction tool, target acquisition path information, and front-end program dependencies. The target acquisition path is a preset file path outside the target container corresponding to the target image.
[0061] In the specific implementation process, the target image configuration file is written and configured by the first developer. The target image configuration file can be a Dockerfile file written by the first developer through the application container engine Docker. The first developer defines basic image information, front-end program construction tools, front-end program dependencies (including but not limited to dependent library files, common module files, operating environment files, index files, front-end program framework files), code files of common services, and target acquisition path information in the Dockerfile file. Afterwards, the first developer triggers the instruction to build the target image, and the first development end executes the instruction in the project directory to build the target Docker image.
[0062] In a specific implementation process, the front-end program building tool may include Webpack.
[0063] S120: Pack the target image into a target binary file.
[0064] In a specific implementation process, the first developer can trigger the image packaging instruction docker save after successfully building the target Docker image, and the first development end executes the docker save instruction to package the target Docker image into a target binary format file.
[0065] S130: Provide the target binary file to the second development end.
[0066] In a specific implementation process, the first development end can provide the target binary file to the second development end (such as Figure 4 As shown), the target binary file may also be provided to the second development end by transferring through a mobile storage medium (such as a mobile hard disk), and the embodiment of the present invention does not impose too many restrictions on this.
[0067] Correspondingly, for the development team / developer corresponding to the front-end program project other than the front-end program dependencies (hereinafter referred to as the second developer), Figure 2 and Figure 5 As shown, the second development terminal used by the second developer specifically performs the following steps:
[0068] S210: Obtain a target binary file provided by the first development end, wherein the target binary file is a package file of a target image.
[0069] S220, loading the target binary file to generate a target container corresponding to the target image, wherein the target container includes a front-end program construction tool, target acquisition path information, and front-end program dependencies.
[0070] In the specific implementation process, the second developer can trigger the loading instruction after obtaining the target binary file, and the second development end executes the loading instruction to load the target binary file through Docker to start the target container, so that the target container can run in the sandbox environment. The target container has the functions of permission control, resource control and resource isolation, which can make the files provided by the second developer (including the upper-level business logic code of the front-end program developed by the second developer based on the front-end dependencies) only stored in a specific path in the container sandbox environment, and perform permission control on file access in the container sandbox environment, as well as control the hardware resources called by the container sandbox environment (including central processing unit (CPU) computing resources, memory resources, network communication resources), and ensure that the inside of the container sandbox environment will not affect the outside of the container sandbox.
[0071] S230: Acquire the code engineering file corresponding to the front-end program from the target acquisition path, and copy it to the target container.
[0072] In the specific implementation process, the code engineering file is a code engineering file with business logic written by the second developer according to the business requirements to be implemented by the front-end program, which may specifically include Hypertext Markup Language (HTML) format files, Cascading Style Sheets (CSS) format files, Java Script (JS) format files, etc. After the second developer prepares the code engineering file, a copy instruction can be triggered, and the second development end executes the copy instruction to obtain the corresponding code engineering file from the target acquisition path (e.g., . / external_files / app / external_files) configured by the first developer and copy it to the target container. For example, after the second developer prepares the code engineering file, a copy instruction COPY. / external_files / app / external_files can be triggered, and the second development end executes the copy instruction to obtain the corresponding code engineering file from the target acquisition path . / external_files / app / external_files and copy it to the target container.
[0073] S240. Compile and package the front-end program dependencies and the code engineering files in the target container using the front-end program building tool to obtain a target front-end program file.
[0074] In this way, the embodiment of the present invention uses container technology to package the front-end program construction tool and the front-end program dependencies into an image in the form of a binary file by the first development end, and then the first development end provides the image in the form of a binary file to the second development end. The second development end obtains a container containing the front-end program construction tool and the front-end program dependencies by loading the image in the form of a binary file, and compiles and packages the front-end program dependencies and code engineering files in the container to obtain the final front-end program file, thereby enabling the second development end to perform subsequent front-end engineering code development based on the front-end program dependencies and compile to obtain the final front-end program file without obtaining the source code of the front-end program dependencies. It is difficult for other people (including the second developer) except the first developer to obtain the source code of the front-end program dependencies whose code working principle can be understood by people by decompiling the binary file, which effectively realizes the confidentiality of the front-end program dependencies.
[0075] Furthermore, in the process of the first development end providing the target binary file to the second development end, the target binary file can be further encrypted, so that other people except the first developer and the second developer cannot obtain the target image in the form of a valid binary file, and thus cannot decompile the binary file, further ensuring the confidentiality of the source code of the front-end program dependencies.
[0076] Alternatively, if Figure 6 As shown, the step S130, providing the target binary file to the second development end, specifically includes:
[0077] S131. Encrypt the target binary file into a target encrypted file, and determine a decryption key corresponding to the target encrypted file.
[0078] In a specific implementation process, the target binary file may be encrypted into a target encrypted file with a preset file name and a preset format, for example, the target encrypted file is my_frontend_app_encrypted.tar.enc.
[0079] S132: Provide the target encrypted file and the decryption key to the second development end.
[0080] Correspondingly, if Figure 7 As shown, the step S210, obtaining the target binary file provided by the first development end, specifically includes:
[0081] S211. Obtain a target encrypted file provided by the first development end and a decryption key corresponding to the target encrypted file.
[0082] S212: Decrypt the target encrypted file using the decryption key to obtain the target binary file.
[0083] In the specific implementation process, the first development end can use symmetric encryption or asymmetric encryption to encrypt the target binary file into a target encrypted file. The first development end should provide the target encrypted file and the corresponding decryption key to the second development end at different times and / or different transmission methods. If a symmetric encryption method is used, the decryption key corresponding to the target encrypted file is the same as the encryption key. The first development end can provide the decryption key to the second development end in advance, and provide the target encrypted file to the second development end at a later time; and / or, the first development end can provide the decryption key and the target encrypted file to the second development end in different transmission methods (for example, the first development end provides the decryption key to the second development end through a mobile storage medium transfer method, and provides the target encrypted file to the second development end through network transmission; for example, the first development end transmits the target encrypted file and the decryption key to the second development end through different physical channels / logical channels). If an asymmetric encryption method is used, the decryption key corresponding to the target encrypted file is a private key of the asymmetric encryption method, which is different from the encryption key (public key) used when encrypting the target binary file. The first development end can provide the decryption key to the second development end in advance, and provide the target encrypted file to the second development end at a later time; and further, the first development end can provide the decryption key and the target encrypted file to the second development end in different transmission methods (for example, the first development end provides the decryption key to the second development end through a mobile storage medium transfer method, and provides the target encrypted file to the second development end through network transmission; for another example, the first development end transmits the target encrypted file and the decryption key to the second development end through different physical channels / logical channels). The process of the first development end encrypting the target binary file and transmitting the encrypted target encrypted file to the second development end through the network, and the second development end decrypting the target slower file to obtain the target binary file can be implemented using the Open Secure Sockets Layer (OpenSSL) protocol.
[0084] Furthermore, in the above-mentioned front-end program development method, the front-end program dependencies are decoupled from the business logic code of the upper layer of the front-end program. Therefore, in order to enable the final front-end program file to implement the corresponding business functions according to the business logic designed by the second developer, it is necessary to compile based on the custom design of the second developer when compiling and packaging the code engineering file. Then, the step S240, through the front-end program construction tool, compiles and packages the front-end program dependencies and the code engineering file in the target container to obtain the target front-end program file, specifically includes:
[0085] By means of the front-end program building tool, a packaging configuration file is called to determine an input directory of the code engineering file and an output directory of the target front-end program file, and a project configuration file is called to determine dependency configuration information of the code engineering file;
[0086] The code engineering file is obtained according to the input directory, and the front-end program dependencies and the code engineering file in the target container are compiled and packaged based on the dependency configuration information to obtain the target front-end program file and output it in the structure of the output directory.
[0087] In the specific implementation process, the packaging configuration file and the project configuration file are configuration information files configured by the second developer based on the program code written in the code engineering file, and are used to control the front-end program building tool in the target container to compile and package the front-end program dependencies and code engineering files according to the needs of the second developer.
[0088] In the specific implementation process, if the front-end program building tool includes Webpack, then the packaging configuration file includes webpack.config.js, and the project configuration file includes package.json. Then, if Figure 8 As shown, the step S240, using the front-end program building tool, compiles and packages the front-end program dependencies and the code engineering files in the target container to obtain the target front-end program files, specifically including:
[0089] S241, parsing webpack.config.js through Webpack, and initializing the compiler according to the webpack.config.js, wherein the input directory of the code engineering file and the output directory of the target front-end program file are obtained from webpack.config.js.
[0090] Specifically, the input directory of the target front-end program file can be obtained through the request path configured in webpack.config.js.
[0091] S242: Register the target compilation plug-in to the compiler by calling the apply method of the target compilation plug-in.
[0092] S243, monitoring hook events through the target compilation plug-in.
[0093] In the specific implementation process, Fig. 9 As shown, Webpack provides a variety of hooks to customize the hook events of compilation plug-ins.
[0094] S244. When the enhanced-resolve hook event is triggered through the target compilation plug-in, package.json is called.
[0095] S245, executing the node command line configured in package.json to obtain the code engineering file from the input directory, compile and package the front-end program dependencies and the code engineering file to obtain the target front-end program file and output it in the structure of the output directory. The node command line configured in package.json indicates the dependency configuration information.
[0096] In this way, through the above steps, the upper-level business logic code developed based on different business needs in the front-end program engineering can be decoupled from the bottom-level front-end program dependencies (including some common basic business logic codes). Thus, the second development end can better realize the subsequent front-end engineering code development based on the front-end program dependencies without obtaining the source code of the front-end program dependencies and compile to obtain the final front-end program file, and different upper-level business logic codes (such as different homepages, different display interfaces) can be compiled and packaged after the second developer completes the development of the corresponding code engineering file by modifying the corresponding configuration file (for example, the second developer modifies the node command line configured in the webpack.config.js file and the package.json file, that is, the execution directory of the node program, and then the modified input and output directory structure will be automatically identified according to the configuration) to obtain the target front-end program files with different business functions, which can conveniently and simply realize the private delivery of the front-end program, and the scalability of the front-end program business functions is strong.
[0097] Based on the same inventive concept, the embodiment of the present invention also provides two different development terminals.
[0098] like Fig. 9 As shown, the first development end includes:
[0099] The image building module M110 is used to obtain a target image configuration file and build a target image according to the target image configuration file; the target image includes a front-end program building tool, target acquisition path information and front-end program dependencies; the target acquisition path is a preset file path outside the target container corresponding to the target image;
[0100] An image binary file generating module M120 is used to package the target image into a target binary file;
[0101] The image providing module M130 is used to provide the target binary file to the second development end; so that the second development end loads the target binary file to obtain the target container, obtains the code engineering file corresponding to the front-end program from the target acquisition path through the target container, and copies it to the target container, and compiles and packages the front-end program dependencies and the code engineering file in the target container through the front-end program building tool to obtain the target front-end program file.
[0102] Further optionally, the image providing module M130 is specifically used for:
[0103] The target binary file is encrypted into a target encrypted file, and a decryption key corresponding to the target encrypted file is determined; and the target encrypted file and the decryption key are provided to the second development end.
[0104] like Fig.10 As shown, another second development end includes:
[0105] The image acquisition module M210 acquires a target binary file provided by the first development end; the target binary file is a package file of the target image;
[0106] The container loading module M220 is used to load the target binary file to generate a target container corresponding to the target image; the target container includes a front-end program construction tool, target acquisition path information and front-end program dependencies;
[0107] The engineering file extraction module M230 is used to obtain the code engineering file corresponding to the front-end program from the target acquisition path and copy it to the target container;
[0108] The compiling module M240 is used to compile and package the front-end program dependencies and the code engineering files in the target container through the front-end program building tool to obtain a target front-end program file.
[0109] Further optionally, the image acquisition module M210 is specifically used for:
[0110] Obtaining a target encrypted file provided by the first development end and a decryption key corresponding to the target encrypted file;
[0111] The target encrypted file is decrypted using the decryption key to obtain the target binary file.
[0112] Further optionally, the compiling module M240 is specifically used for:
[0113] By means of the front-end program building tool, a packaging configuration file is called to determine an input directory of the code engineering file and an output directory of the target front-end program file, and a project configuration file is called to determine dependency configuration information of the code engineering file;
[0114] The code engineering file is obtained according to the input directory, and the front-end program dependencies and the code engineering file in the target container are compiled and packaged based on the dependency configuration information to obtain the target front-end program file and output it in the structure of the output directory.
[0115] Further optionally, the front-end program building tool includes Webpack, the packaging configuration file includes webpack.config.js, and the project configuration file includes package.json;
[0116] The compiling module M240 is specifically used for:
[0117] Parse webpack.config.js through webpack, and initialize the compiler according to the webpack.config.js; wherein, obtain the input directory of the code engineering file and the output directory of the target front-end program file from webpack.config.js;
[0118] Register the target compilation plug-in to the compiler by calling the apply method of the target compilation plug-in;
[0119] When the enhanced-resolve hook event is triggered by the target compilation plug-in listener, the node command line configured in package.json is executed to obtain the code engineering file from the input directory, and the front-end program dependencies and the code engineering file are compiled and packaged to obtain the target front-end program file and output it in the structure of the output directory; wherein the node command line configured in the package.json indicates the dependency configuration information.
[0120] It should be understood that the development end provided in the embodiment of the present invention can be implemented in other ways. For example, the development end embodiment described above is only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the coupling or direct coupling or communication connection between each other shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms. The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, each functional module in the embodiment of the present application can be integrated in a processing module, or each module can exist physically separately, or two or more modules can be integrated in one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0121] Since the specific working principles of the first development end and the second development end are consistent with the front-end program development method described above, the specific implementation methods of the first development end and the second development end can refer to the corresponding content of the front-end program development method described above, and will not be repeated here.
[0122] Based on the same inventive concept, Fig.11 As shown, an embodiment of the present invention further provides an electronic device, comprising: a processor 110 and a memory 120 for storing executable instructions of the processor 110; wherein the processor 110 is configured to execute the instructions to implement the front-end program development method applied to the first development end or the second development end as described above.
[0123] In the specific implementation process, the device may have relatively large differences due to different configurations or performances, and may include one or more processors 110, memory 120, and computer-readable storage medium 130. The memory 120 and / or computer-readable storage medium 130 include one or more applications 131 or data 132. The memory 120 and / or computer-readable storage medium 130 may also include one or more operating systems 133, such as Windows, Mac OS, Linux, IOS, Android, Unix, FreeBSD, etc. Among them, the memory 120 and the computer-readable storage medium 130 may be short-term storage or persistent storage. The application 131 may include one or more modules ( Fig.11 ), each module may include a series of instruction operations. Further, the processor 110 may be configured to communicate with the computer-readable storage medium 130, and execute a series of instruction operations in the computer-readable storage medium 130 on the device. The device may also include one or more power supplies ( Fig.11 one or more network interfaces 140, wherein the network interface 140 includes a wired network interface 141 and / or a wireless network interface 142; and one or more input / output interfaces 143.
[0124] Based on the same inventive concept, the embodiment of the present invention also provides a front-end program development system, such as Figure 1 As shown, it includes a first development terminal and a second development terminal. The first development terminal and the second development terminal are respectively used to implement the corresponding steps involved in the front-end program development method described above. The corresponding content can be found in the above text and will not be repeated here.
[0125] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program code. When the computer program code runs on a computer, the computer implements the front-end program development method applied to the first development end or the second development end.
[0126] The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a high-density digital video disc (DVD), a video compact disc (VCD)), or a semiconductor medium (such as a solid-state disk (SSD)).
[0127] Since the principle of solving the problem by the above-mentioned computer-readable storage medium is consistent with the front-end program development method applied to the first development end and the front-end program development method applied to the second development end described above, the implementation of the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0128] Based on the same inventive concept, an embodiment of the present application also provides a computer program product, which includes: a computer program code, when the computer program code runs on a computer, enables the computer to implement the front-end program development method applied to the first development end or the second development end.
[0129] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center.
[0130] Since the principle of solving the problem by the above-mentioned computer program product is consistent with the front-end program development method applied to the first development end and the front-end program development method applied to the second development end described above, the implementation of the above-mentioned computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.
[0131] The front-end program development method and related hardware provided by the embodiment of the present invention use container technology to package the front-end program construction tool and the front-end program dependencies into an image in the form of a binary file by the first development end, and then the first development end provides the image in the form of a binary file to the second development end, and the second development end obtains a container containing the front-end program construction tool and the front-end program dependencies by loading the image in the form of a binary file, and compiles and packages the front-end program dependencies and code engineering files in the container to obtain the final front-end program file, so that the second development end performs subsequent front-end engineering code development based on the front-end program dependencies and compiles to obtain the final front-end program file without obtaining the source code of the front-end program dependencies. It is difficult for other people (including the second developer) except the first developer to obtain the source code of the front-end program dependencies whose code working principle can be understood by people by decompiling the binary file, which effectively realizes the confidentiality of the front-end program dependencies.
[0132] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0133] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0134] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0135] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0136] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A front-end program development method, characterized in that: Applied to the second development end, including: Obtain a target binary file provided by the first development end; the target binary file is a package file of the target image; The target binary file is loaded to generate a target container corresponding to the target image; the target container includes a front-end program construction tool, target acquisition path information and front-end program dependencies; the target acquisition path is a preset file path outside the target container; Acquire the code engineering file corresponding to the front-end program from the target acquisition path, and copy it to the target container; The front-end program dependencies and the code engineering files in the target container are compiled and packaged by the front-end program building tool to obtain a target front-end program file.
2. The method according to claim 1, characterized in that The step of obtaining the target binary file provided by the first development end includes: Obtaining a target encrypted file provided by the first development end and a decryption key corresponding to the target encrypted file; The target encrypted file is decrypted using the decryption key to obtain the target binary file.
3. The method according to claim 1, characterized in that The front-end program building tool is used to compile and package the front-end program dependencies and the code engineering files in the target container to obtain a target front-end program file, including: By means of the front-end program building tool, a packaging configuration file is called to determine an input directory of the code engineering file and an output directory of the target front-end program file, and a project configuration file is called to determine dependency configuration information of the code engineering file; The code engineering file is obtained according to the input directory, and the front-end program dependencies and the code engineering file in the target container are compiled and packaged based on the dependency configuration information to obtain the target front-end program file and output it in the structure of the output directory.
4. The method according to claim 3, characterized in that The front-end program building tool includes Webpack, the packaging configuration file includes webpack.config.js, and the project configuration file includes package.json; The front-end program building tool is used to compile and package the front-end program dependencies and the code engineering files in the target container to obtain a target front-end program file, including: Parse webpack.config.js through webpack, and initialize the compiler according to the webpack.config.js; wherein, obtain the input directory of the code engineering file and the output directory of the target front-end program file from webpack.config.js; Register the target compilation plug-in to the compiler by calling the apply method of the target compilation plug-in; When the enhanced-resolve hook event is triggered by the target compilation plug-in listener, the node command line configured in package.json is executed to obtain the code engineering file from the input directory, and the front-end program dependencies and the code engineering file are compiled and packaged to obtain the target front-end program file and output it in the structure of the output directory; wherein the node command line configured in the package.json indicates the dependency configuration information.
5. A front-end program development method, characterized in that: Applied to the first development end, including: Obtain a target image configuration file, and build a target image according to the target image configuration file; the target image includes a front-end program construction tool, target acquisition path information, and front-end program dependencies; the target acquisition path is a preset file path outside the target container corresponding to the target image; Packaging the target image into a target binary file; The target binary file is provided to the second development end; so that the second development end loads the target binary file to obtain the target container, obtains the code engineering file corresponding to the front-end program from the target acquisition path through the target container, and copies it to the target container, and compiles and packages the front-end program dependencies and the code engineering file in the target container through the front-end program building tool to obtain the target front-end program file.
6. The method according to claim 5, characterized in that Providing the target binary file to the second development end includes: Encrypting the target binary file into a target encrypted file, and determining a decryption key corresponding to the target encrypted file; The target encrypted file and the decryption key are provided to the second development terminal.
7. A development terminal, characterized in that: include: An image building module is used to obtain a target image configuration file and build a target image according to the target image configuration file; The target image includes a front-end program building tool, target acquisition path information and front-end program dependencies; The target acquisition path is a preset file path outside the target container corresponding to the target image; An image binary file generation module, used for packaging the target image into a target binary file; The image providing module is used to provide the target binary file to the second development end; so that the second development end loads the target binary file to obtain the target container, obtains the code engineering file corresponding to the front-end program from the target acquisition path through the target container, and copies it to the target container, and compiles and packages the front-end program dependencies and the code engineering file in the target container through the front-end program building tool to obtain the target front-end program file.
8. A development terminal, characterized in that: include: An image acquisition module is used to acquire a target binary file provided by the first development end; The target binary file is a package file of the target image; A container loading module, used to load the target binary file to generate a target container corresponding to the target image; the target container includes a front-end program construction tool, target acquisition path information and front-end program dependencies; The target acquisition path is a preset file path outside the target container; A project file extraction module, used to obtain the code project file corresponding to the front-end program from the target acquisition path, and copy it to the target container; A compiling module is used to compile and package the front-end program dependencies and the code engineering files in the target container through the front-end program building tool to obtain a target front-end program file.
9. An electronic device, characterized in that: include: a processor and a memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the instructions to implement the front-end program development method as described in any one of claims 1-4, or to implement the front-end program development method as described in any one of claims 5-6.
10. A front-end program development system, characterized in that: It includes a first development end and a second development end; The first development end is used to implement the front-end program development method according to any one of claims 5-6; The second development end is used to implement the front-end program development method as described in any one of claims 1-4.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program code, and when the computer program code runs on a computer, the computer implements the front-end program development method as described in any one of claims 1 to 4, or implements the front-end program development method as described in any one of claims 5 to 6.
12. A computer program product, characterized in that The computer program product includes: a computer program code, which, when executed on a computer, enables the computer to implement the front-end program development method as described in any one of claims 1 to 4, or to implement the front-end program development method as described in any one of claims 5 to 6.
