Skip to content

Commit 0155952

Browse files
Merge pull request #1 from karmaniverous/feature/component-scaffold
Feature/component scaffold
2 parents b5ab901 + 8c3e405 commit 0155952

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2476
-1332
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 2

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Normalize text files to LF in the repo regardless of platform
2+
* text=auto eol=lf
3+
4+
# Optional: allow CRLF where required on Windows scripts
5+
*.bat text eol=crlf
6+
*.cmd text eol=crlf

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ coverage/
77
dist/
88
esm/
99
node_modules/
10-
context/
1110
.stan/output/
1211
.stan/diff/
1312
.stan/dist/

.lefthook/pre-commit/branch-naming-policy

100644100755
File mode changed.

.lefthook/prepare-commit-msg/add-issue

100644100755
File mode changed.

.prettierrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2-
"endOfLine": "crlf",
2+
"embeddedLanguageFormatting": "auto",
3+
"endOfLine": "lf",
4+
"proseWrap": "never",
35
"singleQuote": true
46
}

.stan/system/.docs.meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "0.4.0"
2+
"version": "0.5.6"
33
}

.stan/system/stan.project.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# stan.project.md — Project-specific requirements
2+
3+
When updated: 2025-08-29T00:00:00Z
4+
5+
Repository goal
6+
7+
- Provide a ready-to-use template for building and publishing React 18 component libraries using TypeScript.
8+
9+
Baseline decisions
10+
11+
- React
12+
- Target React 18.
13+
- Use the modern “react-jsx” runtime.
14+
- Build outputs
15+
- ESM-only. No CJS or IIFE bundles.
16+
- ship types (.d.ts).
17+
- Dependencies
18+
- react and react-dom are peerDependencies (>=18).
19+
- Also present as devDependencies for local development and playground.
20+
- Mark package as "sideEffects": false (no global CSS side-effects).
21+
- Linting
22+
- TS-only rules; no react-specific eslint plugins for now.
23+
- Playground IS included in lint/Prettier scope (treat as first-class source). Exclude only generated output: dist/, docs/, coverage/, .rollup.cache/, .stan/, context/, diagrams/out/.
24+
- Flat config in eslint.config.ts (TypeScript), executed via `node --loader tsx` in npm scripts.
25+
- Windows: set ESLint languageOptions.parserOptions.tsconfigRootDir to path.resolve() to avoid a known typescript-eslint path bug affecting tsconfigRootDir resolution on Windows.
26+
- Limit lint to non-generated code; exclude dist/, docs/, coverage/, .rollup.cache/, .stan/, context/, and diagrams/out/.
27+
- Line endings (cross-platform): enforce LF-only in the repo via .gitattributes, .editorconfig, and Prettier (endOfLine: "lf"). If CRLF noise appears locally, normalize once: • git add --renormalize . • npm run lint:fix Editors with Prettier on save should keep files normalized.
28+
- Tests linted with Vitest recommended rules (non type-checked).
29+
- Testing
30+
- Vitest with happy-dom environment (project default).
31+
- @testing-library/react and @testing-library/jest-dom for component tests.
32+
- jest-dom is registered via vitest.setup.ts.
33+
- Dev preview
34+
- Vite playground under /playground for interactive browser viewing.
35+
- Playground is excluded from npm package (files: ["dist"]) and from typecheck.
36+
- Source layout
37+
- Components under src/components.
38+
- Public entry at src/index.ts re-exports components.
39+
- Removed legacy pieces
40+
- CLI example and related build logic removed.
41+
- No IIFE browser bundle.
42+
- Docs
43+
- Keep TypeDoc for API docs; entry remains src/index.ts.
44+
45+
Operational notes
46+
47+
- Rollup marks react and react/jsx-runtime as externals.
48+
- Keep release and docs scripts; they may be adjusted later as needed.
49+
- Consider adding Storybook or Ladle later if richer docs are required.

.stan/system/stan.project.template.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

.stan/system/stan.todo.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
When updated: 2025-08-31T00:28:00Z
2+
3+
Next up
4+
5+
- Run: npm install to ensure new devDependencies (react, react-dom, @types/react, @types/react-dom, vite, @vitejs/plugin-react, @testing-library/\*, tsx) are installed before running test/docs/typecheck.
6+
- Optionally add story tooling (Storybook or Ladle) if docs scale up.
7+
- Consider pruning unused devDependencies flagged by knip.
8+
- Re-run: npm run lint to confirm the Windows tseslint parser fix.
9+
- Normalize line endings to LF if you see CRLF noise: • git add --renormalize . • npm run lint:fix • commit the normalization
10+
- Verify lint includes /playground and excludes only generated output.
11+
12+
Completed (recent)
13+
14+
- Deduped ESLint config: shared Prettier/import-sort for JS/TS; kept TS-specific rules; expanded Vitest test globs to include JS.
15+
- Fixed ESLint parser error on Windows by setting parserOptions.tsconfigRootDir = path.resolve() in eslint.config.ts.
16+
- Clarified lint/format policy: include /playground; exclude generated outputs; rely on editor Prettier (no new Lefthook script).
17+
- Added tests for library entry re-exports and HelloWorld edge cases.
18+
- Tuned Vitest coverage to exclude docs/, dist/, and playground/ by default.
19+
- Updated README test section with entry re-export example and coverage notes.
20+
- Updated README to reflect React component template usage and features.
21+
- Replaced eslint.config.js with eslint.config.ts (flat config), updated npm scripts to run ESLint via node --loader tsx.
22+
- Scoped linting to avoid type-aware parse errors; ignore playground; tests use Vitest recommended rules (non type-checked).
23+
- Excluded tests and playground from ts typecheck; removed jest-dom types from tsconfig to prevent build/docs errors if not installed.
24+
- Excluded .rollup.cache from Vitest to avoid stale compiled tests.
25+
- Excluded playground from lint/typecheck to reduce false positives.
26+
- Added vitest.setup.ts and configured jest-dom globally.
27+
- Fixed unsafe return by typing HelloWorld return to JSX.Element.
28+
- Sorted imports and simplified tests.
29+
- Updated stan.config.yml to use standard build script.
30+
- Converted template to React 18 with react-jsx runtime.
31+
- Switched to ESM-only build; removed CJS/IIFE and CLI scaffold.
32+
- Added Vite playground under /playground for browser preview.
33+
- Added HelloWorld component + tests (Testing Library).
34+
- Marked react/react-dom as peerDependencies; set sideEffects: false.
35+
- Updated rollup config to externalize react & react/jsx-runtime.
36+
- Kept TypeDoc; preserved Vitest + happy-dom environment.
37+
- Updated package/repository metadata placeholders.

0 commit comments

Comments
 (0)