Skip to content

Commit

Permalink
0.8.1-beta (#95)
Browse files Browse the repository at this point in the history
* CI: Updates GitHub Actions workflows
* SYNTAX: Corrects some syntax mistakes
* DOC: Adds support me on buttons
  • Loading branch information
kashamalasha authored Jan 28, 2024
1 parent 12354e2 commit cf58d01
Show file tree
Hide file tree
Showing 16 changed files with 271 additions and 48 deletions.
82 changes: 82 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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"],
},
},
],
};
50 changes: 50 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 20 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Build release

on:
pull_request:
branches:
- main
types:
- closed

Expand Down Expand Up @@ -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"
Expand All @@ -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} )"
Expand All @@ -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} )"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
coverage/
.vscode/
.eslintrc.js
package-lock.json
*.code-workspace
out
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ The app's name is "Owlet", which means baby owl and is chosen because of the Nig
<a href="https://github.com/kashamalasha/nightscout-widget-electron/releases/latest"><img src="https://img.shields.io/github/downloads/kashamalasha/nightscout-widget-electron/latest/total?color=%2300834a&label=latest" /></a>
<a href="https://github.com/kashamalasha/nightscout-widget-electron/releases/latest"><img src="https://img.shields.io/github/v/release/kashamalasha/nightscout-widget-electron?color=%2300834a" /></a>
</div>
<div style="margin-top: 5px">
<a style="margin: 5px;" href="https://boosty.to/owlet/donate"><img src="./docs/support_me_boosty.png" width="130" alt="Donate me on Boosty"/></a>
<a style="margin: 5px;" href="https://www.paypal.com/donate/?business=46K7J6S3UB3CS&no_recurring=0&item_name=Support+Owlet%3A+Improve+T1D+care+with+a+donation%21+Your+contribution+empowers+health+monitoring.+Join+me+in+making+a+difference%21&currency_code=USD"><img src="./docs/support_me_paypal.png" width="130" alt="Donate me on PayPal"/></a>
</div>


## README Translation
Expand All @@ -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)

Expand Down
51 changes: 51 additions & 0 deletions build/version-check.js
Original file line number Diff line number Diff line change
@@ -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);
}
23 changes: 17 additions & 6 deletions build/version-update.js
Original file line number Diff line number Diff line change
@@ -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`),
Expand All @@ -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`);
15 changes: 9 additions & 6 deletions docs/README.it.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Il nome dell'app è "Owlet", che significa piccolo gufo ed è scelto per via del
<a href="https://github.com/kashamalasha/nightscout-widget-electron/releases/latest"><img src="https://img.shields.io/github/downloads/kashamalasha/nightscout-widget-electron/latest/total?color=%2300834a&label=latest" /></a>
<a href="https://github.com/kashamalasha/nightscout-widget-electron/releases/latest"><img src="https://img.shields.io/github/v/release/kashamalasha/nightscout-widget-electron?color=%2300834a" /></a>
</div>

<div style="margin-top: 5px">
<a style="margin: 5px;" href="https://boosty.to/owlet/donate"><img src="./support_me_boosty.png" width="130" alt="Donate me on Boosty"/></a>
<a style="margin: 5px;" href="https://www.paypal.com/donate/?business=46K7J6S3UB3CS&no_recurring=0&item_name=Support+Owlet%3A+Improve+T1D+care+with+a+donation%21+Your+contribution+empowers+health+monitoring.+Join+me+in+making+a+difference%21&currency_code=USD"><img src="./support_me_paypal.png" width="130" alt="Donate me on PayPal"/></a>
</div>

## Traduzione README

Expand All @@ -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)

Expand Down
15 changes: 9 additions & 6 deletions docs/README.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Aplikacja nosi nazwę „Owlet”, co oznacza małą sowę i została wybrana ze
<a href="https://github.com/kashamalasha/nightscout-widget-electron/releases/latest"><img src="https://img.shields.io/github/downloads/kashamalasha/nightscout-widget-electron/latest/total?color=%2300834a&label=latest" /></a>
<a href="https://github.com/kashamalasha/nightscout-widget-electron/releases/latest"><img src="https://img.shields.io/github/v/release/kashamalasha/nightscout-widget-electron?color=%2300834a" /></a>
</div>

<div style="margin-top: 5px">
<a style="margin: 5px;" href="https://boosty.to/owlet/donate"><img src="./support_me_boosty.png" width="130" alt="Donate me on Boosty"/></a>
<a style="margin: 5px;" href="https://www.paypal.com/donate/?business=46K7J6S3UB3CS&no_recurring=0&item_name=Support+Owlet%3A+Improve+T1D+care+with+a+donation%21+Your+contribution+empowers+health+monitoring.+Join+me+in+making+a+difference%21&currency_code=USD"><img src="./support_me_paypal.png" width="130" alt="Donate me on PayPal"/></a>
</div>

## Tłumaczenie README

Expand All @@ -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)

Expand Down
Loading

0 comments on commit cf58d01

Please sign in to comment.