A method and apparatus for generating engineering documents, a storage medium, and a computer device.

CN115687268BActive Publication Date: 2026-08-14KANG JIAN INFORMATION TECH (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-15
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0004]有鉴于此,本申请提供了一种工程文件生成方法及装置、存储介质、计算机设备,实现了命令行工具与脚手架基础模板之间的解耦,解决了脚手架对模板和可定制参数强依赖的问题,使得模板的配置更加灵活,更好的保证了工程文件的质量

Benefits of technology

[0016]依据本申请再一个方面,提供了一种计算机设备,包括存储介质、处理器及存储在存储介质上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述工程文件生成方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115687268B_ABST
    Figure CN115687268B_ABST
Patent Text Reader

Abstract

This application relates to the field of computer technology and discloses a method and apparatus for generating engineering files, a storage medium, and a computer device. The method includes: responding to an engineering file generation command and outputting a command-line interface; extracting target parameters input by a target user based on the command-line interface, and determining a target engineering template from a preset template pool based on a first parameter in the target parameters, the preset template pool including scaffolding basic templates and customized templates; parsing a target configuration file within the target engineering template, and generating an initial configuration file based on the target configuration file and a second parameter in the target parameters; and rendering the initial configuration file using a template engine to obtain the engineering file. This application decouples the command-line tool from the scaffolding basic template, solves the problem of strong dependence of scaffolding on templates and customizable parameters, makes template configuration more flexible, and better ensures the quality of engineering files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for generating engineering documents, a storage medium, and a computer device. Background Technology

[0002] With the development of front-end development in recent years, the concept of engineering has become increasingly popular. Currently, scaffolding is commonly used to build front-end projects. The emergence of scaffolding can reduce a lot of repetitive work unrelated to business logic. By pre-integrating some stable and reliable project templates, scaffolding allows for the creation of a new project with a single command, which is simple and convenient.

[0003] Many manufacturers in the industry have extensive experience with scaffolding, and scaffolding can serve most businesses well. However, some shortcomings also exist. Currently, most scaffolding in the industry relies heavily on templates and customizable parameters, resulting in low configurability of the templates. If a user uses this scaffolding, they must use the engineering templates provided by the scaffolding. Summary of the Invention

[0004] In view of this, this application provides a method and apparatus for generating engineering documents, a storage medium, and a computer device, which decouples the command-line tool from the scaffolding basic template, solves the problem of strong dependence of scaffolding on templates and customizable parameters, makes the template configuration more flexible, and better ensures the quality of engineering documents.

[0005] According to one aspect of this application, a method for generating engineering documents is provided, the method being implemented using scaffolding, the method comprising:

[0006] In response to the command to generate project files, a command-line interface is output;

[0007] Extract the target parameters input by the target user based on the command line interface, and determine the target project template from the preset template pool based on the first parameter in the target parameters. The preset template pool includes scaffolding foundation templates and customized templates.

[0008] The target configuration file within the target project template is parsed, and an initial configuration file is generated based on the target configuration file and the second parameter in the target parameters.

[0009] The initial configuration file is rendered using a template engine to obtain the project file.

[0010] According to another aspect of this application, an engineering document generation apparatus is provided, the apparatus being implemented based on scaffolding, the apparatus comprising:

[0011] The interface output module is used to output a command-line interface in response to the project file generation command;

[0012] The parameter extraction module is used to extract the target parameters input by the target user based on the command line interface, and to determine the target project template from the preset template pool based on the first parameter in the target parameters. The preset template pool includes scaffolding foundation templates and customized templates.

[0013] The file parsing module is used to parse the target configuration file in the target project template, and generate an initial configuration file based on the target configuration file and the second parameter in the target parameters;

[0014] The rendering module is used to render the initial configuration file using a template engine to obtain the project file.

[0015] According to another aspect of this application, a storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the above-described method for generating engineering files.

[0016] According to another aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described method for generating engineering files.

