mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-03-12 16:58:35 +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",
|
||||
"browserslist": "4.22.1"
|
||||
},
|
||||
"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('browserslist')
|
||||
|
||||
if (foundConfig.length > 0) {
|
||||
console.log('browserslist-config: Found existing browserslist config file, skipping creation.')
|
||||
console.log('browserslist-config: If you want to create a new config file, please remove the existing one.')
|
||||
console.log(`browserslist-config: Found config files at: ${foundConfig.join(', ')}`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const filePath = path.join(process.env.INIT_CWD, '.browserslistrc')
|
||||
|
||||
const fileConfigObject = 'extends @ivuorinen/browserslist-config'
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@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==
|
||||
|
||||
browserslist@4.22.1:
|
||||
version "4.22.1"
|
||||
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.1.tgz#ba91958d1a59b87dab6fed8dfbcb3da5e2e9c619"
|
||||
|
||||
Reference in New Issue
Block a user