forked from microsoft/pxt-arcade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.cmd
80 lines (70 loc) · 2.45 KB
/
setup.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@if not defined _echo @echo off
setlocal enabledelayedexpansion
set BatchFile=%0
set Root=%~dp0
set arcadeRoot=%cd%
set TerminalPath=%LocalAppData%\Microsoft\WindowsApps\wt.exe
set cmdPath=cmd.exe
set OptPull=false
set OptLink=false
set OptRun=false
set OptFirst=false
:ParseArguments
if "%1" == "" goto :DoneParsing
if /I "%1" == "/?" call :Usage && exit /b 1
if /I "%1" == "/firsttime" set "OptFirst=true" && set "OptLink=true" && shift && goto :ParseArguments
if /I "%1" == "/pull" set "OptPull=true" && shift && goto :ParseArguments
if /I "%1" == "/link" set "OptLink=true" && shift && goto :ParseArguments
if /I "%1" == "/run" set "OptRun=true" && shift && goto :ParseArguments
call :Usage && exit /b 1
:DoneParsing
if "%OptFirst%" == "true" (
git clone https://github.com/microsoft/pxt-arcade
git clone https://github.com/microsoft/pxt
git clone https://github.com/microsoft/pxt-common-packages
call npm install -g pxt
call npm install -g gulp
cd pxt-arcade
set arcadeRoot=%cd%
echo done cloning
)
if "%OptPull%" == "true" (
echo pull pxt-arcade
git pull
pushd ..\pxt
echo pull pxt
git pull
popd
pushd ..\pxt-common-packages
echo pull pxt-common-packages
git pull
popd
)
if "%OptLink%" == "true" (
pushd ..\pxt
npm install
npm run build
popd
pushd ..\pxt-common-packages
npm install
npm link ../pxt
popd
npm install
npm link ../pxt
npm link ../pxt-common-packages
)
if "%OptRun%" == "true" (
start %cmdPath% /k "cd /d %arcadeRoot%\..\pxt && gulp watch"
pxt serve --rebundle
)
echo Completed
exit /b
:Usage
echo Usage: %BatchFile% [options]
echo.
echo Setup options:
echo /firsttime Sets up developer environment - will clone 3 repos (pxt, pxt-arcade, and pxt-common-packages) and then run /link option
echo /pull Does a git pull on 3 repos (pxt, pxt-arcade, and pxt-common-packages)
echo /link Runs npm install and links the 3 repos
echo /run Runs local server and watches for changes
goto :eof