Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM modules & More #2285

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ npm-debug.log
npm-debug.log
inav-configurator.iml
/out
/.vite
.eslintrc.json
/.project
/cache/
Expand All @@ -16,4 +17,4 @@ inav-configurator.iml
*.swp
*.bak
eeprom.bin
yarn.lock
yarn.lock
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"args": ["--inspect"],
"env": {
"NODE_ENV": "development",
"NODE_PATH": "${workspaceFolder}/js/"
"NODE_PATH": "${workspaceFolder}/js/",
"DEV_TOOLS_MODE": "undocked" // left, right, bottom, undocked, detach
},
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ sudo mv inav-configurator.desktop /usr/share/applications/
For local development, the **node.js** build system is used.

1. Install node.js
1. From the project folder run `yarn install` and then `npm install`
1. To build the and start the configurator:
1. From the project folder run `npm install` and then `npm install`
1. To build the and start the configurator:
- Run `npm start`.

To build the App run `npm run make` to build for your platform.
Expand Down Expand Up @@ -114,7 +114,9 @@ To be able to open Inspector, set environment variable `NODE_ENV` to `developmen

```NODE_ENV=development npm start``` or ```$env:NODE_ENV="development" | npm start``` for Windows PowerShell

Or use vscode and start a debug session `Debug Configurator` (Just hit F5!)
Or use VScode and start a debug session `Debug Configurator` (Just hit F5!)

To debug the main thread (source files in `js/main`), just set a breakpoint in VScode.

## Different map providers

Expand Down
58 changes: 40 additions & 18 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
const path = require('path');
const fs = require('fs');
import path from 'node:path';
import fs from 'node:fs';
import { fileURLToPath } from 'node:url';

module.exports = {
const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default {
packagerConfig: {
executableName: "inav-configurator",
asar: false,
icon: 'images/inav',
ignore: [
"^(\/\.vscode$)",
"^(\/support$)",
".gitattributes",
".gitignore",
"3D_model_creation.md",
"LICENSE",
"MAPPROXY.md",
"package-lock.json",
"README.md",
"inav_icon_128.psd",
]
},
rebuildConfig: {},
plugins: [
{
name: '@electron-forge/plugin-vite',
config: {
build: [
{
entry: 'js/main/main.js',
config: 'vite.main.config.js',
},
{
entry: 'js/main/preload.js',
config: 'vite.preload.config.js',
},
{
entry: 'js/libraries/bluetooth-device-chooser/bt-device-chooser-preload.js',
config: 'vite.preload.config.js',
},
],
renderer: [
{
name: 'bt_device_chooser',
config: 'vite.bt-dc-renderer.config.js',
},
{
name: 'main_window',
config: 'vite.main-renderer.config.js',
},
],
},
},
],
hooks: {
// Uniform artifact file names
postMake: async (config, makeResults) => {
Expand All @@ -31,9 +54,8 @@ module.exports = {
console.log('Artifact: ' + newPath);
});
});
}
},
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-wix',
Expand All @@ -48,7 +70,7 @@ module.exports = {
appUserModelId: "com.inav.configurator",
icon: path.join(__dirname, "./assets/windows/inav_installer_icon.ico"),
upgradeCode: "13606ff3-b0bc-4dde-8fac-805bc8aed2f8",
ui : {
ui: {
enabled: false,
chooseDirectory: true,
images: {
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
50 changes: 50 additions & 0 deletions images/icons/map/cf_icon_multimission_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions images/icons/map/cf_settings_white.svg
15 changes: 5 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="./src/css/styles.css" media="all" />
<script type="text/javascript">require('./js/configurator_main.js');</script>
<!-- TODO: Update to newer Versions and use proper modules (require) -->
<script type="text/javascript" src="./js/libraries/three/three.min.js"></script>
<script type="text/javascript" src="./js/libraries/three/OrbitControls.js"></script>
<script type="text/javascript" src="./js/libraries/three/GLTFLoader.js"></script>
<title>INAV Configurator</title>
</head>

Expand Down Expand Up @@ -82,7 +76,7 @@ <h1 class="modal__title modal__title" data-i18n="appUpdateNotificationHeader"></
<label for="wireless-mode">
<span class="" data-i18n="wirelessModeSwitch"></span>
</label>
<input id="wireless-mode" class=" togglesmall" type="checkbox" />
<input id="wireless-mode" class="togglesmall" type="checkbox" />
</div>
</div>
</div>
Expand Down Expand Up @@ -169,9 +163,9 @@ <h1 class="modal__title modal__title" data-i18n="appUpdateNotificationHeader"></
</div>
<div class="battery-legend" i18n="sensorBatteryVoltage"></div>
<div class="bottomStatusIcons">
<div class="armedicon cf_tip" data-i18n_title="mainHelpArmed"></div>
<div class="failsafeicon cf_tip" data-i18n_title="mainHelpFailsafe"></div>
<div class="linkicon cf_tip" data-i18n_title="mainHelpLink"></div>
<div id="armedIcon" class="statusicon armed cf_tip" data-i18n_title="mainHelpArmed"></div>
<div id="failsafeicon" class="statusicon failsafe cf_tip" data-i18n_title="mainHelpFailsafe"></div>
<div id="linkicon" class="statusicon link cf_tip" data-i18n_title="mainHelpLink"></div>
</div>
</div>
</div>
Expand Down Expand Up @@ -382,6 +376,7 @@ <h2 class="groundstation-telemetry__header" data-i18n="gsTelemetry"></h2>
</div>
</div>
</div>
<script type="module" src="/js/configurator_main.js"></script>
</body>

</html>
9 changes: 5 additions & 4 deletions js/CliAutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* Check out the docs at https://github.com/yuku/jquery-textcomplete/tree/v1/doc
*/

const FC = require('./fc')
const CONFIGURATOR = require('./data_storage');
const timeout = require('./timeouts');
import 'jquery-textcomplete';
import FC from './fc';
import CONFIGURATOR from './data_storage';
import timeout from './timeouts';

const CliAutoComplete = {
configEnabled: false,
Expand Down Expand Up @@ -558,4 +559,4 @@ CliAutoComplete._initTextcomplete = function() {
]);
};

module.exports = CliAutoComplete;
export default CliAutoComplete;
37 changes: 20 additions & 17 deletions js/appUpdater.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

const semver = require('semver');
import semver from 'semver';

const { GUI } = require('./gui');
const jBox = require('./libraries/jBox/jBox.min');
const i18n = require('./localization');
import { GUI } from './gui';
import jBox from 'jbox';
import i18n from './localization';

var appUpdater = appUpdater || {};

Expand All @@ -17,18 +17,21 @@ appUpdater.checkRelease = function (currVersion) {
let newPrerelase = releaseData.prerelease;

if (newPrerelase == false && semver.gt(newVersion, currVersion)) {
GUI.log(newVersion, app.getVersion());
GUI.log(currVersion);

GUI.log(i18n.getMessage('newVersionAvailable'));
modalStart = new jBox('Modal', {
width: 400,
height: 200,
animation: false,
closeOnClick: false,
closeOnEsc: true,
content: $('#appUpdateNotification')
}).open();

window.electronAPI.appGetVersion().then(currentVersion => {
GUI.log(newVersion, currentVersion);
GUI.log(currVersion);

GUI.log(i18n.getMessage('newVersionAvailable'));
modalStart = new jBox('Modal', {
width: 400,
height: 200,
animation: false,
closeOnClick: false,
closeOnEsc: true,
content: $('#appUpdateNotification')
}).open();
});
}
});

Expand All @@ -40,4 +43,4 @@ appUpdater.checkRelease = function (currVersion) {
});
};

module.exports = appUpdater;
export default appUpdater;
2 changes: 1 addition & 1 deletion js/bitHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ var BitHelper = function() {
return self;
}();

module.exports = BitHelper;
export default BitHelper;
2 changes: 1 addition & 1 deletion js/boards.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ BOARD.findDefinition = function (identifier) {
return DEFAULT_BOARD_DEFINITION;
};

module.exports = BOARD;
export default BOARD;

Loading
Loading