[0017] Using the above technical solution, this application provides a method, apparatus, storage medium, and computer device for generating engineering files. When a target user wants to generate engineering files, they can do so by running a scaffold. After the target user activates the scaffold, they can generate engineering file generation instructions by clicking icons, etc. Then, the scaffold can respond to the engineering file generation instructions and output a command-line interface, where the target user can input target parameters. Furthermore, the target parameters input by the target user can be extracted from the command-line interface. These target parameters can be divided into two parts: a first parameter indicating the target engineering template and a second parameter indicating the configuration items. After extracting the target parameters, the target engineering template corresponding to the first parameter can be found from a preset template pool. Here, the preset template pool can include the engineering templates provided by the scaffold (i.e., the basic scaffold templates) and also the target user's customized templates. Each target engineering template can contain a target configuration file. After selecting a target engineering template, the target configuration file under that template can be parsed, and an initial configuration file can be generated based on the second parameter in the target parameters. Next, the initial configuration file generated above can be rendered using a template engine to obtain the final project file. This application decouples the command-line tool from the scaffolding basic template, solving the problem of strong dependence of scaffolding on templates and customizable parameters, making template configuration more flexible and better ensuring the quality of project files.

[0018] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0020] Figure 1 A flowchart illustrating an engineering file generation method provided in an embodiment of this application is shown.

[0021] Figure 2 A flowchart illustrating another method for generating engineering files provided in an embodiment of this application is shown;

[0022] Figure 3 A flowchart illustrating another method for generating engineering files provided in an embodiment of this application is shown;

[0023] Figure 4 A schematic diagram of the structure of an engineering document generation device provided in an embodiment of this application is shown. Detailed Implementation

[0024] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.

[0025] This embodiment provides a method for generating engineering files, which is implemented using scaffolding, such as... Figure 1 As shown, the method includes:

[0026] Step 101: In response to the project file generation command, output the command line interface;

[0027] The project file generation method provided in this application can be applied to both the client and server sides. When a target user wants to generate project files, they can do so by running a scaffold. Here, the scaffold is an optimized scaffold, which no longer strongly depends on the scaffold's own template and customizable parameters. Customizable parameters may include the selected framework, whether to use some features within the framework, compilation and packaging configuration items, etc. After the target user enables the scaffold, they can generate project file generation instructions by clicking an icon, etc. Then, the scaffold can respond to the project file generation instructions and output a command-line interface, allowing the target user to input target parameters. In addition, the command-line interface can also provide input assistance to the target user, such as providing answer help below the question through command-line highlighting, or making the question answer optional. The command-line interface can be implemented using Node.js. Users can input target parameters in the command-line interface in the following ways: First, users can freely input via the keyboard in each command line; second, some command-line questions can provide fixed options in a format like ABCD, allowing users to select one or more of ABCD using only the arrow keys; third, some command-line questions can have specified answer formats, such as yes / no / y / n, which users can input and press Enter.

[0028] Step 102: Extract the target parameters input by the target user based on the command line interface, and determine the target project template from the preset template pool based on the first parameter in the target parameters. The preset template pool includes scaffolding foundation templates and customized templates.

[0029] In this embodiment, further, target parameters input by the target user can be extracted from the command-line interface. These target parameters can be divided into two parts: a first parameter indicating the target project template and a second parameter indicating the configuration item. After extracting the target parameters, the target project template corresponding to the first parameter can be found from a preset template pool. The first parameter can be a template identifier or a template address, etc., corresponding to the target project template. Here, the preset template pool can include the scaffolding's built-in project templates (i.e., the scaffolding foundation templates) and, in addition, customized templates from the target user.

[0030] Step 103: Parse the target configuration file within the target project template, and generate an initial configuration file based on the target configuration file and the second parameter in the target parameters;

[0031] In this embodiment, each target project template can contain a target configuration file, which can specifically be a configuration JSON file. After selecting a target project template, the target configuration file under that template can be parsed. After parsing, an initial configuration file can be generated based on the second parameter in the target parameters. The second parameter can include the project name, whether TypeScript (an open-source programming language) is used, whether a third-party component library is used, whether a tracking system is integrated, etc.

[0032] Step 104: Render the initial configuration file using a template engine to obtain the project file.

[0033] In this embodiment, the initial configuration file generated above can then be rendered using a template engine to obtain the final project file. When the target configuration file is a JSON configuration file, the template engine can be an EJS template engine. The EJS template engine separates the basic scaffolding template from the configuration data, collecting all configuration items before generating the final project file and dynamically generating the project file using specific EJS syntax. For example, in a command-line question, the user might be asked whether to integrate a certain module. If the user selects no, the code for injecting that module will not appear; otherwise, the code referencing the module will be injected into the project file.

