mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-03-22 04:01:57 +00:00
feat: skip config creation if one already found (#110)
This commit introduces mechanism that'll check for common configuration file locations and respects the original file.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
"postinstall": "node scripts/postinstall.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ivuorinen/config-checker": "^1.1.0",
|
||||
"markdownlint-cli": "0.37.0"
|
||||
},
|
||||
"gitHead": "23d15f15743fb59c1dbe658615ef2ed51c54d230"
|
||||
|
||||
@@ -2,9 +2,18 @@
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const process = require('process')
|
||||
const checkConfig = require('@ivuorinen/config-checker')
|
||||
const foundConfig = checkConfig('markdownlint')
|
||||
|
||||
if (foundConfig.length > 0) {
|
||||
console.log('markdownlint-config: Found existing markdownlint config file, skipping creation.')
|
||||
console.log('markdownlint-config: If you want to create a new config file, please remove the existing one.')
|
||||
console.log(`markdownlint-config: Found config files at: ${foundConfig.join(', ')}`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const filePath = path.join(process.env.INIT_CWD, '.markdownlint.json')
|
||||
|
||||
const fileConfigObject = {
|
||||
extends: '@ivuorinen/markdownlint-config'
|
||||
}
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
wrap-ansi "^8.1.0"
|
||||
wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
|
||||
|
||||
"@ivuorinen/config-checker@^1.1.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@ivuorinen/config-checker/-/config-checker-1.1.0.tgz#73a996445a917627cb558ea69f616978ff97da9d"
|
||||
integrity sha512-YHQSF2yt4YZM0W9jdFXdPUB4X1AicweDJWSJtFw58GVI4+wI8+CJtoKL/Dmbn8F3B6H6gngQHwzENqw80Zsskg==
|
||||
|
||||
"@pkgjs/parseargs@^0.11.0":
|
||||
version "0.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
|
||||
|
||||
Reference in New Issue
Block a user