@sablier/devkit 1.5.1 โ†’ 1.6.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/README.md CHANGED
@@ -1,33 +1,152 @@
1
1
  # ๐Ÿ› ๏ธ Sablier Devkit
2
2
 
3
- This repository contains configuration files and reusable scripts for various Sablier repositories.
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
+ [![npm](https://img.shields.io/npm/v/@sablier/devkit)](https://www.npmjs.com/package/@sablier/devkit)
4
5
 
5
- The files are meant to be extended and customized as needed.
6
+ Configuration files and reusable scripts for Sablier repositories. Designed to be extended and customized as needed.
6
7
 
7
- ## โš™๏ธ Config Files
8
+ ## ๐Ÿ“ฆ Installation
8
9
 
9
- | Tool | Config File/Directory |
10
- | --------------- | :------------------------------------ |
11
- | ๐Ÿ” Biome | [`biome.jsonc`](./biome.jsonc) |
12
- | ๐Ÿ“ EditorConfig | [`.editorconfig`](./.editorconfig) |
13
- | ๐Ÿ›  Just | [`just/`](./just/) |
14
- | โœจ Prettier | [`prettier.json`](./.prettierrc.json) |
15
- | ๐Ÿ“ฆ TSConfig | [`tsconfig/`](./tsconfig/) |
10
+ ```bash
11
+ npm install @sablier/devkit
12
+ ```
13
+
14
+ Or with other package managers:
15
+
16
+ ```bash
17
+ pnpm add @sablier/devkit
18
+ bun add @sablier/devkit
19
+ ```
20
+
21
+ ## ๐Ÿš€ Usage
22
+
23
+ ### Biome
24
+
25
+ Extend the base Biome configuration in your `biome.jsonc`:
26
+
27
+ ```jsonc
28
+ {
29
+ "$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
30
+ "extends": ["@sablier/devkit/biome"],
31
+ }
32
+ ```
33
+
34
+ For UI projects, use the UI variant:
35
+
36
+ ```jsonc
37
+ {
38
+ "extends": ["@sablier/devkit/biome/ui"],
39
+ }
40
+ ```
41
+
42
+ ### Prettier
43
+
44
+ Reference the Prettier config in your `package.json`:
45
+
46
+ ```json
47
+ {
48
+ "prettier": "@sablier/devkit/prettier"
49
+ }
50
+ ```
51
+
52
+ ### TypeScript
53
+
54
+ Extend TSConfig presets in your `tsconfig.json`:
55
+
56
+ ```json
57
+ {
58
+ "extends": "@sablier/devkit/tsconfig/base"
59
+ }
60
+ ```
61
+
62
+ Available presets:
63
+
64
+ - `@sablier/devkit/tsconfig/base` โ€” Base TypeScript configuration
65
+ - `@sablier/devkit/tsconfig/build` โ€” Build-optimized configuration
66
+ - `@sablier/devkit/tsconfig/next` โ€” Next.js configuration
67
+
68
+ ### Vitest
69
+
70
+ Use the devkit vitest config factory in your `vitest.config.ts`:
71
+
72
+ ```typescript
73
+ import { defineDevkitConfig } from "@sablier/devkit/vitest";
74
+
75
+ export default defineDevkitConfig({
76
+ environment: "jsdom", // or "node" (default), "happy-dom"
77
+ setupFiles: ["./tests/setup.ts"],
78
+ coverage: true,
79
+ });
80
+ ```
81
+
82
+ The config provides CI-aware defaults:
83
+
84
+ - `globals: true`
85
+ - `retry: 2` in CI, `0` locally
86
+ - `testTimeout: 30s` in CI, `10s` locally
87
+ - `reporters: ["basic"]` in CI, `["verbose"]` locally
88
+
89
+ For merging with existing Vite configs:
90
+
91
+ ```typescript
92
+ import { defineDevkitConfig, mergeConfig } from "@sablier/devkit/vitest";
93
+ import { defineConfig } from "vitest/config";
94
+
95
+ export default mergeConfig(
96
+ defineDevkitConfig({ environment: "jsdom" }),
97
+ defineConfig({
98
+ test: {
99
+ alias: { "@": "./src" },
100
+ },
101
+ }),
102
+ );
103
+ ```
104
+
105
+ ### Just
106
+
107
+ Import Just recipes in your `justfile`:
108
+
109
+ ```just
110
+ import "@sablier/devkit/just/base.just"
111
+ import "@sablier/devkit/just/npm.just"
112
+ ```
113
+
114
+ Available modules:
115
+
116
+ | Module | Description |
117
+ | --------------- | ------------------------------- |
118
+ | `base.just` | Common development recipes |
119
+ | `npm.just` | NPM package management |
120
+ | `evm.just` | EVM/Foundry tooling |
121
+ | `tsv.just` | TypeScript validation |
122
+ | `settings.just` | Just settings and configuration |
123
+
124
+ ## โš™๏ธ Available Configs
125
+
126
+ | Tool | Config File/Directory |
127
+ | --------------- | ---------------------------------------- |
128
+ | ๐Ÿ” Biome | [`biome/`](./biome/) |
129
+ | ๐Ÿ“ EditorConfig | [`.editorconfig`](./.editorconfig) |
130
+ | ๐Ÿ›  Just | [`just/`](./just/) |
131
+ | โœจ Prettier | [`.prettierrc.json`](./.prettierrc.json) |
132
+ | ๐Ÿ“ฆ TSConfig | [`tsconfig/`](./tsconfig/) |
133
+ | ๐Ÿงช Vitest | [`vitest/`](./vitest/) |
16
134
 
17
135
  ## ๐Ÿˆโ€โฌ› GitHub Actions
18
136
 
19
- The [setup](./actions/setup/) GitHub Actions workflow is used to setup the requisite dependencies in a GitHub CI
20
- workflow.
137
+ The [setup](./actions/setup/) action installs requisite dependencies in GitHub CI workflows.
21
138
 
22
- ## ๐Ÿš€ Setup Script
139
+ ```yaml
140
+ - uses: sablier-labs/devkit/actions/setup@main
141
+ ```
23
142
 
24
- This is meant to be run by Sablier Labs employees and staff.
143
+ ## ๐Ÿ–ฅ๏ธ Setup Script
25
144
 
26
- See [`setup.sh`](./shell/setup.sh) for details.
145
+ For Sablier Labs employees and staff, see [`shell/setup.sh`](./shell/setup.sh).
27
146
 
28
- ## ๐Ÿ“ฆ VSCode Settings
147
+ ## ๐Ÿค Contributing
29
148
 
30
- See [`vscode/settings.json`](./vscode/settings.json).
149
+ Contributions are welcome! Please feel free to submit a Pull Request.
31
150
 
32
151
  ## ๐Ÿ“„ License
33
152
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Configuration files and reusable scripts for Sablier repositories",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "1.5.1",
6
+ "version": "1.6.0",
7
7
  "author": {
8
8
  "name": "Sablier Labs Ltd",
9
9
  "url": "https://sablier.com"
@@ -13,7 +13,16 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@biomejs/biome": "^2.3.7",
16
- "prettier": "^3.6.2"
16
+ "prettier": "^3.6.2",
17
+ "vitest": "^3.2.0"
18
+ },
19
+ "peerDependencies": {
20
+ "vitest": ">=2.0.0"
21
+ },
22
+ "peerDependenciesMeta": {
23
+ "vitest": {
24
+ "optional": true
25
+ }
17
26
  },
18
27
  "exports": {
19
28
  "./biome": "./biome/base.jsonc",
@@ -21,16 +30,21 @@
21
30
  "./prettier": "./.prettierrc.json",
22
31
  "./tsconfig/base": "./tsconfig/base.json",
23
32
  "./tsconfig/build": "./tsconfig/build.json",
24
- "./tsconfig/next": "./tsconfig/next.json"
33
+ "./tsconfig/next": "./tsconfig/next.json",
34
+ "./vitest": {
35
+ "import": "./vitest/index.js",
36
+ "types": "./vitest/index.d.ts"
37
+ }
25
38
  },
26
39
  "engines": {
27
40
  "node": ">=20"
28
41
  },
29
42
  "files": [
30
43
  "biome/",
31
- ".prettierrc.json",
32
44
  "just/",
33
- "tsconfig/"
45
+ ".prettierrc.json",
46
+ "tsconfig/",
47
+ "vitest/"
34
48
  ],
35
49
  "keywords": [
36
50
  "biome",
@@ -39,7 +53,8 @@
39
53
  "prettier",
40
54
  "sablier",
41
55
  "tsconfig",
42
- "typescript"
56
+ "typescript",
57
+ "vitest"
43
58
  ],
44
59
  "publishConfig": {
45
60
  "access": "public"
@@ -6,6 +6,7 @@
6
6
  "lib": ["ESNext"],
7
7
  "module": "NodeNext",
8
8
  "moduleResolution": "NodeNext",
9
+ "noEmit": true,
9
10
  "noFallthroughCasesInSwitch": true,
10
11
  "noImplicitReturns": true,
11
12
  "resolveJsonModule": true,
@@ -7,6 +7,7 @@
7
7
  "emitDecoratorMetadata": true,
8
8
  "experimentalDecorators": true,
9
9
  "forceConsistentCasingInFileNames": true,
10
+ "noEmit": false,
10
11
  "removeComments": true,
11
12
  "skipLibCheck": true,
12
13
  "stripInternal": true
@@ -4,7 +4,6 @@
4
4
  "compilerOptions": {
5
5
  "allowJs": true,
6
6
  "isolatedModules": true,
7
- "noEmit": true,
8
7
  "incremental": true,
9
8
  "jsx": "preserve",
10
9
  "lib": ["dom", "dom.iterable", "ESNext"],
@@ -0,0 +1,29 @@
1
+ import type { UserConfig } from "vitest/config";
2
+ import { defineConfig } from "vitest/config";
3
+
4
+ export interface DevkitVitestOptions {
5
+ environment?: "node" | "jsdom" | "happy-dom";
6
+ setupFiles?: string[];
7
+ coverage?: boolean;
8
+ }
9
+
10
+ export function defineDevkitConfig(options: DevkitVitestOptions = {}) {
11
+ const isCI = !!process.env.CI;
12
+
13
+ const baseConfig: UserConfig = {
14
+ test: {
15
+ coverage: options.coverage ? { provider: "v8" } : undefined,
16
+ environment: options.environment ?? "node",
17
+ globals: true,
18
+ reporters: isCI ? ["basic"] : ["verbose"],
19
+ retry: isCI ? 2 : 0,
20
+ setupFiles: options.setupFiles,
21
+ testTimeout: isCI ? 30_000 : 10_000,
22
+ },
23
+ };
24
+
25
+ return defineConfig(baseConfig);
26
+ }
27
+
28
+ // Re-export for merging with existing vite configs
29
+ export { mergeConfig } from "vitest/config";