[0034] By applying the technical solution of this embodiment, when a target user wants to generate project files, this can be achieved by running the scaffolding. After the target user activates the scaffolding, they can generate project file generation instructions by clicking icons, etc. Then, the scaffolding can respond to the project file generation instructions and output a command-line interface, where the target user can input target parameters. Furthermore, the target parameters input by the target user can be extracted from the command-line interface. These target parameters can be divided into two parts: a first parameter indicating the target project template and a second parameter indicating the configuration items. After extracting the target parameters, the target project template corresponding to the first parameter can be found from a preset template pool. Here, the preset template pool can include the project templates provided by the scaffolding itself, i.e., the basic scaffolding templates, as well as custom templates created by the target user. Each target project template can contain a target configuration file. After selecting a target project template, the target configuration file under that template can be parsed. After parsing, an initial configuration file can be generated based on the second parameter in the target parameters. Then, the template engine can be used to render the generated initial configuration file, thus finally obtaining the project file. This application decouples the command-line tool from the scaffolding basic template, solves the problem of strong dependence of scaffolding on templates and customizable parameters, makes the template configuration more flexible, and better ensures the quality of project files.

[0035] Furthermore, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the specific implementation process of this embodiment, another method for generating engineering documents is provided. This method is based on scaffolding, such as... Figure 2 As shown, the method includes:

[0036] Step 201: In response to the project file generation command, output the command line interface;

[0037] In this embodiment, when a target user wants to generate project files, they can do so by running the scaffolding. After the target user activates the scaffolding, they can generate project file generation instructions by clicking an icon or similar method. Then, the scaffolding can respond to these instructions by outputting a command-line interface, allowing the target user to input target parameters.

[0038] Step 202: Extract the target parameters input by the target user based on the command-line interface;

[0039] In this embodiment, the target parameters input by the target user can be further extracted from the command-line interface. These target parameters can be divided into two parts: a first parameter indicating the target project template and a second parameter indicating the configuration items.

[0040] Step 203: Identify the first parameter from the target parameters and determine the template address indicated by the first parameter;

[0041] In this embodiment, after extracting the target parameters input by the target user, a first parameter can be identified from the target parameters, and the template address corresponding to the target project template can be determined based on the first parameter. The template address can be one-to-one with the target project template.

[0042] Step 204: When the template address is the template address corresponding to the scaffolding foundation template in the preset template pool, the scaffolding foundation template is used as the target project template.

[0043] In this embodiment, the template address can then be used to determine whether it indicates a scaffolding foundation template or a custom template. If the template address corresponds to the template address of the scaffolding foundation template in the preset template pool, since the scaffolding foundation template is a commonly used template that comes with the scaffolding, it can be used directly, and in this case, the scaffolding foundation template can be used as the target project template.

[0044] Step 205: When the template address is the template address corresponding to the customized template in the preset template pool, determine whether the customized template meets the preset access conditions, and when it does, use the customized template as the target project template.

[0045] In this embodiment, if the template address corresponds to the template address of a customized template for a target user in a preset template pool, since it is unknown whether the customized template can meet the scaffolding access conditions, failure to access will directly affect subsequent operations. Therefore, it is necessary to first determine whether the customized template meets the preset access conditions. If the determination finds that the customized template meets the preset access conditions, it means that the customized template can be successfully used subsequently, and at this time, the customized template can be used as the target project template.

[0046] Step 206: Parse the target configuration file within the target project template, and generate an initial configuration file based on the target configuration file and the second parameter in the target parameters;

[0047] In this embodiment, each target project template can contain a target configuration file. After selecting a target project template, the target configuration file under that target project template can be parsed, and an initial configuration file can be generated based on the second parameter in the target parameters.

[0048] Step 207: Render the initial configuration file using a template engine to obtain the project file.

[0049] In this embodiment, the initial configuration file generated above can then be rendered using a template engine to obtain the final project file.

[0050] In this embodiment of the application, optionally, the step 205 of "determining whether the customized template meets the preset access conditions" includes: identifying the target extension corresponding to the customized template and determining whether the target extension is a preset extension to obtain a first determination result; determining whether the target configuration file is present in the root directory of the customized template to obtain a second determination result; when both the first determination result and the second determination result are yes, determining that the customized template meets the preset access conditions.

