Skip to content

Commit d31f7d8

Browse files
authored
Merge pull request #1 from luk4x/feat/cli-creation
Feat/cli creation
2 parents f45e66e + c9f9379 commit d31f7d8

36 files changed

Lines changed: 5635 additions & 1 deletion

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/CONTRIBUTING.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing to `@luk4x/list`.
4+
5+
This project is intentionally small and opinionated. Please read this document carefully before opening an issue or pull request.
6+
7+
---
8+
9+
## Project scope
10+
11+
This component exists to solve **one specific problem**:
12+
13+
> Rendering lists in React with correct, stable keys and minimal boilerplate, without hiding React’s behavior.
14+
15+
Because of that, this project values:
16+
17+
- **Correctness over convenience** (especially around stable keys)
18+
- **failing loudly over silent fallbacks**
19+
- **Minimal API surface**
20+
- **Strong typing**
21+
- **Clear docs**
22+
23+
If a proposed change compromises any of these principles, it’s unlikely to be accepted.
24+
25+
### Proposing changes
26+
27+
Please do **not** propose changes that:
28+
29+
- add styling, layout, or visual concerns
30+
- introduce silent fallbacks as a workaround in case of failure
31+
- attempt to “fix” unstable or poorly modeled data
32+
- hide React’s behavior
33+
- expand the API surface beyond its current scope
34+
35+
Contributions are very welcome when:
36+
37+
- fix bugs or edge cases related to key handling
38+
- improve type safety without increasing API complexity
39+
- improve documentation clarity or examples
40+
- add tests that validate existing behavior
41+
- clarify error messages or developer feedback
42+
43+
### Issues and feature requests
44+
45+
When opening an issue, please include:
46+
47+
- What you’re trying to do
48+
- Expected behavior
49+
- Actual behavior
50+
- A minimal code example
51+
52+
---
53+
54+
## Project environment
55+
56+
The project is a **CLI** that prompts for a destination path and copies the `templates/list` component into a user’s codebase.
57+
58+
Therefore, the changes should be tested through the CLI itself as well, and not just through tests.
59+
60+
### Folder structure
61+
62+
```
63+
64+
├─ .github/ # GitHub metadata
65+
├─ .husky/ # Git hooks
66+
├─ dist/ # Build output (generated)
67+
├─ src/ # CLI source
68+
├─ templates # Component templates shipped by the CLI
69+
├─ tests/ # Runtime and type tests
70+
├─ index.d.ts # Root type exports for tsd
71+
├─ tsup.config.ts # Build config
72+
└─ vitest.config.ts # Test config
73+
74+
```
75+
76+
### Requirements
77+
78+
- Node.js >= 18 (recommended via NVM)
79+
- pnpm
80+
81+
### Tooling and conventions
82+
83+
This project uses the following tools and conventions:
84+
85+
- [@changesets/cli](https://www.npmjs.com/package/@changesets/cli) for versioning and releases
86+
- [Conventional Commits](https://www.conventionalcommits.org) for commit messages
87+
- [Vitest](https://vitest.dev/) and [tsd](https://www.npmjs.com/package/tsd) for testing
88+
89+
### Main scripts
90+
91+
```bash
92+
93+
pnpm install # install dependencies
94+
nvm install # install Node.js version from .nvmrc
95+
pnpm run dev # build and run the CLI locally
96+
pnpm run typecheck # run TypeScript checks (runs on every commit)
97+
pnpm run lint # run ESLint (runs on every commit)
98+
pnpm run test:all # run runtime and type tests (runs on every commit)
99+
pnpm run build # build the CLI with tsup (runs on every push)
100+
101+
```
102+
103+
### Recommended CLI local testing workflow
104+
105+
Because this is a CLI that copies templates into real projects, the most reliable way to test changes is to run it against a fresh test project.
106+
107+
Create a temporary test project:
108+
109+
```bash
110+
111+
mkdir -p /tmp/list-test && cd /tmp/list-test && pnpm init
112+
113+
```
114+
115+
From inside that project, run the CLI directly from your local build (replace the path accordingly):
116+
117+
```bash
118+
119+
node /absolute/path/to/list-repo/dist/cli.mjs
120+
121+
```
122+
123+
This simulates how real users interact with the CLI and helps catch issues that unit tests alone may miss (path resolution, prompts, file output, etc.). Changes that affect the CLI or templates should always be tested this way before opening a pull request.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## Summary
2+
3+
Briefly explain what this pull request does and why it exists.
4+
5+
Focus on:
6+
7+
- what problem is being addressed
8+
- why this change is necessary
9+
- how it aligns with the project’s goals
10+
11+
Avoid generic statements like “refactor” or “cleanup” without context.
12+
13+
---
14+
15+
## Type of change
16+
17+
- [ ] Bug fix (fixes incorrect or broken behavior)
18+
- [ ] Type-safety improvement
19+
- [ ] Documentation improvement
20+
- [ ] Internal refactor (no behavior change)
21+
- [ ] Test improvement
22+
- [ ] Other
23+
24+
---
25+
26+
## Design alignment check
27+
28+
Please confirm the following:
29+
30+
- [ ] This change does **not** add styling or layout concerns
31+
- [ ] This change does **not** expand the API surface beyond its current scope
32+
- [ ] This change preserves the component’s correctness and fail-fast behavior
33+
- [ ] This change does not hide or alter React’s list behavior
34+
- [ ] CLI behavior remains predictable and non-invasive
35+
36+
If any of these are unchecked, explain why below.
37+
38+
---
39+
40+
## Details
41+
42+
Explain the change in more detail if needed.
43+
44+
Include:
45+
46+
- edge cases considered
47+
- trade-offs made
48+
- alternative approaches rejected
49+
50+
---
51+
52+
## Checklist
53+
54+
- [ ] No unnecessary complexity introduced
55+
- [ ] Documentation was updated (if applicable)
56+
- [ ] Tests added/updated (if applicable) and tests pass locally

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup pnpm
16+
uses: pnpm/action-setup@v4
17+
with:
18+
version: 10.28.2
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 18
24+
cache: pnpm
25+
26+
- name: Install
27+
run: pnpm install --frozen-lockfile
28+
29+
- name: Typecheck
30+
run: pnpm run typecheck
31+
32+
- name: Lint
33+
run: pnpm run lint
34+
35+
- name: Tests
36+
run: pnpm run test:all
37+
38+
- name: Build
39+
run: pnpm run build

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm dlx commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm run typecheck && pnpm run lint && pnpm run test:all

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm run build

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict = true

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

0 commit comments

Comments
 (0)