@regardio/dev 1.24.0 → 2.0.2
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/README.md +2 -2
- package/dist/bin/ship/hotfix.bin.mjs +140 -0
- package/dist/bin/ship/production.bin.mjs +120 -0
- package/dist/bin/ship/staging.bin.mjs +70 -0
- package/dist/bin/ship/utils-BQ-JZ2D5.mjs +45 -0
- package/dist/playwright/index.d.mts +24 -0
- package/dist/playwright/index.mjs +61 -0
- package/dist/vitest/node.d.mts +22 -0
- package/dist/vitest/node.mjs +28 -0
- package/dist/vitest/react.d.mts +22 -0
- package/dist/vitest/react.mjs +28 -0
- package/docs/en/README.md +95 -0
- package/docs/en/agents.md +57 -0
- package/docs/en/standards/api.md +324 -0
- package/docs/en/standards/coding.md +144 -0
- package/docs/en/standards/commits.md +111 -0
- package/docs/en/standards/documentation.md +173 -0
- package/docs/en/standards/naming.md +180 -0
- package/docs/en/standards/principles.md +84 -0
- package/docs/en/standards/react.md +246 -0
- package/docs/en/standards/sql.md +258 -0
- package/docs/en/standards/testing.md +139 -0
- package/docs/en/standards/writing.md +119 -0
- package/docs/en/tools/biome.md +89 -0
- package/docs/en/tools/commitlint.md +92 -0
- package/docs/en/tools/dependencies.md +116 -0
- package/docs/en/tools/husky.md +90 -0
- package/docs/en/tools/markdownlint.md +84 -0
- package/docs/en/tools/playwright.md +117 -0
- package/docs/en/tools/releases.md +242 -0
- package/docs/en/tools/typescript.md +89 -0
- package/docs/en/tools/vitest.md +146 -0
- package/package.json +57 -70
- package/src/biome/preset.json +3 -0
- package/templates/changeset/README.md +14 -0
- package/templates/changeset/config.json +11 -0
- package/templates/github/release.yml +77 -0
- package/dist/bin/exec/clean.d.ts +0 -3
- package/dist/bin/exec/clean.d.ts.map +0 -1
- package/dist/bin/exec/clean.js +0 -25
- package/dist/bin/exec/clean.test.d.ts +0 -2
- package/dist/bin/exec/clean.test.d.ts.map +0 -1
- package/dist/bin/exec/clean.test.js +0 -45
- package/dist/bin/exec/husky.d.ts +0 -3
- package/dist/bin/exec/husky.d.ts.map +0 -1
- package/dist/bin/exec/husky.js +0 -9
- package/dist/bin/exec/p.d.ts +0 -3
- package/dist/bin/exec/p.d.ts.map +0 -1
- package/dist/bin/exec/p.js +0 -8
- package/dist/bin/exec/s.d.ts +0 -3
- package/dist/bin/exec/s.d.ts.map +0 -1
- package/dist/bin/exec/s.js +0 -8
- package/dist/bin/exec/tsc.d.ts +0 -3
- package/dist/bin/exec/tsc.d.ts.map +0 -1
- package/dist/bin/exec/tsc.js +0 -8
- package/dist/bin/lint/biome.d.ts +0 -3
- package/dist/bin/lint/biome.d.ts.map +0 -1
- package/dist/bin/lint/biome.js +0 -8
- package/dist/bin/lint/commit.d.ts +0 -3
- package/dist/bin/lint/commit.d.ts.map +0 -1
- package/dist/bin/lint/commit.js +0 -8
- package/dist/bin/lint/md.d.ts +0 -3
- package/dist/bin/lint/md.d.ts.map +0 -1
- package/dist/bin/lint/md.js +0 -16
- package/dist/bin/lint/package.d.ts +0 -4
- package/dist/bin/lint/package.d.ts.map +0 -1
- package/dist/bin/lint/package.js +0 -81
- package/dist/bin/lint/package.test.d.ts +0 -2
- package/dist/bin/lint/package.test.d.ts.map +0 -1
- package/dist/bin/lint/package.test.js +0 -65
- package/dist/bin/ship/hotfix.d.ts +0 -3
- package/dist/bin/ship/hotfix.d.ts.map +0 -1
- package/dist/bin/ship/hotfix.js +0 -141
- package/dist/bin/ship/production.d.ts +0 -3
- package/dist/bin/ship/production.d.ts.map +0 -1
- package/dist/bin/ship/production.js +0 -124
- package/dist/bin/ship/staging.d.ts +0 -3
- package/dist/bin/ship/staging.d.ts.map +0 -1
- package/dist/bin/ship/staging.js +0 -51
- package/dist/bin/ship/utils.d.ts +0 -9
- package/dist/bin/ship/utils.d.ts.map +0 -1
- package/dist/bin/ship/utils.js +0 -63
- package/dist/bin/ship/utils.test.d.ts +0 -2
- package/dist/bin/ship/utils.test.d.ts.map +0 -1
- package/dist/bin/ship/utils.test.js +0 -127
- package/dist/config.test.d.ts +0 -2
- package/dist/config.test.d.ts.map +0 -1
- package/dist/config.test.js +0 -101
- package/dist/playwright/index.d.ts +0 -10
- package/dist/playwright/index.d.ts.map +0 -1
- package/dist/playwright/index.js +0 -42
- package/dist/playwright/index.test.d.ts +0 -2
- package/dist/playwright/index.test.d.ts.map +0 -1
- package/dist/playwright/index.test.js +0 -55
- package/dist/testing/setup-react.d.ts +0 -2
- package/dist/testing/setup-react.d.ts.map +0 -1
- package/dist/testing/setup-react.js +0 -1
- package/dist/vitest/node.d.ts +0 -22
- package/dist/vitest/node.d.ts.map +0 -1
- package/dist/vitest/node.js +0 -16
- package/dist/vitest/react.d.ts +0 -17
- package/dist/vitest/react.d.ts.map +0 -1
- package/dist/vitest/react.js +0 -12
- package/src/bin/exec/clean.test.ts +0 -63
- package/src/bin/exec/clean.ts +0 -36
- package/src/bin/exec/husky.ts +0 -14
- package/src/bin/exec/p.ts +0 -13
- package/src/bin/exec/s.ts +0 -13
- package/src/bin/exec/tsc.ts +0 -13
- package/src/bin/lint/biome.ts +0 -13
- package/src/bin/lint/commit.ts +0 -13
- package/src/bin/lint/md.ts +0 -28
- package/src/bin/lint/package.test.ts +0 -83
- package/src/bin/lint/package.ts +0 -108
- package/src/bin/ship/hotfix.ts +0 -241
- package/src/bin/ship/production.ts +0 -240
- package/src/bin/ship/staging.ts +0 -108
- package/src/bin/ship/utils.test.ts +0 -178
- package/src/bin/ship/utils.ts +0 -109
- package/src/config.test.ts +0 -129
- package/src/markdownlint/markdownlint-cli2.jsonc +0 -9
- package/src/playwright/index.test.ts +0 -73
- package/src/playwright/index.ts +0 -63
- package/src/templates/release.yml +0 -128
- package/src/testing/setup-react.ts +0 -8
- package/src/vitest/node.ts +0 -25
- package/src/vitest/react.ts +0 -19
- /package/{src → templates}/sqlfluff/setup.cfg +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: TypeScript Configuration
|
|
4
|
+
type: guide
|
|
5
|
+
status: published
|
|
6
|
+
summary: TypeScript setup and configuration for Regardio projects
|
|
7
|
+
related: [biome, vitest]
|
|
8
|
+
locale: en-US
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# TypeScript Configuration
|
|
12
|
+
|
|
13
|
+
Strict shared TypeScript presets for Regardio projects. Extend from `@regardio/dev` instead of rebuilding config from scratch. Keep strict settings enabled.
|
|
14
|
+
|
|
15
|
+
## Presets
|
|
16
|
+
|
|
17
|
+
| Preset | Use Case |
|
|
18
|
+
|--------|----------|
|
|
19
|
+
| `@regardio/dev/typescript/base` | Node.js packages, libraries |
|
|
20
|
+
| `@regardio/dev/typescript/react` | React applications and components |
|
|
21
|
+
| `@regardio/dev/typescript/build` | Build-specific settings (extends base) |
|
|
22
|
+
|
|
23
|
+
## Configuration
|
|
24
|
+
|
|
25
|
+
### tsconfig.json
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"extends": "@regardio/dev/typescript/base",
|
|
30
|
+
"include": ["src/**/*.ts"]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For React projects:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"extends": "@regardio/dev/typescript/react",
|
|
39
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### tsconfig.build.json
|
|
44
|
+
|
|
45
|
+
Separate build config for production output:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"compilerOptions": {
|
|
50
|
+
"outDir": "./dist",
|
|
51
|
+
"rootDir": "./src"
|
|
52
|
+
},
|
|
53
|
+
"extends": ["./tsconfig.json", "@regardio/dev/typescript/build"],
|
|
54
|
+
"include": ["src/**/*.ts"]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Strict Settings
|
|
59
|
+
|
|
60
|
+
The base config enables strict TypeScript checking:
|
|
61
|
+
|
|
62
|
+
- `strict: true` - All strict type-checking options
|
|
63
|
+
- `noUncheckedIndexedAccess: true` - Adds `undefined` to index signatures
|
|
64
|
+
- `exactOptionalPropertyTypes: true` - Distinguishes between `undefined` and missing
|
|
65
|
+
- `noImplicitReturns: true` - All code paths must return a value
|
|
66
|
+
- `noFallthroughCasesInSwitch: true` - Prevents switch fallthrough bugs
|
|
67
|
+
|
|
68
|
+
## Scripts
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "exec-tsc --project tsconfig.build.json",
|
|
74
|
+
"typecheck": "exec-tsc --noEmit"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Run `typecheck` regularly during development to catch type errors early.
|
|
80
|
+
|
|
81
|
+
Related documents:
|
|
82
|
+
|
|
83
|
+
- [Biome](./biome.md) — Linting and formatting
|
|
84
|
+
- [Vitest](./vitest.md) — Unit and integration testing for TypeScript projects
|
|
85
|
+
|
|
86
|
+
### Resources
|
|
87
|
+
|
|
88
|
+
- [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/)
|
|
89
|
+
- [tsconfig Reference](https://www.typescriptlang.org/tsconfig)
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: Vitest
|
|
4
|
+
type: guide
|
|
5
|
+
status: published
|
|
6
|
+
summary: Unit and integration testing for TypeScript projects
|
|
7
|
+
related: [typescript, playwright]
|
|
8
|
+
locale: en-US
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Vitest
|
|
12
|
+
|
|
13
|
+
Unit and integration testing for TypeScript projects. Vite-native, TypeScript-first. Configuration centralized in `@regardio/dev`.
|
|
14
|
+
|
|
15
|
+
## Coverage Thresholds
|
|
16
|
+
|
|
17
|
+
Library packages must meet minimum coverage thresholds before publishing:
|
|
18
|
+
|
|
19
|
+
| Metric | Minimum |
|
|
20
|
+
|--------|---------|
|
|
21
|
+
| **Statements** | 80% |
|
|
22
|
+
| **Branches** | 80% |
|
|
23
|
+
| **Functions** | 80% |
|
|
24
|
+
| **Lines** | 80% |
|
|
25
|
+
|
|
26
|
+
These thresholds are enforced by:
|
|
27
|
+
|
|
28
|
+
1. **`pnpm report`** - Fails if coverage is below thresholds
|
|
29
|
+
2. **`ship-staging`** - Runs coverage check before deploying to staging
|
|
30
|
+
3. **GitHub Actions** - Runs coverage check before publishing to npm
|
|
31
|
+
|
|
32
|
+
To check coverage locally:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm report
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Configuration
|
|
39
|
+
|
|
40
|
+
### Node.js Packages
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// vitest.config.ts
|
|
44
|
+
import { defineConfig } from 'vitest/config';
|
|
45
|
+
import { vitestNodeConfig } from '@regardio/dev/vitest/node';
|
|
46
|
+
|
|
47
|
+
export default defineConfig({ test: vitestNodeConfig });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### React Packages
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// vitest.config.ts
|
|
54
|
+
import { defineConfig } from 'vitest/config';
|
|
55
|
+
import { vitestReactConfig } from '@regardio/dev/vitest/react';
|
|
56
|
+
|
|
57
|
+
export default defineConfig({ test: vitestReactConfig });
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Scripts
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"scripts": {
|
|
65
|
+
"test": "exec-s test:*",
|
|
66
|
+
"test:unit": "vitest run",
|
|
67
|
+
"report": "vitest run --coverage"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Required devDependencies:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@regardio/dev": "^1.11.0",
|
|
78
|
+
"@vitest/coverage-v8": "^4.0.0",
|
|
79
|
+
"vitest": "^4.0.0"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Running Tests
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pnpm test:unit # Run all tests once
|
|
88
|
+
pnpm vitest # Watch mode
|
|
89
|
+
pnpm vitest --ui # Visual UI
|
|
90
|
+
pnpm vitest --coverage # With coverage report
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Test File Naming
|
|
94
|
+
|
|
95
|
+
- Unit tests: `*.test.ts` or `*.test.tsx`
|
|
96
|
+
- Place tests next to source files or in `__tests__` directories
|
|
97
|
+
|
|
98
|
+
## Writing Tests
|
|
99
|
+
|
|
100
|
+
Follow the Arrange-Act-Assert pattern:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { describe, it, expect } from 'vitest';
|
|
104
|
+
|
|
105
|
+
describe('calculateTotal', () => {
|
|
106
|
+
it('should apply discount correctly', () => {
|
|
107
|
+
// Arrange
|
|
108
|
+
const items = [{ price: 100 }, { price: 50 }];
|
|
109
|
+
const discount = 0.1;
|
|
110
|
+
|
|
111
|
+
// Act
|
|
112
|
+
const total = calculateTotal(items, discount);
|
|
113
|
+
|
|
114
|
+
// Assert
|
|
115
|
+
expect(total).toBe(135);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## React Component Testing
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { render, screen } from '@testing-library/react';
|
|
124
|
+
import userEvent from '@testing-library/user-event';
|
|
125
|
+
import { Button } from './Button';
|
|
126
|
+
|
|
127
|
+
it('calls onClick when clicked', async () => {
|
|
128
|
+
const handleClick = vi.fn();
|
|
129
|
+
render(<Button onClick={handleClick}>Click me</Button>);
|
|
130
|
+
|
|
131
|
+
await userEvent.click(screen.getByRole('button'));
|
|
132
|
+
|
|
133
|
+
expect(handleClick).toHaveBeenCalledOnce();
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Related documents:
|
|
138
|
+
|
|
139
|
+
- [Testing Approach](../standards/testing.md) — Testing philosophy and patterns for Regardio projects
|
|
140
|
+
- [Playwright](./playwright.md) — End-to-end testing for web applications
|
|
141
|
+
- [TypeScript Configuration](./typescript.md) — TypeScript setup and configuration for Regardio projects
|
|
142
|
+
|
|
143
|
+
### Resources
|
|
144
|
+
|
|
145
|
+
- [Vitest Documentation](https://vitest.dev/)
|
|
146
|
+
- [Testing Library](https://testing-library.com/)
|
package/package.json
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package.json",
|
|
3
3
|
"name": "@regardio/dev",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"private": false,
|
|
6
|
-
"description": "Regardio
|
|
6
|
+
"description": "Regardio development presets: biome, typescript, commitlint, markdownlint, vitest, playwright, sqlfluff, husky, and GitLab-flow ship tooling",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"biome",
|
|
9
9
|
"commitlint",
|
|
10
10
|
"dev",
|
|
11
11
|
"documentation",
|
|
12
|
+
"gitlab-flow",
|
|
12
13
|
"husky",
|
|
13
14
|
"linting",
|
|
14
15
|
"markdownlint",
|
|
15
16
|
"playwright",
|
|
17
|
+
"release",
|
|
16
18
|
"sqlfluff",
|
|
17
19
|
"testing",
|
|
18
20
|
"tooling",
|
|
19
21
|
"typescript",
|
|
20
22
|
"vitest"
|
|
21
23
|
],
|
|
22
|
-
"homepage": "https://
|
|
24
|
+
"homepage": "https://codeberg.org/regardio/commons/src/branch/main/packages/dev",
|
|
23
25
|
"bugs": {
|
|
24
|
-
"url": "https://
|
|
26
|
+
"url": "https://codeberg.org/regardio/commons/issues"
|
|
25
27
|
},
|
|
26
28
|
"repository": {
|
|
27
29
|
"type": "git",
|
|
28
|
-
"url": "git+https://
|
|
30
|
+
"url": "git+https://codeberg.org/regardio/commons.git",
|
|
31
|
+
"directory": "packages/dev"
|
|
29
32
|
},
|
|
30
33
|
"license": "MIT",
|
|
31
34
|
"author": "Bernd Matzner <bernd.matzner@regard.io>",
|
|
@@ -35,92 +38,76 @@
|
|
|
35
38
|
"./biome": "./src/biome/preset.json",
|
|
36
39
|
"./commitlint": "./src/commitlint/commitlint.cjs",
|
|
37
40
|
"./markdownlint": "./src/markdownlint/markdownlint.json",
|
|
38
|
-
"./markdownlint-cli2": "./src/markdownlint/markdownlint-cli2.jsonc",
|
|
39
41
|
"./playwright": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
+
"import": "./dist/playwright/index.mjs",
|
|
43
|
+
"types": "./dist/playwright/index.d.mts"
|
|
42
44
|
},
|
|
43
|
-
"./
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
"./typescript/base.json": "./src/typescript/base.json",
|
|
48
|
-
"./typescript/build.json": "./src/typescript/build.json",
|
|
49
|
-
"./typescript/react.json": "./src/typescript/react.json",
|
|
45
|
+
"./typescript/base": "./src/typescript/base.json",
|
|
46
|
+
"./typescript/build": "./src/typescript/build.json",
|
|
47
|
+
"./typescript/react": "./src/typescript/react.json",
|
|
50
48
|
"./vitest/node": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
49
|
+
"import": "./dist/vitest/node.mjs",
|
|
50
|
+
"types": "./dist/vitest/node.d.mts"
|
|
53
51
|
},
|
|
54
52
|
"./vitest/react": {
|
|
55
|
-
"
|
|
56
|
-
"
|
|
53
|
+
"import": "./dist/vitest/react.mjs",
|
|
54
|
+
"types": "./dist/vitest/react.d.mts"
|
|
57
55
|
}
|
|
58
56
|
},
|
|
59
57
|
"bin": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"exec-s": "dist/bin/exec/s.js",
|
|
64
|
-
"exec-tsc": "dist/bin/exec/tsc.js",
|
|
65
|
-
"lint-biome": "dist/bin/lint/biome.js",
|
|
66
|
-
"lint-commit": "dist/bin/lint/commit.js",
|
|
67
|
-
"lint-md": "dist/bin/lint/md.js",
|
|
68
|
-
"lint-package": "dist/bin/lint/package.js",
|
|
69
|
-
"ship-hotfix": "dist/bin/ship/hotfix.js",
|
|
70
|
-
"ship-production": "dist/bin/ship/production.js",
|
|
71
|
-
"ship-staging": "dist/bin/ship/staging.js"
|
|
58
|
+
"ship-hotfix": "dist/bin/ship/hotfix.bin.mjs",
|
|
59
|
+
"ship-production": "dist/bin/ship/production.bin.mjs",
|
|
60
|
+
"ship-staging": "dist/bin/ship/staging.bin.mjs"
|
|
72
61
|
},
|
|
73
62
|
"files": [
|
|
74
63
|
"dist",
|
|
75
|
-
"src"
|
|
64
|
+
"src/biome",
|
|
65
|
+
"src/commitlint",
|
|
66
|
+
"src/markdownlint",
|
|
67
|
+
"src/typescript",
|
|
68
|
+
"docs",
|
|
69
|
+
"templates"
|
|
76
70
|
],
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@total-typescript/ts-reset": "0.6.1",
|
|
73
|
+
"@types/node": "25.6.0",
|
|
74
|
+
"@vitest/coverage-v8": "4.1.5",
|
|
75
|
+
"tsdown": "0.21.9",
|
|
76
|
+
"vitest": "4.1.5"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"@biomejs/biome": ">=2",
|
|
80
|
+
"@changesets/changelog-git": ">=0.2",
|
|
81
|
+
"@changesets/cli": ">=2",
|
|
82
|
+
"@commitlint/cli": ">=20",
|
|
83
|
+
"@commitlint/config-conventional": ">=20",
|
|
84
|
+
"@playwright/test": ">=1",
|
|
85
|
+
"@testing-library/jest-dom": ">=6",
|
|
86
|
+
"@testing-library/react": ">=16",
|
|
87
|
+
"husky": ">=9",
|
|
88
|
+
"jsdom": ">=29",
|
|
89
|
+
"markdownlint-cli2": ">=0.22",
|
|
90
|
+
"typescript": ">=6",
|
|
91
|
+
"vitest": ">=4"
|
|
92
|
+
},
|
|
93
|
+
"engines": {
|
|
94
|
+
"node": ">=24"
|
|
95
|
+
},
|
|
77
96
|
"scripts": {
|
|
78
|
-
"build": "
|
|
79
|
-
"clean": "
|
|
97
|
+
"build": "tsdown",
|
|
98
|
+
"clean": "rimraf .turbo dist",
|
|
99
|
+
"dev": "tsdown --watch",
|
|
80
100
|
"fix": "run-s fix:pkg fix:md fix:biome",
|
|
81
101
|
"fix:biome": "biome check --write --unsafe .",
|
|
82
102
|
"fix:md": "markdownlint-cli2 --fix",
|
|
83
|
-
"fix:pkg": "
|
|
103
|
+
"fix:pkg": "sort-package-json",
|
|
84
104
|
"lint": "run-s lint:md lint:biome",
|
|
85
105
|
"lint:biome": "biome check .",
|
|
86
106
|
"lint:md": "markdownlint-cli2",
|
|
87
|
-
"lint:pkg": "
|
|
88
|
-
"prepare": "husky",
|
|
89
|
-
"report": "vitest run --coverage",
|
|
90
|
-
"ship:hotfix": "tsx src/bin/ship/hotfix.ts",
|
|
91
|
-
"ship:production": "tsx src/bin/ship/production.ts",
|
|
92
|
-
"ship:staging": "tsx src/bin/ship/staging.ts",
|
|
107
|
+
"lint:pkg": "sort-package-json --check",
|
|
93
108
|
"test": "run-p test:*",
|
|
109
|
+
"test:e2e": "echo 'no e2e tests'",
|
|
94
110
|
"test:unit": "vitest run",
|
|
95
111
|
"typecheck": "tsc --noEmit"
|
|
96
|
-
},
|
|
97
|
-
"dependencies": {
|
|
98
|
-
"@biomejs/biome": "2.4.12",
|
|
99
|
-
"@commitlint/cli": "20.5.0",
|
|
100
|
-
"@commitlint/config-conventional": "20.5.0",
|
|
101
|
-
"@playwright/test": "1.59.1",
|
|
102
|
-
"@testing-library/jest-dom": "6.9.1",
|
|
103
|
-
"@testing-library/react": "16.3.2",
|
|
104
|
-
"@total-typescript/ts-reset": "0.6.1",
|
|
105
|
-
"@types/node": "25.6.0",
|
|
106
|
-
"@vitest/coverage-v8": "4.1.4",
|
|
107
|
-
"@vitest/ui": "4.1.4",
|
|
108
|
-
"husky": "9.1.7",
|
|
109
|
-
"jsdom": "29.0.2",
|
|
110
|
-
"markdownlint-cli2": "0.22.0",
|
|
111
|
-
"npm-run-all": "4.1.5",
|
|
112
|
-
"postcss": "8.5.10",
|
|
113
|
-
"rimraf": "6.1.3",
|
|
114
|
-
"rollup": "4.60.1",
|
|
115
|
-
"sort-package-json": "3.6.1",
|
|
116
|
-
"typescript": "6.0.2",
|
|
117
|
-
"vite": "8.0.8",
|
|
118
|
-
"vitest": "4.1.4"
|
|
119
|
-
},
|
|
120
|
-
"devDependencies": {
|
|
121
|
-
"tsx": "4.21.0"
|
|
122
|
-
},
|
|
123
|
-
"engines": {
|
|
124
|
-
"node": ">=24"
|
|
125
112
|
}
|
|
126
113
|
}
|
package/src/biome/preset.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changesets
|
|
2
|
+
|
|
3
|
+
Pending version bumps live here as small Markdown files. Add one with `pnpm changeset` whenever you make a version-worthy change.
|
|
4
|
+
|
|
5
|
+
## How it fits the GitLab flow
|
|
6
|
+
|
|
7
|
+
- On `main`, authors run `pnpm changeset` alongside their change to describe the bump.
|
|
8
|
+
- `ship-staging` deploys to staging without touching versions.
|
|
9
|
+
- `ship-production` runs quality checks, consumes pending changesets (bumping versions and updating each package's `CHANGELOG.md`), commits the bumps on `main`, and merges to `production`.
|
|
10
|
+
- CI on `production` runs `changeset publish` to push the new versions to npm.
|
|
11
|
+
|
|
12
|
+
## Skipping a release
|
|
13
|
+
|
|
14
|
+
If a commit is tooling-only and should not trigger a release, don't add a changeset.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
|
|
3
|
+
"access": "public",
|
|
4
|
+
"baseBranch": "main",
|
|
5
|
+
"changelog": "@changesets/changelog-git",
|
|
6
|
+
"commit": false,
|
|
7
|
+
"fixed": [],
|
|
8
|
+
"ignore": [],
|
|
9
|
+
"linked": [],
|
|
10
|
+
"updateInternalDependencies": "patch"
|
|
11
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Regardio Release Workflow (GitHub Actions)
|
|
2
|
+
# Copy this file to .github/workflows/release.yml
|
|
3
|
+
#
|
|
4
|
+
# Required setup:
|
|
5
|
+
# 1. Initialize Changesets in your repo:
|
|
6
|
+
# cp -r node_modules/@regardio/dev/templates/changeset .changeset
|
|
7
|
+
# 2. Add these scripts to package.json:
|
|
8
|
+
# "changeset": "changeset",
|
|
9
|
+
# "changeset:publish": "changeset publish",
|
|
10
|
+
# "ship:staging": "ship-staging",
|
|
11
|
+
# "ship:production": "ship-production",
|
|
12
|
+
# "ship:hotfix": "ship-hotfix"
|
|
13
|
+
# 3. Create the branches:
|
|
14
|
+
# git checkout -b staging && git push -u origin staging
|
|
15
|
+
# git checkout -b production && git push -u origin production
|
|
16
|
+
# 4. Add `NPM_TOKEN` to repo secrets. First npm publish of any new package
|
|
17
|
+
# must be done locally (`npm publish --access public`).
|
|
18
|
+
#
|
|
19
|
+
# Usage:
|
|
20
|
+
# - Author adds a changeset on main: `pnpm changeset`
|
|
21
|
+
# - `pnpm ship:staging` deploys to staging for validation
|
|
22
|
+
# - `pnpm ship:production` consumes changesets locally, bumps versions, merges
|
|
23
|
+
# to production. This workflow then publishes to npm.
|
|
24
|
+
|
|
25
|
+
name: Release
|
|
26
|
+
|
|
27
|
+
on:
|
|
28
|
+
push:
|
|
29
|
+
branches:
|
|
30
|
+
- production
|
|
31
|
+
|
|
32
|
+
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
release:
|
|
36
|
+
name: Release
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
permissions:
|
|
39
|
+
contents: write
|
|
40
|
+
id-token: write
|
|
41
|
+
steps:
|
|
42
|
+
- name: Checkout
|
|
43
|
+
uses: actions/checkout@v6
|
|
44
|
+
with:
|
|
45
|
+
fetch-depth: 0
|
|
46
|
+
|
|
47
|
+
- name: Setup pnpm
|
|
48
|
+
uses: pnpm/action-setup@v5
|
|
49
|
+
with:
|
|
50
|
+
version: 10
|
|
51
|
+
|
|
52
|
+
- name: Setup Node.js
|
|
53
|
+
uses: actions/setup-node@v6
|
|
54
|
+
with:
|
|
55
|
+
node-version: 24
|
|
56
|
+
registry-url: https://registry.npmjs.org
|
|
57
|
+
|
|
58
|
+
- name: Install dependencies
|
|
59
|
+
run: pnpm install --frozen-lockfile
|
|
60
|
+
|
|
61
|
+
- name: Build
|
|
62
|
+
run: pnpm -r build
|
|
63
|
+
|
|
64
|
+
- name: Publish changed public packages
|
|
65
|
+
# `changeset publish`:
|
|
66
|
+
# - walks the workspace topologically
|
|
67
|
+
# - replaces `workspace:*` with real versions
|
|
68
|
+
# - skips packages where the current version already exists on npm
|
|
69
|
+
# - skips packages marked `"private": true`
|
|
70
|
+
# - creates git tags like `@scope/pkg@1.2.3` for each published package
|
|
71
|
+
run: pnpm changeset publish
|
|
72
|
+
env:
|
|
73
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
74
|
+
NPM_CONFIG_PROVENANCE: "true"
|
|
75
|
+
|
|
76
|
+
- name: Push tags
|
|
77
|
+
run: git push --tags
|
package/dist/bin/exec/clean.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/bin/exec/clean.ts"],"names":[],"mappings":";AAcA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAQpE"}
|
package/dist/bin/exec/clean.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
export function resolveRimrafBin(require) {
|
|
7
|
-
const pkgPath = require.resolve('rimraf/package.json');
|
|
8
|
-
const pkg = require(pkgPath);
|
|
9
|
-
const binRel = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.rimraf;
|
|
10
|
-
if (!binRel)
|
|
11
|
-
return null;
|
|
12
|
-
const normalized = binRel.startsWith('./') ? binRel.slice(2) : binRel;
|
|
13
|
-
return path.join(path.dirname(pkgPath), normalized);
|
|
14
|
-
}
|
|
15
|
-
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
16
|
-
const require = createRequire(import.meta.url);
|
|
17
|
-
const bin = resolveRimrafBin(require);
|
|
18
|
-
if (!bin) {
|
|
19
|
-
console.error('Unable to locate rimraf binary from package.json bin field');
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
const args = process.argv.slice(2);
|
|
23
|
-
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
24
|
-
child.on('exit', (code) => process.exit(code ?? 0));
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clean.test.d.ts","sourceRoot":"","sources":["../../../src/bin/exec/clean.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { resolveRimrafBin } from './clean.js';
|
|
5
|
-
function makeRequire(pkgPath, pkg) {
|
|
6
|
-
const req = (id) => (id === pkgPath ? pkg : undefined);
|
|
7
|
-
req.resolve = (_id) => pkgPath;
|
|
8
|
-
return req;
|
|
9
|
-
}
|
|
10
|
-
describe('resolveRimrafBin', () => {
|
|
11
|
-
it('resolves when bin is a plain string', () => {
|
|
12
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
13
|
-
const req = makeRequire(pkgPath, { bin: './dist/esm/bin.js' });
|
|
14
|
-
const result = resolveRimrafBin(req);
|
|
15
|
-
expect(result).toBe(path.join('/node_modules/rimraf', 'dist/esm/bin.js'));
|
|
16
|
-
});
|
|
17
|
-
it('strips leading ./ from the bin path', () => {
|
|
18
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
19
|
-
const req = makeRequire(pkgPath, { bin: './bin/rimraf' });
|
|
20
|
-
const result = resolveRimrafBin(req);
|
|
21
|
-
expect(result).toBe(path.join('/node_modules/rimraf', 'bin/rimraf'));
|
|
22
|
-
});
|
|
23
|
-
it('resolves when bin is an object with a rimraf key', () => {
|
|
24
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
25
|
-
const req = makeRequire(pkgPath, { bin: { rimraf: './dist/esm/bin.js' } });
|
|
26
|
-
const result = resolveRimrafBin(req);
|
|
27
|
-
expect(result).toBe(path.join('/node_modules/rimraf', 'dist/esm/bin.js'));
|
|
28
|
-
});
|
|
29
|
-
it('returns null when bin field is missing', () => {
|
|
30
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
31
|
-
const req = makeRequire(pkgPath, {});
|
|
32
|
-
expect(resolveRimrafBin(req)).toBeNull();
|
|
33
|
-
});
|
|
34
|
-
it('returns null when bin object has no rimraf key', () => {
|
|
35
|
-
const pkgPath = '/node_modules/rimraf/package.json';
|
|
36
|
-
const req = makeRequire(pkgPath, { bin: { other: './dist/other.js' } });
|
|
37
|
-
expect(resolveRimrafBin(req)).toBeNull();
|
|
38
|
-
});
|
|
39
|
-
it('resolves against the real rimraf package', () => {
|
|
40
|
-
const req = createRequire(import.meta.url);
|
|
41
|
-
const result = resolveRimrafBin(req);
|
|
42
|
-
expect(result).not.toBeNull();
|
|
43
|
-
expect(path.isAbsolute(result ?? '')).toBe(true);
|
|
44
|
-
});
|
|
45
|
-
});
|
package/dist/bin/exec/husky.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"husky.d.ts","sourceRoot":"","sources":["../../../src/bin/exec/husky.ts"],"names":[],"mappings":""}
|
package/dist/bin/exec/husky.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from 'node:child_process';
|
|
3
|
-
import { createRequire } from 'node:module';
|
|
4
|
-
import { dirname, resolve } from 'node:path';
|
|
5
|
-
const require = createRequire(import.meta.url);
|
|
6
|
-
const bin = resolve(dirname(require.resolve('husky')), 'bin.js');
|
|
7
|
-
const args = process.argv.slice(2);
|
|
8
|
-
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
9
|
-
child.on('exit', (code) => process.exit(code ?? 0));
|
package/dist/bin/exec/p.d.ts
DELETED
package/dist/bin/exec/p.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p.d.ts","sourceRoot":"","sources":["../../../src/bin/exec/p.ts"],"names":[],"mappings":""}
|
package/dist/bin/exec/p.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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));
|
package/dist/bin/exec/s.d.ts
DELETED
package/dist/bin/exec/s.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"s.d.ts","sourceRoot":"","sources":["../../../src/bin/exec/s.ts"],"names":[],"mappings":""}
|