create-atsdc-stack 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +3 -1
- package/CLAUDE.md +236 -0
- package/CONTRIBUTING.md +342 -342
- package/INSTALLATION.md +359 -359
- package/LICENSE +201 -201
- package/README.md +405 -405
- package/app/.env.example +17 -17
- package/app/.github/labeler.yml +61 -0
- package/app/.github/workflows/browser-tests.yml +101 -0
- package/app/.github/workflows/check.yml +24 -0
- package/app/.github/workflows/greetings.yml +16 -0
- package/app/.github/workflows/label.yml +22 -0
- package/app/.github/workflows/stale.yml +27 -0
- package/app/.github/workflows/summary.yml +34 -0
- package/app/.stylelintrc.json +8 -0
- package/app/README.md +251 -251
- package/app/astro.config.mjs +83 -83
- package/app/drizzle.config.ts +16 -16
- package/app/package.json +66 -52
- package/app/playwright.config.ts +27 -0
- package/app/public/manifest.webmanifest +36 -36
- package/app/pwa-assets.config.ts +8 -0
- package/app/src/components/Card.astro +36 -36
- package/app/src/db/initialize.ts +107 -107
- package/app/src/db/schema.ts +72 -72
- package/app/src/db/validations.ts +158 -158
- package/app/src/layouts/Layout.astro +63 -63
- package/app/src/lib/config.ts +36 -36
- package/app/src/lib/content-converter.ts +141 -141
- package/app/src/lib/dom-utils.ts +230 -230
- package/app/src/lib/exa-search.ts +269 -269
- package/app/src/pages/api/chat.ts +91 -91
- package/app/src/pages/api/posts.ts +350 -350
- package/app/src/pages/index.astro +87 -87
- package/app/src/styles/components/button.scss +152 -152
- package/app/src/styles/components/card.scss +180 -180
- package/app/src/styles/components/form.scss +240 -240
- package/app/src/styles/global.scss +141 -141
- package/app/src/styles/pages/index.scss +80 -80
- package/app/src/styles/reset.scss +83 -83
- package/app/src/styles/variables/globals.scss +96 -96
- package/app/src/styles/variables/mixins.scss +238 -238
- package/app/tests/browser.test.nopause.ts +10 -0
- package/app/tests/browser.test.ts +13 -0
- package/bin/cli.js +1151 -1138
- package/package.json +8 -6
- package/app/.astro/settings.json +0 -5
- package/app/.astro/types.d.ts +0 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -1,342 +1,342 @@
|
|
|
1
|
-
# Contributing to ATSDC Stack
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing to the ATSDC Stack! This document provides guidelines and instructions for contributing.
|
|
4
|
-
|
|
5
|
-
## Code of Conduct
|
|
6
|
-
|
|
7
|
-
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
|
|
8
|
-
|
|
9
|
-
## How to Contribute
|
|
10
|
-
|
|
11
|
-
### Reporting Bugs
|
|
12
|
-
|
|
13
|
-
If you find a bug, please create an issue with:
|
|
14
|
-
|
|
15
|
-
1. A clear, descriptive title
|
|
16
|
-
2. Steps to reproduce the issue
|
|
17
|
-
3. Expected behavior
|
|
18
|
-
4. Actual behavior
|
|
19
|
-
5. Your environment (OS, Node version, etc.)
|
|
20
|
-
6. Screenshots (if applicable)
|
|
21
|
-
|
|
22
|
-
### Suggesting Enhancements
|
|
23
|
-
|
|
24
|
-
We welcome feature requests! Please create an issue with:
|
|
25
|
-
|
|
26
|
-
1. A clear, descriptive title
|
|
27
|
-
2. Detailed description of the proposed feature
|
|
28
|
-
3. Use cases and benefits
|
|
29
|
-
4. Possible implementation approach (optional)
|
|
30
|
-
|
|
31
|
-
### Pull Requests
|
|
32
|
-
|
|
33
|
-
1. **Fork the repository**
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
git clone https://github.com/yourusername/atsdc-stack.git
|
|
37
|
-
cd atsdc-stack
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
2. **Create a feature branch**
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
git checkout -b feature/your-feature-name
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
3. **Make your changes**
|
|
47
|
-
- Follow the existing code style
|
|
48
|
-
- Write clear, concise commit messages
|
|
49
|
-
- Add tests if applicable
|
|
50
|
-
- Update documentation as needed
|
|
51
|
-
|
|
52
|
-
4. **Test your changes**
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm run build
|
|
56
|
-
npm run preview
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
5. **Commit your changes**
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
git add .
|
|
63
|
-
git commit -m "feat: add amazing new feature"
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
6. **Push to your fork**
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
git push origin feature/your-feature-name
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
7. **Create a Pull Request**
|
|
73
|
-
- Use a clear, descriptive title
|
|
74
|
-
- Reference any related issues
|
|
75
|
-
- Describe your changes in detail
|
|
76
|
-
- Include screenshots for UI changes
|
|
77
|
-
|
|
78
|
-
## Development Guidelines
|
|
79
|
-
|
|
80
|
-
### Code Style
|
|
81
|
-
|
|
82
|
-
#### TypeScript
|
|
83
|
-
|
|
84
|
-
- Use TypeScript for all new code
|
|
85
|
-
- Prefer interfaces over types for object shapes
|
|
86
|
-
- Use strict mode
|
|
87
|
-
- Avoid `any` - use `unknown` if necessary
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
// Good
|
|
91
|
-
interface User {
|
|
92
|
-
id: string;
|
|
93
|
-
name: string;
|
|
94
|
-
email: string;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Avoid
|
|
98
|
-
type User = {
|
|
99
|
-
id: any;
|
|
100
|
-
name: any;
|
|
101
|
-
};
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
#### SCSS Architecture
|
|
105
|
-
|
|
106
|
-
**Critical Rule**: Never use inline `<style>` tags in `.astro` files unless the component is completely self-standing and not part of the main layout.
|
|
107
|
-
|
|
108
|
-
```astro
|
|
109
|
-
<!-- GOOD: External styles with data attributes (preferred) -->
|
|
110
|
-
---
|
|
111
|
-
import '@/styles/components/button.scss';
|
|
112
|
-
---
|
|
113
|
-
<button class="btn" data-variant="primary" data-size="lg">Click Me</button>
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
```astro
|
|
117
|
-
<!-- GOOD: External styles with class chaining (alternative) -->
|
|
118
|
-
---
|
|
119
|
-
import '@/styles/components/button.scss';
|
|
120
|
-
---
|
|
121
|
-
<button class="btn primary lg">Click Me</button>
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
```astro
|
|
125
|
-
<!-- BAD: Inline styles (avoid this) -->
|
|
126
|
-
<button class="btn">Click Me</button>
|
|
127
|
-
<style>
|
|
128
|
-
.btn { /* styles */ }
|
|
129
|
-
</style>
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**SCSS File Organization:**
|
|
133
|
-
|
|
134
|
-
- **Variables**: `src/styles/variables/globals.scss`
|
|
135
|
-
- **Mixins**: `src/styles/variables/mixins.scss`
|
|
136
|
-
- **Global styles**: `src/styles/global.scss`
|
|
137
|
-
- **Component styles**: `src/styles/components/[component-name].scss`
|
|
138
|
-
- **Page styles**: `src/styles/pages/[page-name].scss`
|
|
139
|
-
|
|
140
|
-
**Naming Conventions & Modifier Strategy:**
|
|
141
|
-
|
|
142
|
-
- Use **data attributes** for modifiers by default (preferred for state and variants)
|
|
143
|
-
- Use **class chaining** when data attributes aren't appropriate
|
|
144
|
-
- Use kebab-case for file names
|
|
145
|
-
- Prefix component-specific classes with component name
|
|
146
|
-
- Use BEM for elements only (not modifiers)
|
|
147
|
-
|
|
148
|
-
```scss
|
|
149
|
-
// Component: Button
|
|
150
|
-
.btn {
|
|
151
|
-
@include button-base;
|
|
152
|
-
|
|
153
|
-
// Preferred: Data attribute modifiers
|
|
154
|
-
&[data-variant='primary'] { /* state/variant */ }
|
|
155
|
-
&[data-size='lg'] { /* size modifier */ }
|
|
156
|
-
&[data-state='loading'] { /* dynamic state */ }
|
|
157
|
-
|
|
158
|
-
// Alternative: Class chaining
|
|
159
|
-
&.primary { /* variant */ }
|
|
160
|
-
&.lg { /* size modifier */ }
|
|
161
|
-
&.loading { /* dynamic state */ }
|
|
162
|
-
|
|
163
|
-
// BEM for elements (still valid)
|
|
164
|
-
&__icon { /* element */ }
|
|
165
|
-
}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**When to use data attributes vs. class chaining:**
|
|
169
|
-
|
|
170
|
-
- **Data attributes (preferred):**
|
|
171
|
-
- Dynamic states (loading, active, disabled)
|
|
172
|
-
- Variants (primary, secondary, success, danger)
|
|
173
|
-
- Configuration (size, padding, alignment)
|
|
174
|
-
- Semantic modifiers that describe state
|
|
175
|
-
|
|
176
|
-
- **Class chaining (when appropriate):**
|
|
177
|
-
- CSS-only solutions without JavaScript
|
|
178
|
-
- When data attributes feel verbose
|
|
179
|
-
- Simple utility classes
|
|
180
|
-
- When working with third-party libraries
|
|
181
|
-
|
|
182
|
-
#### Database Schema
|
|
183
|
-
|
|
184
|
-
- Use NanoID for primary keys
|
|
185
|
-
- Always define Zod schemas for validation
|
|
186
|
-
- Include timestamps (createdAt, updatedAt)
|
|
187
|
-
- Use descriptive column names
|
|
188
|
-
|
|
189
|
-
```typescript
|
|
190
|
-
// Good
|
|
191
|
-
export const posts = pgTable('posts', {
|
|
192
|
-
id: varchar('id', { length: 21 })
|
|
193
|
-
.primaryKey()
|
|
194
|
-
.$defaultFn(() => nanoid()),
|
|
195
|
-
title: varchar('title', { length: 255 }).notNull(),
|
|
196
|
-
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// Corresponding Zod schema
|
|
200
|
-
export const createPostSchema = z.object({
|
|
201
|
-
title: z.string().min(1).max(255),
|
|
202
|
-
});
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
#### API Routes
|
|
206
|
-
|
|
207
|
-
- Always validate input with Zod
|
|
208
|
-
- Use proper HTTP status codes
|
|
209
|
-
- Return consistent response formats
|
|
210
|
-
- Handle errors gracefully
|
|
211
|
-
|
|
212
|
-
```typescript
|
|
213
|
-
export const POST: APIRoute = async ({ request }) => {
|
|
214
|
-
try {
|
|
215
|
-
const body = await request.json();
|
|
216
|
-
const validated = schema.parse(body);
|
|
217
|
-
|
|
218
|
-
// ... process request
|
|
219
|
-
|
|
220
|
-
return new Response(
|
|
221
|
-
JSON.stringify({ data: result }),
|
|
222
|
-
{ status: 200 }
|
|
223
|
-
);
|
|
224
|
-
} catch (error) {
|
|
225
|
-
if (error instanceof z.ZodError) {
|
|
226
|
-
return new Response(
|
|
227
|
-
JSON.stringify({ error: 'Validation error', details: error.errors }),
|
|
228
|
-
{ status: 400 }
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
// ... handle other errors
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Commit Message Guidelines
|
|
237
|
-
|
|
238
|
-
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
239
|
-
|
|
240
|
-
```text
|
|
241
|
-
type(scope): subject
|
|
242
|
-
|
|
243
|
-
body
|
|
244
|
-
|
|
245
|
-
footer
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
**Types:**
|
|
249
|
-
|
|
250
|
-
- `feat`: New feature
|
|
251
|
-
- `fix`: Bug fix
|
|
252
|
-
- `docs`: Documentation changes
|
|
253
|
-
- `style`: Code style changes (formatting, etc.)
|
|
254
|
-
- `refactor`: Code refactoring
|
|
255
|
-
- `test`: Adding or updating tests
|
|
256
|
-
- `chore`: Maintenance tasks
|
|
257
|
-
|
|
258
|
-
**Examples:**
|
|
259
|
-
|
|
260
|
-
```text
|
|
261
|
-
feat(auth): add OAuth integration with Google
|
|
262
|
-
fix(db): resolve connection pool timeout issue
|
|
263
|
-
docs(readme): update installation instructions
|
|
264
|
-
style(scss): reorganize component styles
|
|
265
|
-
refactor(api): simplify error handling
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Testing
|
|
269
|
-
|
|
270
|
-
- Test your changes locally before submitting
|
|
271
|
-
- Ensure the build passes: `npm run build`
|
|
272
|
-
- Check TypeScript types: `npx astro check`
|
|
273
|
-
- Test database migrations if applicable
|
|
274
|
-
|
|
275
|
-
### Documentation
|
|
276
|
-
|
|
277
|
-
- Update README.md if you change functionality
|
|
278
|
-
- Add JSDoc comments to functions and components
|
|
279
|
-
- Update INSTALLATION.md for setup changes
|
|
280
|
-
- Include inline comments for complex logic
|
|
281
|
-
|
|
282
|
-
## Project Structure Conventions
|
|
283
|
-
|
|
284
|
-
```text
|
|
285
|
-
src/
|
|
286
|
-
├── components/ # Reusable Astro components
|
|
287
|
-
│ └── ComponentName.astro
|
|
288
|
-
├── db/ # Database layer
|
|
289
|
-
│ ├── client.ts # Database client
|
|
290
|
-
│ ├── schema.ts # Drizzle schemas
|
|
291
|
-
│ └── validations.ts # Zod schemas
|
|
292
|
-
├── layouts/ # Layout components
|
|
293
|
-
│ └── Layout.astro
|
|
294
|
-
├── pages/ # Routes and pages
|
|
295
|
-
│ ├── api/ # API routes
|
|
296
|
-
│ │ └── endpoint.ts
|
|
297
|
-
│ └── index.astro
|
|
298
|
-
└── styles/ # SCSS files
|
|
299
|
-
├── components/ # Component styles
|
|
300
|
-
├── pages/ # Page styles
|
|
301
|
-
├── variables/
|
|
302
|
-
│ ├── globals.scss
|
|
303
|
-
│ └── mixins.scss
|
|
304
|
-
└── global.scss
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
## Adding New Dependencies
|
|
308
|
-
|
|
309
|
-
When adding a new dependency:
|
|
310
|
-
|
|
311
|
-
1. Justify the need - avoid dependency bloat
|
|
312
|
-
2. Check license compatibility (MIT preferred)
|
|
313
|
-
3. Verify it's actively maintained
|
|
314
|
-
4. Consider bundle size impact
|
|
315
|
-
5. Update package.json and documentation
|
|
316
|
-
|
|
317
|
-
## Release Process
|
|
318
|
-
|
|
319
|
-
Maintainers will handle releases:
|
|
320
|
-
|
|
321
|
-
1. Update version in package.json
|
|
322
|
-
2. Update CHANGELOG.md
|
|
323
|
-
3. Create a git tag
|
|
324
|
-
4. Publish to npm
|
|
325
|
-
|
|
326
|
-
## Questions?
|
|
327
|
-
|
|
328
|
-
If you have questions:
|
|
329
|
-
|
|
330
|
-
1. Check existing issues and discussions
|
|
331
|
-
2. Review the documentation
|
|
332
|
-
3. Create a new issue with the `question` label
|
|
333
|
-
|
|
334
|
-
## Recognition
|
|
335
|
-
|
|
336
|
-
Contributors will be recognized in:
|
|
337
|
-
|
|
338
|
-
- README.md contributors section
|
|
339
|
-
- Release notes
|
|
340
|
-
- Project documentation
|
|
341
|
-
|
|
342
|
-
Thank you for contributing to ATSDC Stack!
|
|
1
|
+
# Contributing to ATSDC Stack
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the ATSDC Stack! This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
|
|
8
|
+
|
|
9
|
+
## How to Contribute
|
|
10
|
+
|
|
11
|
+
### Reporting Bugs
|
|
12
|
+
|
|
13
|
+
If you find a bug, please create an issue with:
|
|
14
|
+
|
|
15
|
+
1. A clear, descriptive title
|
|
16
|
+
2. Steps to reproduce the issue
|
|
17
|
+
3. Expected behavior
|
|
18
|
+
4. Actual behavior
|
|
19
|
+
5. Your environment (OS, Node version, etc.)
|
|
20
|
+
6. Screenshots (if applicable)
|
|
21
|
+
|
|
22
|
+
### Suggesting Enhancements
|
|
23
|
+
|
|
24
|
+
We welcome feature requests! Please create an issue with:
|
|
25
|
+
|
|
26
|
+
1. A clear, descriptive title
|
|
27
|
+
2. Detailed description of the proposed feature
|
|
28
|
+
3. Use cases and benefits
|
|
29
|
+
4. Possible implementation approach (optional)
|
|
30
|
+
|
|
31
|
+
### Pull Requests
|
|
32
|
+
|
|
33
|
+
1. **Fork the repository**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/yourusername/atsdc-stack.git
|
|
37
|
+
cd atsdc-stack
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. **Create a feature branch**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git checkout -b feature/your-feature-name
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. **Make your changes**
|
|
47
|
+
- Follow the existing code style
|
|
48
|
+
- Write clear, concise commit messages
|
|
49
|
+
- Add tests if applicable
|
|
50
|
+
- Update documentation as needed
|
|
51
|
+
|
|
52
|
+
4. **Test your changes**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run build
|
|
56
|
+
npm run preview
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
5. **Commit your changes**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git add .
|
|
63
|
+
git commit -m "feat: add amazing new feature"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
6. **Push to your fork**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git push origin feature/your-feature-name
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
7. **Create a Pull Request**
|
|
73
|
+
- Use a clear, descriptive title
|
|
74
|
+
- Reference any related issues
|
|
75
|
+
- Describe your changes in detail
|
|
76
|
+
- Include screenshots for UI changes
|
|
77
|
+
|
|
78
|
+
## Development Guidelines
|
|
79
|
+
|
|
80
|
+
### Code Style
|
|
81
|
+
|
|
82
|
+
#### TypeScript
|
|
83
|
+
|
|
84
|
+
- Use TypeScript for all new code
|
|
85
|
+
- Prefer interfaces over types for object shapes
|
|
86
|
+
- Use strict mode
|
|
87
|
+
- Avoid `any` - use `unknown` if necessary
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// Good
|
|
91
|
+
interface User {
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
email: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Avoid
|
|
98
|
+
type User = {
|
|
99
|
+
id: any;
|
|
100
|
+
name: any;
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### SCSS Architecture
|
|
105
|
+
|
|
106
|
+
**Critical Rule**: Never use inline `<style>` tags in `.astro` files unless the component is completely self-standing and not part of the main layout.
|
|
107
|
+
|
|
108
|
+
```astro
|
|
109
|
+
<!-- GOOD: External styles with data attributes (preferred) -->
|
|
110
|
+
---
|
|
111
|
+
import '@/styles/components/button.scss';
|
|
112
|
+
---
|
|
113
|
+
<button class="btn" data-variant="primary" data-size="lg">Click Me</button>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```astro
|
|
117
|
+
<!-- GOOD: External styles with class chaining (alternative) -->
|
|
118
|
+
---
|
|
119
|
+
import '@/styles/components/button.scss';
|
|
120
|
+
---
|
|
121
|
+
<button class="btn primary lg">Click Me</button>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```astro
|
|
125
|
+
<!-- BAD: Inline styles (avoid this) -->
|
|
126
|
+
<button class="btn">Click Me</button>
|
|
127
|
+
<style>
|
|
128
|
+
.btn { /* styles */ }
|
|
129
|
+
</style>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**SCSS File Organization:**
|
|
133
|
+
|
|
134
|
+
- **Variables**: `src/styles/variables/globals.scss`
|
|
135
|
+
- **Mixins**: `src/styles/variables/mixins.scss`
|
|
136
|
+
- **Global styles**: `src/styles/global.scss`
|
|
137
|
+
- **Component styles**: `src/styles/components/[component-name].scss`
|
|
138
|
+
- **Page styles**: `src/styles/pages/[page-name].scss`
|
|
139
|
+
|
|
140
|
+
**Naming Conventions & Modifier Strategy:**
|
|
141
|
+
|
|
142
|
+
- Use **data attributes** for modifiers by default (preferred for state and variants)
|
|
143
|
+
- Use **class chaining** when data attributes aren't appropriate
|
|
144
|
+
- Use kebab-case for file names
|
|
145
|
+
- Prefix component-specific classes with component name
|
|
146
|
+
- Use BEM for elements only (not modifiers)
|
|
147
|
+
|
|
148
|
+
```scss
|
|
149
|
+
// Component: Button
|
|
150
|
+
.btn {
|
|
151
|
+
@include button-base;
|
|
152
|
+
|
|
153
|
+
// Preferred: Data attribute modifiers
|
|
154
|
+
&[data-variant='primary'] { /* state/variant */ }
|
|
155
|
+
&[data-size='lg'] { /* size modifier */ }
|
|
156
|
+
&[data-state='loading'] { /* dynamic state */ }
|
|
157
|
+
|
|
158
|
+
// Alternative: Class chaining
|
|
159
|
+
&.primary { /* variant */ }
|
|
160
|
+
&.lg { /* size modifier */ }
|
|
161
|
+
&.loading { /* dynamic state */ }
|
|
162
|
+
|
|
163
|
+
// BEM for elements (still valid)
|
|
164
|
+
&__icon { /* element */ }
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**When to use data attributes vs. class chaining:**
|
|
169
|
+
|
|
170
|
+
- **Data attributes (preferred):**
|
|
171
|
+
- Dynamic states (loading, active, disabled)
|
|
172
|
+
- Variants (primary, secondary, success, danger)
|
|
173
|
+
- Configuration (size, padding, alignment)
|
|
174
|
+
- Semantic modifiers that describe state
|
|
175
|
+
|
|
176
|
+
- **Class chaining (when appropriate):**
|
|
177
|
+
- CSS-only solutions without JavaScript
|
|
178
|
+
- When data attributes feel verbose
|
|
179
|
+
- Simple utility classes
|
|
180
|
+
- When working with third-party libraries
|
|
181
|
+
|
|
182
|
+
#### Database Schema
|
|
183
|
+
|
|
184
|
+
- Use NanoID for primary keys
|
|
185
|
+
- Always define Zod schemas for validation
|
|
186
|
+
- Include timestamps (createdAt, updatedAt)
|
|
187
|
+
- Use descriptive column names
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
// Good
|
|
191
|
+
export const posts = pgTable('posts', {
|
|
192
|
+
id: varchar('id', { length: 21 })
|
|
193
|
+
.primaryKey()
|
|
194
|
+
.$defaultFn(() => nanoid()),
|
|
195
|
+
title: varchar('title', { length: 255 }).notNull(),
|
|
196
|
+
createdAt: timestamp('created_at').defaultNow().notNull(),
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// Corresponding Zod schema
|
|
200
|
+
export const createPostSchema = z.object({
|
|
201
|
+
title: z.string().min(1).max(255),
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### API Routes
|
|
206
|
+
|
|
207
|
+
- Always validate input with Zod
|
|
208
|
+
- Use proper HTTP status codes
|
|
209
|
+
- Return consistent response formats
|
|
210
|
+
- Handle errors gracefully
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
export const POST: APIRoute = async ({ request }) => {
|
|
214
|
+
try {
|
|
215
|
+
const body = await request.json();
|
|
216
|
+
const validated = schema.parse(body);
|
|
217
|
+
|
|
218
|
+
// ... process request
|
|
219
|
+
|
|
220
|
+
return new Response(
|
|
221
|
+
JSON.stringify({ data: result }),
|
|
222
|
+
{ status: 200 }
|
|
223
|
+
);
|
|
224
|
+
} catch (error) {
|
|
225
|
+
if (error instanceof z.ZodError) {
|
|
226
|
+
return new Response(
|
|
227
|
+
JSON.stringify({ error: 'Validation error', details: error.errors }),
|
|
228
|
+
{ status: 400 }
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
// ... handle other errors
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Commit Message Guidelines
|
|
237
|
+
|
|
238
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
239
|
+
|
|
240
|
+
```text
|
|
241
|
+
type(scope): subject
|
|
242
|
+
|
|
243
|
+
body
|
|
244
|
+
|
|
245
|
+
footer
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Types:**
|
|
249
|
+
|
|
250
|
+
- `feat`: New feature
|
|
251
|
+
- `fix`: Bug fix
|
|
252
|
+
- `docs`: Documentation changes
|
|
253
|
+
- `style`: Code style changes (formatting, etc.)
|
|
254
|
+
- `refactor`: Code refactoring
|
|
255
|
+
- `test`: Adding or updating tests
|
|
256
|
+
- `chore`: Maintenance tasks
|
|
257
|
+
|
|
258
|
+
**Examples:**
|
|
259
|
+
|
|
260
|
+
```text
|
|
261
|
+
feat(auth): add OAuth integration with Google
|
|
262
|
+
fix(db): resolve connection pool timeout issue
|
|
263
|
+
docs(readme): update installation instructions
|
|
264
|
+
style(scss): reorganize component styles
|
|
265
|
+
refactor(api): simplify error handling
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Testing
|
|
269
|
+
|
|
270
|
+
- Test your changes locally before submitting
|
|
271
|
+
- Ensure the build passes: `npm run build`
|
|
272
|
+
- Check TypeScript types: `npx astro check`
|
|
273
|
+
- Test database migrations if applicable
|
|
274
|
+
|
|
275
|
+
### Documentation
|
|
276
|
+
|
|
277
|
+
- Update README.md if you change functionality
|
|
278
|
+
- Add JSDoc comments to functions and components
|
|
279
|
+
- Update INSTALLATION.md for setup changes
|
|
280
|
+
- Include inline comments for complex logic
|
|
281
|
+
|
|
282
|
+
## Project Structure Conventions
|
|
283
|
+
|
|
284
|
+
```text
|
|
285
|
+
src/
|
|
286
|
+
├── components/ # Reusable Astro components
|
|
287
|
+
│ └── ComponentName.astro
|
|
288
|
+
├── db/ # Database layer
|
|
289
|
+
│ ├── client.ts # Database client
|
|
290
|
+
│ ├── schema.ts # Drizzle schemas
|
|
291
|
+
│ └── validations.ts # Zod schemas
|
|
292
|
+
├── layouts/ # Layout components
|
|
293
|
+
│ └── Layout.astro
|
|
294
|
+
├── pages/ # Routes and pages
|
|
295
|
+
│ ├── api/ # API routes
|
|
296
|
+
│ │ └── endpoint.ts
|
|
297
|
+
│ └── index.astro
|
|
298
|
+
└── styles/ # SCSS files
|
|
299
|
+
├── components/ # Component styles
|
|
300
|
+
├── pages/ # Page styles
|
|
301
|
+
├── variables/
|
|
302
|
+
│ ├── globals.scss
|
|
303
|
+
│ └── mixins.scss
|
|
304
|
+
└── global.scss
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Adding New Dependencies
|
|
308
|
+
|
|
309
|
+
When adding a new dependency:
|
|
310
|
+
|
|
311
|
+
1. Justify the need - avoid dependency bloat
|
|
312
|
+
2. Check license compatibility (MIT preferred)
|
|
313
|
+
3. Verify it's actively maintained
|
|
314
|
+
4. Consider bundle size impact
|
|
315
|
+
5. Update package.json and documentation
|
|
316
|
+
|
|
317
|
+
## Release Process
|
|
318
|
+
|
|
319
|
+
Maintainers will handle releases:
|
|
320
|
+
|
|
321
|
+
1. Update version in package.json
|
|
322
|
+
2. Update CHANGELOG.md
|
|
323
|
+
3. Create a git tag
|
|
324
|
+
4. Publish to npm
|
|
325
|
+
|
|
326
|
+
## Questions?
|
|
327
|
+
|
|
328
|
+
If you have questions:
|
|
329
|
+
|
|
330
|
+
1. Check existing issues and discussions
|
|
331
|
+
2. Review the documentation
|
|
332
|
+
3. Create a new issue with the `question` label
|
|
333
|
+
|
|
334
|
+
## Recognition
|
|
335
|
+
|
|
336
|
+
Contributors will be recognized in:
|
|
337
|
+
|
|
338
|
+
- README.md contributors section
|
|
339
|
+
- Release notes
|
|
340
|
+
- Project documentation
|
|
341
|
+
|
|
342
|
+
Thank you for contributing to ATSDC Stack!
|