• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4
5apply plugin: 'com.moowork.node'
6
7node {
8    version = "$node_version"
9    npmVersion = "$npm_version"
10    download = true
11    nodeModulesDir = file(buildDir)
12}
13
14// Configures testing for JS modules
15
16task prepareNodePackage(type: Copy) {
17    from("npm") {
18        include 'package.json'
19        // Postpone expansion of package.json until we configure version property in build.gradle
20        def copySpec = it
21        afterEvaluate {
22            copySpec.expand(project.properties + [kotlinDependency: ""])
23        }
24    }
25    from("npm") {
26        exclude 'package.json'
27    }
28    into "$node.nodeModulesDir"
29}
30
31npmInstall.dependsOn prepareNodePackage
32
33// Workaround the problem with Node downloading
34repositories.whenObjectAdded {
35    if (it instanceof IvyArtifactRepository) {
36        metadataSources {
37            artifact()
38        }
39    }
40}
41