You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`src/index.ts` is the plugin entry that wires PicGo CLI/GUI commands, config schema, and migration flow.
5
+
-`src/lib/Migrater.ts` orchestrates URL discovery and upload; `src/lib/FileHandler.ts` reads/writes markdown and rewrites URLs; `src/utils.ts` hosts small helpers.
6
+
-`src/i18n` holds locale strings; keep keys stable when adding translations.
7
+
-`src/types` contains type declarations used by the compiler.
8
+
-`dist/` is the compiled output from TypeScript—do not edit by hand.
9
+
-`test/` includes sample markdown/assets, and `test.js` is a Node integration script that exercises `dist/index.js`.
10
+
11
+
## Build, Test, and Development Commands
12
+
```bash
13
+
pnpm install # install deps (uses pnpm-lock.yaml)
14
+
pnpm build # compile TypeScript to dist/
15
+
pnpm dev # watch & rebuild during development
16
+
pnpm lint # eslint on src + type-check (tsc --noEmit)
17
+
pnpm test# runs test.js against dist; run build first
18
+
```
19
+
Run commands from the repo root. Avoid editing `dist/` manually; regenerate via `pnpm build` when needed.
20
+
21
+
## Coding Style & Naming Conventions
22
+
- TypeScript, CommonJS target es2017; 2-space indentation and single quotes to match existing files.
23
+
- Classes in PascalCase (e.g., `FileHandler`), functions/variables in camelCase, constants in SCREAMING_SNAKE_CASE.
24
+
- Keep plugin config keys under `picgo-plugin-pic-migrater.*`; prefer explicit types and early returns.
25
+
- ESLint extends `eslint-config-love`; `pnpm lint` is the source of truth—fix or annotate intentionally justified cases.
26
+
27
+
## Testing Guidelines
28
+
-`pnpm test` migrates `test/test.md` via compiled `dist/`; ensure `pnpm build` has run and sample files remain intact.
29
+
- When adding tests, prefer integration-style checks in `test/` that assert rewritten markdown output and file creation.
30
+
- If adding new migration cases, include minimal fixtures and document expected suffixes (`newFileSuffix`) to avoid accidental overwrites.
31
+
32
+
## Commit & Pull Request Guidelines
33
+
- Use commitizen for messages: `pnpm cz`. Commitlint follows the PicGo convention (emoji scopes such as `:bug: Fix: ...`, `:tada: Release: ...`); keep messages imperative and scoped.
34
+
- Keep commits small and focused; only update `dist/` for releases or when explicitly required.
35
+
- PRs should describe the change, link related issues, and note how to reproduce or verify. Provide CLI output or screenshots/gifs when affecting user-facing flows (CLI help, GUI notifications).
36
+
37
+
## Security & Configuration Tips
38
+
- The plugin reads/writes markdown files; double-check glob patterns before running migrations to avoid unwanted edits.
39
+
- Avoid logging sensitive paths or credentials in PicGo configs; sanitize sample configs in docs and tests.
0 commit comments