-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.bat
48 lines (38 loc) · 1.14 KB
/
build.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
@echo off
setlocal EnableDelayedExpansion
set FIND=C:\Windows\System32\find.exe
set SUFFIX=%1
WHERE npm >nul 2>&1
set NPM_AVAILABLE=%ERRORLEVEL%
:build
call npm ci
IF "%SUFFIX%" == "" (
GOTO :build
) ELSE (
GOTO :buildPreRelease
)
:build
call npm run build
GOTO end
:buildPreRelease
REM Check that the version of standard-version supports dry-run
call standard-version --help | %FIND% "dry-run" 1> nul 2> nul
IF "%ERRORLEVEL%" NEQ "0" (
GOTO :standardVersionError
)
FOR /F "tokens=4,* USEBACKQ" %%G IN (`standard-version --dry-run ^| %FIND% "tagging"`) DO SET PRE_RELEASE_VERSION=%%G
SET PRE_RELEASE_VERSION=%PRE_RELEASE_VERSION:v=%
IF "!PRE_RELEASE_VERSION!" == "" (
ECHO Using Version 0.0.1
SET PRE_RELEASE_VERSION="0.0.1"
)
ECHO Building Prelease Version: %PRE_RELEASE_VERSION%-%SUFFIX%
call npm run build:pre-release --version-prefix=%PRE_RELEASE_VERSION% --version-suffix=%SUFFIX%
GOTO end
:error
ECHO Please run %~n0%~x0 again after installing npm.
:standardVersionError
ECHO Please install the latest version of standard-version (see https://github.com/conventional-changelog/standard-version)
ECHO.
GOTO end
:end