diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..ebb4532 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,24 @@ +# Repository Guidelines + +## Project Structure & Module Organization +PicGo is an Electron + Vue 3 desktop client. Source lives in `src/`: `src/main` for main-process and IPC logic, `src/renderer` for Vue views, and `src/universal` for shared helpers (`types/`, `events/constants.ts`). `background.ts` wires Electron Builder. Static assets and locale YAML files stay in `public/` (add languages under `public/i18n/`), while `docs/` hosts user-facing guides. Automation scripts live in `scripts/`, and legacy tests sit under `test/unit` (Karma) and `test/e2e` (Spectron). + +## Build, Test, and Development Commands +- `yarn install` — install dependencies; `npm install` is unsupported because native modules are patched for Yarn. +- `yarn dev` / `yarn electron:serve` — start the hot-reload dev environment for both processes. +- `yarn build` / `yarn electron:build` — package the app into `dist_electron/`; set `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/` when downloads are slow. +- `yarn lint` / `yarn lint:fix` — run or auto-fix ESLint (Standard, TypeScript, Vue rules). +- `yarn lint:dpdm` — fail fast on circular dependencies in `src/`. +- `yarn gen-i18n` — regenerate typed locales after touching `public/i18n/*.yml`. + +## Coding Style & Naming Conventions +Follow ESLint Standard defaults: two-space indentation, single quotes, trailing commas where allowed, and no stray semicolons. Author new modules in TypeScript. Keep renderer files browser-safe; route Node APIs through IPC helpers such as `src/main/events/picgoCoreIPC.ts`. Name Vue components in PascalCase (`UploadPanel.vue`) and use camelCase for utilities. Centralize IPC event names inside `src/universal/events/constants.ts`, and store enums/types under `src/universal/types/` so they stay reusable. + +## Testing Guidelines +Place renderer unit specs in `test/unit/specs` with the `.spec.js` suffix; Karma picks them up via `require.context`. Run them with `npx karma start test/unit/karma.conf.js --single-run` and ensure new renderer folders are covered. Spectron e2e cases live in `test/e2e/specs`; build first (`yarn build`), then run `npx mocha test/e2e/index.js` so Spectron can launch `dist/electron/main.js`. Document any test data, IPC stubs, or fixtures you add to keep suites reproducible. + +## Commit & Pull Request Guidelines +Commits follow the PicGo conventional preset enforced by Husky (`yarn lint:dpdm` + Commitlint). Stage your changes and run `yarn cz` to craft messages that pass CI. Pull requests should explain the change, link related issues, and attach UI screenshots or recordings. Note how you validated the work (dev server, build, Karma, Spectron) and call out migration or configuration steps reviewers must perform. + +## Internationalization Tips +Add locales by creating `public/i18n/.yml`, exposing its `LANG_DISPLAY_LABEL`, and registering it in `src/universal/i18n/index.ts`. Finish with `yarn gen-i18n` so the generated typings stay in sync. diff --git a/package.json b/package.json index 9cf2014..c323ca7 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "marked": "^7.0.4", "mitt": "^3.0.0", "multer": "^1.4.5-lts.1", - "picgo": "^1.5.9", + "picgo": "^1.5.11", "qrcode.vue": "^3.3.3", "shell-path": "2.1.0", "uuid": "^9.0.0", diff --git a/public/linux.sh b/public/linux.sh index 88b1a2a..8d315d5 100644 --- a/public/linux.sh +++ b/public/linux.sh @@ -26,4 +26,9 @@ elif [ "$XDG_SESSION_TYPE" = "wayland" ]; then echo "no image" exit 1 fi +else + # fallback for unsupported session types + echo >&2 "Error: Unsupported session type '$XDG_SESSION_TYPE'." + echo >&2 "Solution: The variable of XDG_SESSION_TYPE must set as 'x11' or 'wayland'." + exit 1 fi diff --git a/yarn.lock b/yarn.lock index 7c3f894..6f5eeec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10018,10 +10018,10 @@ pend@~1.2.0: resolved "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= -picgo@^1.5.9: - version "1.5.9" - resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.5.9.tgz#2ff46958c3f53203d7d13b870a1ae4be90aaa3e3" - integrity sha512-6jO53RdHBP9tl9w6fwm+WtlU6qeYMsZAH9HsXZDkyXqQYMRdQ7t2K4BXZo3DQJ76ebYD40fDHAaIW92k7m2A0w== +picgo@^1.5.11: + version "1.5.11" + resolved "https://registry.yarnpkg.com/picgo/-/picgo-1.5.11.tgz#9cfdba44dd73b3e69a99f51112f7091c6a890e3f" + integrity sha512-Z0SqbEGRC6/ZGXfr/Erfec+oH3lQaN8SRZ3PQxZ5oSnE4J/DQ9XDKcc8gqubbZlY1ViQ1ERLJwzuskQ7o4Q+rA== dependencies: "@picgo/i18n" "^1.0.0" "@picgo/store" "^2.0.2"