Bad example 1, before es6(나쁜 예시 2, es6 이전에는)
import React, { useState } from 'react'
export const ConditionalRenderingBad = () => {
const [showConditionOneText, setShowConditionOneText] = useState(false)
const handleClick = () =>
setShowConditionOneText(showConditionOneText => !showConditionOneText)
const beforeES6 = if (showConditionOneText) { The condition must betrue! } else { The condition must befalse! }
return (
<div>
<button onClick={handleClick}>Toggle the text</button>
<p>{beforeES6}</p>
</div>
)
}
Bad example 2(나쁜 예시 2)
import React, { useState } from 'react'
export const ConditionalRenderingBad = () => {
const [showConditionOneText, setShowConditionOneText] = useState(false)
const handleClick = () =>
setShowConditionOneText(showConditionOneText => !showConditionOneText)
return (
<div>
<button onClick={handleClick}>Toggle the text</button>
{showConditionOneText && <p>The condition must be true!</p>}
{!showConditionOneText && <p>The condition must be false!</p>}
</div>
)
}
Good example (좋은 예시)
import React, { useState } from 'react'
export const ConditionalRenderingGood = () => {
const [showConditionOneText, setShowConditionOneText] = useState(false)
const handleClick = () =>
setShowConditionOneText(showConditionOneText => !showConditionOneText)
return (
<div>
<button onClick={handleClick}>Toggle the text</button>
{showConditionOneText ? (
<p>The condition must be true!</p>
) : (
<p>The condition must be false!</p>
)}
</div>
)
}
Bad example (나쁜 예시 )
import React, { useState } from 'react'
export const ConditionalRenderingWhenTrueBad = () => {
const [showConditionalText, setShowConditionalText] = useState(false)
const handleClick = () =>
setShowConditionalText(showConditionalText => !showConditionalText)
return (
<div>
<button onClick={handleClick}>Toggle the text</button>
{showConditionalText ? <p>The condition must be true!</p> : null}
</div>
)
}
Good example (좋은 예시)
import React, { useState } from 'react'
export const ConditionalRenderingWhenTrueGood = () => {
const [showConditionalText, setShowConditionalText] = useState(false)
const handleClick = () =>
setShowConditionalText(showConditionalText => !showConditionalText)
return (
<div>
<button onClick={handleClick}>Toggle the text</button>
{showConditionalText && <p>The condition must be true!</p>}
</div>
)
}
Bad example (나쁜 예시 )
import React from 'react'
const HungryMessage = ({ isHungry }) => (
<span>{isHungry ? 'I am hungry' : 'I am full'}</span>
)
export const BooleanPropBad = () => (
<div>
<span>
<b>This person is hungry: </b>
</span>
<HungryMessage isHungry={true} />
<br />
<span>
<b>This person is full: </b>
</span>
<HungryMessage isHungry={false} />
</div>
)
Good example (좋은 예시)
import React, { useState } from 'react'
export const ConditionalRenderingWhenTrueGood = () => {
const [showConditionalText, setShowConditionalText] = useState(false)
const handleClick = () =>
setShowConditionalText(showConditionalText => !showConditionalText)
return (
<div>
<button onClick={handleClick}>Toggle the text</button>
{showConditionalText && <p>The condition must be true!</p>}
</div>
)
}
<label for="id">아이디</label>
<input type="text" id="id" aria-required="true">
<button aria-expanded="true">열기</button>
<div hidden>열기 내용</div>
CI Tools (무료 오픈소스, 설치형) / 빌드, 테스트, 정적 분석을 자동으로 실행 해줌
</img>
젠킨스 이전? : build, test 명령어를 수동으로 터미널에서 입력
</img>
젠킨스 이후? : 일일이 build, test 명령어를 입력하지 않아도 코드만 commit 해서 push 하면 자동적으로 실행
</img>
아키텍처
</img>
### 3.3.1 General 프로젝트에 대한 설명, url, discard old builds(오래된 빌드 삭제) 등 전반적인 설정을 한다.
### 3.3.2 Source Code Management (소스 코드 관리)
Repositories 설정 (URL, 인증)을 할 수 있으며, 어떤 Branches 들을 build 할 것인지 설정할 수 있다.
public 레포지토리는 credentials(인증) 설정할 필요가 없으나, private 레포지토리는 git 과 연동하여 설정해야한다.
### 3.3.3 Build Triggers (빌드 유발)
빌드를 언제 실행할 지를 설정할 수 있다.
- Trigger builds remotely (e.g., from scripts) 빌드를 원격으로 유발 : 외부에서 URL을 통해 빌드를 진행 할 수 있도록 설정합니다.
- Build after other project are built : 다른 프로젝트를 빌드한 후 이어서 현재 프로젝트를 빌드하는 설정.
- Build periodically** : 주기적으로 빌드
- Poll SCM** : 서버에서 변경된 사항이 존재할 때 빌드를 수행하는 설정
```
schedule 예시
15분 간격으로 빌드 작업을 수행
H/15 * * * *
모든 시간의 첫 30분 동안에 10분 간격으로 빌드를 수행
H(0-29)/10 * * * *
주말을 제외한 주중에 9시부터 16시 사이에 2시간에 한번씩 빌드를 수행
H 9-16/2 * * 1-5
12월 달은 제외하고 매달 1일과 15일에 한번씩 빌드를 수행
H H 1,15 1-11 *
```
### 3.3.4 Build Environment (빌드 환경)
빌드 환경 설정
- Delete workspace before build start : 빌드를 실행하기 전, 이전에 사용되던 작업 공간 삭제
- Use secret text(s) or file(s) : 다양한 자격 증명에 사용할 인증 파일 또는 텍스트 사용
- Abort the build if it’s struck : 빌드가 교착 상태 등의 이유로 중지되면 지정된 시간 내로 빌드 종료 후 지정된 메시지 출력
- Add timestamps to the Console Output : 빌드 시작 시간, 빌드 종료 시간 등 시간과 관련된 내용을 Console output에 함께 출력
- With Ant : Apache Ant를 사용하여 빌드하는 환경 구성.
### 3.3.5 Build (빌드) 명령어 입력 등 다양한 방법으로 빌드 시킬 수 있다. - Execute Windows batch command: 입력된 Window command line 실행 - Execute Shell: sh -xe 명령어 실행. Linux 전용. - Invoke Ant: Ant 빌드 시스템을 사용하는 프로젝트의 경우에 사용. 입력된 인자를 통해 빌드 - Invoke Gradle script: Gradle를 빌드 시스템으로 빌드하는 프로젝트의 경우에 사용. 입력된 인자를 통해 작업. - Invoke top-level Maven targets: Maven 빌드 시스템으로 빌드하는 프로젝트의 경우에 사용. 입력된 인자를 통해 작업 - Run with timeout: 지정된 시간동안 빌드가 완료되지 않으면 빌드 중지 - Set build status to “pending” on GitHub commit: Git 프로젝트 속성에 정의된 이름 속성으로 작업 이름을 대체
빌드 이후 액션을 설정해줄 수 있다. (예, 이메일 알림 등)