This repository contains an Odoo Owl/Capacitor project.
The following sections outline instructions on the proper use of the provided scripts, as well as the errors you may encounter when setting up a new project and how to deal with them.
To install the npm dependencies required for the development of the web app, run:
npm install
These commands run the application on android, but it can also be done with ios if the platform is installed properly.
# Builds and syncs the application
npm run build && npx cap sync
# Runs the app (android)
npx cap run android
# Runs the app (iOS)
npx cap run iosFor a more convenient way of building, syncing and running the application, check out the BSR Script section.
Sometimes, you might want to remove the node_modules folder and reinstall the npm packages to solve issues.
Caution
When deleting node_modules, you are preventing the npm packages, such as @odoo/owl or @capacitor/app from working until they are reinstalled.
# Delete node_modules
rm -rf node_modules
# Reinstall packages
npm installTo only uninstall packages that aren't actual depencencies from node_modules, you can run the prune command.
npm prune
The project uses Vitest for unit testing.
From the repository root:
./mobile/run_tests.shOr directly from inside erplibre_home_mobile:
npm testTest files are located in src/__tests__/:
| File | Coverage |
|---|---|
appService.test.ts |
CRUD applications, initialization regression |
databaseService.test.ts |
SQLite operations (applications, notes) |
dataMigration.test.ts |
SecureStorage → SQLite migration |
migrationService.test.ts |
Migration runner, version storage |
migrationPopup.test.ts |
Migration notification dialog |
noteService.test.ts |
CRUD notes, tags, intents |
Capacitor plugins are mocked under src/__mocks__/:
| Mock | Purpose |
|---|---|
capacitor-secure-storage-plugin.ts |
In-memory key/value store |
@capacitor/dialog.ts |
Stubbed alert/confirm |
@capacitor/core.ts |
Stubbed Capacitor core |
@capacitor-community/sqlite.ts |
In-memory SQLite via sql.js |
@odoo/owl.ts |
Stubbed Owl EventBus |
BSR means Build, Sync and Run, common actions during development. Since you'll often need to build the application and launch it on specific devices, this script was built to make this workflow faster.
Here are the commands
npm run bsr: Builds the app and starts it on localhost (web)
npm run bsr web: Same as npm run bsr
npm run bsr ios: Builds and syncs the app, then runs it on an iOS device.
npm run bsr android: Builds and syncs the app, then runs it on an android device.
This section provices details on the GenComp script.
GenComp means Generate Component. The Script allows you to generate a boilerplate Owl component so you can start programming component features faster.
npm run gencomp <name>: Generates the component in the components folder
npm run gencomp <name> <path>: Generates the component in the provided folder
npm run gencomp <name> <path> <add-css>: Generates the component in the provided folder, and omits the CSS file if add-css is set to false.
Name of the component, will have "Component" appended to it automatically.
Path of the component relative to the components folder.
A path of notes/item will create the component in src/components/notes/item.
Optional parameter.
If set to false, the CSS file will not be created and it will not be added to the imports in src/css/components.scss.
Optional parameter.
npm run gencomp noteItem notes/item false will create the component NoteItem in src/components/notes/item without the CSS file.
This section provides details on the provided shell scripts to help you better understand them and use them in appropriate situations.
Expand
Generalized script to create an Odoo Owl/Capacitor project and add a specific platform. If no platform argument is specified, defaults to adding the Android platform and therefore behaves like create-android.sh.
Creates an Odoo Owl/Capacitor project and adds the Android platform.
Creates an Odoo Owl/Capacitor project and adds the iOS platform.
Adds the Android platform to the project.
Adds the iOS platform to the project.
Builds the Capacitor project. Creates a signed Android executable application.
Builds the Capacitor project. Creates a signed iOS executable application.
Copies the built Odoo Owl project to all platforms and updates the native plugins and dependencies in package.json.
This section outlines the errors that may be faced when trying to initialize a new Odoo Owl/Capacitor project by using the scripts from the previous sections or by manually entering the appropriate commands. The solutions to these errors will also be provided.
Expand
error: Signing for "App" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'App' from project 'App')
https://forum.ionicframework.com/t/ionic-capacitor-failed-ios-build/177400/2