Skip to content

Commit d639144

Browse files
authored
Move to ESM (#1599)
1 parent 3767f6d commit d639144

112 files changed

Lines changed: 3740 additions & 3486 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/chatmodes/Plan.chatmode.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
description: Generate an implementation plan for new features or refactoring existing code.
3+
tools: ['codebase', 'fetch', 'findTestFiles', 'githubRepo', 'search', 'usages']
4+
---
5+
# Planning mode instructions
6+
You are in planning mode. Your task is to generate an implementation plan for a new feature or for refactoring existing code.
7+
8+
Create a plan that is simple and easy to follow. Do not make a lot of changes, but prefer small, incremental updates changing one thing at a time. If you see multiple ways of implementing a feature or refactoring code, lead a discussion to evaluate the options with the user.
9+
10+
Don't make any code edits, just generate a plan.
11+
12+
The plan consists of a Markdown document that describes the implementation plan, including the following sections:
13+
14+
* Overview: A brief description of the feature or refactoring task.
15+
* Requirements: A list of requirements for the feature or refactoring task.
16+
* Implementation Steps: A detailed list of steps to implement the feature or refactoring task.
17+
* Testing: A list of tests that need to be implemented to verify the feature or refactoring task.
18+
* Comments in code: Only if neccessary, when the code is not self-explanatory.
19+

.github/copilot-instructions.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Stretchly Development Assistant
2+
3+
You are a specialized assistant for developers working on Stretchly, a break-time reminder application that encourages regular stretching and healthy work habits.
4+
5+
## Technical Stack
6+
- ElectronJS for cross-platform desktop functionality
7+
- NodeJS backend
8+
- JavaScript (following StandardJS style guidelines) using ESM (ECMAScript Modules)
9+
- HTML and CSS for UI components
10+
11+
## Development Guidelines
12+
- Follow StandardJS style (like no semicolons, 2-space indentation)
13+
- Prefer ES6+ features (like arrow functions, destructuring, etc.)
14+
- Maintain cross-platform compatibility (Windows, macOS, Linux)
15+
- Use appropriate Electron APIs for native functionality
16+
- Maintain accessibility standards in UI components
17+
- Keep performance in mind, especially for background processes
18+
- Consider Chrome compatibility only, as Electron is built on Chromium
19+
20+
## Code Organization
21+
- Respect the existing project structure
22+
- Place new functionality in appropriate modules
23+
- Follow the established patterns for event handling
24+
25+
## Testing Expectations
26+
- Suggest tests for new functionality
27+
- Consider edge cases in different operating systems
28+
29+
When suggesting code changes, explain your reasoning and how they align with Stretchly's goals of promoting healthy computer use.

.github/workflows/arm-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v3
1616
- uses: actions/setup-node@v3
1717
with:
18-
node-version: '20.18.1'
18+
node-version: '22.17.0'
1919
- run: sudo apt update && sudo apt-get install --no-install-recommends -y ruby-full libarchive-tools
2020
- run: sudo gem install fpm -v 1.15
2121
- run: npm install npm -g

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
python-version: '3.12'
2727
- uses: actions/setup-node@v3
2828
with:
29-
node-version: '20.18.1'
29+
node-version: '22.17.0'
3030
- run: pip install setuptools
3131
- run: npm install npm -g
3232
- run: npm install

.github/workflows/snap-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- uses: actions/setup-node@v3
1515
with:
16-
node-version: '20.18.1'
16+
node-version: '22.17.0'
1717
- run: pip install setuptools
1818
- run: npm install -g npm
1919
- run: npm install

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
if: matrix.os == 'ubuntu-latest'
2020
run: |
2121
export DISPLAY=:0
22-
sudo apt install dbus-x11
22+
sudo apt update && sudo apt install dbus-x11
2323
machineId=$(cat /var/lib/dbus/machine-id)
2424
mkdir -p /home/runner/.dbus
2525
mkdir -p /home/runner/.dbus/session-bus/
@@ -46,7 +46,7 @@ jobs:
4646
- name: Use Node.js
4747
uses: actions/setup-node@v3
4848
with:
49-
node-version: '20.18.1'
49+
node-version: '22.17.0'
5050
- run: pip install setuptools
5151
- run: npm install npm -g
5252
- run: npm install

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.18.1
1+
22.17.0

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88
### Added
9-
- Yiddish translations
9+
- Yiddish and Tamil translations
1010

1111
### Changed
1212
- remove flags in Welcome window
1313
- updated many translations
14+
- do not check for Quiet Hours on Windows (deprecated)
1415

1516
### Fixed
1617
- hide close/minimize actions on Break window on macOS

app/break-preload.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {
2+
exposeBreaks,
3+
exposeI18next,
4+
exposeProcess,
5+
exposeSettings,
6+
exposeStretchly,
7+
exposeUtils
8+
} from './utils/context-bridge-exposers.js'
9+
10+
exposeBreaks('long')
11+
exposeI18next()
12+
exposeProcess()
13+
exposeSettings()
14+
exposeStretchly()
15+
exposeUtils()

app/break-renderer.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import HtmlTranslate from './utils/htmlTranslate.js'
2+
import './platform.js'
3+
4+
window.onload = async (event) => {
5+
const [idea, started, duration, strictMode, postpone,
6+
postponePercent, backgroundColor] = await window.breaks.sendBreakData()
7+
8+
new HtmlTranslate(document).translate()
9+
10+
document.ondragover = event =>
11+
event.preventDefault()
12+
13+
document.ondrop = event =>
14+
event.preventDefault()
15+
16+
document.querySelector('#close').onclick = async event =>
17+
await window.breaks.finishBreak()
18+
19+
document.querySelector('#postpone').onclick = async event =>
20+
await window.breaks.postponeBreak()
21+
22+
document.querySelector('.break-idea').textContent = idea[0]
23+
document.querySelector('.break-text').textContent = idea[1]
24+
25+
const progress = document.querySelector('#progress')
26+
const progressTime = document.querySelector('#progress-time')
27+
const postponeElement = document.querySelector('#postpone')
28+
const closeElement = document.querySelector('#close')
29+
const mainColor = await window.settings.get('mainColor')
30+
document.body.classList.add(mainColor.substring(1))
31+
document.body.style.backgroundColor = backgroundColor
32+
33+
document.querySelectorAll('.tiptext').forEach(async tt => {
34+
const keyboardShortcut = await window.settings.get('endBreakShortcut')
35+
tt.innerHTML = await window.utils.formatKeyboardShortcut(keyboardShortcut)
36+
})
37+
38+
setInterval(async () => {
39+
if (await window.settings.get('currentTimeInBreaks')) {
40+
document.querySelector('.breaks > :last-child').innerHTML =
41+
(new Date()).toLocaleTimeString()
42+
}
43+
if (Date.now() - started < duration) {
44+
const passedPercent = (Date.now() - started) / duration * 100
45+
postponeElement.style.display =
46+
await window.utils.canPostpone(postpone, passedPercent, postponePercent) ? 'flex' : 'none'
47+
closeElement.style.display =
48+
await window.utils.canSkip(strictMode, postpone, passedPercent, postponePercent) ? 'flex' : 'none'
49+
progress.value = (100 - passedPercent) * progress.max / 100
50+
progressTime.innerHTML = await window.utils.formatTimeRemaining(Math.trunc(duration - Date.now() + started),
51+
await window.settings.get('language'))
52+
}
53+
}, 100)
54+
await window.breaks.signalLoaded()
55+
}

0 commit comments

Comments
 (0)