-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild-pre-release.bat
61 lines (48 loc) · 1.45 KB
/
build-pre-release.bat
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
@echo off
set FIND=C:\Windows\System32\find.exe
set SUFFIX=%1
FOR /F "tokens=4,* USEBACKQ" %%G IN (`npx standard-version --dry-run ^| %FIND% "tagging"`) DO SET PRE_RELEASE_VERSION=%%G
IF "%PRE_RELEASE_VERSION:~0,1%"=="v" (
set PRE_RELEASE_VERSION=%PRE_RELEASE_VERSION:~1%
)
if "%1"=="" (
set SUFFIX=alpha
)
setlocal EnableDelayedExpansion
WHERE yarn >nul 2>&1
set YARN_AVAILABLE=%ERRORLEVEL%
WHERE npm >nul 2>&1
set NPM_AVAILABLE=%ERRORLEVEL%
IF "%YARN_AVAILABLE%" NEQ "0" (
ECHO The yarn command is not available.
IF "%NPM_AVAILABLE%" EQU "0" (
SET /P "Input=Would you like to use npm to install yarn? (y/n):"
IF "!Input!"=="y" (
call npm install yarn -g
goto build
) else (
GOTO error
)
) else (
GOTO :error
)
)
REM Check that the version of standard-version supports dry-run
call npx standard-version --help | %FIND% "dry-run" 1> nul 2> nul
IF "%ERRORLEVEL%" NEQ "0" (
GOTO :standardVersionError
)
:build
ECHO Building Prelease Version: %PRE_RELEASE_VERSION%-%SUFFIX%
call yarn
REM call yarn run setVersionSuffix %SUFFIX%
REM call yarn run build:pre-release
set "PreReleaseVersion=%PRE_RELEASE_VERSION%" & set "VersionSuffix=%SUFFIX%" & yarn run build:pre-release
GOTO end
:error
ECHO Please run %~n0%~x0 again after installing yarn.
:standardVersionError
ECHO Please install the latest version of standard-version (see https://github.com/conventional-changelog/standard-version)
ECHO.
GOTO end
:end