mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-02-09 03:45:47 +00:00
feat!: module & commonjs in browserslist
BREAKING CHANGE: support module, and commonjs types
This commit is contained in:
22
packages/browserslist-config/scripts/postinstall.cjs
Normal file
22
packages/browserslist-config/scripts/postinstall.cjs
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
// noinspection NpmUsedModulesInstalled
|
||||
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)) {
|
||||
fs.writeFileSync(filePath, fileConfigObject)
|
||||
}
|
||||
Reference in New Issue
Block a user