forked from kitschpatrol/shared-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rewrite browserslist cli for new command builder
- Loading branch information
1 parent
3841f56
commit 864d058
Showing
7 changed files
with
59 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
"url": "[email protected]:envsa/shared-config.git", | ||
"directory": "packages/browserslist-config" | ||
}, | ||
"homepage": "https://github.com/envsa/shared-config/packages/browserslist-config", | ||
"bugs": { | ||
"url": "https://github.com/envsa/shared-config/issues", | ||
"email": "[email protected]" | ||
|
@@ -23,25 +24,35 @@ | |
"pnpm": ">=10.0.0" | ||
}, | ||
"bin": { | ||
"browserslist-config": "bin/cli.js" | ||
"envsa-browserslist": "bin/cli.js" | ||
}, | ||
"main": "./index.cjs", | ||
"main": "./dist/index.cjs", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"bin/*", | ||
"dist/*" | ||
], | ||
"keywords": [ | ||
"shared-config", | ||
"browserslist-config", | ||
"browserslist", | ||
"cli" | ||
"cli", | ||
"envsa", | ||
"envsa-browserslist" | ||
], | ||
"scripts": { | ||
"build": "../../scripts/build.ts && mdat readme", | ||
"build": "tsc && ../../scripts/build.ts && mv './dist/index.js' './dist/index.cjs'", | ||
"cli": "node ./bin/cli.js", | ||
"prepublishOnly": "pnpm run build" | ||
}, | ||
"dependencies": { | ||
"@pinojs/json-colorizer": "^4.0.0", | ||
"browserslist": "^4.24.4", | ||
"cosmiconfig": "^9.0.0", | ||
"execa": "^9.5.2", | ||
"fs-extra": "^11.2.0" | ||
"find-workspaces": "^0.3.1", | ||
"fs-extra": "^11.2.0", | ||
"prettier": "^3.5.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
#!/usr/bin/env node | ||
import { buildCommands } from '$root/src/command-builder.ts'; | ||
import { buildCommands } from '../../../src/command-builder.js'; | ||
import { commandDefinition } from './command.js'; | ||
|
||
await buildCommands('browserslist-config', '[Browserslist]', 'white', { | ||
init: { | ||
command: 'pnpm', | ||
defaultArguments: ['pkg', 'set', 'browserslist[0]=extends @envsa/browserslist-config'], | ||
}, | ||
}); | ||
await buildCommands(commandDefinition); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { CommandDefinition } from '../../../src/command-builder'; | ||
|
||
export const commandDefinition: CommandDefinition = { | ||
commands: { | ||
init: { | ||
commands: [ | ||
{ | ||
name: 'pnpm', | ||
optionFlags: ['pkg', 'set', 'browserslist[0]=extends @envsa/browserslist-config'], | ||
}, | ||
], | ||
locationOptionFlag: true, | ||
}, | ||
}, | ||
description: "Envsa's Browserslist shared configuration tool.", | ||
logColor: 'white', | ||
logPrefix: 'Browserslist', | ||
name: 'envsa-browserslist', | ||
order: 7, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { type Config } from 'browserslist'; | ||
|
||
const config: Config = { | ||
defaults: ['> 0.5% in AU', 'last 3 years', 'iOS >= 7', 'ie >= 11'], | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "CommonJS", | ||
"moduleResolution": "node10", | ||
"resolveJsonModule": false, | ||
"allowImportingTsExtensions": false, | ||
"declaration": true, | ||
"noEmit": false, | ||
"outDir": "dist" | ||
}, | ||
"include": ["./src/index.ts"] | ||
} |