@rtorcato/js-tooling 2.1.0 → 2.1.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 CHANGED
@@ -1,244 +1,36 @@
1
1
  # js-tooling
2
2
 
3
- A comprehensive collection of JavaScript/TypeScript development tools and configurations for modern projects.
3
+ JavaScript and TypeScript tooling for Node.js, React, Next.js, and Vitest.
4
4
 
5
- ## Installation
6
-
7
- Install the package globally or use it directly with npx:
8
-
9
- ```bash
10
- # Install globally
11
- npm install -g @rtorcato/js-tooling
12
-
13
- # Or use with npx
14
- npx @rtorcato/js-tooling setup
15
- ```
16
-
17
- ## Getting started
18
-
19
- Use the interactive CLI to set up tooling for your project:
20
-
21
- ```bash
22
- npx @rtorcato/js-tooling setup
23
- ```
24
-
25
- Or import specific configurations:
26
-
27
- ```javascript
28
- import '@rtorcato/js-tooling/typescript/base';
29
- ```
30
-
31
- ## Available Tools
32
-
33
- This package includes configurations and presets for:
34
-
35
- - **TypeScript** - Base configurations for different project types
36
- - **ESLint** - Linting rules for JavaScript and TypeScript
37
- - **Prettier** - Code formatting configuration
38
- - **Biome** - Fast linter and formatter
39
- - **Vitest** - Testing framework configuration
40
- - **Jest** - Testing framework presets
41
- - **Commitlint** - Commit message linting
42
- - **Semantic Release** - Automated versioning and publishing
43
- - **GitHub Actions** - CI/CD workflow templates
44
- - **And more...**
45
-
46
- ## CI/CD Setup
47
-
48
- The package includes GitHub Actions workflows and semantic-release configuration. For automated publishing, set these secrets in your GitHub repository:
49
-
50
- 1. **`NPM_TOKEN`** - npm authentication token for publishing packages
51
- 2. **`GITHUB_TOKEN`** - automatically provided by GitHub Actions
52
-
53
- Repository settings: `https://github.com/your-username/your-repo/settings/secrets/actions`
54
-
55
- ## CLI Commands
56
-
57
- The package provides several CLI commands:
58
-
59
- ```bash
60
- # Interactive project setup wizard
61
- npx @rtorcato/js-tooling setup
62
-
63
- # Copy configuration files to current directory
64
- npx @rtorcato/js-tooling copy biome
65
- npx @rtorcato/js-tooling copy tsconfig
66
-
67
- # List all available configurations
68
- npx @rtorcato/js-tooling list
69
-
70
- # Diagnose drift between your project and our presets
71
- npx @rtorcato/js-tooling doctor
72
-
73
- # Run commit message helper
74
- npx @rtorcato/js-tooling commitmessage
75
-
76
- # Hello world example
77
- npx @rtorcato/js-tooling helloworld
78
- ```
79
-
80
- ### Doctor
81
-
82
- `doctor` audits an existing project against the presets and reports drift:
83
-
84
- ```bash
85
- npx @rtorcato/js-tooling doctor # current dir
86
- npx @rtorcato/js-tooling doctor -d ./app # specific dir
87
- npx @rtorcato/js-tooling doctor --json # machine-readable output
88
- ```
89
-
90
- For each tracked config (TypeScript, Biome, ESLint, Prettier, Vitest, Commitlint, `package.json`) it reports `ok`, `drift`, `missing`, or `not configured`, and exits non-zero on `drift` or `missing` — handy as a CI check.
91
-
92
- ## Configuration Usage
93
-
94
- ### Biome (Formatter & Linter)
95
-
96
- Since Biome doesn't support configuration extension, use the copy command to get the base configuration:
97
-
98
- ```bash
99
- # Copy base Biome configuration
100
- npx @rtorcato/js-tooling copy biome
101
- ```
102
-
103
- This creates a `biome.json` file with:
104
- - Tab indentation, 100 character line width
105
- - Single quotes, ES5 trailing commas
106
- - Recommended linting rules with sensible overrides
107
- - Smart file patterns excluding build directories
108
-
109
- After copying, customize for your project:
110
-
111
- ```json
112
- {
113
- "linter": {
114
- "rules": {
115
- "recommended": true,
116
- "suspicious": {
117
- "noExplicitAny": "error"
118
- }
119
- }
120
- }
121
- }
122
- ```
123
-
124
- ### TypeScript
125
-
126
- Import TypeScript configurations directly in your `tsconfig.json`:
127
-
128
- ```json
129
- {
130
- "extends": "@rtorcato/js-tooling/typescript/base"
131
- }
132
- ```
133
-
134
- Available configurations:
135
- - `typescript/base` - Base configuration for all projects
136
- - `typescript/react` - React-specific settings
137
- - `typescript/next` - Next.js optimized configuration
138
- - `typescript/node` - Node.js server configuration
139
- - `typescript/express` - Express.js API configuration
140
-
141
- ### ESLint
142
-
143
- ```javascript
144
- // eslint.config.js
145
- import baseConfig from '@rtorcato/js-tooling/eslint/base'
146
- import nextjsConfig from '@rtorcato/js-tooling/eslint/nextjs'
147
-
148
- export default [
149
- ...baseConfig,
150
- // Add project-specific rules
151
- ]
152
- ```
153
-
154
- ### Commitlint
155
-
156
- ```javascript
157
- // commitlint.config.js
158
- import config from '@rtorcato/js-tooling/commitlint/config'
159
- export default config
160
- ```
161
-
162
- ### Vitest
163
-
164
- ```javascript
165
- // vitest.config.js
166
- import { defineConfig } from 'vitest/config'
167
- import baseConfig from '@rtorcato/js-tooling/vitest/config'
168
-
169
- export default defineConfig({
170
- ...baseConfig,
171
- // Add project-specific settings
172
- })
173
- ```
174
-
175
- ### Semantic Release
176
-
177
- ```javascript
178
- // release.config.js
179
- import config from '@rtorcato/js-tooling/semantic-release/github'
180
- export default config
181
- ```
5
+ [![CI](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml/badge.svg)](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml)
6
+ [![npm version](https://badge.fury.io/js/@rtorcato%2Fjs-tooling.svg)](https://badge.fury.io/js/@rtorcato%2Fjs-tooling)
7
+ [![npm downloads](https://img.shields.io/npm/dm/@rtorcato%2Fjs-tooling)](https://www.npmjs.com/package/@rtorcato/js-tooling)
8
+ [![Bundle size](https://img.shields.io/bundlephobia/minzip/@rtorcato/js-tooling)](https://bundlephobia.com/package/@rtorcato/js-tooling)
9
+ [![Coverage](https://codecov.io/gh/rtorcato/js-tooling/branch/main/graph/badge.svg)](https://codecov.io/gh/rtorcato/js-tooling)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
182
11
 
183
- ## Using with Package Managers
12
+ Most tooling libraries give you one piece — just TypeScript configs, or just an ESLint preset. **js-tooling** covers the entire lifecycle: TypeScript, Biome/ESLint, Vitest/Jest, Commitlint, Husky, Semantic Release, and GitHub Actions CI — all wired together. The interactive `setup` wizard scaffolds everything in one shot; `doctor` checks an existing project for drift.
184
13
 
185
- ### With pnpm
186
- ```bash
187
- # Temporarily install and run
188
- pnpm --package=@rtorcato/js-tooling dlx setup
14
+ **[Full documentation →](https://rtorcato.github.io/js-tooling/)**
189
15
 
190
- # Or install globally
191
- pnpm add -g @rtorcato/js-tooling
192
- ```
16
+ ## Quick start
193
17
 
194
- ### With npm
195
18
  ```bash
196
- # Use directly
197
19
  npx @rtorcato/js-tooling setup
198
-
199
- # Or install globally
200
- npm install -g @rtorcato/js-tooling
201
20
  ```
202
21
 
203
- ## Development
204
-
205
- To work on this package locally:
206
-
207
- 1. Clone the repository:
208
- ```bash
209
- git clone https://github.com/rtorcato/js-tooling.git
210
- cd js-tooling
211
- ```
212
-
213
- 2. Install dependencies:
214
- ```bash
215
- pnpm install
216
- ```
22
+ ## What's new
217
23
 
218
- 3. Build the CLI:
219
- ```bash
220
- pnpm run build-cli
221
- ```
24
+ See [CHANGELOG.md](CHANGELOG.md) for the full history.
222
25
 
223
- 4. Link globally for testing:
224
- ```bash
225
- pnpm link --global
226
- ```
26
+ **v2.0.0** All 39 tool packages moved from `dependencies` to `peerDependencies`. Add them to your own `devDependencies`. Also ships: `doctor` subcommand, generator unit tests, Dependabot, CI matrix (Node 22 + 24).
227
27
 
228
- For more details, refer to the [pnpm link documentation](https://pnpm.io/cli/link).
229
-
230
- ## Status
231
-
232
- [![CI](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml/badge.svg)](https://github.com/rtorcato/js-tooling/actions/workflows/ci.yml)
233
- [![npm version](https://badge.fury.io/js/@rtorcato%2Fjs-tooling.svg)](https://badge.fury.io/js/@rtorcato%2Fjs-tooling)
234
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
235
- [![GitHub release (latest by date)](https://img.shields.io/github/v/release/rtorcato/js-tooling)](https://github.com/rtorcato/js-tooling/releases)
236
- [![GitHub issues](https://img.shields.io/github/issues/rtorcato/js-tooling)](https://github.com/rtorcato/js-tooling/issues)
28
+ **v1.1.0** Stricter commitlint limits, fix for CLI path resolution when copying configs.
237
29
 
238
30
  ## Contributing
239
31
 
240
- Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) and feel free to submit issues and pull requests.
32
+ Contributions welcome see [CONTRIBUTING.md](CONTRIBUTING.md).
241
33
 
242
34
  ## License
243
35
 
244
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
36
+ MIT see [LICENSE](LICENSE).
package/dist/cli/index.js CHANGED
@@ -1,9 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ import path from 'node:path';
2
3
  import chalk from 'chalk';
3
4
  import { Command } from 'commander';
5
+ import fs from 'fs-extra';
4
6
  import packageJson from '../../package.json' with { type: 'json' };
5
7
  import { doctorCommand } from './commands/doctor.js';
6
8
  import { setupProject } from './commands/setup.js';
9
+ async function isSelfRepo(dir) {
10
+ try {
11
+ const pkg = await fs.readJson(path.join(dir, 'package.json'));
12
+ return pkg.name === '@rtorcato/js-tooling';
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
7
18
  const program = new Command();
8
19
  program
9
20
  .name('@rtorcato/js-tooling')
@@ -39,7 +50,7 @@ program
39
50
  console.log(` ${chalk.green('●')} ${chalk.bold(key)}: ${chalk.gray(desc)}`);
40
51
  });
41
52
  console.log();
42
- return;
53
+ process.exit(1);
43
54
  }
44
55
  const { source, target, desc } = availableConfigs[config];
45
56
  try {
@@ -96,6 +107,17 @@ program
96
107
  .option('-d, --directory <path>', 'Target directory to diagnose', process.cwd())
97
108
  .option('--json', 'Emit machine-readable JSON output')
98
109
  .action(doctorCommand);
110
+ program.hook('preAction', async (_, actionCommand) => {
111
+ const name = actionCommand.name();
112
+ if (name === 'setup' || name === 'doctor') {
113
+ const dir = actionCommand.opts().directory ?? process.cwd();
114
+ if (await isSelfRepo(dir)) {
115
+ console.log(chalk.yellow('\n⚠️ This command cannot be run inside the @rtorcato/js-tooling repo itself.\n'));
116
+ console.log(chalk.gray(' setup and doctor are for consumer projects, not for the tooling repo.\n'));
117
+ process.exit(0);
118
+ }
119
+ }
120
+ });
99
121
  // Handle unknown commands
100
122
  program.on('command:*', () => {
101
123
  console.error(chalk.red(`\n❌ Unknown command: ${program.args.join(' ')}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtorcato/js-tooling",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "JavaScript and TypeScript tooling for Node.js, React, Next.js, and Vitest.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -33,6 +33,7 @@
33
33
  "test": "vitest",
34
34
  "test:watch": "vitest --watch",
35
35
  "coverage": "vitest run --coverage",
36
+ "knip": "knip",
36
37
  "commit": "cz",
37
38
  "================================================": ""
38
39
  },
@@ -52,9 +53,12 @@
52
53
  "tooling/typescript/reset.d.ts",
53
54
  "tooling/vitest/vitest.config.mjs",
54
55
  "tooling/vitest/vitest.config.d.mts",
56
+ "tooling/vitest/vitest.config.react.mjs",
57
+ "tooling/vitest/vitest.config.react.d.mts",
58
+ "tooling/vitest/vitest.setup.mjs",
59
+ "tooling/vitest/vitest.setup.d.mts",
55
60
  "tooling/tsup/index.ts",
56
61
  "tooling/biome/biome.json",
57
- "tooling/biome/biome.jsonc",
58
62
  "tooling/semantic-release/*.mjs",
59
63
  "tooling/semantic-release/*.d.mts",
60
64
  "README.md"
@@ -99,6 +103,14 @@
99
103
  "types": "./tooling/vitest/vitest.config.d.mts",
100
104
  "import": "./tooling/vitest/vitest.config.mjs"
101
105
  },
106
+ "./vitest/react": {
107
+ "types": "./tooling/vitest/vitest.config.react.d.mts",
108
+ "import": "./tooling/vitest/vitest.config.react.mjs"
109
+ },
110
+ "./vitest/setup": {
111
+ "types": "./tooling/vitest/vitest.setup.d.mts",
112
+ "import": "./tooling/vitest/vitest.setup.mjs"
113
+ },
102
114
  "./tsup": "./tooling/tsup/index.ts",
103
115
  "./biome": "./tooling/biome/biome.json",
104
116
  "./semantic-release": {
@@ -116,14 +128,17 @@
116
128
  },
117
129
  "dependencies": {
118
130
  "chalk": "^5.6.2",
119
- "commander": "^14.0.1",
131
+ "commander": "^14.0.3",
120
132
  "fs-extra": "^11.3.2",
121
- "inquirer": "^12.10.0"
133
+ "inquirer": "^14.0.0"
122
134
  },
123
135
  "devDependencies": {
124
136
  "@biomejs/biome": "^2.3.0",
137
+ "@commitlint/types": "^20.0.0",
138
+ "@eslint/js": "^9.38.0",
139
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
125
140
  "@commitlint/cli": "^20.1.0",
126
- "@commitlint/config-conventional": "^20.0.0",
141
+ "@commitlint/config-conventional": "^21.0.1",
127
142
  "@next/eslint-plugin-next": "^16.0.0",
128
143
  "@playwright/test": "^1.56.1",
129
144
  "@semantic-release/changelog": "^6.0.3",
@@ -135,47 +150,41 @@
135
150
  "@semantic-release/release-notes-generator": "^14.1.0",
136
151
  "@total-typescript/ts-reset": "0.6.1",
137
152
  "@types/fs-extra": "^11.0.4",
138
- "@types/inquirer": "^9.0.9",
139
- "@types/node": "^24.9.1",
153
+ "@types/node": "^25.9.1",
140
154
  "@typescript-eslint/eslint-plugin": "^8.46.2",
141
155
  "@typescript-eslint/parser": "^8.46.2",
142
156
  "@vitejs/plugin-react": "^5.1.0",
143
157
  "@vitest/coverage-v8": "^4.0.3",
144
158
  "commitizen": "^4.3.1",
145
- "conventional-changelog-conventionalcommits": "^9.1.0",
146
- "cross-env": "^10.1.0",
159
+ "conventional-changelog-conventionalcommits": "^9.3.1",
147
160
  "cz-conventional-changelog": "^3.3.0",
148
161
  "esbuild": "^0.25.11",
149
- "esbuild-node-externals": "^1.18.0",
162
+ "esbuild-node-externals": "^1.22.0",
150
163
  "eslint": "9.38.0",
151
- "eslint-config-airbnb": "^19.0.4",
152
- "eslint-config-prettier": "10.1.8",
153
- "eslint-config-turbo": "^2.5.8",
154
164
  "eslint-plugin-import": "^2.32.0",
155
165
  "eslint-plugin-jest": "29.0.1",
156
- "eslint-plugin-jsx-a11y": "^6.10.2",
157
- "eslint-plugin-react": "^7.37.5",
158
- "eslint-plugin-react-hooks": "^7.0.0",
159
- "eslint-plugin-vitest": "0.5.4",
166
+ "jest": "^29.7.0",
160
167
  "husky": "^9.1.7",
161
168
  "is-ci": "^4.1.0",
162
169
  "lint-staged": "^16.2.6",
163
170
  "prettier": "^3.6.2",
164
- "prettier-plugin-tailwindcss": "^0.7.1",
165
171
  "rimraf": "6.0.1",
166
172
  "semantic-release": "^25.0.1",
167
173
  "ts-jest": "^29.4.5",
168
- "tsup": "8.5.0",
174
+ "tsup": "8.5.1",
169
175
  "typescript": "^5.9.3",
170
176
  "typescript-eslint": "^8.60.0",
171
- "vitest": "4.0.3"
177
+ "vitest": "4.0.3",
178
+ "knip": "^5.61.3"
172
179
  },
173
180
  "peerDependencies": {
174
181
  "@biomejs/biome": "^2.0.0",
175
182
  "@commitlint/cli": "^20.0.0",
176
- "@commitlint/config-conventional": "^20.0.0",
183
+ "@commitlint/config-conventional": "^21.0.1",
184
+ "@commitlint/types": "^20.0.0",
185
+ "@eslint/js": "^9.0.0",
186
+ "@ianvs/prettier-plugin-sort-imports": "^4.0.0",
177
187
  "@next/eslint-plugin-next": "^16.0.0",
178
- "@playwright/test": "^1.50.0",
179
188
  "@semantic-release/changelog": "^6.0.0",
180
189
  "@semantic-release/commit-analyzer": "^13.0.0",
181
190
  "@semantic-release/exec": "^7.0.0",
@@ -186,26 +195,14 @@
186
195
  "@total-typescript/ts-reset": "^0.6.0",
187
196
  "@typescript-eslint/eslint-plugin": "^8.0.0",
188
197
  "@typescript-eslint/parser": "^8.0.0",
189
- "@vitejs/plugin-react": "^5.0.0",
190
- "commitizen": "^4.0.0",
191
198
  "conventional-changelog-conventionalcommits": "^9.0.0",
192
- "cz-conventional-changelog": "^3.0.0",
193
- "esbuild": "^0.25.0",
199
+ "esbuild": "^0.25.0 || ^0.27.0 || ^0.28.0",
194
200
  "esbuild-node-externals": "^1.0.0",
195
201
  "eslint": ">=9.0.0",
196
- "eslint-config-airbnb": "^19.0.0",
197
- "eslint-config-prettier": ">=10.0.0",
198
- "eslint-config-turbo": "^2.0.0",
199
202
  "eslint-plugin-import": "^2.0.0",
200
203
  "eslint-plugin-jest": "^29.0.0",
201
- "eslint-plugin-jsx-a11y": "^6.0.0",
202
- "eslint-plugin-react": "^7.0.0",
203
- "eslint-plugin-react-hooks": "^7.0.0",
204
- "eslint-plugin-vitest": "^0.5.0",
205
- "husky": "^9.0.0",
206
- "lint-staged": ">=16.0.0",
204
+ "jest": "^29.0.0",
207
205
  "prettier": "^3.0.0",
208
- "prettier-plugin-tailwindcss": "^0.7.0",
209
206
  "semantic-release": "^25.0.0",
210
207
  "ts-jest": "^29.0.0",
211
208
  "tsup": "^8.0.0",
@@ -223,10 +220,16 @@
223
220
  "@commitlint/config-conventional": {
224
221
  "optional": true
225
222
  },
226
- "@next/eslint-plugin-next": {
223
+ "@commitlint/types": {
224
+ "optional": true
225
+ },
226
+ "@eslint/js": {
227
227
  "optional": true
228
228
  },
229
- "@playwright/test": {
229
+ "@ianvs/prettier-plugin-sort-imports": {
230
+ "optional": true
231
+ },
232
+ "@next/eslint-plugin-next": {
230
233
  "optional": true
231
234
  },
232
235
  "@semantic-release/changelog": {
@@ -259,18 +262,9 @@
259
262
  "@typescript-eslint/parser": {
260
263
  "optional": true
261
264
  },
262
- "@vitejs/plugin-react": {
263
- "optional": true
264
- },
265
- "commitizen": {
266
- "optional": true
267
- },
268
265
  "conventional-changelog-conventionalcommits": {
269
266
  "optional": true
270
267
  },
271
- "cz-conventional-changelog": {
272
- "optional": true
273
- },
274
268
  "esbuild": {
275
269
  "optional": true
276
270
  },
@@ -280,45 +274,18 @@
280
274
  "eslint": {
281
275
  "optional": true
282
276
  },
283
- "eslint-config-airbnb": {
284
- "optional": true
285
- },
286
- "eslint-config-prettier": {
287
- "optional": true
288
- },
289
- "eslint-config-turbo": {
290
- "optional": true
291
- },
292
277
  "eslint-plugin-import": {
293
278
  "optional": true
294
279
  },
295
280
  "eslint-plugin-jest": {
296
281
  "optional": true
297
282
  },
298
- "eslint-plugin-jsx-a11y": {
299
- "optional": true
300
- },
301
- "eslint-plugin-react": {
302
- "optional": true
303
- },
304
- "eslint-plugin-react-hooks": {
305
- "optional": true
306
- },
307
- "eslint-plugin-vitest": {
308
- "optional": true
309
- },
310
- "husky": {
311
- "optional": true
312
- },
313
- "lint-staged": {
283
+ "jest": {
314
284
  "optional": true
315
285
  },
316
286
  "prettier": {
317
287
  "optional": true
318
288
  },
319
- "prettier-plugin-tailwindcss": {
320
- "optional": true
321
- },
322
289
  "semantic-release": {
323
290
  "optional": true
324
291
  },
@@ -338,6 +305,27 @@
338
305
  "optional": true
339
306
  }
340
307
  },
308
+ "knip": {
309
+ "entry": [
310
+ "src/cli/index.ts",
311
+ "src/cli/commands/doctor.ts",
312
+ "tooling/**/*.{mjs,ts}"
313
+ ],
314
+ "project": [
315
+ "src/**/*.ts",
316
+ "tooling/**/*.{mjs,ts}"
317
+ ],
318
+ "ignoreDependencies": [
319
+ "ts-jest",
320
+ "@semantic-release/commit-analyzer",
321
+ "@semantic-release/exec",
322
+ "@semantic-release/github",
323
+ "@semantic-release/npm",
324
+ "@semantic-release/release-notes-generator",
325
+ "conventional-changelog-conventionalcommits",
326
+ "lint-staged"
327
+ ]
328
+ },
341
329
  "lint-staged": {
342
330
  "*.{js,ts,json,md}": [
343
331
  "pnpm exec biome lint --config-path=tooling/biome/biome.json",
@@ -345,9 +333,7 @@
345
333
  ]
346
334
  },
347
335
  "bin": {
348
- "js-tooling": "./dist/cli/index.js",
349
- "commitmessage": "scripts/commitmessage.sh",
350
- "helloworld": "scripts/helloworld.sh"
336
+ "js-tooling": "./dist/cli/index.js"
351
337
  },
352
338
  "config": {
353
339
  "commitizen": {
@@ -10,7 +10,7 @@ export default defineConfig({
10
10
  environment: 'node',
11
11
  coverage: {
12
12
  provider: 'v8',
13
- reporter: ['text', 'json', 'html'],
13
+ reporter: ['text', 'json', 'html', 'json-summary'],
14
14
  include: ['src/cli/generators/**/*.ts'],
15
15
  thresholds: {
16
16
  statements: 25,
@@ -0,0 +1,4 @@
1
+ import type { UserConfig } from 'vitest/config'
2
+
3
+ declare const config: UserConfig
4
+ export default config
@@ -0,0 +1,27 @@
1
+ import base from '@rtorcato/js-tooling/vitest/config'
2
+ import react from '@vitejs/plugin-react'
3
+ import { dirname, resolve } from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+ import { defineConfig, mergeConfig } from 'vitest/config'
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url))
8
+
9
+ export default mergeConfig(
10
+ base,
11
+ defineConfig({
12
+ plugins: [react()],
13
+ test: {
14
+ environment: 'jsdom',
15
+ include: ['src/**/*.{test,spec}.{js,jsx,ts,tsx}'],
16
+ css: true, // ← Vitest will stub every *.css / *.module.css import
17
+ exclude: ['OLD/**'],
18
+ setupFiles: ['./vitest.setup.ts'],
19
+ },
20
+ resolve: {
21
+ alias: [
22
+ { find: '@', replacement: resolve(__dirname, './src') },
23
+ { find: '~', replacement: resolve(__dirname, './src') },
24
+ ],
25
+ },
26
+ })
27
+ )
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,3 @@
1
+ import { vi } from 'vitest'
2
+
3
+ vi.mock('**/*.module.css', () => ({}))
package/scripts/README.md DELETED
@@ -1,8 +0,0 @@
1
- pnpx js-tooling commitmessage
2
- pnpx js-tooling version-bump
3
- pnpx js-tooling genpassword
4
-
5
- <!-- run before publish -->
6
- pnpm exec ./scripts/fix-bins.sh
7
-
8
- pnpm link --global
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # chmod +x scripts/commitmessage.sh
4
- set -e
5
-
6
- echo "Select commit type by number:"
7
- select type in "feat" "fix" "perf" "ci" "WIP" "chore" "docs" "test" "style" "refactor" "build" "BREAKING CHANGE" "revert"; do
8
- if [ -n "$type" ]; then
9
- break
10
- else
11
- echo "❌ Invalid selection. Try again."
12
- fi
13
- done
14
-
15
- if [[ "$type" =~ ^(feat|fix|perf)$ ]]; then
16
- echo "Select semantic version by number:"
17
- select semantic_version in "none" "patch" "minor" "major"; do
18
- [ -n "$semantic_version" ] && break
19
- done
20
- else
21
- semantic_version="none"
22
- fi
23
-
24
- read -p "Enter commit description: " description
25
- read -p "Skip CI? (y/n) [n]: " skip_ci
26
- skip_ci=${skip_ci:-n}
27
-
28
- msg="$type"
29
- [ "$semantic_version" != "none" ] && msg="$msg($semantic_version)"
30
- msg="$msg: $description"
31
- [ "$skip_ci" = "y" ] && msg="$msg [skip ci]"
32
-
33
- echo ""
34
- echo "🔍 Commit preview:"
35
- echo "$msg"
36
- read -p "Is this okay? (y/n): " confirm
37
- [ "$confirm" != "y" ] && echo "❌ Commit aborted." && exit 1
38
-
39
- git add -A
40
- git commit -m "$msg"
41
-
42
- echo ""
43
- read -p "Do you want to push the commit? (y/n): " push_confirm
44
- [ "$push_confirm" = "y" ] && git push || echo "🚫 Commit not pushed."
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # chmod +x scripts/helloworld.sh
4
-
5
- echo "👋 Hello, world from js-tooling!"