@dimensional-innovations/tool-config 4.0.0 → 5.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 +1 -1
- package/README.md +7 -120
- package/package.json +20 -14
- package/bin/lib/ci-setup.js +0 -142
- package/bin/lib/formatting.js +0 -103
- package/bin/lib/handlers/eslint.js +0 -61
- package/bin/lib/handlers/prettier.js +0 -83
- package/bin/lib/handlers/semantic-release.js +0 -60
- package/bin/lib/handlers/stylelint.js +0 -85
- package/bin/lib/handlers/typescript.js +0 -156
- package/bin/lib/package-manager.js +0 -201
- package/bin/lib/ui.js +0 -239
- package/bin/lib/uninstall.js +0 -199
- package/bin/lib/validators.js +0 -28
- package/bin/setup-tool-config.js +0 -442
- package/src/detectors.js +0 -286
- package/src/index.js +0 -69
- package/src/tools/eslint/index.js +0 -282
- package/src/tools/eslint/presets/base.js +0 -75
- package/src/tools/eslint/presets/environments/browser.js +0 -16
- package/src/tools/eslint/presets/environments/node.js +0 -21
- package/src/tools/eslint/presets/environments/universal.js +0 -18
- package/src/tools/eslint/presets/frameworks/angular.js +0 -80
- package/src/tools/eslint/presets/frameworks/astro.js +0 -43
- package/src/tools/eslint/presets/frameworks/node.js +0 -63
- package/src/tools/eslint/presets/frameworks/react.js +0 -81
- package/src/tools/eslint/presets/frameworks/solid.js +0 -50
- package/src/tools/eslint/presets/frameworks/svelte.js +0 -65
- package/src/tools/eslint/presets/frameworks/vanilla.js +0 -22
- package/src/tools/eslint/presets/frameworks/vue.js +0 -159
- package/src/tools/eslint/presets/imports.js +0 -47
- package/src/tools/eslint/presets/typescript.js +0 -142
- package/src/tools/prettier/README.md +0 -398
- package/src/tools/prettier/index.js +0 -132
- package/src/tools/prettier/presets/base.js +0 -36
- package/src/tools/prettier/presets/frameworks/astro.js +0 -15
- package/src/tools/prettier/presets/frameworks/react.js +0 -15
- package/src/tools/prettier/presets/frameworks/svelte.js +0 -22
- package/src/tools/prettier/presets/frameworks/vanilla.js +0 -13
- package/src/tools/prettier/presets/frameworks/vue.js +0 -21
- package/src/tools/prettier/presets/prettierignore.js +0 -57
- package/src/tools/semantic-release/CI_SETUP.md +0 -66
- package/src/tools/semantic-release/README.md +0 -533
- package/src/tools/semantic-release/index.js +0 -130
- package/src/tools/semantic-release/presets/default.js +0 -37
- package/src/tools/semantic-release/presets/library.js +0 -58
- package/src/tools/semantic-release/presets/monorepo.js +0 -48
- package/src/tools/semantic-release/templates/.gitlab-ci.yml +0 -89
- package/src/tools/semantic-release/templates/bitbucket-pipelines.yml +0 -100
- package/src/tools/semantic-release/templates/github-workflow.yml +0 -107
- package/src/tools/stylelint/README.md +0 -425
- package/src/tools/stylelint/index.js +0 -195
- package/src/tools/stylelint/presets/base.js +0 -50
- package/src/tools/stylelint/presets/css-modules.js +0 -43
- package/src/tools/stylelint/presets/frameworks/react.js +0 -18
- package/src/tools/stylelint/presets/frameworks/svelte.js +0 -28
- package/src/tools/stylelint/presets/frameworks/vanilla.js +0 -14
- package/src/tools/stylelint/presets/frameworks/vue.js +0 -38
- package/src/tools/stylelint/presets/scss.js +0 -83
- package/src/tools/stylelint/presets/tailwind.js +0 -49
- package/src/tools/typescript/README.md +0 -665
- package/src/tools/typescript/checker-detection.js +0 -113
- package/src/tools/typescript/index.js +0 -202
- package/src/tools/typescript/presets/base.js +0 -58
- package/src/tools/typescript/presets/environments/browser.js +0 -10
- package/src/tools/typescript/presets/environments/node.js +0 -11
- package/src/tools/typescript/presets/environments/universal.js +0 -11
- package/src/tools/typescript/presets/frameworks/angular.js +0 -11
- package/src/tools/typescript/presets/frameworks/astro.js +0 -11
- package/src/tools/typescript/presets/frameworks/electron.js +0 -100
- package/src/tools/typescript/presets/frameworks/node.js +0 -12
- package/src/tools/typescript/presets/frameworks/react.js +0 -10
- package/src/tools/typescript/presets/frameworks/solid.js +0 -11
- package/src/tools/typescript/presets/frameworks/svelte.js +0 -10
- package/src/tools/typescript/presets/frameworks/vanilla.js +0 -9
- package/src/tools/typescript/presets/frameworks/vue.js +0 -17
- package/src/utils/ignore-patterns.js +0 -157
- package/src/utils/package-reader.js +0 -42
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ export default await createConfig('eslint')
|
|
|
74
74
|
```javascript
|
|
75
75
|
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
76
76
|
|
|
77
|
-
export default createConfig('prettier')
|
|
77
|
+
export default await createConfig('prettier')
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
**Stylelint** (`stylelint.config.js`):
|
|
@@ -82,7 +82,7 @@ export default createConfig('prettier')
|
|
|
82
82
|
```javascript
|
|
83
83
|
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
84
84
|
|
|
85
|
-
export default createConfig('stylelint')
|
|
85
|
+
export default await createConfig('stylelint')
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
**TypeScript** (`tsconfig.json`):
|
|
@@ -106,7 +106,7 @@ Or use the factory function to generate framework-specific TypeScript configs pr
|
|
|
106
106
|
```javascript
|
|
107
107
|
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
108
108
|
|
|
109
|
-
export default createConfig('semantic-release')
|
|
109
|
+
export default await createConfig('semantic-release')
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
That's it! The configs will automatically detect your framework and TypeScript setup.
|
|
@@ -269,7 +269,7 @@ createConfig('semantic-release', {
|
|
|
269
269
|
export default await createConfig('eslint')
|
|
270
270
|
|
|
271
271
|
// prettier.config.js - automatically formats JSX
|
|
272
|
-
export default createConfig('prettier')
|
|
272
|
+
export default await createConfig('prettier')
|
|
273
273
|
```
|
|
274
274
|
|
|
275
275
|
### Vue
|
|
@@ -287,8 +287,7 @@ export default createConfig('prettier')
|
|
|
287
287
|
|
|
288
288
|
**Prettier features:**
|
|
289
289
|
|
|
290
|
-
- SFC (Single File Component) formatting
|
|
291
|
-
- `prettier-plugin-vue` integration
|
|
290
|
+
- SFC (Single File Component) formatting (built-in to Prettier 3.x)
|
|
292
291
|
|
|
293
292
|
**Stylelint features:**
|
|
294
293
|
|
|
@@ -299,7 +298,7 @@ export default createConfig('prettier')
|
|
|
299
298
|
|
|
300
299
|
```javascript
|
|
301
300
|
// stylelint.config.js - automatically handles .vue files
|
|
302
|
-
export default createConfig('stylelint')
|
|
301
|
+
export default await createConfig('stylelint')
|
|
303
302
|
|
|
304
303
|
// npm scripts
|
|
305
304
|
{
|
|
@@ -366,7 +365,6 @@ npx @dimensional-innovations/tool-config
|
|
|
366
365
|
- Auto-detects framework and TypeScript
|
|
367
366
|
- Creates config files automatically
|
|
368
367
|
- Adds scripts to package.json (including `check-all` for multiple tools)
|
|
369
|
-
- Automated CI/CD pipeline setup
|
|
370
368
|
- **Uninstall support** - Clean removal of configs and scripts
|
|
371
369
|
- Supports dry-run mode
|
|
372
370
|
|
|
@@ -384,11 +382,6 @@ npx @dimensional-innovations/tool-config stylelint # Setup Stylelint only
|
|
|
384
382
|
# Setup all tools
|
|
385
383
|
npx @dimensional-innovations/tool-config --all # Setup all tools at once
|
|
386
384
|
|
|
387
|
-
# CI/CD setup
|
|
388
|
-
npx @dimensional-innovations/tool-config --ci gitlab # Setup GitLab CI/CD
|
|
389
|
-
npx @dimensional-innovations/tool-config --ci github # Setup GitHub Actions
|
|
390
|
-
npx @dimensional-innovations/tool-config --setup-ci # Interactive CI setup
|
|
391
|
-
|
|
392
385
|
# Preview mode
|
|
393
386
|
npx @dimensional-innovations/tool-config --dry-run # Preview without creating files
|
|
394
387
|
|
|
@@ -408,9 +401,6 @@ npx @dimensional-innovations/tool-config --uninstall eslint
|
|
|
408
401
|
# Uninstall all detected tools
|
|
409
402
|
npx @dimensional-innovations/tool-config --uninstall --all
|
|
410
403
|
|
|
411
|
-
# Remove CI/CD configuration
|
|
412
|
-
npx @dimensional-innovations/tool-config --uninstall --ci
|
|
413
|
-
|
|
414
404
|
# Preview uninstall
|
|
415
405
|
npx @dimensional-innovations/tool-config --uninstall --dry-run
|
|
416
406
|
```
|
|
@@ -424,111 +414,8 @@ The uninstall command includes safety features to protect your customizations:
|
|
|
424
414
|
- Only removes auto-generated package.json scripts
|
|
425
415
|
- Preserves custom scripts with the same names
|
|
426
416
|
- Supports dry-run to preview what will be removed
|
|
427
|
-
- Cleans up empty directories (e.g., `.github/workflows`)
|
|
428
417
|
- Idempotent - safe to run multiple times
|
|
429
418
|
|
|
430
|
-
**CI/CD Integration:**
|
|
431
|
-
|
|
432
|
-
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:
|
|
433
|
-
|
|
434
|
-
```bash
|
|
435
|
-
# Interactive: prompts for provider if not detected
|
|
436
|
-
npx @dimensional-innovations/tool-config --setup-ci
|
|
437
|
-
|
|
438
|
-
# Direct: specify provider
|
|
439
|
-
npx @dimensional-innovations/tool-config --ci gitlab
|
|
440
|
-
npx @dimensional-innovations/tool-config --ci github
|
|
441
|
-
npx @dimensional-innovations/tool-config --ci bitbucket
|
|
442
|
-
|
|
443
|
-
# Combined: setup semantic-release + CI/CD
|
|
444
|
-
npx @dimensional-innovations/tool-config semantic-release --ci
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
The CLI will:
|
|
448
|
-
|
|
449
|
-
- Auto-detect your git provider (GitLab/GitHub/Bitbucket)
|
|
450
|
-
- Copy the appropriate CI/CD template
|
|
451
|
-
- Show environment variable configuration instructions
|
|
452
|
-
- Guide you through the setup process
|
|
453
|
-
|
|
454
|
-
## CI/CD Setup
|
|
455
|
-
|
|
456
|
-
Ready-to-use CI/CD templates for GitLab CI, GitHub Actions, and Bitbucket Pipelines.
|
|
457
|
-
|
|
458
|
-
### Automated Setup (Recommended)
|
|
459
|
-
|
|
460
|
-
The CLI tool can automatically setup CI/CD for you:
|
|
461
|
-
|
|
462
|
-
```bash
|
|
463
|
-
npx @dimensional-innovations/tool-config --ci gitlab # Or github, bitbucket
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
This will:
|
|
467
|
-
|
|
468
|
-
- Auto-detect your git provider
|
|
469
|
-
- Copy the appropriate template
|
|
470
|
-
- Show configuration instructions
|
|
471
|
-
|
|
472
|
-
### Manual Setup
|
|
473
|
-
|
|
474
|
-
Alternatively, copy templates manually from [src/tools/semantic-release/templates/](./src/tools/semantic-release/templates/).
|
|
475
|
-
|
|
476
|
-
Each template includes:
|
|
477
|
-
|
|
478
|
-
- **Lint Stage** - Runs ESLint, Prettier, and Stylelint
|
|
479
|
-
- **Test Stage** - Runs tests with coverage reporting
|
|
480
|
-
- **Release Stage** - Automated semantic-release (main branch only)
|
|
481
|
-
|
|
482
|
-
### GitLab CI
|
|
483
|
-
|
|
484
|
-
```bash
|
|
485
|
-
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/.gitlab-ci.yml .gitlab-ci.yml
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
Configure these CI/CD variables in GitLab:
|
|
489
|
-
|
|
490
|
-
- `GL_TOKEN`: GitLab Personal Access Token
|
|
491
|
-
- `NPM_TOKEN`: npm authentication token
|
|
492
|
-
|
|
493
|
-
### GitHub Actions
|
|
494
|
-
|
|
495
|
-
```bash
|
|
496
|
-
mkdir -p .github/workflows
|
|
497
|
-
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/github-workflow.yml .github/workflows/ci.yml
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
Configure these secrets in GitHub:
|
|
501
|
-
|
|
502
|
-
- `GITHUB_TOKEN`: Automatically provided
|
|
503
|
-
- `NPM_TOKEN`: npm authentication token
|
|
504
|
-
|
|
505
|
-
### Bitbucket Pipelines
|
|
506
|
-
|
|
507
|
-
```bash
|
|
508
|
-
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/bitbucket-pipelines.yml bitbucket-pipelines.yml
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
Configure this repository variable in Bitbucket:
|
|
512
|
-
|
|
513
|
-
- `NPM_TOKEN`: npm authentication token
|
|
514
|
-
|
|
515
|
-
See [CI_SETUP.md](./src/tools/semantic-release/CI_SETUP.md) for detailed configuration instructions.
|
|
516
|
-
|
|
517
|
-
## Examples
|
|
518
|
-
|
|
519
|
-
See the [`examples/`](./examples/) directory for complete working examples:
|
|
520
|
-
|
|
521
|
-
- [React App](./examples/react-app/) - TypeScript, CSS Modules
|
|
522
|
-
- [Vue App](./examples/vue-app/) - Composition API, Scoped Styles
|
|
523
|
-
- [Svelte App](./examples/svelte-app/) - Svelte 5, Component Styles
|
|
524
|
-
- [Solid App](./examples/solid-app/) - TypeScript, Reactive Primitives
|
|
525
|
-
- [Astro App](./examples/astro-app/) - Multi-framework, TypeScript
|
|
526
|
-
- [Angular App](./examples/angular-app/) - TypeScript, Standalone Components
|
|
527
|
-
- [Node Backend](./examples/node-backend/) - Express, TypeScript
|
|
528
|
-
- [Vanilla JS](./examples/vanilla-js/) - Pure JavaScript, no framework
|
|
529
|
-
|
|
530
|
-
Each example includes all 5 tool configurations and npm scripts.
|
|
531
|
-
|
|
532
419
|
## Advanced Usage
|
|
533
420
|
|
|
534
421
|
**Monorepo Support:**
|
|
@@ -611,7 +498,7 @@ export default await createConfig('eslint', {
|
|
|
611
498
|
**Stylelint** - Extend ignoreFiles:
|
|
612
499
|
|
|
613
500
|
```javascript
|
|
614
|
-
export default createConfig('stylelint', {
|
|
501
|
+
export default await createConfig('stylelint', {
|
|
615
502
|
ignoreFiles: ['**/*.min.css', 'vendor/**']
|
|
616
503
|
})
|
|
617
504
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimensional-innovations/tool-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Universal configuration package for ESLint, Prettier, Stylelint, TypeScript, and semantic-release with auto-detection for React, Vue, Svelte, Solid, Astro, Angular, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -36,13 +36,18 @@
|
|
|
36
36
|
"tool-config"
|
|
37
37
|
],
|
|
38
38
|
"type": "module",
|
|
39
|
-
"
|
|
39
|
+
"imports": {
|
|
40
|
+
"#core/*": "./src/core/*",
|
|
41
|
+
"#tools/*": "./src/tools/*",
|
|
42
|
+
"#cli/*": "./src/cli/*"
|
|
43
|
+
},
|
|
44
|
+
"main": "./dist/index.js",
|
|
45
|
+
"types": "./dist/index.d.ts",
|
|
40
46
|
"bin": {
|
|
41
|
-
"setup-tool-config": "
|
|
47
|
+
"setup-tool-config": "./dist/cli/index.js"
|
|
42
48
|
},
|
|
43
49
|
"files": [
|
|
44
|
-
"
|
|
45
|
-
"bin/**",
|
|
50
|
+
"dist/**",
|
|
46
51
|
"README.md",
|
|
47
52
|
"LICENSE"
|
|
48
53
|
],
|
|
@@ -50,18 +55,19 @@
|
|
|
50
55
|
"node": ">=22.20.0"
|
|
51
56
|
},
|
|
52
57
|
"scripts": {
|
|
53
|
-
"
|
|
54
|
-
"lint
|
|
55
|
-
"
|
|
56
|
-
"prettier
|
|
58
|
+
"build": "tsup",
|
|
59
|
+
"lint": "NODE_OPTIONS='--import tsx' eslint .",
|
|
60
|
+
"lint:fix": "NODE_OPTIONS='--import tsx' eslint --fix .",
|
|
61
|
+
"prettier": "NODE_OPTIONS='--import tsx' prettier --check .",
|
|
62
|
+
"prettier:fix": "NODE_OPTIONS='--import tsx' prettier --write .",
|
|
57
63
|
"test": "vitest run",
|
|
58
64
|
"test:watch": "vitest",
|
|
59
65
|
"test:ui": "vitest --ui",
|
|
60
66
|
"test:coverage": "vitest run --coverage",
|
|
61
|
-
"release": "semantic-release",
|
|
67
|
+
"release": "NODE_OPTIONS='--import tsx' semantic-release",
|
|
62
68
|
"prepare": "husky",
|
|
63
|
-
"style": "stylelint \"**/*.css\" --allow-empty-input",
|
|
64
|
-
"style:fix": "stylelint \"**/*.css\" --fix --allow-empty-input",
|
|
69
|
+
"style": "NODE_OPTIONS='--import tsx' stylelint \"**/*.css\" --allow-empty-input",
|
|
70
|
+
"style:fix": "NODE_OPTIONS='--import tsx' stylelint \"**/*.css\" --fix --allow-empty-input",
|
|
65
71
|
"typecheck": "tsc --noEmit",
|
|
66
72
|
"typecheck:watch": "tsc --noEmit --watch",
|
|
67
73
|
"check-all": "yarn prettier && yarn style && yarn lint && yarn typecheck"
|
|
@@ -69,7 +75,6 @@
|
|
|
69
75
|
"dependencies": {
|
|
70
76
|
"@eslint/compat": "^1.4.0",
|
|
71
77
|
"@eslint/js": "^9.37.0",
|
|
72
|
-
"@prettier/plugin-xml": "^3.4.2",
|
|
73
78
|
"@typescript-eslint/eslint-plugin": "^8.46.0",
|
|
74
79
|
"@typescript-eslint/parser": "^8.46.0",
|
|
75
80
|
"astro-eslint-parser": "^1.2.2",
|
|
@@ -88,7 +93,6 @@
|
|
|
88
93
|
"postcss-html": "^1.8.0",
|
|
89
94
|
"postcss-scss": "^4.0.9",
|
|
90
95
|
"prettier": ">=3.0.0",
|
|
91
|
-
"prettier-plugin-vue": "^1.1.6",
|
|
92
96
|
"prompts": "^2.4.2",
|
|
93
97
|
"stylelint": ">=16.0.0",
|
|
94
98
|
"stylelint-config-standard": "^39.0.1",
|
|
@@ -171,6 +175,8 @@
|
|
|
171
175
|
"semantic-release": "^24.2.9",
|
|
172
176
|
"solid-js": "^1.9.9",
|
|
173
177
|
"svelte": "^5.39.9",
|
|
178
|
+
"tsup": "^8.5.1",
|
|
179
|
+
"tsx": "^4.21.0",
|
|
174
180
|
"typescript": "^5.9.3",
|
|
175
181
|
"vitest": "^3.2.4"
|
|
176
182
|
},
|
package/bin/lib/ci-setup.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CI/CD setup utilities for setup-tool-config CLI
|
|
3
|
-
* Handles CI template copying and configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { copyFileSync, existsSync, mkdirSync } from 'fs'
|
|
7
|
-
import { dirname, join } from 'path'
|
|
8
|
-
import { fileURLToPath } from 'url'
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
const __dirname = dirname(__filename)
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get CI filename and path for a git provider
|
|
17
|
-
*/
|
|
18
|
-
function getCIFileInfo(provider) {
|
|
19
|
-
const ciFiles = {
|
|
20
|
-
gitlab: {
|
|
21
|
-
filename: '.gitlab-ci.yml',
|
|
22
|
-
destination: '.gitlab-ci.yml',
|
|
23
|
-
template: '.gitlab-ci.yml'
|
|
24
|
-
},
|
|
25
|
-
github: {
|
|
26
|
-
filename: 'ci.yml',
|
|
27
|
-
destination: '.github/workflows/ci.yml',
|
|
28
|
-
template: 'github-workflow.yml',
|
|
29
|
-
needsDir: true
|
|
30
|
-
},
|
|
31
|
-
bitbucket: {
|
|
32
|
-
filename: 'bitbucket-pipelines.yml',
|
|
33
|
-
destination: 'bitbucket-pipelines.yml',
|
|
34
|
-
template: 'bitbucket-pipelines.yml'
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return ciFiles[provider] || null
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get environment variable instructions for a git provider
|
|
43
|
-
*/
|
|
44
|
-
function getCIInstructions(provider) {
|
|
45
|
-
const instructions = {
|
|
46
|
-
gitlab: `
|
|
47
|
-
⚠️ Configuration Required:
|
|
48
|
-
Add these CI/CD variables in GitLab Settings > CI/CD > Variables:
|
|
49
|
-
- GL_TOKEN: GitLab Personal Access Token (with api scope)
|
|
50
|
-
- NPM_TOKEN: npm authentication token
|
|
51
|
-
|
|
52
|
-
Then push to main branch to trigger automated releases.`,
|
|
53
|
-
github: `
|
|
54
|
-
⚠️ Configuration Required:
|
|
55
|
-
Add these secrets in GitHub Settings > Secrets and variables > Actions:
|
|
56
|
-
- GITHUB_TOKEN: Automatically provided by GitHub Actions
|
|
57
|
-
- NPM_TOKEN: npm authentication token
|
|
58
|
-
|
|
59
|
-
Then push to main branch to trigger automated releases.`,
|
|
60
|
-
bitbucket: `
|
|
61
|
-
⚠️ Configuration Required:
|
|
62
|
-
Add this repository variable in Bitbucket Settings > Pipelines > Repository variables:
|
|
63
|
-
- NPM_TOKEN: npm authentication token
|
|
64
|
-
|
|
65
|
-
Then push to main branch to trigger automated releases.`
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return instructions[provider] || ''
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Copy CI/CD template
|
|
73
|
-
*/
|
|
74
|
-
export function copyCITemplate(provider, cwd, dryRun = false) {
|
|
75
|
-
if (!provider || provider === 'unknown') {
|
|
76
|
-
console.log(' ⚠️ Could not detect git provider - skipping CI setup')
|
|
77
|
-
console.log(' 💡 You can manually copy templates from:')
|
|
78
|
-
console.log(
|
|
79
|
-
' node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/'
|
|
80
|
-
)
|
|
81
|
-
return false
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const ciInfo = getCIFileInfo(provider)
|
|
85
|
-
|
|
86
|
-
if (!ciInfo) {
|
|
87
|
-
console.log(` ⚠️ Unsupported git provider: ${provider}`)
|
|
88
|
-
return false
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const destPath = join(cwd, ciInfo.destination)
|
|
92
|
-
const destDir = dirname(destPath)
|
|
93
|
-
|
|
94
|
-
// Check if CI file already exists
|
|
95
|
-
if (existsSync(destPath)) {
|
|
96
|
-
console.log(` ⚠️ ${ciInfo.destination} already exists - skipping`)
|
|
97
|
-
return false
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (dryRun) {
|
|
101
|
-
console.log(` 📄 Would create: ${ciInfo.destination}`)
|
|
102
|
-
if (ciInfo.needsDir && !existsSync(destDir)) {
|
|
103
|
-
console.log(` 📁 Would create directory: ${dirname(ciInfo.destination)}`)
|
|
104
|
-
}
|
|
105
|
-
return true
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
// Create directory if needed
|
|
110
|
-
if (ciInfo.needsDir && !existsSync(destDir)) {
|
|
111
|
-
mkdirSync(destDir, { recursive: true })
|
|
112
|
-
console.log(` ✅ Created directory: ${dirname(ciInfo.destination)}`)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Copy template
|
|
116
|
-
const templatePath = join(
|
|
117
|
-
__dirname,
|
|
118
|
-
'..',
|
|
119
|
-
'..',
|
|
120
|
-
'src',
|
|
121
|
-
'tools',
|
|
122
|
-
'semantic-release',
|
|
123
|
-
'templates',
|
|
124
|
-
ciInfo.template
|
|
125
|
-
)
|
|
126
|
-
copyFileSync(templatePath, destPath)
|
|
127
|
-
console.log(` ✅ Created: ${ciInfo.destination}`)
|
|
128
|
-
|
|
129
|
-
// Show configuration instructions
|
|
130
|
-
console.log(getCIInstructions(provider))
|
|
131
|
-
|
|
132
|
-
console.log('\n 📖 For more details, see:')
|
|
133
|
-
console.log(
|
|
134
|
-
' node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/CI_SETUP.md'
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
return true
|
|
138
|
-
} catch (error) {
|
|
139
|
-
console.error(` ❌ Failed to copy CI template:`, error.message)
|
|
140
|
-
return false
|
|
141
|
-
}
|
|
142
|
-
}
|
package/bin/lib/formatting.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formatting utilities for CLI output
|
|
3
|
-
* Standardized box drawing with consistent width
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import pc from 'picocolors'
|
|
7
|
-
|
|
8
|
-
const BOX_WIDTH = 70 // Standard width for all boxes
|
|
9
|
-
|
|
10
|
-
export const BOX = {
|
|
11
|
-
topLeft: '┌',
|
|
12
|
-
topRight: '┐',
|
|
13
|
-
bottomLeft: '└',
|
|
14
|
-
bottomRight: '┘',
|
|
15
|
-
vertical: '│',
|
|
16
|
-
horizontal: '─',
|
|
17
|
-
separator: '━',
|
|
18
|
-
width: BOX_WIDTH
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create a box with standard width (70 chars)
|
|
23
|
-
* @param {string[]} lines - Array of content lines
|
|
24
|
-
* @param {string} title - Optional title for top border
|
|
25
|
-
* @returns {string} Formatted box
|
|
26
|
-
*/
|
|
27
|
-
export function createBox(lines, title = '') {
|
|
28
|
-
const width = BOX.width
|
|
29
|
-
const contentWidth = width - 4 // Remove: │ + space + space + │
|
|
30
|
-
|
|
31
|
-
// Create top border
|
|
32
|
-
let top
|
|
33
|
-
if (title) {
|
|
34
|
-
const titlePart = `─ ${title} `
|
|
35
|
-
const remaining = width - 2 - titlePart.length // -2 for corners
|
|
36
|
-
top = BOX.topLeft + titlePart + BOX.horizontal.repeat(remaining) + BOX.topRight
|
|
37
|
-
} else {
|
|
38
|
-
top = BOX.topLeft + BOX.horizontal.repeat(width - 2) + BOX.topRight
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Create content lines - pad each to exact width
|
|
42
|
-
const content = lines.map(line => {
|
|
43
|
-
const padded = line.slice(0, contentWidth).padEnd(contentWidth)
|
|
44
|
-
return `${BOX.vertical} ${padded} ${BOX.vertical}`
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
// Create bottom border
|
|
48
|
-
const bottom = BOX.bottomLeft + BOX.horizontal.repeat(width - 2) + BOX.bottomRight
|
|
49
|
-
|
|
50
|
-
return [top, ...content, bottom].join('\n')
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Create a separator line
|
|
55
|
-
* @returns {string} Separator line
|
|
56
|
-
*/
|
|
57
|
-
export function createSeparator() {
|
|
58
|
-
return BOX.separator.repeat(BOX.width)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Create a simple indented list
|
|
63
|
-
* @param {string[]} items - Array of items
|
|
64
|
-
* @param {string} bullet - Bullet character (default: '•')
|
|
65
|
-
* @returns {string} Formatted list
|
|
66
|
-
*/
|
|
67
|
-
export function createList(items, bullet = '•') {
|
|
68
|
-
return items.map(item => ` ${bullet} ${item}`).join('\n')
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Create a progress indicator
|
|
73
|
-
* @param {number} current - Current step
|
|
74
|
-
* @param {number} total - Total steps
|
|
75
|
-
* @param {string} label - Label for this step
|
|
76
|
-
* @returns {string} Progress line
|
|
77
|
-
*/
|
|
78
|
-
export function createProgress(current, total, label) {
|
|
79
|
-
return ` [${current}/${total}] ${label}`
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Color symbols for CLI output
|
|
84
|
-
*/
|
|
85
|
-
export const SYMBOLS = {
|
|
86
|
-
success: pc.green('✓'),
|
|
87
|
-
warning: pc.yellow('⚠'),
|
|
88
|
-
error: pc.red('✗'),
|
|
89
|
-
info: pc.blue('ℹ')
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Color helper functions
|
|
94
|
-
*/
|
|
95
|
-
export const colors = {
|
|
96
|
-
success: pc.green,
|
|
97
|
-
warning: pc.yellow,
|
|
98
|
-
error: pc.red,
|
|
99
|
-
info: pc.blue,
|
|
100
|
-
dim: pc.dim,
|
|
101
|
-
bold: pc.bold,
|
|
102
|
-
cyan: pc.cyan
|
|
103
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ESLint handler for setup-tool-config CLI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { existsSync, writeFileSync } from 'fs'
|
|
6
|
-
import { join } from 'path'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Get config filename
|
|
10
|
-
*/
|
|
11
|
-
export function getConfigFilename() {
|
|
12
|
-
return 'eslint.config.js'
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generate config file content
|
|
17
|
-
*/
|
|
18
|
-
export function generateConfigContent() {
|
|
19
|
-
return `import { createConfig } from '@dimensional-innovations/tool-config'
|
|
20
|
-
|
|
21
|
-
export default await createConfig('eslint')
|
|
22
|
-
`
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get npm scripts
|
|
27
|
-
*/
|
|
28
|
-
export function getScripts() {
|
|
29
|
-
return {
|
|
30
|
-
lint: 'eslint .',
|
|
31
|
-
'lint:fix': 'eslint --fix .'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Write config file
|
|
37
|
-
*/
|
|
38
|
-
export function writeConfig(cwd, _detected, dryRun = false) {
|
|
39
|
-
const filename = getConfigFilename()
|
|
40
|
-
const filepath = join(cwd, filename)
|
|
41
|
-
const content = generateConfigContent()
|
|
42
|
-
|
|
43
|
-
if (existsSync(filepath)) {
|
|
44
|
-
console.log(` ⚠️ ${filename} already exists - skipping`)
|
|
45
|
-
return false
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (dryRun) {
|
|
49
|
-
console.log(` 📄 Would create: ${filename}`)
|
|
50
|
-
return true
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
writeFileSync(filepath, content, 'utf8')
|
|
55
|
-
console.log(` ✅ Created: ${filename}`)
|
|
56
|
-
return true
|
|
57
|
-
} catch (error) {
|
|
58
|
-
console.error(` ❌ Failed to create ${filename}:`, error.message)
|
|
59
|
-
return false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prettier handler for setup-tool-config CLI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { existsSync, writeFileSync } from 'fs'
|
|
6
|
-
import { join } from 'path'
|
|
7
|
-
|
|
8
|
-
import { prettierIgnoreContent } from '../../../src/tools/prettier/index.js'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Get config filename
|
|
12
|
-
*/
|
|
13
|
-
export function getConfigFilename() {
|
|
14
|
-
return 'prettier.config.js'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Generate config file content
|
|
19
|
-
*/
|
|
20
|
-
export function generateConfigContent() {
|
|
21
|
-
return `import { createConfig } from '@dimensional-innovations/tool-config'
|
|
22
|
-
|
|
23
|
-
export default createConfig('prettier')
|
|
24
|
-
`
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Get npm scripts
|
|
29
|
-
*/
|
|
30
|
-
export function getScripts() {
|
|
31
|
-
return {
|
|
32
|
-
'prettier:fix': 'prettier --write .',
|
|
33
|
-
prettier: 'prettier --check .'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Write config file
|
|
39
|
-
*/
|
|
40
|
-
export function writeConfig(cwd, _detected, dryRun = false) {
|
|
41
|
-
const filename = getConfigFilename()
|
|
42
|
-
const filepath = join(cwd, filename)
|
|
43
|
-
const content = generateConfigContent()
|
|
44
|
-
|
|
45
|
-
if (existsSync(filepath)) {
|
|
46
|
-
console.log(` ⚠️ ${filename} already exists - skipping`)
|
|
47
|
-
return false
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (dryRun) {
|
|
51
|
-
console.log(` 📄 Would create: ${filename}`)
|
|
52
|
-
|
|
53
|
-
// Prettier also creates .prettierignore
|
|
54
|
-
const ignoreFile = '.prettierignore'
|
|
55
|
-
const ignoreExists = existsSync(join(cwd, ignoreFile))
|
|
56
|
-
if (!ignoreExists) {
|
|
57
|
-
console.log(` 📄 Would create: ${ignoreFile}`)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return true
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
writeFileSync(filepath, content, 'utf8')
|
|
65
|
-
console.log(` ✅ Created: ${filename}`)
|
|
66
|
-
|
|
67
|
-
// Prettier also creates .prettierignore
|
|
68
|
-
const ignoreFile = '.prettierignore'
|
|
69
|
-
const ignorePath = join(cwd, ignoreFile)
|
|
70
|
-
|
|
71
|
-
if (!existsSync(ignorePath)) {
|
|
72
|
-
writeFileSync(ignorePath, prettierIgnoreContent, 'utf8')
|
|
73
|
-
console.log(` ✅ Created: ${ignoreFile}`)
|
|
74
|
-
} else {
|
|
75
|
-
console.log(` ⚠️ ${ignoreFile} already exists - skipping`)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return true
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error(` ❌ Failed to create ${filename}:`, error.message)
|
|
81
|
-
return false
|
|
82
|
-
}
|
|
83
|
-
}
|