[0051] In this embodiment, when determining whether a customized template meets the preset access conditions, the target extension of the customized template is first identified. The target extension is the file extension of the customized template. Next, it is determined whether the target extension and the preset extension are consistent, resulting in a first judgment result. The first judgment result can be consistent or inconsistent. For example, when the template engine is an ejs template engine, the preset extension can be .ejs. Simultaneously, files in the root directory of the customized template can be searched to determine whether the root directory includes the target configuration file, resulting in a second judgment result. The second judgment result can be included or excluded. Finally, the first and second judgment results are used together to determine whether the customized template meets the preset access conditions. Specifically, if the first judgment result is yes (consistent) and the second judgment result is also yes (included), then the customized template meets the preset access conditions, and project files can be successfully generated using the customized template. However, if either the first or second judgment result is no, or if both the first and second judgment results are no, then the customized template does not meet the preset access conditions.

[0052] Furthermore, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the specific implementation process of this embodiment, another method for generating engineering documents is provided. This method is based on scaffolding, such as... Figure 3 As shown, the method includes:

[0053] Step 301: In response to the project file generation command, output the command line interface;

[0054] In this embodiment, when a target user wants to generate project files, they can do so by running the scaffolding. After the target user activates the scaffolding, they can generate project file generation instructions by clicking an icon or similar method. Then, the scaffolding can respond to these instructions by outputting a command-line interface, allowing the target user to input target parameters.

[0055] Step 302: Compare the target parameters input by the target user based on the command line interface with preset parameters to determine whether the preset parameters include the target parameters; and / or, compare the parameter format corresponding to the target parameters input by the target user based on the command line interface with a preset format to determine whether the parameter format of the target parameters is consistent with the preset format;

[0056] In this embodiment, the command-line interface can also validate the target parameters input by the target user. Validation can be divided into two aspects: firstly, validating whether the target parameter is part of a preset set of parameters; and secondly, validating whether the parameter format corresponding to the target parameter is a preset format. Regarding the first aspect, for input from the command-line interface, the interface itself can correspond to preset parameters with answers, such as yes / no / y / n. If the preset parameter is yes / no, and the target user inputs y / n, then the target parameter does not belong to the preset parameters and cannot be recognized; similarly, if the preset parameter is y / n, and the target user inputs yes / no, then the target parameter also does not belong to the preset parameters and cannot be recognized. Regarding the second aspect, for input from the command-line interface, the interface itself can correspond to preset formats with answers, such as the full spelling of a template address. If the parameter format corresponding to the target parameter is an abbreviation of the template address, then the parameter format of the target parameter does not belong to the preset format and cannot be recognized.

[0057] Step 303: When the preset parameters include the target parameters, and / or when the parameter format of the target parameters is consistent with the preset format, extract the target parameters input by the target user based on the command line interface, and determine the target project template from the preset template pool based on the first parameter in the target parameters. The preset template pool includes scaffolding foundation templates and customized templates.

[0058] In this embodiment, if the target parameter is determined to be a preset parameter and its format is also a preset format, then the target parameter input by the target user via the command-line interface is identifiable, and subsequent operations can proceed. The target parameter input by the target user can then be extracted from the command-line interface. This target parameter can be divided into two parts: a first parameter indicating the target project template and a second parameter indicating the configuration item. After extracting the target parameter, the target project template corresponding to the first parameter can be found in the preset template pool. The first parameter can be a template identifier or a template address, etc. The preset template pool can include the scaffolding's own project templates (i.e., the scaffolding foundation templates) and, in addition, the target user's customized templates.

[0059] Step 304: Parse the target configuration file within the target project template, and generate an initial configuration file based on the target configuration file and the second parameter in the target parameters;

[0060] In this embodiment, each target project template can contain a target configuration file. After selecting a target project template, the target configuration file under that target project template can be parsed, and an initial configuration file can be generated based on the second parameter in the target parameters.

[0061] Step 305: Render the initial configuration file using a template engine to obtain the project file;

[0062] In this embodiment, the initial configuration file generated above can then be rendered using a template engine to obtain the final project file.

[0063] Step 306: Determine the project folder where the project file is located, and navigate to the root directory of the project folder;

