-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🩹 fix(patch): fix --silent and --no-dashboard output (#2485)
## Type of change **PATCH: backwards compatible change**
- Loading branch information
1 parent
742b388
commit 783d9df
Showing
12 changed files
with
244 additions
and
104 deletions.
There are no files selected for viewing
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
55 changes: 35 additions & 20 deletions
55
sources/@repo/yarn-plugin-bud/bundles/@yarnpkg/plugin-bud.js
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
sources/@repo/yarn-plugin-bud/sources/command/_browserslist.ts
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,24 @@ | ||
import {CommandClass, Option} from 'clipanion' | ||
|
||
import {Command} from './base.command' | ||
|
||
export class Browserslist extends Command { | ||
public static paths: CommandClass['paths'] = [[`@bud`, `browserslist`]] | ||
|
||
public static usage: CommandClass['usage'] = { | ||
category: `@bud`, | ||
description: `run browserslist`, | ||
examples: [ | ||
[`browserslist usage info`, `yarn @bud browserslist --help`], | ||
], | ||
} | ||
|
||
public passthrough = Option.Proxy({name: `browserslist options`}) | ||
|
||
public async execute() { | ||
return await this.cli | ||
.run([`browserslist`, ...(this.passthrough ?? [])]) | ||
.then(this.throwIfError) | ||
.catch(this.catch) | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
sources/@repo/yarn-plugin-bud/sources/command/browserslist-update.ts
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,93 @@ | ||
import {path} from '@repo/constants' | ||
import {CommandClass} from 'clipanion' | ||
import {execa} from 'execa' | ||
import * as fs from 'fs-jetpack' | ||
import {kebabCase} from 'lodash' | ||
|
||
import {Command} from './base.command' | ||
|
||
export class BrowserslistUpdate extends Command { | ||
public static paths: CommandClass['paths'] = [ | ||
[`@bud`, `browserslist`, `update`], | ||
[`@bud`, `browserslist`, `upgrade`], | ||
] | ||
|
||
public static usage: CommandClass['usage'] = { | ||
category: `@bud`, | ||
description: `update browserslist`, | ||
examples: [ | ||
[`browserslist usage info`, `yarn @bud browserslist --help`], | ||
], | ||
} | ||
|
||
public static queries: Array<[string, Array<string>]> = [ | ||
[`Default`, []], | ||
[`Last 2 versions`, [`last 2 versions`]], | ||
[`Last 3 versions`, [`last 3 versions`]], | ||
[ | ||
`WordPress`, | ||
[ | ||
`> 1%`, | ||
`last 1 Android versions`, | ||
`last 1 ChromeAndroid versions`, | ||
`last 2 Chrome versions`, | ||
`last 2 Firefox versions`, | ||
`last 2 Safari versions`, | ||
`last 2 iOS versions`, | ||
`last 2 Edge versions`, | ||
`last 2 Opera versions`, | ||
], | ||
], | ||
] | ||
|
||
public async execute() { | ||
this.context.stdout.write(`Updating browserslist...\n`) | ||
|
||
await execa(`yarn`, [`browserslist`, `--update-db`]).catch(this.catch) | ||
|
||
this.context.stdout.write(`Updating queries...\n`) | ||
|
||
await Promise.all( | ||
BrowserslistUpdate.queries.map( | ||
async ([name, query]) => await this.updateQuery(name, query), | ||
), | ||
).catch(this.catch) | ||
} | ||
|
||
public async updateQuery(name: string, query: Array<string>) { | ||
const list = await execa(`yarn`, [`browserslist`, query.join(`, `)]) | ||
.then(({stdout}) => stdout) | ||
.catch(this.catch) | ||
|
||
if (!list) return | ||
|
||
const parts = [] | ||
|
||
// banner | ||
parts.push(`/**\n * ${name}\n */\n`) | ||
// opening module.exports statement | ||
parts.push(`module.exports = [\n`) | ||
// each line from stdout | ||
list.split(`\n`).map(item => parts.push(` \`${item}\`,\n`)) | ||
// closing bracket | ||
parts.push(`]`) | ||
|
||
// file name | ||
const filename = `${kebabCase(name.toLowerCase())}.cjs` | ||
// file path | ||
const writePath = path( | ||
`sources`, | ||
`@roots`, | ||
`browserslist-config`, | ||
filename, | ||
) | ||
// file contents | ||
const contents = parts.join(``) | ||
|
||
// write output | ||
await fs.writeAsync(writePath, contents).catch(this.catch) | ||
|
||
// log | ||
this.context.stdout.write(`Updated ${filename}\n`) | ||
} | ||
} |
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
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
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,18 +1,26 @@ | ||
/** | ||
* WordPress defaults | ||
* WordPress | ||
*/ | ||
module.exports = [ | ||
`and_chr 117`, | ||
`and_chr 118`, | ||
`android 118`, | ||
`chrome 118`, | ||
`chrome 117`, | ||
`chrome 116`, | ||
`chrome 115`, | ||
`chrome 109`, | ||
`edge 118`, | ||
`edge 117`, | ||
`edge 116`, | ||
`firefox 118`, | ||
`firefox 117`, | ||
`ios_saf 17.0`, | ||
`ios_saf 16.6`, | ||
`ios_saf 15.6-15.7`, | ||
`op_mini all`, | ||
`opera 103`, | ||
`opera 102`, | ||
`safari 17.0`, | ||
`safari 16.6`, | ||
`samsung 22`, | ||
] | ||
] |
Oops, something went wrong.