์๋ ํ์ธ์ @pedronauck ๐์ ๋๋ค!
๋ฒ๊ทธ ์ค๋ช
docz 0.11์์ 0.13์ผ๋ก ์
๊ทธ๋ ์ด๋ํ๊ธฐ ์ ์ ๋น๋ ๋ก๊ทธ์ stdout์ ๋งค์ฐ ๊ฐ๊ฒฐํ์ต๋๋ค.
๊ทธ๋ฆฌ๊ณ ์ด์ ๋งค ์๊ฐ๋ง๋ค stdout์ ์๋ก์ด ์ค์ด ์ถ๊ฐ๋๊ธฐ ๋๋ฌธ์ ๊ฑฐ์ ๋์ด ์์ต๋๋ค.
์ฌํํ๊ธฐ ์ํด
tty๊ฐ ์๋ ํ๊ฒฝ(์: CI)์์ docz ๋น๋
์์๋๋ ํ๋
TTY์์๋ง ์๋ํ๋ โ Creating production build
์ธ์ํ ๋ ์ ๋๋ฉ์ด์
์ด ์์๋์ง ์์ต๋๋ค.
ํ๊ฒฝ
ํํธ
if (process.stdout.isTTY) {
// animated output (erasing and restoring the current line's output is supported)
} else {
// plain console output (can't erase what's already been printed)
}
process.stdout.isTTY
์ ์์กดํ๋ ๊ฒ๋ง์ผ๋ก๋ ์ถฉ๋ถํ์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค. ์ผ๋ถ CI์์๋ ์ฌ์ค์ด๋ฉฐ ์ด๋ ์คํด์ ์์ง๊ฐ ์์ต๋๋ค. ์ฌ๊ธฐ์ ํ๋์ ์ ์ฌํ ์ฌ์ฉ์ ์ ์ isTTY()
๊ธฐ๋ฅ์ด ํ์ํฉ๋๋ค. https://github.com/prettier/prettier/pull/5804
์๋
ํ์ธ์ ๋๋ถ๋ถ์ CI์๋ process.env.CI
= true
์์ต๋๋ค. ์งํ๋ฅ ์ธ์๋ฅผ ๋นํ์ฑํํ๊ธฐ ์ํด ์ด ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ์ด๋ป์ต๋๊น?
Prettier์ isTTY()
๊ธฐ๋ฅ์ ๋ณต์ฌํ์ฌ ๋ถ์ฌ๋ฃ๊ธฐ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค. process.env.CI
๋๋ process.stdout.isTTY
๋ ๋ชจ๋ ์ค์ ์๋๋ฆฌ์ค์ ๋ํด ์ถฉ๋ถํ ํ์ธ์ ์ ๊ณตํ์ง ์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์๋ ํ์ธ์ ๋๋ถ๋ถ์ CI์๋
process.env.CI
=true
์์ต๋๋ค. ์งํ๋ฅ ์ธ์๋ฅผ ๋นํ์ฑํํ๊ธฐ ์ํด ์ด ํ๊ฒฝ ๋ณ์๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ์ด๋ป์ต๋๊น?