[0064] In this embodiment, after generating the project file, it can be further determined which project folder the generated project file belongs to. After determining the project folder where the project file is located, it can jump to the root directory of that project folder.

[0065] Step 307: Run the install dependency command in the root directory to install the target dependency package for the project file based on the install dependency command.

[0066] In this embodiment, after navigating to the root directory of the project folder, the dependency installation command can be run within that directory. This allows the installation of the necessary target dependency packages for the project files, completing all preparations before starting the service. Front-end projects typically import numerous third-party dependency packages, but these packages are not generated along with the project files; usually, only the package name and version number are recorded. There is usually only one command to install dependencies, depending on which dependency management tool the user prefers. Currently, two commonly used package management tools are npm and yarn. If using npm, the dependency installation command is `npm i`; if using yarn, the command is `yarn`.

[0067] Optionally, after step 302, the method further includes: when the preset parameter does not include the target parameter, and / or when the parameter format of the target parameter is inconsistent with the preset format, outputting an error message, the error message including the preset parameter and / or the preset format.

[0068] In this embodiment, if it is determined that the preset parameters do not include the target parameters input by the target user, and / or the parameter format of the target parameters input by the target user is different from the preset format, it indicates that there is a problem with the target parameters input by the target user and they cannot be recognized. In this case, an error message can be output. The error message can both remind the target user that the input target parameters are incorrect and output the specific location and problem of the error. For example, the specific command line with the error can be identified, and the preset parameters and / or the preset format can be displayed at the corresponding location of that specific command line. If the error in the answer corresponding to the specific command line is that the target parameters are different from the preset parameters, the correct preset parameters can be highlighted at the corresponding location; if the error in the answer corresponding to the specific command line is that the parameter format of the target parameters is different from the preset format, the correct preset format can be highlighted at the corresponding location. This embodiment of the application, by displaying preset parameters and / or preset formats in the error message, can help the target user quickly discover and solve problems, thus smoothly proceeding to the next step.

[0069] Optionally, after the "responding to the project file generation instruction" in step 301, the method further includes: outputting a permission verification interface, extracting user information input by the target user based on the permission verification interface, determining whether the target user has permission to generate project files based on the user information; and when the target user has permission to generate project files, executing the step of outputting the command line interface.

[0070] In this embodiment, upon responding to the project file generation command, the target user's permission to generate project files can be verified first. Specifically, after responding to the project file generation command, a permission verification interface can be directly output, allowing the target user to input user information. Next, user information can be extracted from the permission verification interface. This user information can be ID card information, account information, etc. After extraction, the user information can be compared with a preset permission list to determine if it is present. If it is, the target user has the permission to generate project files; otherwise, they do not. When the target user has the permission to generate project files, the steps described above for outputting the command-line interface can continue.

[0071] Furthermore, as Figure 1 In a specific implementation of the method, this application provides an engineering document generation device, which is based on scaffolding, such as... Figure 4 As shown, the device includes:

[0072] The interface output module is used to output a command-line interface in response to the project file generation command;

[0073] The parameter extraction module is used to extract the target parameters input by the target user based on the command line interface, and to determine the target project template from the preset template pool based on the first parameter in the target parameters. The preset template pool includes scaffolding foundation templates and customized templates.

[0074] The file parsing module is used to parse the target configuration file in the target project template, and generate an initial configuration file based on the target configuration file and the second parameter in the target parameters;

[0075] The rendering module is used to render the initial configuration file using a template engine to obtain the project file.

[0076] Optionally, the parameter extraction module includes:

[0077] A template address determination unit is used to identify the first parameter from the target parameters and determine the template address indicated by the first parameter;

[0078] The first judgment unit is used to use the scaffolding foundation template as the target project template when the template address is the template address corresponding to the scaffolding foundation template in the preset template pool.

[0079] The second judgment unit is used to determine whether the customized template meets the preset access conditions when the template address is the template address corresponding to the customized template in the preset template pool, and when it meets the conditions, to use the customized template as the target project template.

[0080] Optionally, the second determining unit is used for:

[0081] Identify the target extension corresponding to the customized template and determine whether the target extension is a preset extension to obtain a first determination result; determine whether the target configuration file is present in the root directory of the customized template to obtain a second determination result; when both the first determination result and the second determination result are yes, determine that the customized template meets the preset access conditions.

