File processing method and device, computer readable storage medium, and electronic device
By establishing a mapping relationship between the client and the server between the version number of the dependent package and the local disk directory, the problem of inconsistency in updating the version information of the dependent package is solved, improving development efficiency and simplifying the management process.
Patent Information
- Application Number
- CN202010691169.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-17
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-07-17
AI Technical Summary
During the software development process, when the version information of dependent packages is updated, if other developers of the project fail to update the version information of the local package in time, the version information will be inconsistent, resulting in abnormal system operation and reduced development efficiency.
By establishing a mapping relationship between the file name and version number and the local disk file directory between the client and the server, the batch script file is used to automatically update the local disk directory to ensure the consistency of dependent package versions.
It improves project development efficiency, ensures the consistency of dependent package versions, avoids system operation abnormalities, and simplifies the dependent package management process.
Smart Images

Figure CN113778477B
Abstract
Description
Background Art
[0002] With the development of computer technology, there are more and more software development projects. In the process of project development, in order to develop projects that better meet business needs or user needs, improve software performance, and correct software defects, it may be necessary to update the software.
[0003] At present, front-ends are usually developed in a modular way. Therefore, every time a dependent package is modified, all project developers must update the latest version information to the local development environment to ensure that the referenced package version information is consistent and prevent unpredictable errors.
[0004] However, the above solution has the following defects: when the version information of the dependent package is updated, if other developers of the project fail to update the version information of the local package in time, the version information will be inconsistent, resulting in system operation abnormalities during the development process, thereby reducing the development efficiency of the project.
[0005] Therefore, it is necessary to provide a new project dependency package management method and device.
[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0007] The purpose of the present invention is to provide a project dependency package management method, a project dependency package management device, a computer-readable storage medium and an electronic device, thereby at least to a certain extent overcoming the problem of low project development efficiency caused by the limitations and defects of related technologies.
[0008] According to one aspect of the present disclosure, a file processing method is provided, which is applied to a client, wherein a script file of a file to be called is configured in a local disk of the client, and the file processing method comprises:
[0009] Read the script file of the file to be called, obtain the file name and version number of the file to be called, and update the file name and version number to a preset batch script file;
[0010] Execute the updated batch script file, and establish a mapping relationship between the file name and version number and the file directory in the local disk; wherein the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk;
[0011] When the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so as to call the to-be-called file in the updated file directory.
[0012] In an exemplary embodiment of the present disclosure, executing the updated batch script file and establishing a mapping relationship between the file name and version number and the file directory in the local disk includes:
[0013] Obtaining a storage path of the file directory in the local disk, and writing the storage path into a preset mapping script file to obtain a mapping path;
[0014] The mapping commands in the updated batch processing script file are executed in batches, and a mapping relationship between the file name and version number and the file directory in the local disk is established based on the mapping path.
[0015] In an exemplary embodiment of the present disclosure, updating the file name and version number into a preset batch script file includes:
[0016] Creating a preset batch processing script file, and determining whether the file name and version number exist in the preset batch processing script file;
[0017] When it is determined that the file name and the version number do not exist in the preset batch processing script file, the file name and the version number that do not exist in the preset batch processing script file are updated into the preset batch processing script file.
[0018] In an exemplary embodiment of the present disclosure, mounting the file directory hosting the script file in the server to the local disk includes:
[0019] The file directory hosting the script file in the server is mounted to the local disk through the network file system service provided by the server.
[0020] In an exemplary embodiment of the present disclosure, the file processing method further includes:
[0021] Based on a preset management tool, the script file of the file to be called is installed in the server; wherein the preset management tool includes an NPM package manager and / or a YARN resource manager.
[0022] According to one aspect of the present disclosure, there is provided a file processing method, which is applied to a server, wherein the server is configured with a network file service system, and the file processing method comprises:
[0023] Run the script file of the file to be called installed by the client in the shared directory of the server to generate the file directory of the file to be called;
[0024] Based on the network file service system, the file directory of the to-be-called file is mounted to the local disk of the client, so that the client establishes a mapping relationship between the file directory of the to-be-called file and the file name and version number included in the script file in the local disk;
[0025] When it is detected that the file directory of the file to be called is updated, update information is generated according to the updated file directory, and the update information is sent to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating the calling of the updated file directory from the local disk.
[0026] According to one aspect of the present disclosure, there is provided a file processing device, which is applied to a client, wherein a script file of a file to be called is configured in a local disk of the client, and the file processing device comprises:
[0027] A script file reading module is used to read the script file of the file to be called, obtain the file name and version number of the file to be called, and update the file name and version number to a preset batch script file;
[0028] A mapping relationship establishment module, used to execute the updated batch script file and establish a mapping relationship between the file name and version number and the file directory in the local disk; wherein the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk;
[0029] The file directory update module is used to automatically update the file directory in the local disk according to the update information based on the mapping relationship when receiving the update information of the file directory sent by the server, so as to call the to-be-called file according to the updated file directory.
[0030] According to one aspect of the present disclosure, there is provided a file processing device, which is applied to a server, wherein a network file service system is configured in the server, and the file processing device comprises:
[0031] A script file running module is used to run the script file of the file to be called installed by the client in the shared directory of the server to generate a file directory of the file to be called;
[0032] A file directory mounting module, used for mounting the file directory of the to-be-called file to the local disk of the client based on the network file service system, so that the client establishes a mapping relationship between the file directory of the to-be-called file and the file name and version number included in the script file in the local disk;
[0033] An update information sending module is used to generate update information according to the updated file directory when it detects that the file directory of the file to be called is updated, and send the update information to the client, so that the client can automatically update the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating the calling of the updated file directory from the local disk.
[0034] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the file processing method described in any one of the above is implemented.
[0035] According to one aspect of the present disclosure, there is provided an electronic device, including:
[0036] Processor; and
[0037] A memory, configured to store executable instructions of the processor;
[0038] The processor is configured to execute any one of the above-mentioned file processing methods by executing the executable instructions.
[0039] The embodiment of the present invention provides a project dependency package management method. On the one hand, by reading a script file of a file to be called, the file name and version number of the file to be called are obtained, and the file name and version number are updated to a preset batch script file; then the updated batch script file is executed to establish a mapping relationship between the file name and version number and the file directory in the local disk; finally, when the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so that the updated file directory can call the file to be called. The problem that when the version information of the dependent package is updated, other developers of the project fail to update the version information of the local package in time, the version information is inconsistent, so that the system runs abnormally during the development process, thereby reducing the development efficiency of the project, is solved in the prior art, and the development efficiency of the project is improved; on the other hand, by executing the updated batch script file, a mapping relationship between the file name and version number and the file directory in the local disk is established, and the efficiency of establishing the mapping relationship is improved; on the other hand, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, and the update efficiency is improved.
[0040] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0042] Figure 1 The following is a flowchart schematically showing a file processing method according to an exemplary embodiment of the present invention.
[0043] Figure 2 A block diagram schematically shows a file processing system according to an exemplary embodiment of the present invention.
[0044] Figure 3 A flowchart schematically illustrates a method for executing an updated batch script file and establishing a mapping relationship between the file name and version number and the file directory in the local disk according to an exemplary embodiment of the present invention.
[0045] Figure 4An application scenario diagram schematically illustrates an example of establishing a mapping relationship between name information and version number information and a file directory in a local disk according to an exemplary embodiment of the present invention.
[0046] Figure 5 A flowchart of a method for automatically updating a file directory in the local disk according to the update information based on a mapping relationship according to an exemplary embodiment of the present invention is schematically shown.
[0047] Figure 6 A flowchart schematically illustrates another file processing method according to an exemplary embodiment of the present invention.
[0048] Figure 7 A flowchart schematically illustrates another file processing method according to an exemplary embodiment of the present invention.
[0049] Figure 8 A block diagram schematically shows a file processing device according to an exemplary embodiment of the present invention.
[0050] Fig. 9 A block diagram schematically shows another file processing device according to an exemplary embodiment of the present invention.
[0051] Fig.10 An electronic device for implementing the above-mentioned file processing method according to an exemplary embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0052] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solutions of the present invention may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present invention.
[0053] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0054] In the process of project development, it is often necessary to call external software. However, since there are many developers working independently during the software development process, how to ensure that the versions of the external software called are consistent is an urgent problem to be solved.
[0055] This exemplary embodiment first provides a file processing method, which can be run on a client, and a script file of the file to be called is configured in the local disk of the client; of course, those skilled in the art can also run the method of the present invention on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the project dependency package management method may include the following steps:
[0056] Step S110. Read the script file of the file to be called, obtain the file name and version number of the file to be called, and update the file name and version number to the preset batch script file;
[0057] Step S120. Execute the updated batch script file, and establish a mapping relationship between the file name and version number and the file directory in the local disk; wherein the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk;
[0058] Step S130: When the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so as to call the to-be-called file according to the updated file directory.
[0059] In the above-mentioned project dependency package management method, on the one hand, by reading the script file of the file to be called, the file name and version number of the file to be called are obtained, and the file name and version number are updated to the preset batch script file; then the updated batch script file is executed to establish a mapping relationship between the file name and version number and the file directory in the local disk; finally, when the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so as to call the updated file directory to the file to be called, which solves the problem in the prior art that when the version information of the dependent package is updated, if other developers of the project do not update the version information of the local package in time, the version information will be inconsistent, thereby causing abnormal system operation during the development process, thereby reducing the development efficiency of the project, and improving the development efficiency of the project; on the other hand, by executing the updated batch script file, a mapping relationship between the file name and version number and the file directory in the local disk is established, thereby improving the efficiency of establishing the mapping relationship; on the other hand, based on the mapping relationship, the file directory in the local disk is automatically updated according to the update information, thereby improving the update efficiency.
[0060] Hereinafter, each step involved in the file processing method according to the exemplary embodiment of the present invention will be explained and illustrated in detail with reference to the accompanying drawings.
[0061] First, the terms involved in the exemplary embodiments of the present invention are explained and described.
[0062] NodeJS is a JavaScript runtime environment based on the Chrome V8 engine. The projects mentioned in the exemplary embodiments of the present invention are developed based on this runtime environment.
[0063] NPM, a package management tool installed with NodeJS, can solve many problems in NodeJS code deployment. Common usage scenarios are as follows: allowing users to download third-party packages (dependency packages) written by others from the NPM server for local use; allowing users to download and install command-line programs written by others from the NPM server for local use; allowing users to upload packages or command-line programs written by themselves to the NPM server for others to use.
[0064] YARN, Yet Another Resource Negotiator, is a new Hadoop resource manager. It is a general resource management system that can provide unified resource management and scheduling for upper-level applications. Its introduction has brought great benefits to the cluster in terms of utilization, unified resource management and data sharing.
[0065] NFS, Network File System, enables users to access files elsewhere on the network just like using their own computers.
[0066] Secondly, the purpose of the invention of the exemplary embodiment of the present invention is explained and illustrated. The exemplary embodiment of the present invention uniformly installs the to-be-called files (that is, the dependent packages of the project, hereinafter collectively referred to as the to-be-called files) to the server, and then the developer uses a script batch processing method in the local development environment to map the to-be-called files in the developer's local environment with the package version information of the server one by one, thereby solving the problem that when the version information of the dependent package is updated, if other developers of the project do not update the version information of the local package in time, the version information will be inconsistent, resulting in abnormal system operation during the development process, thereby reducing the development efficiency of the project.
[0067] Hereinafter, the file processing system of the exemplary embodiment of the present invention will be explained and described. Figure 2 As shown, the management system of the project dependency package may include a client 210 where the project developers are located, and a server 220 that hosts the file directory of the dependency package, and of course, may also include a development platform 230 where the project is located. The client and the server are connected via a network, and the client and the development platform are also connected via a network. And there are:
[0068] The server 220 is used to host the file directory of the file to be called; the client 210 and the development platform where the project is located can be used to execute the file calling method proposed in this application.
[0069] Hereinafter, step S110 to step S130 will be explained and illustrated.
[0070] In step S110, the script file of the file to be called is read to obtain the file name and version number of the file to be called, and the file name and version number are updated to a preset batch script file.
[0071] In this example embodiment, first, the script file of the file to be called is explained and described. Specifically, the script file of the file to be called is package.json, which has been created when the project starts to be developed. The script file of the file to be called includes the file name and version number of the file to be called; after the script file is created, it can be installed in a shared folder in the server, where the server can be an NFS server or other server that can provide NFS services. This example does not impose special restrictions on this. Secondly, when it is necessary to establish a mapping relationship between the file name and version number and the file directory in the local disk, it is necessary to read the package.json file first, and then obtain the name information and version number information of all the files to be called.
[0072] It should be noted that if other files to be called are added to the project, the script files of the files to be called need to be updated. Specifically, it may include: when it is detected that there are newly added files to be called in the project, the script files of the files to be called are updated; reading the updated script files of the files to be called, and obtaining the file names and version numbers of all the files to be called included in the updated script files of the files to be called. Through this method, the file names and version numbers of the files to be called included in the script files of the files to be called can be complete, thereby avoiding the problem of abnormal system operation caused by inconsistent maintenance of package version information.
[0073] Furthermore, in this example embodiment, after obtaining the file name and version number of the above-mentioned file to be called, it is also necessary to update the file name and version number to the preset batch script file. Specifically, first, create a preset batch script file, and determine whether the file name and version number exist in the preset batch script file; secondly, when it is determined that the file name and version number do not exist in the preset batch script file, update the file name and version number that do not exist in the preset batch script file to the preset batch script file. In detail:
[0074] First, create a batch script file batch, which includes shell or bat files; second, create a mapping script file npm_link.js, which can be used to traverse the directory of files to be called (the package directory includes file names and version numbers) and update the batch file configuration. Further, run the mapping script file to traverse all the name information and version number information, and determine whether the name information and version number information exist in the batch script file. If not, update the name information and version number information that do not exist in the batch script file to the batch script file.
[0075] In step S120, the updated batch script file is executed to establish a mapping relationship between the file name and version number and the file directory in the local disk; wherein the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk.
[0076] In this example embodiment, first, NFS (Network File System) service is configured on the server side to provide NFS service to the developers of the project; secondly, the directory MNT specified by the server is set as a shared directory. At the same time, in order to generate the file directory in the server, the dependent package needs to be installed in the server, which may specifically include: based on a preset management tool, installing the script file of the file to be called in the server; wherein the preset management tool includes the NPM package manager and / or the YARN resource manager. Furthermore, since the server side is configured with a network file system, the file directory hosting the dependent package in the server can be mounted to the local disk of the developer of the project through the network file system service provided by the server. Through this method, the mounting efficiency of the file directory of the dependent package can be improved.
[0077] For further reference, Figure 3 As shown, executing the updated batch script file and establishing a mapping relationship between the file name and version number and the file directory in the local disk may include steps S310 to S320. Among them:
[0078] In step S310, the storage path of the file directory in the local disk is obtained, and the storage path is written into a preset mapping script file to obtain a mapping path;
[0079] In step S320, the mapping commands in the updated batch script file are executed in batches, and a mapping relationship between the file name and version number and the file directory in the local disk is established based on the mapping path.
[0080] Below, steps S310 to S320 are explained and illustrated. First, the developer mounts the directory MNT (file directory) shared on the NFS server to the developer's local file system NFS_modules directory; second, the developer downloads the project code to the local project directory through version control tools such as svn or git; then, the developer needs to write the storage path of the mounted local NFS_modules directory into the npm_link.js file, which can be specifically as follows:
[0081] / / Set the shared directory mounted locally
[0082] let NFS_modulesPWD=' / home / z1 / work / project / NFS_modules / node_modules / ';
[0083] Further, execute the npm_link.js file, create a batch mapping command for generating dependent packages, and update it to the batch file; after the npm_link package mapping command is generated, automatically execute the batch file and execute the batch mapping command. At this time, a node_modules directory will be generated in the project, and the packages in the directory will correspond one-to-one with the packages installed on the server. You can run the system for development without modifying the reference package path in the project file. For the specific mapping process, please refer to Figure 4 As shown, for example, developer 1 mounts the file directory on the server to the local NFS_modules directory, and obtains versioned package 1, versioned package 2, versioned package 3, ..., versioned package n, etc. At the same time, all dependent packages in the project node_modules directory are traversed to obtain unversioned package 1, unversioned package 2, unversioned package 3, ..., unversioned package n, and then establishes a mapping relationship between versioned package 1, versioned package 2, versioned package 3, ..., versioned package n and unversioned package 1, unversioned package 2, unversioned package 3, ..., unversioned package n. This method not only improves the efficiency of mounting the file directory, but also realizes automatic synchronization between the packages in the directory and the packages installed on the server.
[0084] In step S130, when the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so as to call the to-be-called file according to the updated file directory.
[0085] In this example embodiment, when the server detects that the file name and version number have changed, it can use the changed version number and file name to update the file directory, and then generate update information based on the updated file directory, and send the update information to the client, so that the client's file directory can also be updated synchronously. The specific update process can be referred to Figure 5 shown.
[0086] Step S501, the server receives an update request for a dependent package (for example, may include package 1, package 2, ..., package n, etc.), and updates the file name and / or version number of the file to be called in response to the update request;
[0087] Step S502, generate update information according to the file name and / or version number of the updated file to be called, and send the update information to the client; when the client receives the update information, it can automatically update the file directory in the local disk according to the update information based on the established mapping relationship, so that the information of the file to be called called by all developers of the project is completely consistent, thereby avoiding the problem of abnormal system operation caused by inconsistent maintenance of package version information; at the same time, it can also avoid the problem of time cost waste caused by manual update.
[0088] The exemplary embodiment of the present invention also provides another file processing method, which is applied to a server, wherein the server is configured with a network file service system. Figure 6 As shown, the file processing method may further include steps S610 to S630. Among them:
[0089] In step S610, the script file of the file to be called installed by the client in the shared directory of the server is run to generate a file directory of the file to be called;
[0090] In step S620, based on the network file service system, the file directory of the to-be-called file is mounted to the local disk of the client, so that the client establishes a mapping relationship between the file directory of the to-be-called file and the file name and version number included in the script file in the local disk;
[0091] In step S630, when it is detected that the file directory of the file to be called is updated, update information is generated according to the updated file directory, and the update information is sent to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating the calling of the updated file directory from the local disk.
[0092] Figure 6The exemplary file processing method solves the problem in the prior art that when the version information of the dependent package is updated, if other developers of the project fail to update the version information of the local package in time, inconsistent version information will occur, resulting in system operation abnormalities during the development process, thereby reducing the development efficiency of the project, thereby improving the development efficiency of the project.
[0093] The following, combined Figure 7 The management method of the project dependency package of the exemplary embodiment of the present invention is further explained and illustrated. Figure 7 As shown, the project dependency package management method may include the following steps:
[0094] Step S710, create configuration file information in the project. Specifically, first, create package.json, which contains the name information and version information of the dependent package; then, create a batch file batch, which includes shell or bat files; finally, create npm_link.js, which can be used to traverse the package directory and update the batch file configuration.
[0095] Step S720, configure the server. First, the server configures the NFS (Network File System) service to provide the NFS service to the project developers; second, the directory MNT specified by the server is set as a shared directory; finally, the developer installs the specified version of the dependency package that the project depends on to the MNT directory of the server through NPM or YARN according to the dependency package of the project, and obtains the above file directory.
[0096] Step S730, configure the batch execution file batch. First, each line represents a mapping command for a package, which can be specifically as follows:
[0097] sudo npm link autod
[0098] sudo npm link egg-scripts
[0099] Secondly, execute this batch file through the spawn method of child_process in nodeJS to realize batch mapping of packages.
[0100] Step S740, configuring the local environment of the developers of the project.
[0101] First, the developer mounts the directory MNT (file directory) shared on the NFS server to the developer's local file system NFS_modules directory;
[0102] Secondly, developers download the project code to the local project directory through version control tools such as svn or git;
[0103] Then, the developer needs to write the storage path of the NFS_modules directory mounted locally into the npm_link.js file, as shown below:
[0104] / / Set the shared directory mounted locally
[0105] let NFS_modulesPWD=' / home / z1 / work / project / NFS_modules / node_modules / ';
[0106] Step S750, execute the npm_link.js file, create a batch mapping command for generating dependent packages, and update it to the batch file; after the npm_link package mapping command is generated, automatically execute the batch file and execute the batch mapping command;
[0107] Step S760, a node_modules directory is generated in the project, and the packages in the directory correspond one-to-one with the packages installed on the server, so that the system can be run for development without modifying the reference package path in the project file.
[0108] The project dependency package management method provided in the example embodiment of the present invention solves the problem of system operation abnormality caused by inconsistent maintenance of version information of local reference packages of developers by installing the front-end project dependency package on the server side, and then the developer establishes a mapping relationship between the dependency package of the local development environment and the installation package of the server side through script batch processing in the local environment.
[0109] The exemplary embodiment of the present invention further provides a file processing device, which is applied to a client, wherein a script file of a file to be called is configured in a local disk of the client. Figure 8 As shown, the file processing device may include a script file reading module 810, a mapping relationship establishing module 820 and a file directory updating module 830. Among them:
[0110] The script file reading module 810 can be used to read the script file of the file to be called, obtain the file name and version number of the file to be called, and update the file name and version number to the preset batch script file;
[0111] The mapping relationship establishment module 820 can be used to execute the updated batch script file and establish a mapping relationship between the file name and version number and the file directory in the local disk; wherein the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk;
[0112] The file directory update module 830 can be used to automatically update the file directory in the local disk according to the update information based on the mapping relationship when receiving the update information of the file directory sent by the server, so as to call the to-be-called file according to the updated file directory.
[0113] In an exemplary embodiment of the present disclosure, executing the updated batch script file to establish a mapping relationship between the file name and version number and the file directory in the local disk includes:
[0114] Obtaining a storage path of the file directory in the local disk, and writing the storage path into a preset mapping script file to obtain a mapping path;
[0115] The mapping commands in the updated batch processing script file are executed in batches, and a mapping relationship between the file name and version number and the file directory in the local disk is established based on the mapping path.
[0116] In an exemplary embodiment of the present disclosure, updating the file name and version number to a preset batch script file includes:
[0117] Creating a preset batch processing script file, and determining whether the file name and version number exist in the preset batch processing script file;
[0118] When it is determined that the file name and the version number do not exist in the preset batch processing script file, the file name and the version number that do not exist in the preset batch processing script file are updated into the preset batch processing script file.
[0119] In an exemplary embodiment of the present disclosure, mounting the file directory hosting the script file in the server to the local disk includes:
[0120] The file directory hosting the script file in the server is mounted to the local disk through the network file system service provided by the server.
[0121] In an exemplary embodiment of the present disclosure, the file processing device further includes:
[0122] The script file installation module can be used to install the script file of the file to be called into the server based on a preset management tool; wherein the preset management tool includes the NPM package manager and / or the YARN resource manager.
[0123] The exemplary embodiment of the present invention also provides another file processing device, which is applied to a server, wherein the server is configured with a network file service system. Fig. 9 As shown, the file processing device includes a script file running module 910, a script file mounting module 920 and an update information sending module 930. Among them:
[0124] The script file running module 910 may be used to run the script file of the file to be called installed by the client in the shared directory of the server, and generate the file directory of the file to be called;
[0125] The file directory mounting module 920 may be used to mount the file directory of the to-be-called file to the local disk of the client based on the network file service system, so that the client establishes a mapping relationship between the file directory of the to-be-called file and the file name and version number included in the script file in the local disk;
[0126] The update information sending module 930 can be used to generate update information based on the updated file directory when it detects that the file directory of the file to be called is updated, and send the update information to the client, so that the client can automatically update the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating the calling of the updated file directory from the local disk.
[0127] The specific details of each module in the above-mentioned file processing device have been described in detail in the corresponding file processing method, so they will not be repeated here.
[0128] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0129] In addition, although the steps of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0130] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above method is also provided.
[0131] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0132] Refer to the following Fig.10 The electronic device 1000 according to this embodiment of the present invention will be described. Fig.10 The electronic device 1000 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0133] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include, but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.
[0134] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 1The step S110 shown in is: reading the script file of the file to be called, obtaining the file name and version number of the file to be called, and updating the file name and version number to the preset batch script file; step S120: executing the updated batch script file, establishing a mapping relationship between the file name and version number and the file directory in the local disk; wherein, the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk; step S130: when receiving the update information of the file directory sent by the server, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so as to call the file to be called according to the updated file directory.
[0135] The processing unit 1010 may perform the following operations: Figure 6 The step S610 shown in the figure is: running the script file of the file to be called installed by the client in the shared directory of the server to generate the file directory of the file to be called; step S620: based on the network file service system, mounting the file directory of the file to be called to the local disk of the client, so that the client establishes a mapping relationship between the file directory of the file to be called and the file name and version number included in the script file in the local disk; step S630: when it is detected that the file directory of the file to be called is updated, generating update information according to the updated file directory, and sending the update information to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating the calling of the updated file directory from the local disk.
[0136] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202 , and may further include a read-only storage unit (ROM) 10203 .
[0137] The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0138] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0139] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or may communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0140] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0141] In an exemplary embodiment of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of this specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0142] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0143] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0144] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0145] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0146] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0147] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0148] Other embodiments of the invention will readily occur to those skilled in the art after considering the specification and practicing the invention invented herein. This application is intended to cover any variations, uses or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art that are not invented by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
Claims
1. A file processing method, characterized in that: Applied to a client, a script file of a file to be called is configured in the local disk of the client, and the file processing method includes: Read the script file of the file to be called, obtain the file name and version number of the file to be called, and update the file name and version number to a preset batch script file; Execute the updated batch script file, and establish a mapping relationship between the file name and version number and the file directory in the local disk; wherein the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk; When the update information of the file directory sent by the server is received, the file directory in the local disk is automatically updated according to the update information based on the mapping relationship, so as to call the to-be-called file according to the updated file directory.
2. The file processing method according to claim 1, characterized in that: The executing of the updated batch script file to establish a mapping relationship between the file name and version number and the file directory in the local disk includes: Obtaining a storage path of the file directory in the local disk, and writing the storage path into a preset mapping script file to obtain a mapping path; The mapping commands in the updated batch processing script file are executed in batches, and a mapping relationship between the file name and version number and the file directory in the local disk is established based on the mapping path.
3. The file processing method according to claim 1, characterized in that: The updating of the file name and version number to a preset batch script file includes: Creating a preset batch processing script file, and determining whether the file name and version number exist in the preset batch processing script file; When it is determined that the file name and the version number do not exist in the preset batch processing script file, the file name and the version number that do not exist in the preset batch processing script file are updated into the preset batch processing script file.
4. The file processing method according to claim 1, characterized in that: The step of mounting the file directory hosting the script file in the server to the local disk includes: The file directory hosting the script file in the server is mounted to the local disk through the network file system service provided by the server.
5. The file processing method according to claim 1, characterized in that: The file processing method further includes: Based on a preset management tool, the script file of the file to be called is installed in the server; wherein the preset management tool includes an NPM package manager and / or a YARN resource manager.
6. A file processing method, characterized in that: Applied to a server, wherein the server is equipped with a network file service system, the file processing method comprises: Run the script file of the file to be called installed by the client in the shared directory of the server to generate the file directory of the file to be called; Based on the network file service system, the file directory of the to-be-called file is mounted to the local disk of the client, so that the client establishes a mapping relationship between the file directory of the to-be-called file and the file name and version number included in the script file in the local disk; When it is detected that the file directory of the file to be called is updated, update information is generated according to the updated file directory, and the update information is sent to the client, so that the client automatically updates the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating the calling of the updated file directory from the local disk.
7. A file processing device, characterized in that: Applied to a client, a script file of a file to be called is configured in the local disk of the client, and the file processing device includes: A script file reading module is used to read the script file of the file to be called, obtain the file name and version number of the file to be called, and update the file name and version number to a preset batch script file; A mapping relationship establishment module, used to execute the updated batch script file and establish a mapping relationship between the file name and version number and the file directory in the local disk; wherein the file directory in the local disk is obtained by mounting the file directory hosting the script file in the server to the local disk; The file directory updating module is used to automatically update the file directory in the local disk according to the updated information based on the mapping relationship when receiving the updated information of the file directory sent by the server, so as to call the to-be-called file according to the updated file directory.
8. A file processing device, characterized in that: Applied to a server, wherein the server is provided with a network file service system, the file processing device comprises: A script file running module is used to run the script file of the file to be called installed by the client in the shared directory of the server to generate a file directory of the file to be called; A file directory mounting module, used for mounting the file directory of the to-be-called file to the local disk of the client based on the network file service system, so that the client establishes a mapping relationship between the file directory of the to-be-called file and the file name and version number included in the script file in the local disk; An update information sending module is used to generate update information according to the updated file directory when it detects that the file directory of the file to be called is updated, and send the update information to the client, so that the client can automatically update the file directory in the local disk according to the update information based on the mapping relationship, thereby facilitating the calling of the updated file directory from the local disk.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the file processing method according to any one of claims 1 to 6 is implemented.
10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the file processing method according to any one of claims 1 to 6 by executing the executable instructions.
