@regardio/dev 0.9.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/LICENSE +9 -0
- package/README.md +416 -0
- package/dist/bin/exec-clean.d.ts +3 -0
- package/dist/bin/exec-clean.d.ts.map +1 -0
- package/dist/bin/exec-clean.js +18 -0
- package/dist/bin/exec-husky.d.ts +3 -0
- package/dist/bin/exec-husky.d.ts.map +1 -0
- package/dist/bin/exec-husky.js +8 -0
- package/dist/bin/exec-p.d.ts +3 -0
- package/dist/bin/exec-p.d.ts.map +1 -0
- package/dist/bin/exec-p.js +8 -0
- package/dist/bin/exec-s.d.ts +3 -0
- package/dist/bin/exec-s.d.ts.map +1 -0
- package/dist/bin/exec-s.js +8 -0
- package/dist/bin/exec-ts.d.ts +3 -0
- package/dist/bin/exec-ts.d.ts.map +1 -0
- package/dist/bin/exec-ts.js +28 -0
- package/dist/bin/exec-tsc.d.ts +3 -0
- package/dist/bin/exec-tsc.d.ts.map +1 -0
- package/dist/bin/exec-tsc.js +8 -0
- package/dist/bin/flow-branch.d.ts +3 -0
- package/dist/bin/flow-branch.d.ts.map +1 -0
- package/dist/bin/flow-branch.js +27 -0
- package/dist/bin/flow-version.d.ts +3 -0
- package/dist/bin/flow-version.d.ts.map +1 -0
- package/dist/bin/flow-version.js +83 -0
- package/dist/bin/lint-biome.d.ts +3 -0
- package/dist/bin/lint-biome.d.ts.map +1 -0
- package/dist/bin/lint-biome.js +8 -0
- package/dist/bin/lint-commit.d.ts +3 -0
- package/dist/bin/lint-commit.d.ts.map +1 -0
- package/dist/bin/lint-commit.js +8 -0
- package/dist/bin/lint-md.d.ts +3 -0
- package/dist/bin/lint-md.d.ts.map +1 -0
- package/dist/bin/lint-md.js +10 -0
- package/dist/config.test.d.ts +2 -0
- package/dist/config.test.d.ts.map +1 -0
- package/dist/config.test.js +101 -0
- package/dist/playwright/index.d.ts +10 -0
- package/dist/playwright/index.d.ts.map +1 -0
- package/dist/playwright/index.js +42 -0
- package/dist/playwright/index.test.d.ts +2 -0
- package/dist/playwright/index.test.d.ts.map +1 -0
- package/dist/playwright/index.test.js +55 -0
- package/dist/testing/setup-react.d.ts +2 -0
- package/dist/testing/setup-react.d.ts.map +1 -0
- package/dist/testing/setup-react.js +1 -0
- package/dist/vitest/node.d.ts +3 -0
- package/dist/vitest/node.d.ts.map +1 -0
- package/dist/vitest/node.js +6 -0
- package/dist/vitest/react.d.ts +3 -0
- package/dist/vitest/react.d.ts.map +1 -0
- package/dist/vitest/react.js +7 -0
- package/package.json +104 -0
- package/src/bin/exec-clean.ts +24 -0
- package/src/bin/exec-husky.ts +13 -0
- package/src/bin/exec-p.ts +13 -0
- package/src/bin/exec-s.ts +13 -0
- package/src/bin/exec-ts.ts +39 -0
- package/src/bin/exec-tsc.ts +13 -0
- package/src/bin/lint-biome.ts +13 -0
- package/src/bin/lint-commit.ts +13 -0
- package/src/bin/lint-md.ts +16 -0
- package/src/biome/preset.json +297 -0
- package/src/commitlint/commitlint.cjs +26 -0
- package/src/config.test.ts +129 -0
- package/src/markdownlint/markdownlint.json +9 -0
- package/src/playwright/index.test.ts +73 -0
- package/src/playwright/index.ts +63 -0
- package/src/testing/setup-react.ts +8 -0
- package/src/typescript/base.json +50 -0
- package/src/typescript/build.json +19 -0
- package/src/typescript/react.json +8 -0
- package/src/vitest/node.ts +12 -0
- package/src/vitest/react.ts +15 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Regardio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
# @regardio/dev
|
|
2
|
+
|
|
3
|
+
Developer tooling for testing, linting, and build workflows in Regardio projects.
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
|
|
7
|
+
We believe in **balanced strictness**: rigorous enough to catch bugs early and maintain consistency, yet practical enough to not impede development velocity.
|
|
8
|
+
|
|
9
|
+
### Strict by Default
|
|
10
|
+
|
|
11
|
+
- **TypeScript strict mode** with `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes`
|
|
12
|
+
- **Comprehensive linting** via Biome for code quality, style, and complexity
|
|
13
|
+
- **Conventional commits** enforced through commitlint
|
|
14
|
+
- **Automated testing** as a first-class concern
|
|
15
|
+
|
|
16
|
+
### Practical in Application
|
|
17
|
+
|
|
18
|
+
Strictness serves developers, not the other way around. Our approach:
|
|
19
|
+
|
|
20
|
+
- **Sensible defaults** - Shared configs that work out of the box
|
|
21
|
+
- **Minimal boilerplate** - Extend presets, override only what's necessary
|
|
22
|
+
- **Fast feedback** - Quick linting and type checking during development
|
|
23
|
+
- **Clear exceptions** - When rules don't apply, document why with `// biome-ignore` or `@ts-expect-error`
|
|
24
|
+
|
|
25
|
+
### The Balance
|
|
26
|
+
|
|
27
|
+
We optimize for:
|
|
28
|
+
|
|
29
|
+
1. **Catching bugs before they ship** - Strict types prevent runtime errors
|
|
30
|
+
2. **Readable, maintainable code** - Consistent style reduces cognitive load
|
|
31
|
+
3. **Developer experience** - Tools should help, not hinder
|
|
32
|
+
4. **Team velocity** - Shared understanding through enforced conventions
|
|
33
|
+
|
|
34
|
+
Exceptions are allowed but must be intentional and documented. The goal is code that's correct, consistent, and a pleasure to work with.
|
|
35
|
+
|
|
36
|
+
## What's inside
|
|
37
|
+
|
|
38
|
+
- **CLI bins**: exec-clean, exec-husky, exec-p, exec-s, exec-ts, exec-tsc, lint-biome, lint-commit, lint-md
|
|
39
|
+
- **Config presets**: Biome, Commitlint, Markdownlint, TypeScript (base/react)
|
|
40
|
+
- **Testing configs**: Vitest (node/react), Playwright base config, Testing Library setup
|
|
41
|
+
- **Dev dependencies**: All commonly needed testing and linting packages bundled
|
|
42
|
+
- **[Developer Documentation](./docs/README.md)**: Foundational principles, testing philosophy, naming conventions
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pnpm add -D @regardio/dev
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Testing
|
|
51
|
+
|
|
52
|
+
### Vitest Configuration
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// vitest.config.ts (Node.js package)
|
|
56
|
+
import { defineConfig } from 'vitest/config';
|
|
57
|
+
import { vitestNodeConfig } from '@regardio/dev/vitest/node';
|
|
58
|
+
|
|
59
|
+
export default defineConfig({ test: vitestNodeConfig });
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// vitest.config.ts (React package)
|
|
64
|
+
import { defineConfig } from 'vitest/config';
|
|
65
|
+
import { vitestReactConfig } from '@regardio/dev/vitest/react';
|
|
66
|
+
|
|
67
|
+
export default defineConfig({ test: vitestReactConfig });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Playwright Configuration
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// playwright.config.ts
|
|
74
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
75
|
+
import { buildPlaywrightBaseConfig } from '@regardio/dev/playwright';
|
|
76
|
+
|
|
77
|
+
export default defineConfig(
|
|
78
|
+
buildPlaywrightBaseConfig({
|
|
79
|
+
appPort: 5100,
|
|
80
|
+
appUrl: 'http://localhost:5100',
|
|
81
|
+
devices,
|
|
82
|
+
webServerCommand: 'vite preview',
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Testing Library Setup
|
|
88
|
+
|
|
89
|
+
For React packages, create a `src/test-setup.ts`:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import '@regardio/dev/testing/setup-react';
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Config Presets
|
|
96
|
+
|
|
97
|
+
- **Biome**: `"extends": ["@regardio/dev/biome"]`
|
|
98
|
+
- **TypeScript**: `@regardio/dev/typescript/base.json`, `@regardio/dev/typescript/react.json`
|
|
99
|
+
- **Commitlint**: `module.exports = require('@regardio/dev/commitlint');`
|
|
100
|
+
- **Markdownlint**: `"extends": "@regardio/dev/markdownlint"`
|
|
101
|
+
|
|
102
|
+
## Scripts (examples)
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"scripts": {
|
|
107
|
+
"fix": "exec-p fix:*",
|
|
108
|
+
"fix:biome": "lint-biome check --write --unsafe .",
|
|
109
|
+
"fix:md": "lint-md --fix \"**/*.md\" \"**/*.mdx\" \"!**/node_modules/**\" \"!**/dist/**\"",
|
|
110
|
+
"lint": "exec-p lint:*",
|
|
111
|
+
"lint:biome": "lint-biome check .",
|
|
112
|
+
"lint:md": "lint-md \"**/*.md\" \"**/*.mdx\" \"!**/node_modules/**\" \"!**/dist/**\"",
|
|
113
|
+
"prepare": "exec-husky",
|
|
114
|
+
"test": "exec-p test:*",
|
|
115
|
+
"test:e2e": "playwright test",
|
|
116
|
+
"test:unit": "vitest run",
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Local Config Files
|
|
122
|
+
|
|
123
|
+
Each package needs a few local config files that extend the shared presets. Here's the minimal setup:
|
|
124
|
+
|
|
125
|
+
### Required Files
|
|
126
|
+
|
|
127
|
+
All config files should be placed in the **package root** (same level as `package.json`):
|
|
128
|
+
|
|
129
|
+
| File | Purpose | Extends |
|
|
130
|
+
|------|---------|---------|
|
|
131
|
+
| `tsconfig.json` | TypeScript base config | `@regardio/dev/typescript/base.json` or `react.json` |
|
|
132
|
+
| `tsconfig.build.json` | Build-specific config | `./tsconfig.json` + `@regardio/dev/typescript/build.json` |
|
|
133
|
+
| `biome.jsonc` | Linting and formatting | `@regardio/dev/biome` |
|
|
134
|
+
| `.commitlintrc.json` | Commit message linting | `@regardio/dev/commitlint` (workspace root only) |
|
|
135
|
+
| `.markdownlint.jsonc` | Markdown linting | `@regardio/dev/markdownlint` |
|
|
136
|
+
| `vitest.config.ts` | Unit test config | Uses `vitestNodeConfig` or `vitestReactConfig` |
|
|
137
|
+
| `playwright.config.ts` | E2E test config | Uses `buildPlaywrightBaseConfig` |
|
|
138
|
+
| `.hintrc` | webhint config (optional) | `development` preset |
|
|
139
|
+
|
|
140
|
+
### File Naming Conventions
|
|
141
|
+
|
|
142
|
+
- **JSON configs**: Use the standard names expected by each tool
|
|
143
|
+
- `.commitlintrc.json` (not `commitlint.config.json`)
|
|
144
|
+
- `.markdownlint.jsonc` (supports comments)
|
|
145
|
+
- `biome.jsonc` (supports comments, Biome also accepts `biome.json`)
|
|
146
|
+
- **TypeScript configs**: Always `tsconfig*.json`
|
|
147
|
+
- **Test configs**: `vitest.config.ts`, `playwright.config.ts`
|
|
148
|
+
- **Hidden files**: Prefix with `.` for tool-specific configs (`.hintrc`, `.editorconfig`)
|
|
149
|
+
|
|
150
|
+
### Workspace Root vs Package Root
|
|
151
|
+
|
|
152
|
+
| Location | Files |
|
|
153
|
+
|----------|-------|
|
|
154
|
+
| **Workspace root** | `.editorconfig`, `.commitlintrc.json`, `.gitignore`, AI agent configs |
|
|
155
|
+
| **Each package** | `tsconfig.json`, `tsconfig.build.json`, `biome.jsonc`, `.markdownlint.jsonc`, test configs |
|
|
156
|
+
|
|
157
|
+
### Example: tsconfig.json (Node.js package)
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"extends": "@regardio/dev/typescript/base.json",
|
|
162
|
+
"include": ["src/**/*.ts"]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Example: tsconfig.build.json
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"compilerOptions": {
|
|
171
|
+
"outDir": "./dist",
|
|
172
|
+
"rootDir": "./src"
|
|
173
|
+
},
|
|
174
|
+
"extends": ["./tsconfig.json", "@regardio/dev/typescript/build.json"],
|
|
175
|
+
"include": ["src/**/*.ts"]
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Example: biome.jsonc
|
|
180
|
+
|
|
181
|
+
```jsonc
|
|
182
|
+
{
|
|
183
|
+
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
|
|
184
|
+
"extends": ["@regardio/dev/biome"]
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Code Quality Philosophy
|
|
189
|
+
|
|
190
|
+
### Strictness by Default
|
|
191
|
+
|
|
192
|
+
We enforce strict checks across the codebase:
|
|
193
|
+
|
|
194
|
+
- **TypeScript**: `strict: true`, `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
|
|
195
|
+
- **Biome**: Comprehensive lint rules for correctness, style, and complexity
|
|
196
|
+
- **Commits**: Conventional commit format enforced via commitlint
|
|
197
|
+
|
|
198
|
+
### Why So Strict?
|
|
199
|
+
|
|
200
|
+
1. **Catch bugs early** - Strict type checking prevents entire categories of runtime errors
|
|
201
|
+
2. **Consistent codebase** - Uniform style reduces cognitive load when reading code
|
|
202
|
+
3. **Self-documenting** - Explicit types and patterns make intent clear
|
|
203
|
+
4. **Refactoring confidence** - Strong types enable safe, large-scale changes
|
|
204
|
+
|
|
205
|
+
### Exceptions: Few and Intentional
|
|
206
|
+
|
|
207
|
+
We allow very few exceptions, and each must be justified:
|
|
208
|
+
|
|
209
|
+
- **`// biome-ignore`** - Only when the rule genuinely doesn't apply, don't use it just to make the linter happy. Always add a comment explaining why the exception is necessary.
|
|
210
|
+
- **`@ts-expect-error`** - Only for known TypeScript limitations with an explanatory comment. Always include a reason for the exception.
|
|
211
|
+
- **`eslint-disable`** - We don't use ESLint directly; all linting is handled by Biome. If you encounter an ESLint rule that needs to be disabled, discuss it with the team first and document the reasoning.
|
|
212
|
+
|
|
213
|
+
The goal is balance: strict enough to prevent bugs, flexible enough to not block legitimate patterns.
|
|
214
|
+
|
|
215
|
+
## Editor & AI Configuration
|
|
216
|
+
|
|
217
|
+
### EditorConfig
|
|
218
|
+
|
|
219
|
+
Create `.editorconfig` at the workspace root:
|
|
220
|
+
|
|
221
|
+
```ini
|
|
222
|
+
root = true
|
|
223
|
+
|
|
224
|
+
[*]
|
|
225
|
+
charset = utf-8
|
|
226
|
+
end_of_line = lf
|
|
227
|
+
indent_size = 2
|
|
228
|
+
indent_style = tab
|
|
229
|
+
insert_final_newline = true
|
|
230
|
+
trim_trailing_whitespace = true
|
|
231
|
+
|
|
232
|
+
[*.md]
|
|
233
|
+
indent_style = space
|
|
234
|
+
trim_trailing_whitespace = false
|
|
235
|
+
|
|
236
|
+
[*.{yml,yaml}]
|
|
237
|
+
indent_style = space
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### AI Agent Configuration
|
|
241
|
+
|
|
242
|
+
These files help AI coding assistants understand project conventions.
|
|
243
|
+
|
|
244
|
+
#### Claude (CLAUDE.md)
|
|
245
|
+
|
|
246
|
+
```markdown
|
|
247
|
+
# Project Guidelines
|
|
248
|
+
|
|
249
|
+
## Code Style
|
|
250
|
+
- Use TypeScript with strict mode
|
|
251
|
+
- Follow Biome formatting (tabs, no semicolons where optional)
|
|
252
|
+
- Prefer functional patterns over classes
|
|
253
|
+
|
|
254
|
+
## Testing
|
|
255
|
+
- Unit tests with Vitest, E2E with Playwright
|
|
256
|
+
- Test files: `*.test.ts` or `*.test.tsx`
|
|
257
|
+
|
|
258
|
+
## Commits
|
|
259
|
+
- Use conventional commits: `feat:`, `fix:`, `docs:`, etc.
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
#### Gemini (.gemini/settings.json)
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"codeStyle": {
|
|
267
|
+
"language": "typescript",
|
|
268
|
+
"formatter": "biome",
|
|
269
|
+
"indentation": "tabs"
|
|
270
|
+
},
|
|
271
|
+
"testing": {
|
|
272
|
+
"framework": "vitest",
|
|
273
|
+
"e2e": "playwright"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
#### Windsurf (.windsurf/rules.md)
|
|
279
|
+
|
|
280
|
+
```markdown
|
|
281
|
+
# Windsurf Rules
|
|
282
|
+
|
|
283
|
+
- Extend shared configs from `@regardio/dev`
|
|
284
|
+
- Use `pnpm` for package management
|
|
285
|
+
- Follow conventional commits
|
|
286
|
+
- Prefer minimal, focused edits
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
#### Cursor (.cursor/rules.md)
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
# Cursor Rules
|
|
293
|
+
|
|
294
|
+
## Project Structure
|
|
295
|
+
- Monorepo with pnpm workspaces
|
|
296
|
+
- Shared tooling in `packages/dev`
|
|
297
|
+
|
|
298
|
+
## Coding Standards
|
|
299
|
+
- TypeScript strict mode
|
|
300
|
+
- Biome for linting and formatting
|
|
301
|
+
- Vitest for unit tests, Playwright for E2E
|
|
302
|
+
|
|
303
|
+
## Workflow
|
|
304
|
+
- Run `pnpm lint` before committing
|
|
305
|
+
- Use conventional commit messages
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Bundled Dependencies
|
|
309
|
+
|
|
310
|
+
When you add `@regardio/dev` as a dev dependency, you get access to:
|
|
311
|
+
|
|
312
|
+
- **Testing**: vitest, @vitest/ui, @playwright/test, @testing-library/react, @testing-library/jest-dom, jsdom
|
|
313
|
+
- **Linting**: @biomejs/biome, markdownlint-cli2, @commitlint/cli
|
|
314
|
+
- **Build**: typescript, tsx, vite, husky
|
|
315
|
+
- **Release**: @changesets/cli for versioning and publishing
|
|
316
|
+
|
|
317
|
+
## Releasing
|
|
318
|
+
|
|
319
|
+
This package uses [Changesets](https://github.com/changesets/changesets) for versioning and npm publishing.
|
|
320
|
+
|
|
321
|
+
### Adding a Changeset
|
|
322
|
+
|
|
323
|
+
When making changes that should be released:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
pnpm changeset
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Automated Release (GitHub Action)
|
|
330
|
+
|
|
331
|
+
When changesets are merged to `main`:
|
|
332
|
+
|
|
333
|
+
1. A "Version Packages" PR is created with updated version and CHANGELOG
|
|
334
|
+
2. Merging that PR publishes to npm
|
|
335
|
+
|
|
336
|
+
### Manual Release
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
pnpm version # Update version and CHANGELOG
|
|
340
|
+
pnpm build # Build the package
|
|
341
|
+
pnpm release # Publish to npm
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### GitHub Repository Setup
|
|
345
|
+
|
|
346
|
+
Before the release action works, configure these in **GitHub repo settings**:
|
|
347
|
+
|
|
348
|
+
#### 1. NPM_TOKEN Secret
|
|
349
|
+
|
|
350
|
+
```text
|
|
351
|
+
Settings → Secrets and variables → Actions → New repository secret
|
|
352
|
+
Name: NPM_TOKEN
|
|
353
|
+
Value: <your npm access token with publish permissions>
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
To create an npm token:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
npm login
|
|
360
|
+
npm token create --read-only=false
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
#### 2. GitHub Actions Permissions
|
|
364
|
+
|
|
365
|
+
```text
|
|
366
|
+
Settings → Actions → General → Workflow permissions
|
|
367
|
+
☑ Read and write permissions
|
|
368
|
+
☑ Allow GitHub Actions to create and approve pull requests
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### 3. Branch Protection Ruleset
|
|
372
|
+
|
|
373
|
+
```text
|
|
374
|
+
Settings → Rules → Rulesets → New ruleset → New branch ruleset
|
|
375
|
+
|
|
376
|
+
Ruleset Name: main-protection
|
|
377
|
+
Enforcement: Active
|
|
378
|
+
Target: Add target → Include by pattern → main
|
|
379
|
+
|
|
380
|
+
Rules to enable:
|
|
381
|
+
☑ Restrict deletions
|
|
382
|
+
☑ Require a pull request before merging
|
|
383
|
+
☑ Require status checks to pass
|
|
384
|
+
- Require up to date: ☑
|
|
385
|
+
- Status checks: Release (appears after first workflow run)
|
|
386
|
+
☑ Block force pushes
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## License
|
|
392
|
+
|
|
393
|
+
MIT © [Regardio](https://regard.io)
|
|
394
|
+
|
|
395
|
+
## Contact
|
|
396
|
+
|
|
397
|
+
- **Website**: [regard.io](https://regard.io)
|
|
398
|
+
- **GitHub**: [@regardio](https://github.com/regardio)
|
|
399
|
+
- **Email**: [bernd.matzner@regard.io](mailto:bernd.matzner@regard.io)
|
|
400
|
+
|
|
401
|
+
## Acknowledgments
|
|
402
|
+
|
|
403
|
+
This project stands on the shoulders of giants. We're deeply grateful to the Open Source community and the maintainers of the tools that make this possible:
|
|
404
|
+
|
|
405
|
+
- [Biome](https://biomejs.dev/) - The Biome team
|
|
406
|
+
- [commitlint](https://commitlint.js.org/) - The commitlint team
|
|
407
|
+
- [Husky](https://typicode.github.io/husky/) - typicode and contributors
|
|
408
|
+
- [markdownlint](https://github.com/DavidAnson/markdownlint) - David Anson and contributors
|
|
409
|
+
- [Playwright](https://playwright.dev/) - Microsoft
|
|
410
|
+
- [pnpm](https://pnpm.io/) - Zoltan Kochan and contributors
|
|
411
|
+
- [React](https://react.dev/) - Meta and contributors
|
|
412
|
+
- [TypeScript](https://www.typescriptlang.org/) - Microsoft and contributors
|
|
413
|
+
- [Vite](https://vitejs.dev/) - Evan You and the Vite team
|
|
414
|
+
- [Vitest](https://vitest.dev/) - Anthony Fu and the Vitest team
|
|
415
|
+
|
|
416
|
+
And countless other projects that form the foundation of modern web development. Thank you for sharing your work with the world. 💚
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-clean.d.ts","sourceRoot":"","sources":["../../src/bin/exec-clean.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const pkgPath = require.resolve('rimraf/package.json');
|
|
7
|
+
const pkg = require(pkgPath);
|
|
8
|
+
let binRel = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.rimraf;
|
|
9
|
+
if (!binRel) {
|
|
10
|
+
console.error('Unable to locate rimraf binary from package.json bin field');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
if (binRel.startsWith('./'))
|
|
14
|
+
binRel = binRel.slice(2);
|
|
15
|
+
const bin = path.join(path.dirname(pkgPath), binRel);
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
18
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-husky.d.ts","sourceRoot":"","sources":["../../src/bin/exec-husky.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const bin = require.resolve('husky');
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
8
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-p.d.ts","sourceRoot":"","sources":["../../src/bin/exec-p.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const bin = require.resolve('npm-run-all/bin/run-p/index.js');
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
8
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-s.d.ts","sourceRoot":"","sources":["../../src/bin/exec-s.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const bin = require.resolve('npm-run-all/bin/run-s/index.js');
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
8
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-ts.d.ts","sourceRoot":"","sources":["../../src/bin/exec-ts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
if (args.length === 0) {
|
|
7
|
+
console.error('Usage: exec-ts <script.ts> [args...]');
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
const [scriptArg, ...rest] = args;
|
|
11
|
+
const script = scriptArg ?? '';
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const pkgPath = require.resolve('tsx/package.json');
|
|
14
|
+
const pkg = require(pkgPath);
|
|
15
|
+
const binRel = pkg.bin;
|
|
16
|
+
const binPath = typeof binRel === 'string'
|
|
17
|
+
? binRel
|
|
18
|
+
: typeof binRel === 'object' && binRel !== null && 'tsx' in binRel
|
|
19
|
+
? binRel.tsx
|
|
20
|
+
: undefined;
|
|
21
|
+
if (!binPath) {
|
|
22
|
+
console.error('Unable to locate tsx binary from package.json bin field');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const bin = path.join(path.dirname(pkgPath), binPath);
|
|
26
|
+
const spawnOptions = { stdio: 'inherit' };
|
|
27
|
+
const child = spawn(process.execPath, [bin, script, ...rest], spawnOptions);
|
|
28
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-tsc.d.ts","sourceRoot":"","sources":["../../src/bin/exec-tsc.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const bin = require.resolve('typescript/bin/tsc');
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
8
|
+
child.on('exit', (code) => process.exit(code ?? 0));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-branch.d.ts","sourceRoot":"","sources":["../../src/bin/flow-branch.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
const [expectedBranch, deploymentLabel] = process.argv.slice(2);
|
|
4
|
+
if (!expectedBranch || !deploymentLabel) {
|
|
5
|
+
console.error('Usage: flow-branch <expected-branch> <deployment-label>');
|
|
6
|
+
process.exit(1);
|
|
7
|
+
}
|
|
8
|
+
const envBranch = process.env.GITHUB_REF_NAME || process.env.GITHUB_HEAD_REF || process.env.BRANCH_NAME || '';
|
|
9
|
+
let currentBranch = envBranch;
|
|
10
|
+
if (!currentBranch) {
|
|
11
|
+
const res = spawnSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
|
|
12
|
+
encoding: 'utf8',
|
|
13
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
14
|
+
});
|
|
15
|
+
if (res.status !== 0) {
|
|
16
|
+
console.error('Failed to determine the current Git branch.');
|
|
17
|
+
if (res.stderr)
|
|
18
|
+
console.error(res.stderr.trim());
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
currentBranch = (res.stdout || '').toString().trim();
|
|
22
|
+
}
|
|
23
|
+
if (currentBranch !== expectedBranch) {
|
|
24
|
+
console.error(`Refusing to deploy ${deploymentLabel}. Expected branch "${expectedBranch}", but current branch is "${currentBranch}".`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
console.log(`Branch check passed. Proceeding with ${deploymentLabel} deployment from "${expectedBranch}".`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-version.d.ts","sourceRoot":"","sources":["../../src/bin/flow-version.ts"],"names":[],"mappings":""}
|