@dimensional-innovations/tool-config 1.0.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 +21 -0
- package/README.md +646 -0
- package/bin/setup-tool-config.js +675 -0
- package/package.json +168 -0
- package/src/detectors.js +261 -0
- package/src/index.js +64 -0
- package/src/tools/eslint/index.js +287 -0
- package/src/tools/eslint/presets/base.js +82 -0
- package/src/tools/eslint/presets/environments/browser.js +16 -0
- package/src/tools/eslint/presets/environments/node.js +21 -0
- package/src/tools/eslint/presets/environments/universal.js +18 -0
- package/src/tools/eslint/presets/frameworks/angular.js +74 -0
- package/src/tools/eslint/presets/frameworks/astro.js +38 -0
- package/src/tools/eslint/presets/frameworks/node.js +57 -0
- package/src/tools/eslint/presets/frameworks/react.js +76 -0
- package/src/tools/eslint/presets/frameworks/solid.js +45 -0
- package/src/tools/eslint/presets/frameworks/svelte.js +78 -0
- package/src/tools/eslint/presets/frameworks/vanilla.js +16 -0
- package/src/tools/eslint/presets/frameworks/vue.js +125 -0
- package/src/tools/eslint/presets/imports.js +41 -0
- package/src/tools/eslint/presets/typescript.js +131 -0
- package/src/tools/prettier/README.md +398 -0
- package/src/tools/prettier/index.js +114 -0
- package/src/tools/prettier/presets/base.js +36 -0
- package/src/tools/prettier/presets/frameworks/astro.js +15 -0
- package/src/tools/prettier/presets/frameworks/react.js +15 -0
- package/src/tools/prettier/presets/frameworks/svelte.js +22 -0
- package/src/tools/prettier/presets/frameworks/vanilla.js +13 -0
- package/src/tools/prettier/presets/frameworks/vue.js +20 -0
- package/src/tools/prettier/presets/prettierignore.js +56 -0
- package/src/tools/semantic-release/CI_SETUP.md +66 -0
- package/src/tools/semantic-release/README.md +533 -0
- package/src/tools/semantic-release/index.js +130 -0
- package/src/tools/semantic-release/presets/default.js +37 -0
- package/src/tools/semantic-release/presets/library.js +58 -0
- package/src/tools/semantic-release/presets/monorepo.js +48 -0
- package/src/tools/semantic-release/templates/.gitlab-ci.yml +85 -0
- package/src/tools/semantic-release/templates/bitbucket-pipelines.yml +100 -0
- package/src/tools/semantic-release/templates/github-workflow.yml +107 -0
- package/src/tools/stylelint/README.md +425 -0
- package/src/tools/stylelint/index.js +191 -0
- package/src/tools/stylelint/presets/base.js +50 -0
- package/src/tools/stylelint/presets/css-modules.js +43 -0
- package/src/tools/stylelint/presets/frameworks/react.js +18 -0
- package/src/tools/stylelint/presets/frameworks/svelte.js +28 -0
- package/src/tools/stylelint/presets/frameworks/vanilla.js +14 -0
- package/src/tools/stylelint/presets/frameworks/vue.js +38 -0
- package/src/tools/stylelint/presets/scss.js +83 -0
- package/src/tools/stylelint/presets/tailwind.js +49 -0
- package/src/utils/package-reader.js +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 DIMENSIONAL INNOVATIONS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
# @dimensional-innovations/tool-config
|
|
2
|
+
|
|
3
|
+
> Universal configuration package for ESLint, Prettier, Stylelint, and semantic-release with automatic framework detection.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@dimensional-innovations/tool-config)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](./tests/)
|
|
9
|
+
|
|
10
|
+
**One package. Four tools. Zero configuration.**
|
|
11
|
+
|
|
12
|
+
Stop juggling multiple config packages. This single package provides battle-tested configurations for ESLint, Prettier, Stylelint, and semantic-release that automatically detect your project's framework, environment, and TypeScript setup.
|
|
13
|
+
|
|
14
|
+
## Why This Package?
|
|
15
|
+
|
|
16
|
+
**Before:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install --save-dev \
|
|
20
|
+
eslint @eslint/js eslint-config-airbnb eslint-plugin-react \
|
|
21
|
+
prettier prettier-config-standard \
|
|
22
|
+
stylelint stylelint-config-standard \
|
|
23
|
+
semantic-release @semantic-release/git @semantic-release/changelog
|
|
24
|
+
|
|
25
|
+
# ...then configure each one individually
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**After:**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --save-dev @dimensional-innovations/tool-config
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- 🎯 **Zero Configuration** - Auto-detects your framework, environment, and TypeScript
|
|
37
|
+
- 🧰 **Multi-Tool Support** - ESLint, Prettier, Stylelint, semantic-release in one package
|
|
38
|
+
- ⚛️ **8+ Frameworks** - React, Vue, Svelte, Solid, Astro, Angular, Vanilla JS, Node.js
|
|
39
|
+
- 📦 **All-In-One** - All plugins and parsers included as dependencies
|
|
40
|
+
- 🔧 **Customizable** - Override any setting while keeping smart defaults
|
|
41
|
+
- 🚀 **Modern** - ESLint 9+ flat config, latest tooling versions
|
|
42
|
+
- ✅ **Battle-Tested** - 369 tests with 100% coverage
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install --save-dev @dimensional-innovations/tool-config
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or use the interactive CLI:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx @dimensional-innovations/tool-config
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Basic Usage
|
|
59
|
+
|
|
60
|
+
Create config files in your project root:
|
|
61
|
+
|
|
62
|
+
**ESLint** (`eslint.config.js`):
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
66
|
+
|
|
67
|
+
export default await createConfig('eslint')
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Prettier** (`prettier.config.js`):
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
74
|
+
|
|
75
|
+
export default createConfig('prettier')
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Stylelint** (`stylelint.config.js`):
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
82
|
+
|
|
83
|
+
export default createConfig('stylelint')
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**semantic-release** (`release.config.js`):
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
90
|
+
|
|
91
|
+
export default createConfig('semantic-release')
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
That's it! The configs will automatically detect your framework and TypeScript setup.
|
|
95
|
+
|
|
96
|
+
### Add npm Scripts
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"scripts": {
|
|
101
|
+
"lint": "eslint .",
|
|
102
|
+
"lint:fix": "eslint --fix .",
|
|
103
|
+
"prettier": "prettier --check .",
|
|
104
|
+
"prettier:fix": "prettier --write .",
|
|
105
|
+
"style": "stylelint '**/*.css'",
|
|
106
|
+
"style:fix": "stylelint '**/*.css' --fix"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Supported Frameworks
|
|
112
|
+
|
|
113
|
+
| Framework | ESLint | Prettier | Stylelint | Auto-Detect |
|
|
114
|
+
| --------- | ------ | -------- | ------------------- | ----------- |
|
|
115
|
+
| React | ✅ | ✅ | ✅ CSS Modules | ✅ |
|
|
116
|
+
| Vue | ✅ | ✅ | ✅ Scoped Styles | ✅ |
|
|
117
|
+
| Svelte | ✅ | ✅ | ✅ Component Styles | ✅ |
|
|
118
|
+
| Solid | ✅ | ✅ | ✅ CSS Modules | ✅ |
|
|
119
|
+
| Astro | ✅ | ✅ | ✅ | ✅ |
|
|
120
|
+
| Angular | ✅ | ✅ | ✅ | ✅ |
|
|
121
|
+
| Vanilla | ✅ | ✅ | ✅ | ✅ |
|
|
122
|
+
| Node.js | ✅ | ✅ | N/A | ✅ |
|
|
123
|
+
|
|
124
|
+
**Meta-frameworks**: Next.js (→ React), Nuxt (→ Vue), SvelteKit (→ Svelte)
|
|
125
|
+
|
|
126
|
+
## API Documentation
|
|
127
|
+
|
|
128
|
+
### `createConfig(tool, options)`
|
|
129
|
+
|
|
130
|
+
The main factory function that creates configurations for any supported tool.
|
|
131
|
+
|
|
132
|
+
**Parameters:**
|
|
133
|
+
|
|
134
|
+
- `tool` (string, required): Tool name - `'eslint'`, `'prettier'`, `'stylelint'`, or `'semantic-release'`
|
|
135
|
+
- `options` (object, optional): Configuration options
|
|
136
|
+
|
|
137
|
+
**Common Options:**
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
{
|
|
141
|
+
framework: 'auto', // 'auto' | 'react' | 'vue' | 'svelte' | etc.
|
|
142
|
+
typescript: undefined, // undefined (auto-detect) | true | false
|
|
143
|
+
cwd: process.cwd() // Working directory for detection
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### ESLint Options
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
await createConfig('eslint', {
|
|
151
|
+
framework: 'auto', // Auto-detect or specify framework
|
|
152
|
+
environment: 'auto', // 'auto' | 'browser' | 'node' | 'universal'
|
|
153
|
+
typescript: undefined, // Auto-detect TypeScript
|
|
154
|
+
ignore: [], // Additional ignore patterns
|
|
155
|
+
rules: {} // Custom rule overrides
|
|
156
|
+
})
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Example - Custom Rules:**
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
export default await createConfig('eslint', {
|
|
163
|
+
rules: {
|
|
164
|
+
'no-console': 'off',
|
|
165
|
+
'react/prop-types': 'warn'
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Example - Explicit Framework:**
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
export default await createConfig('eslint', {
|
|
174
|
+
framework: 'vue',
|
|
175
|
+
typescript: true
|
|
176
|
+
})
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Prettier Options
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
createConfig('prettier', {
|
|
183
|
+
framework: 'auto',
|
|
184
|
+
// Override any Prettier option
|
|
185
|
+
semi: false,
|
|
186
|
+
singleQuote: true,
|
|
187
|
+
printWidth: 100
|
|
188
|
+
})
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Example - Custom Settings:**
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
export default createConfig('prettier', {
|
|
195
|
+
printWidth: 120,
|
|
196
|
+
tabWidth: 4,
|
|
197
|
+
trailingComma: 'all'
|
|
198
|
+
})
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Stylelint Options
|
|
202
|
+
|
|
203
|
+
```javascript
|
|
204
|
+
createConfig('stylelint', {
|
|
205
|
+
framework: 'auto',
|
|
206
|
+
cssType: 'auto', // 'auto' | 'scss' | 'css' | { preprocessor, tailwind, modules }
|
|
207
|
+
rules: {} // Custom rule overrides
|
|
208
|
+
})
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Example - SCSS + Tailwind:**
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
export default createConfig('stylelint', {
|
|
215
|
+
cssType: {
|
|
216
|
+
preprocessor: 'scss',
|
|
217
|
+
tailwind: true
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### semantic-release Options
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
createConfig('semantic-release', {
|
|
226
|
+
preset: 'default', // 'default' | 'library' | 'monorepo'
|
|
227
|
+
gitProvider: 'auto' // 'auto' | 'gitlab' | 'github' | 'bitbucket'
|
|
228
|
+
})
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Example - Library Release:**
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
export default createConfig('semantic-release', {
|
|
235
|
+
preset: 'library',
|
|
236
|
+
gitProvider: 'github'
|
|
237
|
+
})
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Framework-Specific Guides
|
|
241
|
+
|
|
242
|
+
### React
|
|
243
|
+
|
|
244
|
+
**Auto-detected when:**
|
|
245
|
+
|
|
246
|
+
- `react` or `react-dom` in dependencies
|
|
247
|
+
- `next` in dependencies (Next.js)
|
|
248
|
+
|
|
249
|
+
**ESLint features:**
|
|
250
|
+
|
|
251
|
+
- React hooks rules
|
|
252
|
+
- JSX best practices
|
|
253
|
+
- React 18+ features
|
|
254
|
+
|
|
255
|
+
**Prettier features:**
|
|
256
|
+
|
|
257
|
+
- JSX formatting
|
|
258
|
+
- Component style consistency
|
|
259
|
+
|
|
260
|
+
**Stylelint features:**
|
|
261
|
+
|
|
262
|
+
- CSS Modules support (`:global`, `:local`, `composes`)
|
|
263
|
+
- Tailwind CSS support (auto-detected)
|
|
264
|
+
|
|
265
|
+
**Example:**
|
|
266
|
+
|
|
267
|
+
```javascript
|
|
268
|
+
// eslint.config.js - automatically detects React
|
|
269
|
+
export default await createConfig('eslint')
|
|
270
|
+
|
|
271
|
+
// prettier.config.js - automatically formats JSX
|
|
272
|
+
export default createConfig('prettier')
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Vue
|
|
276
|
+
|
|
277
|
+
**Auto-detected when:**
|
|
278
|
+
|
|
279
|
+
- `vue` in dependencies
|
|
280
|
+
- `nuxt` in dependencies (Nuxt)
|
|
281
|
+
|
|
282
|
+
**ESLint features:**
|
|
283
|
+
|
|
284
|
+
- Vue 3 Composition API
|
|
285
|
+
- `<script setup>` support
|
|
286
|
+
- Template linting
|
|
287
|
+
|
|
288
|
+
**Prettier features:**
|
|
289
|
+
|
|
290
|
+
- SFC (Single File Component) formatting
|
|
291
|
+
- `prettier-plugin-vue` integration
|
|
292
|
+
|
|
293
|
+
**Stylelint features:**
|
|
294
|
+
|
|
295
|
+
- Scoped styles support
|
|
296
|
+
- Vue SFC style blocks
|
|
297
|
+
|
|
298
|
+
**Example:**
|
|
299
|
+
|
|
300
|
+
```javascript
|
|
301
|
+
// stylelint.config.js - automatically handles .vue files
|
|
302
|
+
export default createConfig('stylelint')
|
|
303
|
+
|
|
304
|
+
// npm scripts
|
|
305
|
+
{
|
|
306
|
+
"style": "stylelint '**/*.css' '**/*.vue'"
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Svelte
|
|
311
|
+
|
|
312
|
+
**Auto-detected when:**
|
|
313
|
+
|
|
314
|
+
- `svelte` in dependencies
|
|
315
|
+
- `@sveltejs/kit` in dependencies (SvelteKit)
|
|
316
|
+
|
|
317
|
+
**ESLint features:**
|
|
318
|
+
|
|
319
|
+
- Svelte 5 runes support
|
|
320
|
+
- Component linting
|
|
321
|
+
- Reactive statements
|
|
322
|
+
|
|
323
|
+
**Prettier features:**
|
|
324
|
+
|
|
325
|
+
- Svelte component formatting
|
|
326
|
+
- `prettier-plugin-svelte` integration
|
|
327
|
+
|
|
328
|
+
**Stylelint features:**
|
|
329
|
+
|
|
330
|
+
- Component-scoped styles
|
|
331
|
+
- `.svelte` file support
|
|
332
|
+
|
|
333
|
+
### TypeScript
|
|
334
|
+
|
|
335
|
+
**Auto-detected when:**
|
|
336
|
+
|
|
337
|
+
- `typescript` in devDependencies
|
|
338
|
+
- `tsconfig.json` exists
|
|
339
|
+
|
|
340
|
+
**Features:**
|
|
341
|
+
|
|
342
|
+
- Type-aware linting
|
|
343
|
+
- Strict type checking rules
|
|
344
|
+
- Import/export type syntax
|
|
345
|
+
- Works with all frameworks
|
|
346
|
+
|
|
347
|
+
**Disable if needed:**
|
|
348
|
+
|
|
349
|
+
```javascript
|
|
350
|
+
export default await createConfig('eslint', {
|
|
351
|
+
typescript: false // Force disable even if detected
|
|
352
|
+
})
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## CLI Tool
|
|
356
|
+
|
|
357
|
+
Interactive setup wizard for quick configuration:
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
npx @dimensional-innovations/tool-config
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Features:**
|
|
364
|
+
|
|
365
|
+
- Choose which tools to configure
|
|
366
|
+
- Auto-detects framework and TypeScript
|
|
367
|
+
- Creates config files automatically
|
|
368
|
+
- Adds npm scripts to package.json
|
|
369
|
+
- **NEW:** Automated CI/CD pipeline setup
|
|
370
|
+
- Supports dry-run mode
|
|
371
|
+
|
|
372
|
+
**Options:**
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
npx @dimensional-innovations/tool-config eslint # Setup ESLint only
|
|
376
|
+
npx @dimensional-innovations/tool-config --all # Setup all tools
|
|
377
|
+
npx @dimensional-innovations/tool-config --dry-run # Preview without creating files
|
|
378
|
+
npx @dimensional-innovations/tool-config --ci gitlab # Setup GitLab CI/CD
|
|
379
|
+
npx @dimensional-innovations/tool-config --ci github # Setup GitHub Actions
|
|
380
|
+
npx @dimensional-innovations/tool-config --setup-ci # Interactive CI setup
|
|
381
|
+
npx @dimensional-innovations/tool-config --help # Show all options
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**CI/CD Integration:**
|
|
385
|
+
|
|
386
|
+
When you select `semantic-release` in interactive mode, the CLI will automatically prompt you to setup CI/CD for automated releases. Or use the `--ci` flag to setup CI/CD directly:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# Interactive: prompts for provider if not detected
|
|
390
|
+
npx @dimensional-innovations/tool-config --setup-ci
|
|
391
|
+
|
|
392
|
+
# Direct: specify provider
|
|
393
|
+
npx @dimensional-innovations/tool-config --ci gitlab
|
|
394
|
+
npx @dimensional-innovations/tool-config --ci github
|
|
395
|
+
npx @dimensional-innovations/tool-config --ci bitbucket
|
|
396
|
+
|
|
397
|
+
# Combined: setup semantic-release + CI/CD
|
|
398
|
+
npx @dimensional-innovations/tool-config semantic-release --ci
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
The CLI will:
|
|
402
|
+
|
|
403
|
+
- Auto-detect your git provider (GitLab/GitHub/Bitbucket)
|
|
404
|
+
- Copy the appropriate CI/CD template
|
|
405
|
+
- Show environment variable configuration instructions
|
|
406
|
+
- Guide you through the setup process
|
|
407
|
+
|
|
408
|
+
## CI/CD Setup
|
|
409
|
+
|
|
410
|
+
Ready-to-use CI/CD templates for GitLab CI, GitHub Actions, and Bitbucket Pipelines.
|
|
411
|
+
|
|
412
|
+
### Automated Setup (Recommended)
|
|
413
|
+
|
|
414
|
+
The CLI tool can automatically setup CI/CD for you:
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
npx @dimensional-innovations/tool-config --ci gitlab # Or github, bitbucket
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
This will:
|
|
421
|
+
|
|
422
|
+
- Auto-detect your git provider
|
|
423
|
+
- Copy the appropriate template
|
|
424
|
+
- Show configuration instructions
|
|
425
|
+
|
|
426
|
+
### Manual Setup
|
|
427
|
+
|
|
428
|
+
Alternatively, copy templates manually from [src/tools/semantic-release/templates/](./src/tools/semantic-release/templates/).
|
|
429
|
+
|
|
430
|
+
Each template includes:
|
|
431
|
+
|
|
432
|
+
- **Lint Stage** - Runs ESLint, Prettier, and Stylelint
|
|
433
|
+
- **Test Stage** - Runs tests with coverage reporting
|
|
434
|
+
- **Release Stage** - Automated semantic-release (main branch only)
|
|
435
|
+
|
|
436
|
+
### GitLab CI
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/.gitlab-ci.yml .gitlab-ci.yml
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Configure these CI/CD variables in GitLab:
|
|
443
|
+
|
|
444
|
+
- `GL_TOKEN`: GitLab Personal Access Token
|
|
445
|
+
- `NPM_TOKEN`: npm authentication token
|
|
446
|
+
|
|
447
|
+
### GitHub Actions
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
mkdir -p .github/workflows
|
|
451
|
+
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/github-workflow.yml .github/workflows/ci.yml
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Configure these secrets in GitHub:
|
|
455
|
+
|
|
456
|
+
- `GITHUB_TOKEN`: Automatically provided
|
|
457
|
+
- `NPM_TOKEN`: npm authentication token
|
|
458
|
+
|
|
459
|
+
### Bitbucket Pipelines
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/bitbucket-pipelines.yml bitbucket-pipelines.yml
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
Configure this repository variable in Bitbucket:
|
|
466
|
+
|
|
467
|
+
- `NPM_TOKEN`: npm authentication token
|
|
468
|
+
|
|
469
|
+
See [CI_SETUP.md](./src/tools/semantic-release/CI_SETUP.md) for detailed configuration instructions.
|
|
470
|
+
|
|
471
|
+
## Examples
|
|
472
|
+
|
|
473
|
+
See the [`examples/`](./examples/) directory for complete working examples:
|
|
474
|
+
|
|
475
|
+
- [React App](./examples/react-app/) - TypeScript, CSS Modules
|
|
476
|
+
- [Vue App](./examples/vue-app/) - Composition API, Scoped Styles
|
|
477
|
+
- [Svelte App](./examples/svelte-app/) - Svelte 5, Component Styles
|
|
478
|
+
- [Solid App](./examples/solid-app/) - TypeScript, Reactive Primitives
|
|
479
|
+
- [Astro App](./examples/astro-app/) - Multi-framework, TypeScript
|
|
480
|
+
- [Angular App](./examples/angular-app/) - TypeScript, Standalone Components
|
|
481
|
+
- [Node Backend](./examples/node-backend/) - Express, TypeScript
|
|
482
|
+
- [Vanilla JS](./examples/vanilla-js/) - Pure JavaScript, no framework
|
|
483
|
+
|
|
484
|
+
Each example includes all 4 tool configurations and npm scripts.
|
|
485
|
+
|
|
486
|
+
## Advanced Usage
|
|
487
|
+
|
|
488
|
+
### Monorepo Support
|
|
489
|
+
|
|
490
|
+
Use different configs per workspace:
|
|
491
|
+
|
|
492
|
+
```javascript
|
|
493
|
+
// apps/frontend/eslint.config.js
|
|
494
|
+
export default await createConfig('eslint', {
|
|
495
|
+
framework: 'react',
|
|
496
|
+
typescript: true
|
|
497
|
+
})
|
|
498
|
+
|
|
499
|
+
// apps/backend/eslint.config.js
|
|
500
|
+
export default await createConfig('eslint', {
|
|
501
|
+
framework: 'node',
|
|
502
|
+
environment: 'node'
|
|
503
|
+
})
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### Custom Ignore Patterns
|
|
507
|
+
|
|
508
|
+
```javascript
|
|
509
|
+
export default await createConfig('eslint', {
|
|
510
|
+
ignore: ['dist/**', 'build/**', '**/*.generated.ts']
|
|
511
|
+
})
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### Environment-Specific Rules
|
|
515
|
+
|
|
516
|
+
```javascript
|
|
517
|
+
const isDev = process.env.NODE_ENV === 'development'
|
|
518
|
+
|
|
519
|
+
export default await createConfig('eslint', {
|
|
520
|
+
rules: {
|
|
521
|
+
'no-console': isDev ? 'off' : 'error',
|
|
522
|
+
'no-debugger': isDev ? 'warn' : 'error'
|
|
523
|
+
}
|
|
524
|
+
})
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Combining with Other Configs
|
|
528
|
+
|
|
529
|
+
```javascript
|
|
530
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
531
|
+
import customRules from './custom-rules.js'
|
|
532
|
+
|
|
533
|
+
const baseConfig = await createConfig('eslint')
|
|
534
|
+
|
|
535
|
+
export default [
|
|
536
|
+
...baseConfig,
|
|
537
|
+
{
|
|
538
|
+
files: ['**/*.js'],
|
|
539
|
+
rules: customRules
|
|
540
|
+
}
|
|
541
|
+
]
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
## Troubleshooting
|
|
545
|
+
|
|
546
|
+
### ESLint Not Detecting Framework
|
|
547
|
+
|
|
548
|
+
Ensure your `package.json` includes the framework dependency:
|
|
549
|
+
|
|
550
|
+
```json
|
|
551
|
+
{
|
|
552
|
+
"dependencies": {
|
|
553
|
+
"react": "^18.0.0"
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
Or explicitly specify:
|
|
559
|
+
|
|
560
|
+
```javascript
|
|
561
|
+
export default await createConfig('eslint', {
|
|
562
|
+
framework: 'react'
|
|
563
|
+
})
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### TypeScript Parsing Errors
|
|
567
|
+
|
|
568
|
+
Make sure `typescript` is installed:
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
npm install --save-dev typescript
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### Prettier Plugin Not Found
|
|
575
|
+
|
|
576
|
+
Install the required peer dependency:
|
|
577
|
+
|
|
578
|
+
```bash
|
|
579
|
+
npm install --save-dev prettier-plugin-svelte # For Svelte
|
|
580
|
+
npm install --save-dev prettier-plugin-astro # For Astro
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### Stylelint Not Linting .vue Files
|
|
584
|
+
|
|
585
|
+
Update your npm script to include `.vue` files:
|
|
586
|
+
|
|
587
|
+
```json
|
|
588
|
+
{
|
|
589
|
+
"scripts": {
|
|
590
|
+
"style": "stylelint '**/*.css' '**/*.vue'"
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### Config Not Updating After Framework Change
|
|
596
|
+
|
|
597
|
+
Delete `node_modules/.cache` and restart your editor:
|
|
598
|
+
|
|
599
|
+
```bash
|
|
600
|
+
rm -rf node_modules/.cache
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
## Requirements
|
|
604
|
+
|
|
605
|
+
- **Node.js**: >= 22.12.0 (Node.js 22 LTS "Jod")
|
|
606
|
+
- **npm**: >= 10.0.0
|
|
607
|
+
- **ECMAScript**: ES2025 (ESM modules required)
|
|
608
|
+
|
|
609
|
+
## Philosophy
|
|
610
|
+
|
|
611
|
+
This package follows these principles:
|
|
612
|
+
|
|
613
|
+
- **Zero Config by Default** - Works out of the box with sensible defaults
|
|
614
|
+
- **Smart Detection** - Automatically adapts to your project structure
|
|
615
|
+
- **Fail Loudly** - Errors for critical issues, warnings for quality improvements
|
|
616
|
+
- **Framework Agnostic** - No opinions about which framework you use
|
|
617
|
+
- **Modern Standards** - Uses latest tooling and ESLint flat config
|
|
618
|
+
- **Comprehensive Coverage** - 100% test coverage, battle-tested in production
|
|
619
|
+
|
|
620
|
+
## Contributing
|
|
621
|
+
|
|
622
|
+
Contributions welcome! This package is built to be extensible.
|
|
623
|
+
|
|
624
|
+
**To add a new framework:**
|
|
625
|
+
|
|
626
|
+
1. Add detection logic in `src/detectors.js`
|
|
627
|
+
2. Create presets in `src/tools/{tool}/presets/frameworks/`
|
|
628
|
+
3. Add tests with 100% coverage
|
|
629
|
+
4. Update documentation
|
|
630
|
+
|
|
631
|
+
See [IMPLEMENTATION_PLAN.md](./IMPLEMENTATION_PLAN.md) for architecture details.
|
|
632
|
+
|
|
633
|
+
## License
|
|
634
|
+
|
|
635
|
+
MIT © [DIMENSIONAL INNOVATIONS](https://dimin.com)
|
|
636
|
+
|
|
637
|
+
## Links
|
|
638
|
+
|
|
639
|
+
- [npm package](https://www.npmjs.com/package/@dimensional-innovations/tool-config)
|
|
640
|
+
- [GitLab repository](https://gitlab.com/dimensional-innovations/tool-config)
|
|
641
|
+
- [Issue tracker](https://gitlab.com/dimensional-innovations/tool-config/issues)
|
|
642
|
+
- [Changelog](./CHANGELOG.md)
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
**Made with ❤️ by DIMENSIONAL INNOVATIONS**
|