diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..d262e87 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,82 @@ +module.exports = { + overrides: [ + { + files: [ + "js/widget.js", + "js/util.js", + "js/settings.js", + "js/backend.js", + "js/translator.js", + "test/util.test.js", + ], + parserOptions: { + ecmaVersion: 2022, + sourceType: "module", + }, + ecmaFeatures: { + impliedStrict: true, + }, + env: { + browser: true, + es2022: true, + jest: true, + }, + extends: ["eslint:recommended"], + rules: { + semi: "error", + indent: ["error", 2], + "no-multi-spaces": "error", + "space-in-parens": "error", + "no-multiple-empty-lines": "error", + "prefer-const": "error", + "no-use-before-define": "error", + "no-console": "error", + curly: "error", + "no-undef-init": "error", + "init-declarations": ["error", "always"], + quotes: ["error", "backtick"], + }, + }, + { + files: [ + "build/version-update.js", + "build/version-check.js", + "build/notarize.js", + "js/auto-update.js", + "js/logger.js", + "js/preload.js", + "main.js", + ], + parserOptions: { + ecmaVersion: 2022, + }, + ecmaFeatures: { + impliedStrict: true, + }, + env: { + browser: true, + node: true, + es2022: true, + }, + extends: [ + "eslint:recommended", + "plugin:import/errors", + "plugin:import/warnings", + ], + rules: { + semi: "error", + indent: ["error", 2], + "no-multi-spaces": "error", + "space-in-parens": "error", + "no-multiple-empty-lines": "error", + "prefer-const": "error", + "no-use-before-define": "error", + "no-console": "error", + curly: "error", + "no-undef-init": "error", + "init-declarations": ["error", "always"], + quotes: ["error", "backtick"], + }, + }, + ], +}; diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..462849f --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,50 @@ +name: Check the source code + +on: + push: + branches: + - develop + pull_request: + branches: + - main + types: + - opened + - synchronize + +jobs: + + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '21.1.0' + + - name: Install dependencies + run: npm install + + - name: Run linter + run: npm run lint + + version-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '21.1.0' + + - name: Install dependencies + run: npm install + + - name: Check README files version + run: npm run version-check diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 314e857..46bcc58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,8 @@ name: Build release on: pull_request: + branches: + - main types: - closed @@ -120,7 +122,7 @@ jobs: steps: - name: Get the release data - id: releases_data + id: releases_data_first env: HOST: "https://api.github.com" ENDPOINT: "/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases" @@ -135,13 +137,13 @@ jobs: - name: Read the output run: | - echo ${{ steps.releases_data.outputs.release_data }} | jq '.' + echo ${{ steps.releases_data_first.outputs.release_data }} | jq '.' - name: Filter requested data for blockmaps id: jq_filter_blockmap run: | blockmaps=$( - echo '${{ steps.releases_data.outputs.release_data }}' | jq -r \ + echo '${{ steps.releases_data_first.outputs.release_data }}' | jq -r \ 'fromjson | .assets | map(select(.name | endswith(".blockmap"))) | map(.id | tostring) | join(" ")' ) echo "( ${blockmaps} )" @@ -168,11 +170,25 @@ jobs: "${HOST}${ENDPOINT}$asset_id" done + - name: Get the release data + id: releases_data_second + env: + HOST: "https://api.github.com" + ENDPOINT: "/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases" + run: | + data=$( + curl -X GET -s \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "${HOST}${ENDPOINT}" + ) + data=$(echo "${data}" | jq '.[0] | {name, id, assets: (.assets | map({name, id}))} | tostring') + echo "release_data=${data}" >> $GITHUB_OUTPUT + - name: Filter requested data for mac universal distros id: jq_filter_macuni run: | macuni=$( - echo '${{ steps.releases_data.outputs.release_data }}' | jq -r \ + echo '${{ steps.releases_data_second.outputs.release_data }}' | jq -r \ 'fromjson | .assets | map(select(.name | contains("universal"))) | map(.id | tostring) | join(" ")' ) echo "( ${macuni} )" diff --git a/.gitignore b/.gitignore index c18e01b..02bc838 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ node_modules/ coverage/ .vscode/ -.eslintrc.js package-lock.json *.code-workspace out diff --git a/README.md b/README.md index 4bad739..ec421c6 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ The app's name is "Owlet", which means baby owl and is chosen because of the Nig +
## README Translation @@ -32,15 +36,15 @@ I was inspired by the [mlukasek/M5_NightscoutMon](https://github.com/mlukasek/M5 ## Installation packages -[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-win-x64.exe) +[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) -[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-arm64.dmg) +[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) -[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-x64.dmg) +[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) -[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-linux-x86_64.AppImage) +[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) -[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.0-beta.tar.gz) +[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) [![Download Souces](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/build/version-check.js b/build/version-check.js new file mode 100644 index 0000000..cfcc4a9 --- /dev/null +++ b/build/version-check.js @@ -0,0 +1,51 @@ +/* eslint-disable no-console */ + +const fs = require(`fs`); +const path = require(`path`); + +const RED = `\x1b[1;91m`; +const YELLOW = `\x1b[1;93m`; +const GREEN = `\x1b[1;92m`; +const RESET = `\x1b[0m`; + +console.log(`Current package.json version is: ${YELLOW}${process.env.npm_package_version}${RESET}\n`); + +let countOldVersion = 0; + +const readmeFiles = [ + path.join(process.cwd(), `README.md`), + path.join(process.cwd(), `docs`, `README.it.md`), + path.join(process.cwd(), `docs`, `README.pl.md`), + path.join(process.cwd(), `docs`, `README.ru.md`), +]; + +readmeFiles.forEach((file) => { + try { + const readmeContent = fs.readFileSync(file, `utf-8`); + const linksInFileArray = readmeContent.match(/\d\.\d\.\d-beta/g); + + let hasOldVersion = false; + + linksInFileArray.some((linkVersion) => { + if (linkVersion != process.env.npm_package_version) { + hasOldVersion = true; + countOldVersion++; + } + return hasOldVersion; + }); + + if (hasOldVersion) { + console.log(`${RED}${path.relative(process.cwd(), file)}${RESET} is outdated`); + } else { + console.log(`${GREEN}${path.relative(process.cwd(), file)}${RESET} is ok`); + } + } catch (error) { + console.error(`${RED}Error reading file: ${path.relative(process.cwd(), file)}${RESET}: \n${error}`); + } +}); + +console.log(`\nVersion-check job is done`); + +if (countOldVersion > 0) { + process.exit(1); +} diff --git a/build/version-update.js b/build/version-update.js index 7821f9e..a9bed0a 100644 --- a/build/version-update.js +++ b/build/version-update.js @@ -1,7 +1,14 @@ +/* eslint-disable no-console */ + const fs = require(`fs`); const path = require(`path`); -console.log(`Current version is:`, process.env.npm_package_version); +const RED = `\x1b[1;91m`; +const YELLOW = `\x1b[1;93m`; +const GREEN = `\x1b[1;92m`; +const RESET = `\x1b[0m`; + +console.log(`Current package.json version is: ${YELLOW}${process.env.npm_package_version}${RESET}\n`); const readmeFiles = [ path.join(process.cwd(), `README.md`), @@ -11,10 +18,14 @@ const readmeFiles = [ ]; readmeFiles.forEach((file) => { - let readmeContent = fs.readFileSync(file, `utf-8`); - readmeContent = readmeContent.replace(/\d\.\d\.\d-beta/g, process.env.npm_package_version); - fs.writeFileSync(file, readmeContent, `utf-8`); - console.log(`${path.relative(process.cwd(), file)} updated with the latest version:`, process.env.npm_package_version); + try { + let readmeContent = fs.readFileSync(file, `utf-8`); + readmeContent = readmeContent.replace(/\d\.\d\.\d-beta/g, process.env.npm_package_version); + fs.writeFileSync(file, readmeContent, `utf-8`); + console.log(`${GREEN}${path.relative(process.cwd(), file)}${RESET} is updated`); + } catch (error) { + console.error(`${RED}Error reading file: ${path.relative(process.cwd(), file)}${RESET}: \n${error}`); + } }); -console.log(`Version-update job is done`); +console.log(`\nVersion-update job is done`); diff --git a/docs/README.it.md b/docs/README.it.md index d251e93..27ed542 100644 --- a/docs/README.it.md +++ b/docs/README.it.md @@ -12,7 +12,10 @@ Il nome dell'app è "Owlet", che significa piccolo gufo ed è scelto per via del - + ## Traduzione README @@ -32,15 +35,15 @@ Sono stato inspirato dalla soluzione [mlukasek/M5_NightscoutMon](https://github. ## Pacchetti di installazione -[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-win-x64.exe) +[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) -[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-arm64.dmg) +[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) -[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-x64.dmg) +[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) -[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-linux-x86_64.AppImage) +[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) -[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.0-beta.tar.gz) +[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) [![Download Souces](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/docs/README.pl.md b/docs/README.pl.md index 285d612..b26bd0c 100644 --- a/docs/README.pl.md +++ b/docs/README.pl.md @@ -12,7 +12,10 @@ Aplikacja nosi nazwę „Owlet”, co oznacza małą sowę i została wybrana ze - + ## Tłumaczenie README @@ -32,15 +35,15 @@ Zainspirowałem się rozwiązaniem [mlukasek/M5_NightscoutMon](https://github.co ## Gotowe pakiety instalacyjne -[![Pobierz dla systemu Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-win-x64.exe) +[![Pobierz dla systemu Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) -[![Pobierz dla systemu macOS (procesory Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-arm64.dmg) +[![Pobierz dla systemu macOS (procesory Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) -[![Pobierz dla systemu macOS (procesory Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-x64.dmg) +[![Pobierz dla systemu macOS (procesory Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) -[![Pobierz dla systemów Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-linux-x86_64.AppImage) +[![Pobierz dla systemów Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) -[![Pobierz źródła](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.0-beta.tar.gz) +[![Pobierz źródła](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) [![Pobierz źródła](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/docs/README.ru.md b/docs/README.ru.md index 2d9220b..9de6f5e 100644 --- a/docs/README.ru.md +++ b/docs/README.ru.md @@ -12,7 +12,10 @@ - + ## Перевод README @@ -32,15 +35,15 @@ ## Установка приложения -[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-win-x64.exe) +[![Download for Windows](https://img.shields.io/badge/Download-Windows%20.exe-blue?style=for-the-badge&logo=windows)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-win-x64.exe) -[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-arm64.dmg) +[![Download for macOS(Apple Silicon)](https://img.shields.io/badge/Download-macOS%20(Apple%20Silicon)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-arm64.dmg) -[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-mac-x64.dmg) +[![Download for macOS(Intel)](https://img.shields.io/badge/Download-macOS%20(Intel)%20.dmg-blue?style=for-the-badge&logo=apple)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-mac-x64.dmg) -[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.0-beta/Owlet-0.8.0-beta-linux-x86_64.AppImage) +[![Download for Linux](https://img.shields.io/badge/Download-Linux%20.AppImage-blue?style=for-the-badge&logo=linux&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/download/v0.8.1-beta/Owlet-0.8.1-beta-linux-x86_64.AppImage) -[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.0-beta.tar.gz) +[![Download Souces](https://img.shields.io/badge/Download-Sources%20.tar.gz-blue?style=for-the-badge&logo=electron&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/archive/refs/tags/v0.8.1-beta.tar.gz) [![Download Souces](https://img.shields.io/badge/Browse-Latest%20Release-red?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kashamalasha/nightscout-widget-electron/releases/latest) diff --git a/docs/support_me_boosty.png b/docs/support_me_boosty.png new file mode 100644 index 0000000..e479e35 Binary files /dev/null and b/docs/support_me_boosty.png differ diff --git a/docs/support_me_paypal.png b/docs/support_me_paypal.png new file mode 100644 index 0000000..1deab4d Binary files /dev/null and b/docs/support_me_paypal.png differ diff --git a/js/settings.js b/js/settings.js index 32a67b9..820f527 100644 --- a/js/settings.js +++ b/js/settings.js @@ -13,7 +13,7 @@ translator.load(LANGUAGE); const log = window.electronAPI.logger; -const form = document.forms["settings-form"]; +const form = document.forms[`settings-form`]; const FormFields = { NIGHTSCOUT: { @@ -151,7 +151,7 @@ const formSubmission = (formDataObj) => { window.electronAPI.closeWindow(); window.electronAPI.restart(); -} +}; window.electronAPI.setUnits((_evt, isMMOL) => { log.info(`Test of converting units in mmol/l: ${isMMOL} from settingsWindow`); @@ -184,7 +184,7 @@ FormButtons.LOG.addEventListener(`click`, (evt) => { const isFormModified = (currentForm, initialForm) => { return JSON.stringify(formDataToObject(currentForm)) !== JSON.stringify(formDataToObject(initialForm)); -} +}; FormButtons.CLOSE.addEventListener(`click`, () => { const currentFormState = new FormData(form); diff --git a/js/util.js b/js/util.js index da129e4..c364ae7 100644 --- a/js/util.js +++ b/js/util.js @@ -172,7 +172,7 @@ const alert = (type, title, msg, sync = false) => { const formDataToObject = (formData) => { return Object.fromEntries([...formData.entries()]); -} +}; export { dir2Char, diff --git a/package.json b/package.json index 24a391b..2f48632 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "email": "dmitry.burnyshev@gmail.com" }, "homepage": "https://github.com/kashamalasha/nightscout-widget-electron", - "version": "0.8.0-beta", + "version": "0.8.1-beta", "main": "main.js", "scripts": { "start": "NODE_ENV=production electron .", @@ -18,7 +18,8 @@ "ship": "electron-builder -p always", "test": "jest", "test-coverage": "jest --coverage", - "version-update": "node build/version-update.js" + "version-update": "node build/version-update.js", + "version-check": "node build/version-check.js" }, "build": { "appId": "com.burny.owlet.app", diff --git a/test/util.test.js b/test/util.test.js index 1d31ea3..40fd23c 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -199,18 +199,18 @@ describe(`convertUnitsFor`, () => { it(`should not modify non-numeric values`, () => { const isMMOL = false; const inputObject = { - TEXT: 'some text', + TEXT: `some text`, BOOLEAN: true, ARRAY: [1, 2, 3], - OBJECT: { key: 'value' } + OBJECT: { key: `value` } }; convertUnitsFor(inputObject, isMMOL); - expect(inputObject.TEXT).toBe('some text'); + expect(inputObject.TEXT).toBe(`some text`); expect(inputObject.BOOLEAN).toBe(true); expect(inputObject.ARRAY).toEqual([1, 2, 3]); - expect(inputObject.OBJECT).toEqual({ key: 'value' }); + expect(inputObject.OBJECT).toEqual({ key: `value` }); }); }); @@ -523,12 +523,12 @@ describe(`prepareData`, () => { describe(`formDataToObject`, () => { it(`converts FormData to object`, () => { const formData = new FormData(); - formData.append('name', 'Dmitry'); - formData.append('age', '40'); - formData.append('is-happy', 'on'); + formData.append(`name`, `Dmitry`); + formData.append(`age`, `40`); + formData.append(`is-happy`, `on`); const result = formDataToObject(formData); - expect(result).toEqual({ name: 'Dmitry', age: '40', 'is-happy': 'on' }); + expect(result).toEqual({ name: `Dmitry`, age: `40`, 'is-happy': `on` }); }); it(`handles FormData with multiple values for the same key`, () => {