chore: initial project setup for newzy
Add repository scaffolding: .gitignore, README, CONTRIBUTING, MIT license, pre-push quality hook, and documentation covering branching, file conventions, and commit style. Establish the main/develop branching strategy. This is project setup only; no application functionality is included.
This commit is contained in:
commit
357a72114b
9 files changed
+569
No files matched your search
@@ -0,0 +1,89 @@
|
||||
# Branching Strategy
|
||||
|
||||
This document describes the branch model, naming conventions, and merge/rebase workflows for **newzy**.
|
||||
|
||||
## Branches
|
||||
|
||||
### Long-lived branches
|
||||
|
||||
| Branch | Purpose | Protected |
|
||||
| ----------- | -------------------------------------------------------------- | --------- |
|
||||
| `main` | Production-ready code. Always deployable. Receives releases. | Yes |
|
||||
| `develop` | Integration branch. All features land here before release. | Yes |
|
||||
|
||||
### Short-lived branches
|
||||
|
||||
| Branch | Created from | Merged into | Used for |
|
||||
| ------------ | ------------ | ------------ | ------------------------------------------ |
|
||||
| `feature/*` | `develop` | `develop` | New features and enhancements |
|
||||
| `bugfix/*` | `develop` | `develop` | Bug fixes not yet in production |
|
||||
| `hotfix/*` | `main` | `main` | Critical fixes for production (immediate) |
|
||||
|
||||
## Naming Conventions
|
||||
|
||||
- Use lowercase, kebab-case names: `feature/reader-view`, `bugfix/empty-feed-crash`.
|
||||
- Prefix with the type: `feature/`, `bugfix/`, `hotfix/`.
|
||||
- Keep the description short (2–4 words) and meaningful.
|
||||
- Optionally prefix with an issue number: `feature/123-article-search`.
|
||||
|
||||
## Merge and Rebase Workflows
|
||||
|
||||
### Feature development (rebase workflow)
|
||||
|
||||
Keep feature branches linear by rebasing onto the latest `develop` before pushing a pull request:
|
||||
|
||||
```bash
|
||||
git checkout feature/reader-view
|
||||
git fetch origin
|
||||
git rebase origin/develop
|
||||
# resolve any conflicts, then:
|
||||
git rebase --continue
|
||||
git push --force-with-lease origin feature/reader-view
|
||||
```
|
||||
|
||||
> **Rule:** only force-push branches that are still under active development and have not been merged. Never force-push `main` or `develop`.
|
||||
|
||||
### Merging into `develop`
|
||||
|
||||
- Feature and bugfix branches are **squash-merged** into `develop` so each feature appears as one clean commit.
|
||||
- The commit message of the squash commit must be a valid Conventional Commit (see [commits.md](commits.md)).
|
||||
|
||||
### Merging into `main` (releases)
|
||||
|
||||
- `develop` is merged into `main` with a **merge commit** (no squash, no rebase) to preserve the full feature history.
|
||||
- Example: `git merge --no-ff develop -m "release: cut v1.0.0"`.
|
||||
- Tag the resulting commit and push the tag.
|
||||
|
||||
### Hotfixes
|
||||
|
||||
```bash
|
||||
# 1. Branch off main
|
||||
git checkout main
|
||||
git pull --rebase origin main
|
||||
git checkout -b hotfix/feed-outage
|
||||
|
||||
# 2. Fix, commit, and PR against main (merge commit)
|
||||
|
||||
# 3. After merging into main, back-merge into develop
|
||||
git checkout develop
|
||||
git pull --rebase origin develop
|
||||
git merge --no-ff hotfix/feed-outage -m "merge: backport hotfix/feed-outage"
|
||||
git push origin develop
|
||||
```
|
||||
|
||||
## Conflict Resolution Strategy
|
||||
|
||||
1. **Rebase early, rebase often.** Resolve conflicts against `develop` at least once per day while a feature branch is active.
|
||||
2. Resolve conflicts on the feature branch (the rebasing side), never by rewriting `main`/`develop`.
|
||||
3. After resolving, run `git rebase --continue` and verify the app still works before pushing.
|
||||
4. If a conflict cannot be resolved confidently, stop and ask for help in the pull request — do not guess.
|
||||
5. The person who created the conflict (usually the branch doing the rebasing) owns the resolution.
|
||||
|
||||
## Do / Don't
|
||||
|
||||
| Do | Don't |
|
||||
| --------------------------------------------------------- | ------------------------------------------------ |
|
||||
| Branch off `develop` (or `main` for hotfixes) | Commit directly to `main` or `develop` |
|
||||
| Keep branches short-lived (ideally under a week) | Push broken/unfinished code to protected branches|
|
||||
| Use `--force-with-lease` when force-pushing | Force-push shared or merged branches |
|
||||
| Rebase before opening a PR | Merge `develop` back into your feature branch |
|
||||
@@ -0,0 +1,81 @@
|
||||
# Commit Conventions
|
||||
|
||||
All commits in **newzy** follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. This keeps history readable, machine-parseable, and enables automated changelogs.
|
||||
|
||||
## Format
|
||||
|
||||
```
|
||||
<type>[optional scope]: <short description>
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer(s)]
|
||||
```
|
||||
|
||||
- **type** (required): what kind of change this is.
|
||||
- **scope** (optional): area of the codebase affected, e.g. `reader`, `feed`, `ci`.
|
||||
- **description** (required): imperative mood, no trailing period, ≤ 72 chars.
|
||||
- **body** (optional): wrap at 72 chars; explain *what* and *why*, not *how*.
|
||||
- **footer** (optional): `BREAKING CHANGE:` annotations and issue references (`Closes #12`).
|
||||
|
||||
## Allowed Types
|
||||
|
||||
| Type | Use for |
|
||||
| ---------- | ---------------------------------------------------------- |
|
||||
| `feat` | New functionality for the user |
|
||||
| `fix` | Bug fixes |
|
||||
| `docs` | Documentation changes only |
|
||||
| `style` | Formatting, whitespace — no behavior change |
|
||||
| `refactor` | Code change that neither fixes a bug nor adds a feature |
|
||||
| `perf` | Performance improvements |
|
||||
| `test` | Adding or correcting tests |
|
||||
| `build` | Build system, dependencies, bundlers |
|
||||
| `ci` | CI configuration and pipeline changes |
|
||||
| `chore` | Maintenance, tooling, housekeeping (e.g. repo setup) |
|
||||
| `revert` | Reverting a previous commit |
|
||||
|
||||
## Sample Commit Messages
|
||||
|
||||
```text
|
||||
chore: initial project setup for newzy
|
||||
|
||||
Add repository scaffolding: .gitignore, README, CONTRIBUTING,
|
||||
MIT license, and documentation for branching, conventions,
|
||||
and commit style. Establish main/develop branch strategy.
|
||||
```
|
||||
|
||||
```text
|
||||
feat(feed): add paginated news feed
|
||||
|
||||
Fetches the first page of articles on load and appends
|
||||
additional pages on scroll. Closes #12.
|
||||
```
|
||||
|
||||
```text
|
||||
fix(reader): handle missing article images
|
||||
|
||||
Falls back to a placeholder image when an article has no
|
||||
media, fixing a blank card in the feed.
|
||||
```
|
||||
|
||||
```text
|
||||
docs: clarify rebase rules for feature branches
|
||||
```
|
||||
|
||||
```text
|
||||
ci: add lint and test checks to pull request workflow
|
||||
```
|
||||
|
||||
```text
|
||||
chore(deps): bump vite from 5.2.0 to 5.4.1
|
||||
|
||||
BREAKING CHANGE: Node 18 is no longer supported; requires Node 20+.
|
||||
```
|
||||
|
||||
## Rules of Thumb
|
||||
|
||||
1. One logical change per commit — split unrelated changes.
|
||||
2. Write the description in imperative mood: `add`, `fix`, `remove` (not `added`, `fixes`, `removed`).
|
||||
3. Reference issues in the footer: `Closes #12`, `Refs #34`.
|
||||
4. Mark breaking changes with a `BREAKING CHANGE:` footer.
|
||||
5. When in doubt about the type, `chore` is the safe fallback for housekeeping.
|
||||
@@ -0,0 +1,57 @@
|
||||
# File Structure & Naming Conventions
|
||||
|
||||
This document defines the repository layout and naming rules for **newzy**.
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
project-root/
|
||||
├── .gitignore # Files/directories excluded from version control
|
||||
├── LICENSE # MIT License
|
||||
├── README.md # Project overview and quick start
|
||||
├── CONTRIBUTING.md # Contribution guidelines
|
||||
├── docs/ # Project documentation
|
||||
│ ├── branching.md # Branch strategy, merge and rebase workflows
|
||||
│ ├── conventions.md # This file: structure and naming rules
|
||||
│ └── commits.md # Commit message format and examples
|
||||
├── hooks/ # Versioned Git hooks (install via core.hooksPath)
|
||||
│ └── pre-push # Code quality checks before pushing
|
||||
└── milestones/ # Milestone prompts and progress tracking
|
||||
└── m1-setup-git-project-prompt.md
|
||||
```
|
||||
|
||||
As the application grows, the following top-level entries are expected (added in later milestones):
|
||||
|
||||
```
|
||||
project-root/
|
||||
├── src/ # Application source code
|
||||
│ ├── components/ # Reusable UI components
|
||||
│ ├── pages/ # Route-level views
|
||||
│ ├── lib/ # Shared utilities and helpers
|
||||
│ └── ...
|
||||
├── public/ # Static assets (images, favicon, ...)
|
||||
├── tests/ # Test suites (if not colocated)
|
||||
├── scripts/ # Build/automation scripts
|
||||
└── .env.example # Documented, example environment variables
|
||||
```
|
||||
|
||||
## Naming Conventions
|
||||
|
||||
| Item | Convention | Examples |
|
||||
| ---------------- | ----------------- | --------------------------------- |
|
||||
| Directories | kebab-case, plural where they hold many items | `components/`, `news-articles/` |
|
||||
| Source files | kebab-case | `article-card.tsx`, `feed-service.ts` |
|
||||
| Test files | `*.test.*` or `*.spec.*` suffix, colocated with source or in `tests/` | `article-card.test.tsx` |
|
||||
| Docs | kebab-case `.md` | `branching.md`, `commits.md` |
|
||||
| Branches | `type/kebab-name` | `feature/reader-view` |
|
||||
| Tags | `vX.Y.Z` (SemVer) | `v1.0.0` |
|
||||
| Env files | `.env.example` committed, `.env*` ignored | `.env.example` |
|
||||
|
||||
## General Rules
|
||||
|
||||
1. **One file, one concern.** If a file grows beyond ~300 lines, consider splitting it.
|
||||
2. **Colocate** related files (component + its tests + its styles) in the same directory.
|
||||
3. **No committed secrets.** Secrets belong in `.env` (ignored); `.env.example` documents required variables with placeholder values.
|
||||
4. **Docs live in `docs/`** unless they are root-level standards (README, CONTRIBUTING, LICENSE).
|
||||
5. **Milestones live in `milestones/`**, named `m<#>-<kebab-name>-prompt.md`.
|
||||
6. Avoid absolute paths and machine-specific settings in committed files.
|
||||
Reference in new issue
Block a user