Development Setup¶
Dependencies¶
To ensure a smooth development process, the following libraries and frameworks are essential:
- Vue.js : The core framework. Ensure you have the latest stable version.
- Vuex : For state management within Vue.js.
- Vue Router : For managing navigation within the application.
- Axios : For making HTTP requests to the API.
- Node.js : The runtime environment for executing JavaScript code server-side.
- Webpack : For module bundling.
- Babel : For JavaScript compilation.
- ESLint : For code linting and maintaining coding standards.
- Jest : For unit testing.
- Sass : For advanced styling capabilities.
Environment Setup¶
Setting up your development environment involves the following steps:
-
Install Node.js and npm :
- Download and install Node.js from nodejs.org.
- npm (Node Package Manager) comes bundled with Node.js.
- Verify installation by running
node -v
andnpm -v
in your terminal.
-
Clone or Download Source Code:
-
Clone the RoCS App repository or download the source code archive:
-
-
Project Packaging:
- Open a terminal and navigate to the project root directory.
-
Execute the following command to package the project:
-
Open Hbuilder and Create a New Project:
- Open Hbuilder and create a new project.
- Choose project type as "5+App."
- Set the project name and location as desired.
-
Project Setup:
- After project creation, retain the
unpackage
folder andmanifest.json
. - Replace all files in the new project (except
unpackage
andmanifest.json
) with the contents of thedist
folder generated during the build.
- After project creation, retain the
-
Configure
manifest.json
:- Open
manifest.json
and configure it according to your requirements.
- Open
-
Cloud Build:
- In Hbuilder, navigate to
Build
->Mobile App - Cloud Packaging
. - Wait for the APK generation process to complete.
- In Hbuilder, navigate to
-
Final Steps:
- Once the build is finished, you will find the generated APK in the specified output directory.
Note
This guide assumes familiarity with Hbuilder and the basics of 5+App development.
Customize the manifest.json
file to meet your specific application requirements.
The provided source code serves as a reference project, and developers are encouraged to modify it according to your needs.
Running Locally¶
To run the application locally:
-
Local Development Server :
- Execute
npm run serve
in the terminal. This command starts a local development server. - The application will be hosted at
http://localhost:8080
by default. You can access it using a web browser.
- Execute
-
Live Reloading :
- The local server comes with hot-reloading. Any changes made to the source code will automatically refresh the application in the browser.
-
Accessing Application Features :
- Test different features like robot control and system settings as they would function in the production environment.
-
Running Unit Tests :
- Execute
npm run test
to run unit tests. This ensures your local changes haven't broken existing functionalities.
- Execute
-
Linting Code :
- Run
npm run lint
to identify and fix linting issues, ensuring code consistency.
- Run
Following these steps will set up a robust development environment, enabling you to efficiently develop, test, and debug the application.