Skip to content

Commit

Permalink
Rollback install node
Browse files Browse the repository at this point in the history
  • Loading branch information
demianzhang authored Apr 5, 2019
1 parent 52f029f commit 65cc094
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ $install_yarn = $TRUE
$PIP_INSTALL = "python -m pip install ."

# nodejs
$nodeUrl = "https://aka.ms/nni/nodejs-download/win64"
$version = "10.15.1"
$nodeUrl = "https://nodejs.org/dist/v10.15.1/node-v10.15.1-win-x64.zip"
$yarnUrl = "https://yarnpkg.com/latest.tar.gz"
$unzipNodeDir = "node-v$version-win-x64"

$NNI_DEPENDENCY_FOLDER = "C:\tmp\$env:USERNAME"

Expand All @@ -31,7 +33,7 @@ $NNI_PKG_FOLDER = $NNI_PYTHON3 +"\nni"
if(!(Test-Path $NNI_DEPENDENCY_FOLDER)){
New-Item $NNI_DEPENDENCY_FOLDER -ItemType Directory
}
$NNI_NODE_TARBALL = $NNI_DEPENDENCY_FOLDER+"\nni-node.tar.gz"
$NNI_NODE_ZIP = $NNI_DEPENDENCY_FOLDER+"\nni-node.zip"
$NNI_NODE_FOLDER = $NNI_DEPENDENCY_FOLDER+"\nni-node"
$NNI_YARN_TARBALL = $NNI_DEPENDENCY_FOLDER+"\nni-yarn.tar.gz"
$NNI_YARN_FOLDER = $NNI_DEPENDENCY_FOLDER+"\nni-yarn"
Expand All @@ -41,7 +43,7 @@ $NNI_YARN = $NNI_YARN_FOLDER +"\bin\yarn"
$NNI_VERSION_VALUE = $(git describe --tags)
$NNI_VERSION_TEMPLATE = "999.0.0-developing"

if(!(Test-Path $NNI_NODE_TARBALL)){
if(!(Test-Path $NNI_NODE_ZIP)){
Write-Host "Downloading Node..."
(New-Object Net.WebClient).DownloadFile($nodeUrl, $NNI_NODE_ZIP)
}
Expand All @@ -56,8 +58,8 @@ if ($install_node) {
if(Test-Path $NNI_NODE_FOLDER){
Remove-Item $NNI_NODE_FOLDER -Recurse -Force
}
New-Item $NNI_NODE_FOLDER -ItemType Directory
cmd /c tar -xf $NNI_NODE_TARBALL -C $NNI_NODE_FOLDER --strip-components 1
Expand-Archive $NNI_NODE_ZIP -DestinationPath $NNI_DEPENDENCY_FOLDER
Rename-Item "$NNI_DEPENDENCY_FOLDER\$unzipNodeDir" "nni-node"

### yarn install
if(Test-Path $NNI_YARN_FOLDER){
Expand Down Expand Up @@ -122,4 +124,4 @@ $PKG_JSON = $NNI_PKG_FOLDER+"\package.json"
(Get-Content $PKG_JSON).replace($NNI_VERSION_TEMPLATE, $NNI_VERSION_VALUE) | Set-Content $PKG_JSON
cmd /c $NNI_YARN --prod --cwd $NNI_PKG_FOLDER
$NNI_PKG_FOLDER_STATIC = $NNI_PKG_FOLDER+"\static"
Copy-Item "src\webui\build" $NNI_PKG_FOLDER_STATIC -Recurse
Copy-Item "src\webui\build" $NNI_PKG_FOLDER_STATIC -Recurse

0 comments on commit 65cc094

Please sign in to comment.