Skip to content

Commit 002cb15

Browse files
authored
Merge pull request #13 from bholmesdev/chore/contribution-ready
Contribution readiness
2 parents 9b0d13f + e963321 commit 002cb15

File tree

19 files changed

+348
-1020
lines changed

19 files changed

+348
-1020
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node-version: [18]
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
- uses: pnpm/action-setup@v2
18+
with:
19+
version: 8
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'pnpm'
25+
- name: Install dependencies
26+
run: pnpm install
27+
28+
- name: Lint check
29+
run: pnpm check

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ npm-debug.log*
77

88
# typescript build
99
*.tsbuildinfo
10-
dist/
10+
dist/
11+
12+
# turborepo
13+
.turbo

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["biomejs.biome"]
3+
}

CONTRIBUTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Contributing to simple stack
2+
3+
Hey contributor 👋 Welcome to simple stack! We're a young project open to contributions of any kind, from fixes to features to documentation and tooling.
4+
5+
## Repository overview
6+
7+
Simple stack is a **monorepo** containing a suite of packages built for Astro. These are the most important directories:
8+
9+
```bash
10+
# packages including `simple-stack-form`, `simple-stack-partial`, etc
11+
packages/*
12+
# Astro projects that use and test these packages
13+
examples/*
14+
```
15+
16+
All source code is written in TypeScript, and components may use a variety of frameworks (Astro, React, Vue, Svelte, etc).
17+
18+
## What to ask before making a PR
19+
20+
Before submitting a pull request, we suggest asking:
21+
22+
1. **Have I checked the community discord and existing issue logs first?** We use GitHub issues and [discord discussions](https://wtw.dev/chat) to collaborate on changes. By opening an issue or starting a Discord thread, you can get early feedback on your problem before diving into a solution.
23+
24+
2. **Have I reviewed the existing documentation?** You may find an answer to your request in the package README. In fact, you might find room to improve our docs for future users with a similar problem.
25+
26+
If the answer is **yes** to both and you have a PR to contribute, get to it!
27+
28+
## Prerequisites
29+
30+
New contributors need the following tools:
31+
32+
- [Node 18.14+](https://nodejs.org/en/download) for building packages and example sites.
33+
- [pnpm](https://pnpm.io/) to install dependencies. We prefer pnpm since it runs quickly and offers a [robust workspace feature](https://pnpm.io/workspaces) to manage monorepo dependencies.
34+
35+
## Initial setup
36+
37+
To get started, clone this repository and install dependencies from the project root:
38+
39+
```bash
40+
git clone https://github.com/bholmesdev/simple-stack.git
41+
cd simple-stack
42+
pnpm install
43+
```
44+
45+
### Linting and formatting
46+
47+
This project uses [Biome](https://biomejs.dev/) to lint and format code across packages. If you use VS Code, this repository includes a `.vscode/` directory to preconfigure your default linter. [Visit the editor integration docs](https://biomejs.dev/guides/integrate-in-editor/) to enable linting in your editor of choice.
48+
49+
To run the linter manually, you can use the following commands at the project root:
50+
51+
```bash
52+
# lint and format all files in packages/*
53+
pnpm check
54+
# apply lint and format fixes to all files in packages/*
55+
pnpm check:apply
56+
# run `lint` or `format` steps individually
57+
pnpm lint
58+
pnpm lint:apply
59+
pnpm format
60+
pnpm format:apply
61+
```
62+
63+
## Development
64+
65+
You may want live compilation for your TypeScript code while working. We use [turborepo](https://turbo.build/) to build packages for development and production. For live reloading, run the following at the project root:
66+
67+
```bash
68+
pnpm dev
69+
```
70+
71+
This will build all `packages/*` entries and listen for changes.
72+
73+
To test your code, you can run any one of our Astro projects under `examples/*`. First open a second terminal, navigate to that example, and run the same `pnpm dev` command. You may need to kill and restart this server to see your package edits take effect.
74+
75+
You can also run packages _and_ examples simultaneously:
76+
77+
```bash
78+
pnpm dev:all
79+
```
80+
81+
However, we've found console logs are harder to read using this approach. Use whichever you prefer!

package.json

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
{
2-
"name": "simple-stack",
3-
"version": "1.0.0",
4-
"description": "",
5-
"main": "index.js",
6-
"scripts": {
7-
"check": "biome check packages/*",
8-
"check:apply": "biome check packages/* --apply",
9-
"lint": "biome lint packages/*",
10-
"lint:apply": "biome lint packages/* --apply",
11-
"format": "biome format",
12-
"format:write": "biome format --write"
13-
},
14-
"keywords": [],
15-
"author": "",
16-
"license": "ISC",
17-
"devDependencies": {
18-
"@biomejs/biome": "^1.4.1"
19-
}
2+
"name": "simple-stack",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"dev": "turbo dev --filter='./packages/*'",
8+
"dev:all": "turbo dev",
9+
"build": "turbo build --filter='./packages/*'",
10+
"build:all": "turbo build",
11+
"check": "biome check packages/*",
12+
"check:apply": "biome check packages/* --apply",
13+
"lint": "biome lint packages/*",
14+
"lint:apply": "biome lint packages/* --apply",
15+
"format": "biome format",
16+
"format:write": "biome format --write"
17+
},
18+
"keywords": [],
19+
"author": "",
20+
"license": "ISC",
21+
"devDependencies": {
22+
"@biomejs/biome": "^1.4.1",
23+
"turbo": "^1.11.2"
24+
}
2025
}

packages/form/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { existsSync } from "node:fs";
22
import { mkdir, readFile, readdir } from "node:fs/promises";
33
import { resolve } from "node:path";
44
import { fileURLToPath } from "node:url";
5-
import { copy } from "fs-extra/esm";
65
import {
76
cancel,
87
confirm,
@@ -12,6 +11,7 @@ import {
1211
select,
1312
text,
1413
} from "@clack/prompts";
14+
import { copy } from "fs-extra/esm";
1515
import { bgGreen, bgWhite, black, bold, dim, green } from "kleur/colors";
1616

1717
const frameworks = [

packages/form/src/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import mapObject from "just-map-object";
22
import {
3+
ZodArray,
34
ZodBoolean,
45
type ZodError,
6+
ZodNullable,
57
ZodNumber,
68
ZodObject,
79
ZodOptional,
810
type ZodRawShape,
911
type ZodType,
1012
z,
11-
ZodNullable,
12-
ZodArray,
1313
} from "zod";
1414

1515
export { mapObject };

packages/form/templates/preact/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import {
66
type FieldErrors,
77
type FormState,
88
type FormValidator,
9+
formNameInputProps,
910
getInitialFormState,
1011
toSetValidationErrors,
1112
toTrackAstroSubmitStatus,
1213
toValidateField,
1314
validateForm,
14-
formNameInputProps,
1515
} from "simple:form";
1616

1717
export function useCreateFormContext(

packages/form/templates/react/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import {
1010
type FieldErrors,
1111
type FormState,
1212
type FormValidator,
13+
formNameInputProps,
1314
getInitialFormState,
1415
toSetValidationErrors,
1516
toTrackAstroSubmitStatus,
1617
toValidateField,
1718
validateForm,
18-
formNameInputProps,
1919
} from "simple:form";
2020

2121
export function useCreateFormContext(

packages/form/tsconfig.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
2-
"extends": "../../tsconfig.base.json",
3-
"include": ["src"],
4-
"compilerOptions": {
5-
"outDir": "./dist",
6-
"rootDir": "./src",
7-
"declaration": true,
8-
"declarationMap": true,
9-
"sourceMap": true
10-
}
2+
"extends": "../../tsconfig.base.json",
3+
"include": ["src"],
4+
"compilerOptions": {
5+
"outDir": "./dist",
6+
"rootDir": "./src"
7+
}
118
}

0 commit comments

Comments
 (0)