문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 다음 판 | 이전 판 | ||
|
gradle:nodejs [2018/02/27 15:00] kwon37xi 만듦 |
gradle:nodejs [2022/05/20 14:39] (현재) kwon37xi [npm task] |
||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| ====== Gradle node.js plugin ====== | ====== Gradle node.js plugin ====== | ||
| * [[: | * [[: | ||
| - | * https:// | + | * https:// |
| ===== node.js instance ===== | ===== node.js instance ===== | ||
| 줄 9: | 줄 9: | ||
| ===== 설정 ===== | ===== 설정 ===== | ||
| <code groovy> | <code groovy> | ||
| + | plugins { | ||
| + | id " | ||
| + | } | ||
| + | |||
| node { | node { | ||
| - | | + | version = " |
| - | | + | |
| + | } | ||
| + | </ | ||
| - | // Version of npm to use. | + | ===== 실행 ===== |
| - | | + | |
| - | // Version of Yarn to use. | + | <code sh> |
| - | | + | # node.js local 설치 |
| + | ./gradlew nodeSetup | ||
| - | // Base URL for fetching node distributions (change if you have a mirror). | + | # npm package.json 패키지 목록 설치 |
| - | | + | ./gradlew npmInstall |
| - | // 이 값이 true이면 node, | + | </code> |
| - | download = true | + | |
| - | // Set the work directory for unpacking node | + | |
| - | workDir = file(" | + | |
| - | | + | <code sh> |
| - | | + | # 명령의 인자를 가변으로 줄 수 있는 방법은 없어보임. (3.3) |
| + | ./gradlew npm_run | ||
| + | ./gradlew npm_update | ||
| + | ./gradlew npm_list | ||
| + | </ | ||
| + | | ||
| + | <code groovy> | ||
| + | npm_update { | ||
| + | args = [' | ||
| + | } | ||
| + | </code> | ||
| - | // Set the work directory for Yarn | + | ===== node task ===== |
| - | | + | |
| - | // Set the work directory where node_modules should be located | + | <code groovy> |
| - | | + | task myScript(type: |
| + | | ||
| + | args = [' | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | ===== npm task ===== | ||
| + | * '' | ||
| + | * 그 외에도 '' | ||
| + | <code groovy> | ||
| + | task npmServe(type: | ||
| + | description = " | ||
| + | dependsOn(npmBuild) | ||
| + | args = [' | ||
| + | } | ||
| + | </ | ||
| + | |||