Skip to content

Commit

Permalink
Update react (#303)
Browse files Browse the repository at this point in the history
* Error updating log item

* Replace timepicker with native timepicker

* update react to 19

* remove whyDidYouRender

* Migrate client to Vite and update dependencies

* Remove React imports and simplify component code

* Refactor React components to remove FC type and simplify imports

* Add Vitest for testing and update project configuration

* Update project configuration and dependencies

- Remove moment-duration-format package
- Update Moment.js to version 2.30.1
- Modify Sentry sourcemap upload path
- Update Electron build and client paths
- Refactor config import in Electron modules
- Add TypeScript declaration for Moment.js locale

* Switch from Yarn to pnpm and bump Electron app version

- Update GitHub workflow to use pnpm for client installation and build
- Increment Electron app version to 3.22.6
- Simplify configuration in config.ts by removing unused variables

* Remove Yarn configuration and migrate Electron project to pnpm

- Delete .yarnrc.yml files in root and electron directories
- Remove Yarn-specific lock files and releases
- Update package.json to remove Yarn package manager specification
- Add pnpm-lock.yaml for Electron project

* Remove pnpm cache configuration from GitHub workflow

* Pin pnpm version to 9.15.3 in GitHub workflow

* Update GitHub workflow pnpm configuration

- Update pnpm version to latest
- Add Windows build tools setup
- Use non-frozen lockfile for pnpm installations
- Simplify architecture-specific configurations for macOS builds

* revert build file

* add yarn lock

* add empy lock file for CI

* remove lockfiles

* no need for lockfile

* as

* remove package.json from root

* remove cache

* add --immutable

* remove cache, as I dont have lock files

* --check-cache

* add yarn

* remove immutable

* yarn fails also, revert to pnpm again

* install with corepack

* pnpm latest

* window build not working, try pnpm 8

* https://www.electron.build/index.html#note-for-pnpm

* pnpm 9

* update electron-builder

* ModuleNotFoundError: No module named 'distutils' Error: `gyp` failed with exit code: 1

* python3 -m pip install setuptools

* brew install python-setuptools

* setuptools for all envs
  • Loading branch information
MayGo authored Jan 31, 2025
1 parent 22d26c3 commit e3da883
Show file tree
Hide file tree
Showing 167 changed files with 25,478 additions and 31,134 deletions.
48 changes: 32 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install Yarn Berry
run: corepack enable && corepack prepare yarn@stable --activate
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
run_install: false

- name: Get Package Version
id: package_version
Expand All @@ -59,33 +61,47 @@ jobs:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
run: |
yarn dlx @sentry/cli releases set-commits "${{ env.PACKAGE_VERSION }}" --commit "${{ github.repository }}@${{ github.sha }}"
yarn dlx @sentry/cli releases new "${{ env.PACKAGE_VERSION }}"
pnpm dlx @sentry/cli releases set-commits "${{ env.PACKAGE_VERSION }}" --commit "${{ github.repository }}@${{ github.sha }}"
pnpm dlx @sentry/cli releases new "${{ env.PACKAGE_VERSION }}"
- name: Install Python Setuptools on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y python3-setuptools
- name: Install Python Setuptools on macOS
if: startsWith(matrix.os, 'macos')
run: brew install python-setuptools

- name: Install Python Setuptools on Windows
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install setuptools
- name: Install Dependencies (Electron)
shell: bash
run: |
cd electron
if [ "${{ matrix.os }}" = "macos-15" ]; then
# Force x64 architecture for macos-15
export npm_config_arch=x64
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
# Force arm64 architecture for macos-latest
export npm_config_arch=arm64
fi
yarn install
pnpm install --no-frozen-lockfile
cd ..
- name: Install Dependencies (Client)
run: |
cd client
yarn install
pnpm install --no-frozen-lockfile
cd ..
- name: Build Client
run: |
cd client
yarn build
pnpm build
cd ..
- name: Create .env file
Expand All @@ -111,15 +127,15 @@ jobs:
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.os != 'windows-latest' }}
run: |
cd electron
yarn build
yarn prepare_client
pnpm build
pnpm prepare_client
# Determine the architecture to build
if [ "${{ matrix.os }}" = "macos-15" ]; then
ARCH="x64"
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
ARCH="arm64"
fi
yarn release -- --mac --${ARCH}
pnpm release -- --mac --${ARCH}
cd ..
- name: Upload Sentry Sourcemaps
Expand All @@ -128,9 +144,9 @@ jobs:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
run: |
yarn dlx @sentry/cli releases files "${{ env.PACKAGE_VERSION }}" upload-sourcemaps ./client/build/static/js/ --rewrite --url-prefix "~/dist/static/js"
yarn dlx @sentry/cli releases files "${{ env.PACKAGE_VERSION }}" list
yarn dlx @sentry/cli releases finalize "${{ env.PACKAGE_VERSION }}"
pnpm dlx @sentry/cli releases files "${{ env.PACKAGE_VERSION }}" upload-sourcemaps ./client/dist/assets/ --rewrite --url-prefix "~/dist/assets"
pnpm dlx @sentry/cli releases files "${{ env.PACKAGE_VERSION }}" list
pnpm dlx @sentry/cli releases finalize "${{ env.PACKAGE_VERSION }}"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
Expand Down
Binary file removed .yarn/install-state.gz
Binary file not shown.
934 changes: 0 additions & 934 deletions .yarn/releases/yarn-4.5.1.cjs

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Windows: `%USERPROFILE%\AppData\Roaming\tockler\logs\main.log`
```bash
git clone https://github.com/Maygo/tockler.git # Download this project

npm install yarn -g # install yarn or binary from https://yarnpkg.com
corepack enable pnpm # install pnpm https://pnpm.io/installation
```

### Start application
Expand All @@ -128,16 +128,16 @@ Renderer and main process builds have been separated. It's easier to boilerplate

```
cd client/
yarn install # Install dependencies
yarn start
pnpm install # Install dependencies
pnpm start
```

#### Electron (main)

```
cd electron/
yarn install # Install dependencies
yarn start
pnpm install # Install dependencies
pnpm start
```

Build scripts samples are in .github/workflows files.
Expand Down
39 changes: 21 additions & 18 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Binary file removed client/.yarn/install-state.gz
Binary file not shown.
934 changes: 0 additions & 934 deletions client/.yarn/releases/yarn-4.5.1.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions client/.yarnrc.yml

This file was deleted.

94 changes: 50 additions & 44 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
5 changes: 0 additions & 5 deletions client/env.sample

This file was deleted.

28 changes: 28 additions & 0 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
15 changes: 15 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tockler</title>

<script src="https://unpkg.com/react-scan/dist/auto.global.js"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
8 changes: 0 additions & 8 deletions client/jest.config.js

This file was deleted.

Loading

0 comments on commit e3da883

Please sign in to comment.