Intelligent station building method and system based on Git
Through the intelligent website building method based on Git, website building scripts are automatically generated, which solves the problem of high technical threshold for existing website building, reduces the website building and technical costs of users, and simplifies the operation process.
Patent Information
- Application Number
- CN202510132104.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-06
- Publication Date
- 2025-05-06
AI Technical Summary
The existing website building technology has a high threshold, and users need to master many professional knowledge, and the various website building technology stacks and languages are not unified, which increases the difficulty of learning and cost of website building for users.
Provides an intelligent website building method based on Git, which simplifies the user's operation process by obtaining user's code files, building code feature structure diagrams, and automatically generating environment installation scripts and website deployment scripts.
It reduces the website construction costs and technical costs of users, simplifies the operation process, and allows users to build a website without mastering complex professional knowledge.
Smart Images

Figure CN119939069A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of website construction, and in particular to a Git-based intelligent website construction method and system. Background Art
[0002] Building a website is a highly professional operation, which involves a wide range of knowledge, high professional requirements, and complex technology. Developers need to understand all aspects of knowledge. Existing website building technologies are relatively scattered, and developers need to develop and use them by themselves. They involve domain name resolution, page coding, server environment construction, server environment construction, code deployment, server security and other technical knowledge. The threshold is high and the learning curve is steep. At the same time, there are too many technical solutions for various types of website building technology stacks, and the language used by each type of solution is not unified, which brings a higher learning threshold for users. Summary of the invention
[0003] In order to solve the above problems in the prior art, the present invention provides a Git-based intelligent website building method and system to reduce the website building cost of users and simplify the user's operation process.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is:
[0005] In a first aspect, the present invention provides a Git-based intelligent website building method, comprising the steps of:
[0006] S1. Obtain the code files stored by the user in the Git repository;
[0007] S2. construct a code feature structure diagram according to the code file, and automatically generate an environment installation script and a website deployment script based on the code feature structure diagram;
[0008] S3, generating a website installation environment according to the environment installation script;
[0009] S4. Execute the website deployment script in the website installation environment to generate a website corresponding to the code file.
[0010] The beneficial effect of the present invention is that by analyzing the user's code files, and then obtaining the user's website building technology and architecture through the code feature structure diagram, a set of website building scripts is automatically generated, which solves the threshold that users need to master a lot of professional knowledge to build a website, thus reducing the user's usage cost and technical cost, thereby greatly reducing the user's website building cost and simplifying the user's operation process.
[0011] Optionally, constructing a code feature structure diagram according to the code file in step S2 includes the following steps:
[0012] Traversing all files in the code file to obtain file types contained in the code file;
[0013] Count the number of files of each file type;
[0014] Counting the file proportion of each file type according to the number of files;
[0015] A code feature structure diagram is constructed according to the file type, the number of files and the file proportion.
[0016] Optionally, the step S2 is:
[0017] A code feature structure diagram is constructed according to the code file, the code feature structure diagram is analyzed to obtain the code programming language of the code file, and an environment installation script and a website deployment script are automatically generated based on the code programming language of the code file.
[0018] Optionally, the environment installation script includes a language environment installation script, a technical framework installation script, a configuration file generation script and a software package installation script, and the website deployment script includes a compilation script, a running script and a parsing script.
[0019] Optionally, step S2 includes the following steps:
[0020] S21, constructing a code feature structure diagram according to the code file;
[0021] S22, analyzing the code feature structure diagram to obtain the code programming language of the code file, and generating a language environment installation script based on the code programming language;
[0022] S23, supplementing the code feature structure diagram according to the code programming language to generate a technical framework installation script;
[0023] S24, identifying and parsing a key configuration file from the code file according to the code programming language, and generating an operating environment installation script according to the environment requirements in the key configuration file;
[0024] S25, analyzing the third-party package in the code file to generate a corresponding software package installation script;
[0025] S26, generating a parsing script including an Nginx configuration file according to the basic configuration information of the code file;
[0026] S27. Generate a compile script and a run script according to the website type corresponding to the code file.
[0027] Optionally, both step S3 and step S4 are based on executing corresponding scripts in a pipeline manner.
[0028] Optionally, step S3 includes the following steps:
[0029] S31, obtaining the environment installation script;
[0030] S32, initializing an automated environment installation pipeline according to the environment installation script;
[0031] S33, executing the environment installation pipeline to generate a website installation environment.
[0032] Optionally, step S4 includes the following steps:
[0033] S41, determining whether the website installation environment is installed, if so, executing step S42;
[0034] S42, obtaining the website deployment script;
[0035] S43, initializing an automated website deployment pipeline according to the website deployment script;
[0036] S44, executing the website deployment pipeline to generate a website corresponding to the code file.
[0037] Optionally, the step S1 includes the following steps:
[0038] S11. Obtain the warehouse code address input by the user;
[0039] S12. Use the Git tool to download the content of the warehouse code address to obtain the code file.
[0040] In a second aspect, the present invention provides a Git-based intelligent website building system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the Git-based intelligent website building method of the first aspect is implemented.
[0041] Among them, the technical effects corresponding to the Git-based intelligent website building system provided in the second aspect refer to the relevant description of the Git-based intelligent website building method provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of a flow chart of a Git-based intelligent website building method according to an embodiment of the present invention;
[0043] Figure 2 Schematic diagram of the process of step S1 in the Git-based intelligent website building method according to an embodiment of the present invention;
[0044] Figure 3Schematic diagram of the process of step S2 in the Git-based intelligent website building method according to an embodiment of the present invention;
[0045] Figure 4 Schematic diagram of the process of step S3 in the Git-based intelligent website building method according to an embodiment of the present invention;
[0046] Figure 5 Schematic diagram of the process of step S4 in the Git-based intelligent website building method according to an embodiment of the present invention;
[0047] Figure 6 Schematic diagram of the framework of the Git-based intelligent website building system according to an embodiment of the present invention.
[0048] Description of reference numerals:
[0049] 1. Intelligent website building system based on Git;
[0050] 2. Processor;
[0051] 3. Memory. DETAILED DESCRIPTION
[0052] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0053] Embodiment 1
[0054] This embodiment is suitable for application scenarios where a website needs to be built, and is particularly suitable for application scenarios where ordinary users who do not have strong professional knowledge of website building need to build personal websites. The existing website building methods have very high requirements for the professionalism of users and cannot meet the needs of ordinary users to build a complete personal website. This embodiment analyzes the user's code file and automatically generates a set of website building scripts, thereby greatly reducing the user's website building cost and simplifying the user's operation process. See the following description for details.
[0055] Please refer to Figures 1 to 5 , the intelligent website building method based on Git includes the following steps:
[0056] S1. Get the code files stored by the user in the Git repository.
[0057] like Figure 2 As shown, step S1 includes the following steps:
[0058] S11. Obtain the warehouse code address input by the user.
[0059] S12. Use the Git tool to download the content of the warehouse code address to obtain the code file.
[0060] Among them, Git is an open source distributed version control system that can effectively and quickly handle version management of projects ranging from very small to very large.
[0061] When a user needs to build a website, the relevant code files are stored in the Git repository to obtain a repository code address. The repository code address is input into the website building system of this embodiment, and the website building system uses the Git tool to download the repository content for the input repository code address to obtain the code files stored by the user.
[0062] S2. construct a code feature structure diagram according to the code file, and automatically generate an environment installation script and a website deployment script based on the code feature structure diagram;
[0063] In this embodiment, step S2 is:
[0064] A code feature structure diagram is constructed according to the code file, the code feature structure diagram is analyzed to obtain the code programming language of the code file, and an environment installation script and a website deployment script are automatically generated based on the code programming language of the code file.
[0065] That is, in this embodiment, after obtaining the code file required for website building in step S1, the code file is first scanned and analyzed to extract the structural information of the code file and construct a structure diagram representing the code features. This structure diagram reflects the structural features of each module, function and their mutual relationship in the code file. Then, a feature graph matching method is used to identify similar code structures by comparing with a predefined code pattern library. Through this process, the system can automatically generate a series of corresponding script files for further analysis or automated processing.
[0066] Among them, the environment installation script includes the language environment installation script, the technical framework installation script, the configuration file generation script and the software package installation script, and the website deployment script includes the compilation script, the running script and the parsing script.
[0067] Therefore, if Figure 3 As shown, step S2 includes the following steps:
[0068] S21. Construct a code feature structure diagram according to the code file.
[0069] Wherein, step S21 includes the following steps:
[0070] (1) Scan files: traverse all files in the code file to obtain the file types contained in the code file, including .py, .js, .html, .java, etc.
[0071] (2) Count the number of files: Count the number of files of each file type.
[0072] (3) Statistical file ratio: Statistical file ratio of each file type based on the number of files. The file ratio of each file type is the ratio of the number of files of that file type to the total number of code files.
[0073] (4) Generate feature graph: Construct a code feature structure graph based on file type, file number, and file ratio.
[0074] S22. Analyze the code feature structure diagram to obtain the code programming language of the code file, and generate a language environment installation script based on the code programming language.
[0075] In step S22, the main programming language to which the code feature structure diagram in step S21 belongs is inferred mainly through a feature graph matching method to generate a corresponding language environment installation script. Specifically, the following steps are included:
[0076] (1) Establish a feature library: Establish a set of standard graph feature libraries for each programming language. The standard graph feature library includes common file extensions, libraries, and module dependencies, etc.
[0077] (2) Matching feature graphs: Use graph isomorphism or feature-based similarity algorithms to compare the features of the code feature structure graph and the standard graph feature library to obtain the code programming language of the code file.
[0078] (3) Generate script: Generate a language environment installation script based on the code programming language.
[0079] S23. Supplement the code feature structure diagram according to the code programming language and generate a technical framework installation script.
[0080] In step S23, according to the main programming language determined in S22, the code structure is further analyzed to supplement the data graph and generate a technical framework installation script. Specifically, the following steps are included:
[0081] (1) Code structure analysis: Analyze whether certain frameworks or architectures are used in the code files, such as Django, Flask, Spring, React, etc.
[0082] (2) Supplementary data diagram: The code feature structure diagram is supplemented according to the architecture information of the code file to reflect the technical architecture adopted by the code file.
[0083] (3) Generate installation script: Generate the corresponding technical framework installation script based on the analysis results.
[0084] S24. Identify and parse a key configuration file from the code file according to the code programming language, and generate a running environment installation script according to the environment requirements in the key configuration file.
[0085] In step S24, by further analyzing the key configuration files in the project, necessary environmental conditions are extracted from them, and an installation script for the operating environment is generated. Specifically, the following steps are included:
[0086] (1) Extract configuration files: Identify key configuration files in code files, such as .env, config.json, settings.py, etc.
[0087] (2) Parsing configuration files: Read and parse configuration files such as .env and config.json to extract relevant information required by the environment, such as environment variables, database connection configuration, port number, etc.
[0088] (3) Generate installation script: Generate the corresponding runtime environment installation script based on the dependencies in the configuration, such as Docker, virtual environment, etc.
[0089] S25. Analyze the third-party packages in the code file to generate corresponding software package installation scripts.
[0090] In step S25, by analyzing the third-party packages used in the code file, an installation script for installing the software package is output. Specifically, the following steps are included:
[0091] (1) Package analysis: Scan the project code and analyze the third-party packages used in it, such as libraries imported through import or require statements.
[0092] (2) Generate installation script: Generate the corresponding package installation script based on the package information used.
[0093] S26. Generate a parsing script including an Nginx configuration file according to the basic configuration information of the code file.
[0094] In step S26, an Nginx configuration file is generated for domain name resolution based on the system settings and basic warehouse information. Specifically, the following steps are included:
[0095] (1) Generate configuration: Generate Nginx configuration files based on the project's domain name, port, and other information.
[0096] (2) Output configuration file: Output a valid Nginx configuration for use during deployment.
[0097] S27. Generate a compilation script and a running script according to the website type corresponding to the code file.
[0098] In step S27, an automated executable script is generated based on the code file for compiling and running the project. Specifically, the following steps are included:
[0099] (1) Generate script: Generate an executable script based on the website type of the code file, such as bash script, Makefile, Dockerfile, etc.
[0100] (2) Execute compilation and startup commands: When generating an executable script, the compilation and startup commands of the project are automatically filled in.
[0101] S3, generate a website installation environment according to the environment installation script;
[0102] In this embodiment, both step S3 and step S4 are based on executing the corresponding scripts in a pipeline manner. The basic idea of pipeline is to decompose a complete task into multiple subtasks, which are processed in parallel at different stages. Each stage focuses on a part of the task, allowing different parts of multiple tasks to be processed simultaneously, thereby improving the overall efficiency and throughput of the system.
[0103] Among them, according to the executable script generated in step S2, the system will automatically create a complete environment installation pipeline for the language environment installation script, the technical framework installation script, the operating environment installation script, and the software package installation script. The pipeline includes a series of steps from environment configuration to dependency management to ensure that each script can be successfully executed in the specified environment. Through automated task processing, the pipeline can efficiently deploy and execute these scripts step by step, and automatically perform error detection and logging based on the execution results. The entire process will be fully automated from script generation to execution, greatly improving operation and maintenance efficiency and reducing the risk of manual intervention.
[0104] Reference Figure 4 It can be seen that step S3 includes the following steps:
[0105] S31. Obtain the environment installation script.
[0106] In step S31, a series of script files generated in step S2 for environment installation are obtained, including but not limited to:
[0107] 1. Language environment installation script: such as requirements.txt and package.json.
[0108] 2. Technical framework installation script: such as docker-compose.yml and npminstall.
[0109] 3. Configuration file generation script: such as nginx.conf.
[0110] 4. Software package installation script.
[0111] S32. Initialize an automated environment installation pipeline according to the environment installation script.
[0112] In step S32, an automated pipeline is initialized according to the script related to the environment installation. The creation of the pipeline needs to determine whether the required environment has been installed. If the environment already exists, the corresponding installation node is skipped; if the environment is not installed, the corresponding installation node is created.
[0113] (1) Check whether the environment has been installed: By checking whether the target environment already exists, determine whether the corresponding installation script needs to be executed.
[0114] (2) Create pipeline nodes: Intelligently create pipeline nodes based on whether the environment has been installed. If the environment is not installed, create a node for the installation environment and add it to the pipeline.
[0115] (3) Initialization pipeline: The pipeline should be able to include the following nodes: installing the language environment, installing the necessary technical framework, installing the software package, and configuring the server.
[0116] S33, execute the environment installation pipeline to generate the website installation environment.
[0117] In step S33, the system needs to execute the pipeline and perform corresponding operations in sequence according to the script of each node to ensure the completion of environment installation, technical framework installation, software package installation and server configuration.
[0118] (1) Execute environment installation: If the environment is not installed, execute the installation script.
[0119] (2) Execute package installation: Execute the package installation script to install the dependencies required by the project.
[0120] (3) Execute the compilation and startup script: After completing the environment and dependency installation, execute the project's compilation and startup commands to start step S4.
[0121] (4) Error handling: Each execution step should contain error handling logic to ensure appropriate rollback or reporting when a node fails.
[0122] S4. Execute the website deployment script in the website installation environment to generate a website corresponding to the code file.
[0123] In this embodiment, a complete website deployment pipeline is created based on the parsing script, compiling script, and running script generated in step S2. The pipeline includes a series of steps from code compilation, parsing, testing, and running to ensure that each executable script can be successfully executed in a specified environment.
[0124] Reference Figure 5 It can be seen that step S4 includes the following steps:
[0125] S41, determine whether the website installation environment is installed, if so, execute step S42.
[0126] In step S41, the system needs to obtain the running status of the environment installation pipeline in step S33. If all nodes are executed, the environment installation is successful, indicating that the environment is ready and can proceed to the next step. If any node fails, the deployment will fail and the process ends. Specifically, the following steps are included:
[0127] (1) Check the pipeline status: You need to determine whether the environment installation pipeline is executed successfully.
[0128] (2) Determine the next step based on the pipeline execution results: If all steps are completed successfully, continue with the next step of compilation and running; if any node fails, end the process and report the error.
[0129] S42. Obtain the website deployment script.
[0130] In step S42, the compilation script, parsing script and execution script generated in step S2 are obtained.
[0131] S43. Initialize an automated website deployment pipeline according to the website deployment script.
[0132] In step S43, a new pipeline node is initialized according to the compilation script, parsing script, and running script obtained in step S42. Each script will correspond to an independent pipeline node, and these nodes will be executed in sequence to ensure that the project can be successfully compiled, run, and configure the necessary parsing services.
[0133] S44. Execute the website deployment pipeline to generate a website corresponding to the code file.
[0134] In step S44, we will execute the created pipeline. Each node will execute the corresponding scripts in sequence, such as compile scripts, run scripts, and parse scripts, to ensure that the project can be compiled and run correctly, and the server parsing is configured. Specifically, the following steps are included:
[0135] (1) Execute the compilation script: Execute the compilation script to compile the project code into an executable file, or build the project into a final runnable state.
[0136] (2) Execute the run script: Execute the run script to start the project and run it on the server. For example, start the backend service, frontend application, or the entire application container.
[0137] (3) Execute the parsing script: Execute the parsing script, configure Nginx or other reverse proxy services on the server, parse domain name requests and forward them to the backend service, and ensure that external requests can be correctly routed to the service running the project.
[0138] In summary, this embodiment obtains the user's website building technology and architecture through the characteristic structure diagram of the user code, thereby automatically generating a set of website building scripts, and using a pipeline method to run the website building scripts, thereby greatly reducing the user's website building costs and simplifying the user's operating procedures.
[0139] Embodiment 2
[0140] Please refer to Figure 6 The Git-based intelligent website building system 1 includes a memory 3, a processor 2, and a computer program stored in the memory 3 and executable on the processor 2. When the processor 2 executes the computer program, the steps in the above-mentioned embodiment 1 are implemented.
[0141] Since the system / device described in the above embodiments of the present invention is a system / device used to implement the method of the above embodiments of the present invention, a person skilled in the art can understand the specific structure and deformation of the system / device based on the method described in the above embodiments of the present invention, and thus will not be described in detail here. All systems / devices used in the method of the above embodiments of the present invention belong to the scope of protection of the present invention.
[0142] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0143] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (apparatus) and computer program products according to the embodiments of the present invention. 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.
[0144] It should be noted that in the claims, any reference numerals placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In the claims enumerating several means, several of these means may be embodied by the same hardware. The use of the words first, second, third, etc., is for convenience of expression only and does not indicate any order. These words may be understood as part of the component name.
[0145] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0146] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments after knowing the basic creative concept. Therefore, the claims should be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
[0147] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention should also include these modifications and variations.
Claims
1. Intelligent website building method based on Git, characterized in that: Includes steps: S1. Obtain the code files stored by the user in the Git repository; S2. construct a code feature structure diagram according to the code file, and automatically generate an environment installation script and a website deployment script based on the code feature structure diagram; S3, generating a website installation environment according to the environment installation script; S4. Execute the website deployment script in the website installation environment to generate a website corresponding to the code file.
2. The Git-based intelligent website building method according to claim 1, characterized in that: Constructing the code feature structure diagram according to the code file in step S2 includes the following steps: Traversing all files in the code file to obtain file types contained in the code file; Count the number of files of each file type; Counting the file proportion of each file type according to the number of files; A code feature structure diagram is constructed according to the file type, the number of files and the file proportion.
3. The Git-based intelligent website building method according to claim 1, characterized in that: The step S2 is: A code feature structure diagram is constructed according to the code file, the code feature structure diagram is analyzed to obtain the code programming language of the code file, and an environment installation script and a website deployment script are automatically generated based on the code programming language of the code file.
4. The Git-based intelligent website building method according to claim 3, characterized in that: The environment installation script includes a language environment installation script, a technical framework installation script, a configuration file generation script and a software package installation script, and the website deployment script includes a compilation script, a running script and a parsing script.
5. The Git-based intelligent website building method according to claim 4, characterized in that: The step S2 comprises the following steps: S21, constructing a code feature structure diagram according to the code file; S22, analyzing the code feature structure diagram to obtain the code programming language of the code file, and generating a language environment installation script based on the code programming language; S23, supplementing the code feature structure diagram according to the code programming language to generate a technical framework installation script; S24, identifying and parsing a key configuration file from the code file according to the code programming language, and generating an operating environment installation script according to the environment requirements in the key configuration file; S25, analyzing the third-party package in the code file to generate a corresponding software package installation script; S26, generating a parsing script including an Nginx configuration file according to the basic configuration information of the code file; S27. Generate a compile script and a run script according to the website type corresponding to the code file.
6. The Git-based intelligent website building method according to claim 4, characterized in that: Both step S3 and step S4 are based on executing the corresponding scripts in a pipeline manner.
7. The Git-based intelligent website building method according to claim 6, characterized in that: The step S3 comprises the following steps: S31, obtaining the environment installation script; S32, initializing an automated environment installation pipeline according to the environment installation script; S33, executing the environment installation pipeline to generate a website installation environment.
8. The Git-based intelligent website building method according to claim 6, characterized in that: The step S4 comprises the following steps: S41, determining whether the website installation environment is installed, if so, executing step S42; S42, obtaining the website deployment script; S43, initializing an automated website deployment pipeline according to the website deployment script; S44, executing the website deployment pipeline to generate a website corresponding to the code file.
9. The Git-based intelligent website building method according to any one of claims 1 to 8, characterized in that: The step S1 comprises the following steps: S11. Obtain the warehouse code address input by the user; S12. Use the Git tool to download the content of the warehouse code address to obtain the code file.
10. An intelligent website building system based on Git, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the Git-based intelligent website building method described in any one of claims 1 to 9 is implemented.