Method and device for developing and debugging page codes
By realizing real-time synchronization of local code and SaaS environment based on Webpack and WebSocket on the SaaS platform, the problem of difficult problem location and high time cost in page code debugging is solved, and fast and accurate code debugging and repair are achieved.
Patent Information
- Application Number
- CN202410874846.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-10-01
AI Technical Summary
During the development process of the SaaS platform, it is difficult to effectively debug the page code with existing technology, resulting in difficulty in problem location, long debugging chain, and increased time costs.
By building a software engineering scaffolding based on Webpack and combining it with WebSocket to achieve two-way communication between local code and the SaaS environment, code changes can be synchronized in real time, eliminating the need to repeat the packaging and uploading process, allowing direct code repair and debugging, and locating specific locations through error messages.
Real-time rendering of local code modifications to the page code development platform is realized, which simplifies problem location, significantly improves the efficiency of code development and debugging, and saves time and cost.
Smart Images

Figure CN118733465A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for developing and debugging page codes. Background Art
[0002] In some platforms developed based on SaaS (Software as a Service, software delivery model), multiple independent components are used to build business pages or expand business capabilities based on platform capabilities. Common scenarios include low-code visualization platforms, data middle-end applets and other platforms. In the past, local development was mostly based on the software development kit or software engineering scaffolding provided by the SaaS platform, but the test scenarios were relatively simple during the development process, and in some cases the test scope could not cover the entire scope. When the SaaS platform is actually used, unexpected problems may occur when used in combination with other components, and the error log is not comprehensive. At this time, the chain for fixing the problem will be relatively long, and it is necessary to locally predict the problem points, package and upload them, or perform log burial for investigation, which increases the time cost. In summary, the existing page code debugging method is difficult to locate problems, and the debugging chain is long, which increases the debugging time cost. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method and device for developing and debugging page code, which can achieve the purpose of presenting the local code to the page code development platform in real time after modification. Because the local code is directly linked to the page code development platform SaaS presentation effect, the process of repeated packaging and uploading is omitted, and the code can be directly repaired and debugged. In addition, the error information will also index the specific location of the local code, so the problem is located simply and accurately, which greatly improves the efficiency of code development and debugging and saves the time cost of code development and debugging.
[0004] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a method for developing and debugging page code is provided, comprising: in response to receiving a development and debugging notification sent by a software engineering scaffold after the compilation of the page code is completed, obtaining the storage path of the page code, the page code including component code corresponding to no less than one component to be tested; obtaining the component identifier to be tested, and loading the component code corresponding to the component to be tested according to the storage path of the page code and the component identifier to be tested; performing page rendering and display according to the component code corresponding to the component to be tested, and performing development and debugging of the page code according to the page rendering and display result.
[0005] Optionally, the software engineering scaffolding is built based on Webpack; when the software engineering scaffolding detects that the page code is written based on the Webpack plug-in or monitors that the page code status has changed and triggers a specified function in the Webpack plug-in, it determines that the page code has changed and compiles the changed page code.
[0006] Optionally, the development debugging notification includes the compilation status of the page code, the compilation status is obtained through the Webpack plug-in, and the compilation status includes an initial compilation status and a hot update status.
[0007] Optionally, when the compilation state is the initial compilation state, the storage path of the page code is obtained through the software engineering scaffolding, and the path configuration of the component to be tested is performed according to the storage path.
[0008] Optionally, the method further comprises: in response to executing a start debugging instruction in a code editor of the page code development platform, building a software engineering scaffolding, and starting a communication service between the page code development platform and the software engineering scaffolding.
[0009] Optionally, in response to executing a startup debugging instruction in a code editor of a page code development platform, building a software engineering scaffolding includes: in response to executing a startup debugging instruction in a code editor of a page code development platform, prompting a user to enter a verification key; performing user identity verification based on the verification key entered by the user, and building the software engineering scaffolding after the verification passes.
[0010] Optionally, page rendering and display are performed according to the component code corresponding to the component to be tested, including: obtaining the component code corresponding to the component that does not need to be debugged from a page code development platform; and page rendering and display are performed according to the component code corresponding to the component to be tested and the component code corresponding to the component that does not need to be debugged.
[0011] According to another aspect of an embodiment of the present invention, a development and debugging device for page code is provided, comprising: a storage path acquisition module, for obtaining the storage path of the page code in response to receiving a development and debugging notification sent by a software engineering scaffold after the page code is compiled, wherein the page code includes component code corresponding to no less than one component to be tested; a component code loading module, for obtaining an identification of the component to be tested, and loading the component code corresponding to the component to be tested according to the storage path of the page code and the identification of the component to be tested; a page rendering and display module, for performing page rendering and display according to the component code corresponding to the component to be tested, and performing development and debugging of the page code according to the page rendering and display result.
[0012] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the page code development and debugging method provided by an embodiment of the present invention.
[0013] According to another aspect of an embodiment of the present invention, a computer readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for developing and debugging page codes provided in an embodiment of the present invention is implemented.
[0014] An embodiment of the above invention has the following advantages or beneficial effects: by responding to the development and debugging notification sent by the software engineering scaffold after the compilation of the page code is completed, the storage path of the page code is obtained, and the page code includes no less than the component code corresponding to the component to be tested; the component identifier to be tested is obtained, and the component code corresponding to the component to be tested is loaded according to the storage path of the page code and the component identifier to be tested; the page is rendered and displayed according to the component code corresponding to the component to be tested, and the technical solution of developing and debugging the page code is performed according to the page rendering display result, which realizes the purpose of presenting the local code to the page code development platform in real time after modification. Because the local code is directly linked to the SaaS presentation effect of the page code development platform, the process of repeated packaging and uploading is omitted, and the code can be directly repaired and debugged, and the error information will also index the specific location of the local code, so the problem is simple and accurate, which greatly improves the efficiency of code development and debugging and saves the time cost of code development and debugging.
[0015] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0017] Figure 1 Schematic diagram of main steps of a method for developing and debugging page code according to an embodiment of the present invention;
[0018] Figure 2 It is a schematic diagram of the implementation process of the webpack software engineering scaffolding of an embodiment of the present invention;
[0019] Figure 3 It is a schematic diagram of a page rendering process according to an embodiment of the present invention;
[0020] Figure 4 Schematic diagram of main modules of a device for developing and debugging page code according to an embodiment of the present invention;
[0021] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0022] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0024] In the introduction of the embodiments of the present invention, the professional terms and their definitions are as follows:
[0025] SaaS, short for "Software as a Service", refers to a software delivery model where users access applications over the Internet without installing, maintaining or managing the software. In the SaaS model, the software provider is responsible for maintaining and updating the application, and users only need to access and use the software through a browser or other means. This model usually provides services on a subscription basis;
[0026] Scaffolding: It is a metaprogramming method. The programmer writes a specification to describe how to use the database. Then the compiler scaffolding generates the corresponding code based on the specification to perform database operations such as adding, deleting, modifying, and checking, so as to build powerful applications more efficiently on the scaffolding. In the field of software engineering, scaffolding can be interpreted as development tools and development frameworks that help developers in the development process. With scaffolding, you don't have to build or write the underlying software from scratch;
[0027] webpack is a code compilation tool with entry, exit, loader and plug-in. webpack is a static module packaging tool for modern JavaScript applications. When webpack processes an application, it builds a dependency graph internally, which maps out each module required by the application and generates one or more JavaScript files;
[0028] WebSocket is a network communication protocol that provides full-duplex communication over a single TCP connection. This means that the server and client can send and receive information at the same time, which is very useful in real-time applications. The WebSocket protocol is part of the HTML5 specification and aims to provide a standardized way for web pages to communicate with servers in real time, two-way, over a persistent connection.
[0029] In order to solve the technical problems existing in the prior art, the present invention provides a method and device for developing and debugging page codes, which builds a software engineering scaffold based on webpack and adds a startup instruction. This instruction is mainly based on the webpack compilation mechanism and cooperates with WebSocket to realize two-way communication between the local and SaaS environments, so that webpack automatically compiles the latest code after the local code is modified, and notifies the client through WebSocket after the compilation is completed. After the WebSocket client in the SaaS environment receives the update mark, it reloads the local code through Js Loader, thereby achieving the purpose of presenting the local code to the SaaS environment in real time after the modification. Because the local code is directly linked to the SaaS presentation effect, the process of repeated packaging and uploading is omitted, and it can be directly repaired and tested, and the error information will also index the specific location of the local code, which greatly improves the efficiency of debugging and repair.
[0030] Figure 1 1 is a schematic diagram of the main steps of the page code development and debugging method according to an embodiment of the present invention. According to the embodiment of the present invention, the page code development and debugging method mainly includes the following steps S101 to S103.
[0031] Step S101: in response to receiving a development debugging notification sent by a software engineering scaffold after completing the compilation of a page code, obtaining a storage path of the page code, wherein the page code includes component code corresponding to at least one component to be tested.
[0032] According to one embodiment of the present invention, the software engineering scaffolding is built based on Webpack; when the software engineering scaffolding detects that the page code is written based on the Webpack plug-in or monitors that the page code status has changed and triggers a specified function in the Webpack plug-in, it determines that the page code has changed and compiles the changed page code.
[0033] According to one of the embodiments of the present invention, the development debugging notification includes the compilation status of the page code, the compilation status is obtained through the Webpack plug-in, and the compilation status includes an initial compilation status and a hot update status.
[0034] Webpack is a static module bundler for modern JavaScript applications. When Webpack processes an application, it internally builds a dependency graph that maps out each module required by the application and generates one or more JavaScript files.
[0035] Here are some key points about Webpack:
[0036] 1. Module concept: In Webpack, everything is considered a module, including JavaScript, CSS (Cascading Style Sheets), images and other files. Webpack will analyze the dependencies between these files;
[0037] 2. Entry: The entry tells Webpack which file to start building its internal dependency graph from. Webpack will start from this entry file and find all the dependent components of the application;
[0038] 3. Output: The output property tells Webpack where to output the data package files it creates and how to name these files;
[0039] 4. Loaders: Webpack itself can only understand JavaScript and JSON (JavaScript Object Notation, JS Object Notation) files. Loaders allow Webpack to process other types of files and convert them into valid modules for application use and addition to the dependency graph;
[0040] 5. Plugins: Plugins can be used to perform a variety of tasks, such as packaging optimization, resource management, and environment variable injection. Using plugins allows you to add custom processing logic during the build process.
[0041] Through the above functions and configuration options, Webpack can efficiently manage and package various resources in large front-end projects.
[0042] In an embodiment of the present invention, a software engineering scaffold is built based on Webpack, and a building instruction "widget" is added, wherein widget is a small component of a window. This instruction mainly handles the following items: using a Webpack plug-in to write a code file that conforms to the building logic of a page code development platform; turning on the webpack monitoring function "watch", after which the code is modified, it will re-trigger the compilation success hook function, wherein the hook function refers to a function in the Webpack plug-in, which will be executed after the webpack is started or the monitored code changes; registering the webpack plug-in, based on adding processing logic to the compilation success hook function, first determine whether the initialization is completed based on the compilation status, if the initialization of the compilation status is completed, output the basic information of the component and the URL of the local service and identify the compilation status as the initial compilation status, otherwise push the compilation status as a hot update status based on the WebSocket service, based on which the page code development platform SaaS platform is notified that the local code has been updated, thereby realizing the operation of re-pulling the page code. The basic component information includes, for example, the component number and version number, which are used to identify the uniqueness of the component; the local service refers to the storage path of the page code, such as an address such as http: / / localhost:3000, through which all JavaScript files obtained after the page code is compiled can be accessed.
[0043] WebSocket is a network communication protocol that provides full-duplex communication over a single TCP connection. This means that the server and client can send and receive information at the same time, which is very useful in real-time applications. The WebSocket protocol is part of the HTML5 specification and aims to provide a standardized way for web pages to communicate with servers in real time through persistent connections. Here are a few important features about WebSocket:
[0044] 1. Full-duplex communication: WebSocket allows the server and client to exchange information at the same time, which is a major difference from traditional HTTP requests (based on the request-response model);
[0045] 2. Real-time: Since WebSocket provides a persistent connection, it can achieve real-time data transmission, which is critical for applications such as chat applications, online games, and real-time data streaming;
[0046] 3. Persistent connection: Once a WebSocket connection is established, it remains open until the client or server decides to close the connection. This persistence reduces the repeated handshakes required to establish a connection, thereby reducing latency.
[0047] The WebSocket protocol has become increasingly popular in modern network applications due to its low latency and real-time performance, and is particularly suitable for scenarios that require fast, real-time interaction. The present invention is mainly based on the characteristics of WebSocket, and creates a server when webpack starts, which is used to push the compilation status "initial compilation status", "hot update status", etc. to the page code development platform SaaS platform. Specifically, a development and debugging notification can be generated according to the compilation status of the page code, and the development and debugging notification can be sent to the page code development platform SaaS platform. After receiving the development and debugging notification, the page code development platform SaaS platform obtains the storage path of the page code, that is, the local service address mentioned above, such as http: / / localhost:3000.
[0048] According to an embodiment of the present invention, when the compilation state is the initial compilation state, the storage path of the page code is obtained through the software engineering scaffold, and the path of the component to be tested is configured according to the storage path. When the compilation state is the hot update state, since the storage path of the page code has been obtained from the software engineering scaffold in the initial compilation state, the storage path of the page code can be directly obtained from the SaaS platform or the cache of the SaaS platform.
[0049] In the specific implementation process, since building a large screen usually requires many components to be assembled to form a "delivery page", the page code can include component codes corresponding to the multiple components. When developing and debugging the code, you can only debug the component code of some of the components, and these components are the components to be tested. After obtaining the storage path of the page code through the software engineering scaffolding, you can configure the path of the component to be tested according to the storage path on the SaaS platform, so as to load the component code of the component to be tested from the storage path through JS Loder. For components that do not need to be debugged, you can directly obtain the corresponding component code loaded by the SaaS platform from the page code development platform.
[0050] Step S102: Obtain the component identifier to be tested, and load the component code corresponding to the component to be tested according to the storage path of the page code and the component identifier to be tested. In this step, the component code corresponding to the component to be tested is loaded from the storage path of the page code, so as to achieve the purpose of presenting the local code to the SaaS environment in real time after modification.
[0051] Step S103: Render and display the page according to the component code corresponding to the component to be tested, and develop and debug the page code according to the page rendering and display result.
[0052] According to another embodiment of the present invention, the method further includes: in response to executing a start debugging instruction in a code editor of the page code development platform, building a software engineering scaffolding, and starting a communication service between the page code development platform and the software engineering scaffolding.
[0053] According to one embodiment of the present invention, in response to executing a startup debugging instruction in a code editor of a page code development platform, building a software engineering scaffolding may specifically include: in response to executing a startup debugging instruction in a code editor of a page code development platform, prompting a user to enter a verification key; performing user identity verification based on the verification key entered by the user, and building a software engineering scaffolding after the verification passes.
[0054] In the specific implementation process, for starting debugging, right-click on the component in the SaaS platform editing and delivery page to obtain the component token value (verification key). This value can be processed by any encryption means, as long as the scaffolding can be decrypted according to the encryption logic; after obtaining the token, execute the Node command (npm runwidget, start debugging) in VSCode (code editor), and then the developer will be prompted to enter the token. If the verification is successful, the software engineering scaffolding will be built. If the verification fails, the reason for the failure will be notified and the execution will end. If the verification is successful, the webpack build will be started and the WebSocket service will be enabled. If the build is successful, the component information and the URL of the local service will be output. The developer copies the URL of the local service and configures the path of the component that needs to be debugged in the SaaS environment. After configuration, the local code will be loaded through JS Loder when rendering the delivery page.
[0055] For hot update debugging, since the watch monitoring function in webpack is enabled, the developer will re-execute the code compilation hook function (CompileSucceed) when modifying the code. If the compilation status is no longer the initial compilation status, the hot update status will be triggered. WebSocket will push this compilation status to the SaaS environment. When the SaaS environment receives this compilation status, it will re-execute Js Loder and reload the component code of the local component to be tested to achieve the purpose of hot update.
[0056] According to another embodiment of the present invention, rendering and displaying a page according to the component code corresponding to the component to be tested includes: obtaining the component code corresponding to the component that does not need to be debugged from a page code development platform; and rendering and displaying the page according to the component code corresponding to the component to be tested and the component code corresponding to the component that does not need to be debugged. When rendering and displaying the page, in order to facilitate the presentation of the overall effect of the page, the component codes corresponding to the component to be tested and the component that does not need to be tested can be loaded and then rendered together to obtain the overall display effect of the page.
[0057] Figure 2 1 is a schematic diagram of the implementation process of the webpack software engineering scaffolding of an embodiment of the present invention. Figure 2 As shown, in the embodiment of the present invention, the implementation process of the webpack software engineering scaffolding mainly includes: executing the instruction widget, building the webpack configuration, and starting the webpack listener to execute the callback after the code is compiled, and marking the compilation status. Then, register the webpack plug-in and start the WebSocket service. When the compilation status is the initial compilation status, it means the initial startup of the project and outputs the component information; when the compilation status is not the initial compilation status, the WebSocket service marks the hot update status, based on which the SaaS platform is notified that the local code has been updated, thereby achieving the operation of re-pulling the code.
[0058] Figure 3 FIG. 1 is a schematic diagram of a page rendering process according to an embodiment of the present invention. Figure 3 As shown, the two actions of driver debugging and hot update can run through the entire flow chart.
[0059] 1. Start debugging: Right-click on the component in the SaaS editing and delivery page to obtain the component token value. This value can be processed by any encryption method as long as the scaffolding can be decrypted according to the encryption logic; after obtaining the token, execute the Node command (npm run widget) in VSCode, and then the developer will be prompted to enter the token for verification. If the verification is successful, the build will be executed. If it fails, the failure reason will be notified and the execution will end; if the verification is successful, the webpack build will be started and the WebSocket service will be enabled. If the build is successful, the component information will be output, including the URL of the local service. Copy the URL of the local service and configure the path of the component that needs to be debugged in the SaaS environment. After configuration, the local code will be loaded through JS Loder when rendering the delivery page.
[0060] 2. Hot update: Since the watch in webpack is turned on, the developer will re-execute the code compilation hook function (CompileSucceed) when modifying the code. If the compilation status is no longer the initial compilation status, the hot update status will be triggered. WebSocket will push this status to the SaaS environment to notify the SaaS platform that the local code has been updated. When the SaaS environment receives this notification, it will re-execute Js Loder and reload the local code to achieve the purpose of hot update.
[0061] Figure 4 400 is a schematic diagram of the main modules of the page code development and debugging device according to an embodiment of the present invention. According to an embodiment of the present invention, the page code development and debugging device 400 mainly includes a storage path acquisition module 401, a component code loading module 402 and a page rendering and display module 403.
[0062] The storage path acquisition module 401 is used to obtain the storage path of the page code in response to receiving the development debugging notification sent by the software engineering scaffold after the page code is compiled, and the page code includes component code corresponding to at least one component to be tested;
[0063] The component code loading module 402 is used to obtain the identification of the component to be tested, and load the component code corresponding to the component to be tested according to the storage path of the page code and the identification of the component to be tested;
[0064] The page rendering and display module 403 is used to render and display the page according to the component code corresponding to the component to be tested, and to develop and debug the page code according to the page rendering and display result.
[0065] According to one embodiment of the present invention, the software engineering scaffolding is built based on Webpack; when the software engineering scaffolding detects that the page code is written based on the Webpack plug-in or monitors that the page code status has changed and triggers a specified function in the Webpack plug-in, it determines that the page code has changed and compiles the changed page code.
[0066] According to another embodiment of the present invention, the development debugging notification includes the compilation status of the page code, the compilation status is obtained through the Webpack plug-in, and the compilation status includes an initial compilation status and a hot update status.
[0067] According to yet another embodiment of the present invention, when the compilation state is the initial compilation state, the storage path of the page code is obtained through the software engineering scaffolding, and the path configuration of the component to be tested is performed according to the storage path.
[0068] According to another embodiment of the present invention, the page code development and debugging device 400 also includes a scaffolding construction module (not shown in the figure), which is used to: in response to executing a start debugging instruction in the code editor of the page code development platform, build a software engineering scaffolding, and start the communication service between the page code development platform and the software engineering scaffolding.
[0069] According to another embodiment of the present invention, a scaffolding construction module (not shown in the figure) can be specifically used to: in response to executing a start debugging instruction in a code editor of a page code development platform, prompt the user to enter a verification key; perform user identity verification based on the verification key entered by the user, and after the verification passes, build a software engineering scaffolding.
[0070] According to another embodiment of the present invention, the page rendering and display module 403 can also be used to: obtain the component code corresponding to the component that does not need to be debugged from the page code development platform; and perform page rendering and display according to the component code corresponding to the component to be tested and the component code corresponding to the component that does not need to be debugged.
[0071] According to the technical solution of the embodiment of the present invention, by responding to the development and debugging notification sent by the software engineering scaffold after the compilation of the page code is completed, the storage path of the page code is obtained, and the page code includes component code corresponding to no less than one component to be tested; the component identifier to be tested is obtained, and the component code corresponding to the component to be tested is loaded according to the storage path of the page code and the component identifier to be tested; the page is rendered and displayed according to the component code corresponding to the component to be tested, and the development and debugging of the page code is performed according to the page rendering and display results. The technical solution realizes the purpose of presenting the local code to the page code development platform in real time after modification. Because the local code is directly linked to the SaaS presentation effect of the page code development platform, the process of repeated packaging and uploading is omitted, and the code can be directly repaired and debugged, and the error information will also index the specific location of the local code, so the problem is simple and accurate, which greatly improves the efficiency of code development and debugging and saves the time cost of code development and debugging.
[0072] Figure 5 An exemplary system architecture 500 is shown to which the page code development and debugging method or the page code development and debugging apparatus according to the embodiment of the present invention can be applied.
[0073] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0074] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0075] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0076] Server 505 can be a server that provides various services, such as a background management server that provides support for the code development website browsed by the user using the terminal devices 501, 502, and 503 (for example only). The background management server can respond to the received page code development and debugging request and other data by receiving the development and debugging notification sent by the software engineering scaffold after the page code is compiled, obtaining the storage path of the page code, the page code includes no less than the component code corresponding to the component to be tested; obtaining the component to be tested identification, and loading the component code corresponding to the component to be tested according to the storage path of the page code and the component to be tested identification; performing page rendering and display according to the component code corresponding to the component to be tested, and performing page code development and debugging and other processing according to the page rendering and display results, and feeding back the processing results (such as page rendering and display results - for example only) to the terminal device.
[0077] It should be noted that the page code development and debugging method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the page code development and debugging device is generally disposed in the server 505 .
[0078] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0079] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 6 The terminal device or server 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.
[0080] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0081] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0082] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0083] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-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 of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0084] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0085] The units or modules involved in the embodiments of the present invention may be implemented in software or in hardware. The units or modules described may also be provided in a processor. For example, they may be described as follows: a processor includes a storage path acquisition module, a component code loading module, and a page rendering and display module. Among them, the names of these units or modules do not constitute limitations on the units or modules themselves in certain circumstances. For example, the page rendering and display module may also be described as "a module for performing page rendering and display according to the component code corresponding to the component to be tested, and developing and debugging the page code according to the page rendering and display results".
[0086] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: in response to receiving a development and debugging notification sent by the software engineering scaffold after the page code is compiled, the storage path of the page code is obtained, and the page code includes component code corresponding to no less than one component to be tested; the component to be tested identifier is obtained, and the component code corresponding to the component to be tested is loaded according to the storage path of the page code and the component to be tested identifier; the page is rendered and displayed according to the component code corresponding to the component to be tested, and the page code is developed and debugged according to the page rendering display result.
[0087] According to the technical solution of the embodiment of the present invention, by responding to the development and debugging notification sent by the software engineering scaffold after the compilation of the page code is completed, the storage path of the page code is obtained, and the page code includes component code corresponding to no less than one component to be tested; the component identifier to be tested is obtained, and the component code corresponding to the component to be tested is loaded according to the storage path of the page code and the component identifier to be tested; the page is rendered and displayed according to the component code corresponding to the component to be tested, and the development and debugging of the page code is performed according to the page rendering and display results. The technical solution realizes the purpose of presenting the local code to the page code development platform in real time after modification. Because the local code is directly linked to the SaaS presentation effect of the page code development platform, the process of repeated packaging and uploading is omitted, and the code can be directly repaired and debugged, and the error information will also index the specific location of the local code, so the problem is simple and accurate, which greatly improves the efficiency of code development and debugging and saves the time cost of code development and debugging.
[0088] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for developing and debugging page code. It is characterized in that include: In response to receiving a development debugging notification sent by the software engineering scaffold after the page code is compiled, obtaining a storage path of the page code, wherein the page code includes component code corresponding to at least one component to be tested; Obtaining an identification of the component to be tested, and loading a component code corresponding to the component to be tested according to the storage path of the page code and the identification of the component to be tested; The page is rendered and displayed according to the component code corresponding to the component to be tested, and the page code is developed and debugged according to the page rendering and display results.
2. The method according to claim 1, It is characterized in that The software engineering scaffolding is built based on Webpack; When the software engineering scaffold detects that the page code is written based on the Webpack plug-in or monitors that the page code state changes and triggers the specified function in the Webpack plug-in, it determines that the page code has changed and compiles the changed page code.
3. The method according to claim 2, It is characterized in that The development debugging notification includes the compilation status of the page code, and the compilation status is obtained through the Webpack plug-in. The compilation status includes an initial compilation status and a hot update status.
4. The method according to claim 3, It is characterized in that When the compilation state is the initial compilation state, the storage path of the page code is obtained through the software engineering scaffold, and the path configuration of the component to be tested is performed according to the storage path.
5. The method according to claim 1, It is characterized in that The method further comprises: In response to executing a start debugging instruction in a code editor of a page code development platform, a software engineering scaffold is constructed, and a communication service between the page code development platform and the software engineering scaffold is started.
6. The method according to claim 5, It is characterized in that In response to executing a start debugging instruction in a code editor of a page code development platform, a software engineering scaffold is constructed, including: In response to executing a start debugging instruction in a code editor of a page code development platform, prompting a user to enter a verification key; Perform user identity verification based on the verification key entered by the user, and build the software engineering scaffolding after the verification passes.
7. The method according to claim 1, It is characterized in that Rendering and displaying the page according to the component code corresponding to the component under test includes: Obtaining component codes corresponding to the components that do not need to be debugged from the page code development platform; The page is rendered and displayed according to the component code corresponding to the component to be tested and the component code corresponding to the component that does not need to be debugged.
8. A device for developing and debugging page code, It is characterized in that include: A storage path acquisition module, configured to acquire a storage path of the page code in response to receiving a development debugging notification sent by the software engineering scaffold after the page code is compiled, wherein the page code includes component code corresponding to at least one component to be tested; A component code loading module, used to obtain the identification of the component to be tested, and load the component code corresponding to the component to be tested according to the storage path of the page code and the identification of the component to be tested; The page rendering and display module is used to perform page rendering and display according to the component code corresponding to the component to be tested, and to develop and debug the page code according to the page rendering and display results.
9. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Page debugging method and device, equipment and storage medium
CN119046175A
A page debugging method, device, equipment and storage medium
CN119046175B
Webpage online updating method and device, equipment and storage medium
CN119376767A
