@dimensional-innovations/tool-config 1.4.1 → 3.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/README.md +128 -23
- package/bin/lib/ci-setup.js +142 -0
- package/bin/lib/formatting.js +103 -0
- package/bin/lib/handlers/eslint.js +61 -0
- package/bin/lib/handlers/prettier.js +83 -0
- package/bin/lib/handlers/semantic-release.js +60 -0
- package/bin/lib/handlers/stylelint.js +85 -0
- package/bin/lib/handlers/typescript.js +156 -0
- package/bin/lib/package-manager.js +201 -0
- package/bin/lib/ui.js +239 -0
- package/bin/lib/uninstall.js +199 -0
- package/bin/lib/validators.js +28 -0
- package/bin/setup-tool-config.js +270 -576
- package/package.json +17 -4
- package/src/detectors.js +27 -2
- package/src/index.js +8 -3
- package/src/tools/typescript/README.md +665 -0
- package/src/tools/typescript/checker-detection.js +113 -0
- package/src/tools/typescript/index.js +202 -0
- package/src/tools/typescript/presets/base.js +58 -0
- package/src/tools/typescript/presets/environments/browser.js +10 -0
- package/src/tools/typescript/presets/environments/node.js +11 -0
- package/src/tools/typescript/presets/environments/universal.js +11 -0
- package/src/tools/typescript/presets/frameworks/angular.js +11 -0
- package/src/tools/typescript/presets/frameworks/astro.js +11 -0
- package/src/tools/typescript/presets/frameworks/electron.js +100 -0
- package/src/tools/typescript/presets/frameworks/node.js +12 -0
- package/src/tools/typescript/presets/frameworks/react.js +10 -0
- package/src/tools/typescript/presets/frameworks/solid.js +11 -0
- package/src/tools/typescript/presets/frameworks/svelte.js +10 -0
- package/src/tools/typescript/presets/frameworks/vanilla.js +9 -0
- package/src/tools/typescript/presets/frameworks/vue.js +17 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimensional-innovations/tool-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Universal configuration package for ESLint, Prettier, Stylelint, and semantic-release with auto-detection for React, Vue, Svelte, Solid, Astro, Angular, and more",
|
|
3
|
+
"version": "3.0.0",
|
|
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": {
|
|
7
7
|
"name": "J.D. Hillen",
|
|
@@ -61,7 +61,9 @@
|
|
|
61
61
|
"release": "semantic-release",
|
|
62
62
|
"prepare": "husky",
|
|
63
63
|
"style": "stylelint \"**/*.css\"",
|
|
64
|
-
"style:fix": "stylelint \"**/*.css\" --fix"
|
|
64
|
+
"style:fix": "stylelint \"**/*.css\" --fix",
|
|
65
|
+
"typecheck": "tsc --noEmit",
|
|
66
|
+
"typecheck:watch": "tsc --noEmit --watch"
|
|
65
67
|
},
|
|
66
68
|
"dependencies": {
|
|
67
69
|
"@eslint/compat": "^1.4.0",
|
|
@@ -79,6 +81,7 @@
|
|
|
79
81
|
"eslint-plugin-svelte": "^3.12.4",
|
|
80
82
|
"eslint-plugin-vue": "^10.5.0",
|
|
81
83
|
"globals": "^16.4.0",
|
|
84
|
+
"picocolors": "^1.1.1",
|
|
82
85
|
"postcss": "^8.4.49",
|
|
83
86
|
"postcss-html": "^1.8.0",
|
|
84
87
|
"postcss-scss": "^4.0.9",
|
|
@@ -94,6 +97,7 @@
|
|
|
94
97
|
"vue-eslint-parser": "^10.2.0"
|
|
95
98
|
},
|
|
96
99
|
"peerDependencies": {
|
|
100
|
+
"@typescript/native-preview": ">=7.0.0-preview",
|
|
97
101
|
"astro": ">=3.0.0 || >=4.0.0 || >=5.0.0",
|
|
98
102
|
"eslint": ">=9.0.0",
|
|
99
103
|
"less": ">=4.0.0",
|
|
@@ -105,9 +109,13 @@
|
|
|
105
109
|
"stylelint": ">=16.0.0",
|
|
106
110
|
"svelte": ">=3.0.0 || >=4.0.0 || >=5.0.0",
|
|
107
111
|
"tailwindcss": ">=3.0.0",
|
|
108
|
-
"typescript": ">=5.0.0"
|
|
112
|
+
"typescript": ">=5.0.0",
|
|
113
|
+
"vue-tsc": ">=2.0.0"
|
|
109
114
|
},
|
|
110
115
|
"peerDependenciesMeta": {
|
|
116
|
+
"@typescript/native-preview": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
111
119
|
"astro": {
|
|
112
120
|
"optional": true
|
|
113
121
|
},
|
|
@@ -143,12 +151,17 @@
|
|
|
143
151
|
},
|
|
144
152
|
"typescript": {
|
|
145
153
|
"optional": true
|
|
154
|
+
},
|
|
155
|
+
"vue-tsc": {
|
|
156
|
+
"optional": true
|
|
146
157
|
}
|
|
147
158
|
},
|
|
148
159
|
"devDependencies": {
|
|
149
160
|
"@semantic-release/changelog": "^6.0.3",
|
|
150
161
|
"@semantic-release/git": "^10.0.1",
|
|
151
162
|
"@semantic-release/gitlab": "^13.2.9",
|
|
163
|
+
"@types/node": "^24.7.2",
|
|
164
|
+
"@types/prompts": "^2.4.9",
|
|
152
165
|
"@vitest/coverage-v8": "^3.2.4",
|
|
153
166
|
"@vitest/ui": "^3.2.4",
|
|
154
167
|
"astro": "^5.14.1",
|
package/src/detectors.js
CHANGED
|
@@ -134,7 +134,17 @@ export function detectEnvironment(framework, cwd = process.cwd()) {
|
|
|
134
134
|
* @returns {boolean} True if TypeScript is detected
|
|
135
135
|
*/
|
|
136
136
|
export function detectTypeScript(cwd = process.cwd()) {
|
|
137
|
-
|
|
137
|
+
// Check for tsconfig.json
|
|
138
|
+
if (existsSync(join(cwd, 'tsconfig.json'))) {
|
|
139
|
+
return true
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Check for TypeScript in dependencies or devDependencies
|
|
143
|
+
const pkg = readPackageJson(cwd)
|
|
144
|
+
if (!pkg) return false
|
|
145
|
+
|
|
146
|
+
// TypeScript is typically a devDependency
|
|
147
|
+
return !!(pkg.dependencies?.typescript || pkg.devDependencies?.typescript)
|
|
138
148
|
}
|
|
139
149
|
|
|
140
150
|
/**
|
|
@@ -239,6 +249,19 @@ export function detectCssType(cwd = process.cwd()) {
|
|
|
239
249
|
return results
|
|
240
250
|
}
|
|
241
251
|
|
|
252
|
+
/**
|
|
253
|
+
* Detect if project is an Electron application
|
|
254
|
+
* @param {string} cwd - Current working directory
|
|
255
|
+
* @returns {boolean} True if Electron project detected
|
|
256
|
+
*/
|
|
257
|
+
export function detectElectron(cwd = process.cwd()) {
|
|
258
|
+
const pkg = readPackageJson(cwd)
|
|
259
|
+
if (!pkg) return false
|
|
260
|
+
|
|
261
|
+
const deps = getAllDependencies(pkg)
|
|
262
|
+
return !!(deps.electron || deps['@electron-toolkit/utils'] || deps['@electron-toolkit/preload'])
|
|
263
|
+
}
|
|
264
|
+
|
|
242
265
|
/**
|
|
243
266
|
* Auto-detect all configuration options
|
|
244
267
|
* @param {string} cwd - Current working directory
|
|
@@ -250,12 +273,14 @@ export function autoDetect(cwd = process.cwd()) {
|
|
|
250
273
|
const typescript = detectTypeScript(cwd)
|
|
251
274
|
const gitProvider = detectGitProvider(cwd)
|
|
252
275
|
const cssType = detectCssType(cwd)
|
|
276
|
+
const electron = detectElectron(cwd)
|
|
253
277
|
|
|
254
278
|
return {
|
|
255
279
|
framework,
|
|
256
280
|
environment,
|
|
257
281
|
typescript,
|
|
258
282
|
gitProvider,
|
|
259
|
-
cssType
|
|
283
|
+
cssType,
|
|
284
|
+
electron
|
|
260
285
|
}
|
|
261
286
|
}
|
package/src/index.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* @dimensional-innovations/tool-config
|
|
3
3
|
* Universal configuration package for development tools
|
|
4
4
|
*
|
|
5
|
-
* Supports: ESLint, Prettier, Stylelint, semantic-release
|
|
5
|
+
* Supports: ESLint, Prettier, Stylelint, semantic-release, TypeScript
|
|
6
6
|
* Auto-detects: React, Vue, Svelte, Solid, Astro, Angular, Vanilla JS, Node.js
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Create a configuration for a specific tool
|
|
11
11
|
*
|
|
12
|
-
* @param {string} tool - Tool name ('eslint' | 'prettier' | 'stylelint' | 'semantic-release')
|
|
12
|
+
* @param {string} tool - Tool name ('eslint' | 'prettier' | 'stylelint' | 'semantic-release' | 'typescript')
|
|
13
13
|
* @param {Object} options - Configuration options
|
|
14
14
|
* @returns {Promise<any>|any} Tool-specific configuration
|
|
15
15
|
*
|
|
@@ -47,9 +47,13 @@ export async function createConfig(tool, options = {}) {
|
|
|
47
47
|
const { createReleaseConfig } = await import('./tools/semantic-release/index.js')
|
|
48
48
|
return createReleaseConfig(options)
|
|
49
49
|
}
|
|
50
|
+
case 'typescript': {
|
|
51
|
+
const { createTypescriptConfig } = await import('./tools/typescript/index.js')
|
|
52
|
+
return createTypescriptConfig(options)
|
|
53
|
+
}
|
|
50
54
|
default:
|
|
51
55
|
throw new Error(
|
|
52
|
-
`Unknown tool: "${tool}". Supported tools: eslint, prettier, stylelint, semantic-release`
|
|
56
|
+
`Unknown tool: "${tool}". Supported tools: eslint, prettier, stylelint, semantic-release, typescript`
|
|
53
57
|
)
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -59,6 +63,7 @@ export { createEslintConfig } from './tools/eslint/index.js'
|
|
|
59
63
|
export { createPrettierConfig } from './tools/prettier/index.js'
|
|
60
64
|
export { createStylelintConfig } from './tools/stylelint/index.js'
|
|
61
65
|
export { createReleaseConfig } from './tools/semantic-release/index.js'
|
|
66
|
+
export { createTypescriptConfig } from './tools/typescript/index.js'
|
|
62
67
|
|
|
63
68
|
// Re-export detection utilities for advanced users
|
|
64
69
|
export { autoDetect, detectFramework, detectEnvironment, detectTypeScript } from './detectors.js'
|