mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Fix script to build migrations by having it use the .ts
template (#18878)
* Fix script to build migrations * Validate version is a number
This commit is contained in:
parent
cf7c790505
commit
033b529c17
@ -1,12 +1,24 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
|
validate-number(){
|
||||||
|
re='^[0-9]+$'
|
||||||
|
if [[ ! $1 =~ $re ]]; then
|
||||||
|
echo "Error: The value must be a number." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
g-migration() {
|
g-migration() {
|
||||||
[[ -z "$1" ]] && { echo "Migration version is required!" ; exit 1; }
|
[[ -z "$1" ]] && { echo "Migration version is required!" ; exit 1; }
|
||||||
local vnum=$1
|
local vnum=$1
|
||||||
|
|
||||||
|
validate-number "$vnum"
|
||||||
|
|
||||||
if (($1 < 100)); then
|
if (($1 < 100)); then
|
||||||
vnum=0$1
|
vnum=0$1
|
||||||
fi
|
fi
|
||||||
touch app/scripts/migrations/"$vnum".js
|
touch app/scripts/migrations/"$vnum".ts
|
||||||
cp app/scripts/migrations/template.js app/scripts/migrations/"$vnum".js
|
cp app/scripts/migrations/template.ts app/scripts/migrations/"$vnum".ts
|
||||||
|
|
||||||
touch app/scripts/migrations/"$vnum".test.js
|
touch app/scripts/migrations/"$vnum".test.js
|
||||||
cp app/scripts/migrations/template.test.js app/scripts/migrations/"$vnum".test.js
|
cp app/scripts/migrations/template.test.js app/scripts/migrations/"$vnum".test.js
|
||||||
|
Loading…
Reference in New Issue
Block a user