[0082] Optionally, the device further includes:

[0083] The jump module is used to determine the project folder where the project file is located after obtaining the project file, and jump to the root directory of the project folder;

[0084] The dependency installation module is used to run dependency installation commands in the root directory and install target dependency packages for the project file based on the dependency installation commands.

[0085] Optionally, the device further includes:

[0086] The comparison module is used to compare the target parameters input by the target user based on the command line interface with preset parameters before extracting the target parameters input by the target user based on the command line interface, and to determine whether the preset parameters include the target parameters; and / or to compare the parameter format corresponding to the target parameters input by the target user based on the command line interface with a preset format, and to determine whether the parameter format of the target parameters is consistent with the preset format.

[0087] Optionally, the device further includes:

[0088] The prompt output module is used to output an error prompt when the preset parameter does not include the target parameter, and / or when the parameter format of the target parameter is inconsistent with the preset format, the error prompt including the preset parameter and / or the preset format.

[0089] Optionally, the device further includes:

[0090] The interface output module is used to output a permission verification interface after responding to the project file generation instruction, extract user information input by the target user based on the permission verification interface, and determine whether the target user has permission to generate project files based on the user information.

[0091] The interface output module is also used to execute the step of outputting the command line interface when it has the permission to generate the project file.

[0092] It should be noted that other corresponding descriptions of the functional units involved in the engineering document generation apparatus provided in this application embodiment can be found in the following references. Figures 1 to 3 The corresponding descriptions in the method will not be repeated here.

[0093] Based on the above, Figures 1 to 3 Accordingly, this application also provides a storage medium storing a computer program, which, when executed by a processor, implements the above-described method. Figures 1 to 3 The method for generating project files is shown.

[0094] Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, or portable hard drive), and includes several instructions to cause a computer device (such as a personal computer, server, or network device) to execute the methods described in the various implementation scenarios of this application.

[0095] Based on the above, Figures 1 to 3 The method shown, and Figure 4 To achieve the above objectives, the present application also provides a computer device, specifically a personal computer, server, network device, etc., as shown in the virtual device embodiment. This computer device includes a storage medium and a processor; the storage medium stores a computer program; the processor executes the computer program to achieve the above-described objectives. Figures 1 to 3 The method for generating project files is shown.

[0096] Optionally, the computer device may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Bluetooth interfaces, Wi-Fi interfaces), etc.

[0097] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or combine certain components, or have different component arrangements.

[0098] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and stores the hardware and software resources of a computer device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the storage medium, as well as communication with other hardware and software within the physical device.

[0099] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented using software plus necessary general-purpose hardware platforms, or it can be implemented using hardware. When the target user wants to generate project files, it can do so by running the scaffolding. After the target user enables the scaffolding, it can generate project file generation instructions by clicking icons, etc. Then, the scaffolding can respond to the project file generation instructions and output a command-line interface, so that the target user can input target parameters in the command-line interface. Furthermore, the target parameters input by the target user can be extracted from the command-line interface. The target parameters can be divided into two parts: a first parameter indicating the target project template and a second parameter indicating the configuration items. After extracting the target parameters, the target project template corresponding to the first parameter can be found from the preset template pool according to the first parameter in the target parameters. Here, the preset template pool can include the project templates provided by the scaffolding, that is, the basic scaffolding templates, and can also include the target user's customized templates. Each target project template can contain a target configuration file. After selecting the target project template, the target configuration file under the target project template can be parsed, and after parsing, an initial configuration file can be generated together according to the second parameter in the target parameters. Next, the initial configuration file generated above can be rendered using a template engine to obtain the final project file. This application decouples the command-line tool from the scaffolding basic template, solving the problem of strong dependence of scaffolding on templates and customizable parameters, making template configuration more flexible and better ensuring the quality of project files.

[0100] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or can be modified to be located in one or more apparatuses different from this embodiment. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.

[0101] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of any particular implementation scenario. The above disclosures are merely a few specific implementation scenarios of this application; however, this application is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of this application.

Claims

