Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync(yarn-run-utils): dependencies, adjustments #398

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

776 changes: 388 additions & 388 deletions .yarn/releases/yarn.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@atls/yarn-run-utils@workspace:yarn/run-utils"
dependencies:
"@yarnpkg/core": "npm:4.0.5"
"@yarnpkg/core": "npm:4.1.2"
languageName: unknown
linkType: soft

Expand Down
12 changes: 10 additions & 2 deletions yarn/run-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@
"dist"
],
"dependencies": {
"@yarnpkg/core": "4.0.5"
"@yarnpkg/core": "4.1.2"
},
"publishConfig": {
"access": "public",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "dist/index.js",
"typings": "dist/index.d.ts"
"types": "dist/index.d.ts"
}
}
14 changes: 7 additions & 7 deletions yarn/run-utils/sources/pass-through-run.context.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import type { Writable } from 'node:stream'
import type { PassThrough } from 'node:stream'

import { StreamOutput } from './stream.output.js'
import { StreamOutput } from './stream.output.js'

export class PassThroughRunContext {
private readonly stdoutOutput = new StreamOutput()
public readonly stdout: PassThrough

private readonly stderrOutput = new StreamOutput()
public readonly stderr: PassThrough

public readonly stdout: Writable
private readonly stdoutOutput = new StreamOutput()

public readonly stderr
private readonly stderrOutput = new StreamOutput()

constructor() {
this.stdout = this.stdoutOutput.stream
this.stderr = this.stderrOutput.stream
}

get output() {
get output(): string {
return [this.stdoutOutput.data, this.stderrOutput.data].filter(Boolean).join('\n')
}
}
29 changes: 16 additions & 13 deletions yarn/run-utils/sources/spinner.progress.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Writable } from 'node:stream'
import type { Configuration } from '@yarnpkg/core'
import type { Writable } from 'node:stream'
import type { WriteStream } from 'node:tty'

import { WriteStream } from 'node:tty'

import { Configuration } from '@yarnpkg/core'
import { MessageName } from '@yarnpkg/core'
import { formatUtils } from '@yarnpkg/core'
import { MessageName } from '@yarnpkg/core'
import { formatUtils } from '@yarnpkg/core'

export class SpinnerProgress {
static PROGRESS_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
Expand All @@ -20,22 +19,26 @@ export class SpinnerProgress {
private readonly configuration: Configuration
) {}

start() {
if ((this.stdout as WriteStream).isTTY && !process.env.TOOLS_DISABLE_PROGRESS) {
isEnabled(): boolean {
return (this.stdout as WriteStream).isTTY && !process.env.TOOLS_DISABLE_PROGRESS
}

start(): void {
if (this.isEnabled()) {
this.running = true
this.write()
this.tick()
}
}

end() {
if ((this.stdout as WriteStream).isTTY && this.running) {
end(): void {
if (this.isEnabled() && this.running) {
this.running = false
this.clear(true)
}
}

private tick() {
private tick(): void {
setTimeout(() => {
if (this.running) {
this.clear()
Expand All @@ -49,7 +52,7 @@ export class SpinnerProgress {
}, SpinnerProgress.PROGRESS_INTERVAL)
}

private write() {
private write(): void {
const spinner = SpinnerProgress.PROGRESS_FRAMES[this.position]

const name = formatUtils.pretty(
Expand All @@ -63,7 +66,7 @@ export class SpinnerProgress {
)
}

private clear(complete = false) {
private clear(complete = false): void {
this.stdout.write(`\x1b[${0}A`)

if (complete) {
Expand Down
6 changes: 3 additions & 3 deletions yarn/run-utils/sources/stream.output.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { PassThrough } from 'stream'
import { PassThrough } from 'node:stream'

export class StreamOutput {
public readonly stream = new PassThrough()

private chunks: Array<Buffer> = []

constructor() {
this.stream.on('data', (chunk) => this.chunks.push(chunk))
this.stream.on('data', (chunk: Buffer) => this.chunks.push(chunk))
}

get data() {
get data(): string {
return Buffer.concat(this.chunks).toString()
}
}
Loading