1. A method for generating engineering documents, characterized in that, The method is based on scaffolding and includes: In response to the command to generate project files, a command-line interface is output; Extract the target parameters input by the target user based on the command line interface, and determine the target project template from the preset template pool based on the first parameter in the target parameters. The preset template pool includes scaffolding foundation templates and customized templates. The first parameter is the template identifier or template address of the target project template. The target configuration file within the target project template is parsed, and an initial configuration file is generated based on the target configuration file and the second parameter in the target parameters. The second parameter includes at least one of the following: project name, whether TypeScript is used, whether a third-party component library is used, and whether a point-tracking system is connected. The initial configuration file is rendered using a template engine to obtain the project file; After obtaining the project file, the method further includes: Determine the project folder where the project file is located, and navigate to the root directory of the project folder; Run the dependency installation command in the root directory, and install the target dependency packages for the project file based on the dependency package management tool commonly used by the user. Before extracting the target parameters input by the target user based on the command-line interface, the method further includes: The target parameters input by the target user through the command-line interface are compared with preset parameters to determine whether the preset parameters include the target parameters; and / or, The parameter format corresponding to the target parameter input by the target user based on the command line interface is compared with the preset format to determine whether the parameter format of the target parameter is consistent with the preset format; When the preset parameters do not include the target parameters, and / or when the parameter format of the target parameters is inconsistent with the preset format, an error message is output, and the error message includes the preset parameters and / or the preset format.

2. The method according to claim 1, characterized in that, The step of determining the target project template from the preset template pool based on the first parameter in the target parameters includes: Identify the first parameter from the target parameters and determine the template address indicated by the first parameter; When the template address is the template address corresponding to the scaffolding foundation template in the preset template pool, the scaffolding foundation template is used as the target project template; When the template address is the template address corresponding to the customized template in the preset template pool, it is determined whether the customized template meets the preset access conditions, and when it does, the customized template is used as the target project template.

3. The method according to claim 2, characterized in that, The step of determining whether the customized template meets the preset access conditions includes: Identify the target extension corresponding to the customized template, and determine whether the target extension is a preset extension to obtain a first determination result; Determine whether the target configuration file exists in the root directory of the customized template to obtain a second determination result; When both the first and second judgment results are yes, it is determined that the customized template meets the preset access conditions.

4. The method according to claim 1, characterized in that, Following the response to the project file generation instruction, the method further includes: Output the permission verification interface, extract the user information input by the target user based on the permission verification interface, and determine whether the target user has the permission to generate project files based on the user information; When you have the permission to generate the project file, execute the steps to output the command-line interface.

5. An engineering document generation device, characterized in that, The device is based on scaffolding and includes: The interface output module is used to output a command-line interface in response to the project file generation command; The parameter extraction module is used to extract the target parameters input by the target user based on the command line interface, and to determine the target project template from the preset template pool based on the first parameter in the target parameters. The preset template pool includes scaffolding foundation templates and customized templates. The first parameter is the template identifier or template address of the target project template. The file parsing module is used to parse the target configuration file in the target project template, and generate an initial configuration file based on the target configuration file and the second parameter in the target parameters. The second parameter includes at least one of the following: project name, whether to use TypeScript, whether to use a third-party component library, and whether to connect to a tracking system. The rendering module is used to render the initial configuration file through the template engine to obtain the project file; The device further includes: The jump module is used to determine the project folder where the project file is located after obtaining the project file, and jump to the root directory of the project folder; The dependency package installation module is used to run the dependency installation command in the root directory, and install the target dependency package for the project file based on the dependency installation command. The dependency installation command is determined based on the dependency package management tool commonly used by the user. The device further includes: The comparison module is used to compare the target parameters input by the target user based on the command line interface with preset parameters before extracting the target parameters input by the target user based on the command line interface, and to determine whether the preset parameters include the target parameters; and / or to compare the parameter format corresponding to the target parameters input by the target user based on the command line interface with a preset format, and to determine whether the parameter format of the target parameters is consistent with the preset format; The prompt output module is used to output an error prompt when the preset parameter does not include the target parameter, and / or when the parameter format of the target parameter is inconsistent with the preset format, the error prompt including the preset parameter and / or the preset format.

6. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 4.

7. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 4.

Citation Information

Patent Citations

  • Software template-based software generation method, apparatus and computer device

    CN110989986A

  • Method and device for generating Flutter project file

    CN111459465A

  • Project engineering generation method and device, computer equipment and storage medium

    CN113408260A