-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving JsonSchemas into this repo (#613)
Co-authored-by: Kylstad <acn-nkyls@ai-dev.no> Co-authored-by: EKEBERG Steffen <steffen.ekeberg@soprasteria.com> Co-authored-by: Steffen Lorang Ekeberg <steffen.ekeberg@gmail.com> Co-authored-by: Terje Holene <terje.holene@gmail.com> Co-authored-by: Ole Martin Handeland <git@olemartin.org> Co-authored-by: Martin Joakim Ulstein <mjulstein@users.noreply.github.com> Co-authored-by: tba76 <70642698+tba76@users.noreply.github.com> Co-authored-by: Nina Kylstad <nkylstad@gmail.com> Co-authored-by: Ivar Nesje <ivarne@users.noreply.github.com> Co-authored-by: FTLems <90687291+FTLems@users.noreply.github.com> Co-authored-by: DanRJ <daniel.rustadj@gmail.com> Co-authored-by: Håkon <2082481+haakemon@users.noreply.github.com> Co-authored-by: Truls Gunnerød <Truls.Gunnerod@no.experis.com> Co-authored-by: Martin Joakim Ulstein <6736558+mjulstein@users.noreply.github.com> Co-authored-by: Magnus Revheim Martinsen <mrmartinsen.96@gmail.com> Co-authored-by: Rune Tømmerås Larsen <rune@hjemmekino.no> Co-authored-by: = <bjosttveit@gmail.com>
- Loading branch information
1 parent
2b5a069
commit 6ebaa4f
Showing
6 changed files
with
1,119 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -u | ||
|
||
PRE_RELEASE=no | ||
COMMIT=no | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
--cdn) | ||
PATH_TO_CDN=$(realpath "$2") | ||
shift # pop option | ||
shift # pop value | ||
;; | ||
--frontend) | ||
PATH_TO_FRONTEND=$(realpath "$2") | ||
shift # pop option | ||
shift # pop value | ||
;; | ||
--pre-release) | ||
PRE_RELEASE=yes | ||
shift # pop option | ||
;; | ||
--commit) | ||
COMMIT=yes | ||
shift # pop option | ||
;; | ||
-*|--*) | ||
echo "Unknown option $1" | ||
exit 1 | ||
;; | ||
*) | ||
echo "Unknown argument $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
SOURCE=src/altinn-app-frontend/dist | ||
TARGET=toolkits/altinn-app-frontend | ||
|
||
if ! test -d "$PATH_TO_CDN" || ! test -d "$PATH_TO_CDN/$TARGET"; then | ||
echo "Unable to find $PATH_TO_CDN/$TARGET" | ||
echo "Make sure path to CDN has been passed with --cdn <path>" | ||
exit 1 | ||
fi | ||
if ! test -d "$PATH_TO_FRONTEND" || ! test -d "$PATH_TO_FRONTEND/$SOURCE"; then | ||
echo "Unable to find $PATH_TO_FRONTEND/$SOURCE (did you run yarn build first?)" | ||
echo "Make sure path to CDN has been passed with --frontend <path>" | ||
exit 1 | ||
fi | ||
|
||
SOURCE_SCHEMAS="$PATH_TO_FRONTEND/schemas" | ||
TARGET_SCHEMAS="$PATH_TO_CDN/schemas" | ||
|
||
SOURCE="$PATH_TO_FRONTEND/$SOURCE" | ||
TARGET="$PATH_TO_CDN/$TARGET" | ||
|
||
echo "-------------------------------------" | ||
echo "Source: $SOURCE" | ||
echo "Target: $TARGET" | ||
echo "Pre-release: $PRE_RELEASE (toggle with --pre-release)" | ||
echo "Commit: $COMMIT (toggle with --commit)" | ||
echo "-------------------------------------" | ||
|
||
CURRENT_VERSION=$(git describe --abbrev=0 --tags 2>/dev/null) | ||
CURRENT_VERSION_PARTS=(${CURRENT_VERSION//./ }) | ||
APP_FULL=${CURRENT_VERSION:1} | ||
APP_MAJOR=${CURRENT_VERSION_PARTS[0]:1} | ||
APP_MAJOR_MINOR=${CURRENT_VERSION_PARTS[0]:1}.${CURRENT_VERSION_PARTS[1]} | ||
AUTHOR_FULL=$(git log -1 | grep Author) | ||
AUTHOR_NAME=$(git log -1 | grep Author | cut -d' ' -f2) | ||
AUTHOR_EMAIL=$(git log -1 | grep Author | cut -d' ' -f3 | cut -d'<' -f2 | cut -d'>' -f1) | ||
COMMIT_ID=$(git rev-parse HEAD~0) | ||
|
||
echo "Full version: $APP_FULL" | ||
echo "Major version: $APP_MAJOR" | ||
echo "Major + minor: $APP_MAJOR_MINOR" | ||
echo "Latest author: $AUTHOR_FULL" | ||
echo "Author name: $AUTHOR_NAME" | ||
echo "Author email: $AUTHOR_EMAIL" | ||
echo "Commit ID: $COMMIT_ID" | ||
echo "-------------------------------------" | ||
|
||
COMMIT_FILE=$(mktemp --suffix=-cdn-commit) | ||
{ | ||
echo "$AUTHOR_FULL updated altinn-app-frontend to $APP_FULL" | ||
echo "based on commit https://github.com/Altinn/app-frontend-react/commit/$COMMIT_ID" | ||
git log -1 | grep -Ev "commit|Author|Date" | ||
} >> "$COMMIT_FILE" | ||
|
||
echo "CDN commit message:" | ||
echo | ||
cat "$COMMIT_FILE" | ||
echo "-------------------------------------" | ||
echo "Files to be copied:" | ||
echo | ||
ls -1 $SOURCE/* | ||
echo "-------------------------------------" | ||
echo "Log:" | ||
echo | ||
|
||
# Needed in order for git commands to work | ||
cd "$TARGET" | ||
|
||
if [[ "$PRE_RELEASE" == "no" ]]; then | ||
echo " * Copying Major version" | ||
test -e "$TARGET/$APP_MAJOR" && git rm -r "$TARGET/$APP_MAJOR" | ||
mkdir -p "$TARGET/$APP_MAJOR" | ||
cp -fr $SOURCE/* "$TARGET/$APP_MAJOR/" | ||
echo " * Copying Minor version" | ||
test -e "$TARGET/$APP_MAJOR_MINOR" && git rm -r "$TARGET/$APP_MAJOR_MINOR" | ||
mkdir -p "$TARGET/$APP_MAJOR_MINOR" | ||
cp -fr $SOURCE/* "$TARGET/$APP_MAJOR_MINOR/" | ||
|
||
echo " * Copying schemas" | ||
cp -prv $SOURCE_SCHEMAS/* "$TARGET_SCHEMAS/" | ||
else | ||
echo " * Copying Major version (skipped using --pre-release)" | ||
echo " * Copying Minor version (skipped using --pre-release)" | ||
echo " * Copying schemas (skipped using --pre-release)" | ||
fi | ||
|
||
echo " * Copying Patch version" | ||
test -e "$TARGET/$APP_FULL" && git rm -r "$TARGET/$APP_FULL" | ||
mkdir -p "$TARGET/$APP_FULL" | ||
cp -fr $SOURCE/* "$TARGET/$APP_FULL/" | ||
|
||
echo " * Updating index.json" | ||
ls -1 | \ | ||
grep --perl-regexp '^[\d\.]+(-[a-z0-9.]+)?$' | \ | ||
sort --version-sort | \ | ||
jq --raw-input --slurp 'split("\n") | map(select(. != ""))' > index.json | ||
|
||
cd ../.. | ||
|
||
echo " * Staged for commit:" | ||
git add . | ||
git status --short | ||
|
||
if [[ "$COMMIT" == "yes" ]]; then | ||
echo " * Committing changes" | ||
git commit --author="$AUTHOR_NAME <$AUTHOR_EMAIL>" -F "$COMMIT_FILE" | ||
else | ||
echo " * Skipping commit (toggle with --commit)" | ||
fi | ||
|
||
echo "-------------------------------------" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
{ | ||
"$id": "https://altinncdn.no/schemas/json/component/number-format.schema.v1.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Input number formatting", | ||
"description": "Schema that describes the options that can be configured for number formatting on an `input` component, based on react-number-format package. For complete list of available options, see https://github.com/s-yadav/react-number-format#props", | ||
"type": "object", | ||
"additionalProperties": true, | ||
"properties": { | ||
"allowedDecimalSeparators": { | ||
"title": "Allowed decimal separators", | ||
"description": "Characters which when pressed result in a decimal separator. When missing, decimalSeparator and '.' are used", | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"maxLength": 1 | ||
}, | ||
"examples": [[",", ".", "/"]] | ||
}, | ||
"allowEmptyFormatting": { | ||
"title": "Allow empty formatting", | ||
"description": "Apply formatting to empty inputs", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"allowLeadingZeros": { | ||
"title": "Allow leading zeros", | ||
"description": "Allow leading zeros at beginning of number", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"allowNegative": { | ||
"title": "Allow negative", | ||
"description": "Allow negative numbers (Only when format option is not provided)", | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"decimalScale": { | ||
"title": "Decimal scale", | ||
"description": "If defined it limits to given decimal scale.", | ||
"type": "number", | ||
"examples": [1, 2, 3] | ||
}, | ||
"decimalSeparator": { | ||
"title": "Decimal separator", | ||
"description": "Support decimal point on a number. Single character string.", | ||
"type": "string", | ||
"maxLength": 1, | ||
"default": "." | ||
}, | ||
"fixedDecimalScale": { | ||
"title": "Fixed decimal scale", | ||
"description": "Used together with decimalScale. If true it adds 0s to match given decimal scale.", | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"format": { | ||
"title": "Format", | ||
"description": "Format given as hash string, to allow number input in place of hash.", | ||
"type": "string", | ||
"examples": ["### ### ###", "+47 ### ## ###", "##-##-##-##"] | ||
}, | ||
"mask": { | ||
"title": "Mask", | ||
"description": "Mask to show in place of non-entered values", | ||
"type": "string", | ||
"examples": ["_"], | ||
"default": " " | ||
}, | ||
"prefix": { | ||
"title": "Prefix", | ||
"description": "Add a prefix before the number", | ||
"type": "string", | ||
"examples": ["$", "kr", "-", "(+47) "] | ||
}, | ||
"suffix": { | ||
"title": "Suffix", | ||
"description": "Add a suffix after the number", | ||
"type": "string", | ||
"examples": ["%", "kr", "kg"] | ||
}, | ||
"thousandSeparator": { | ||
"title": "Thousand separator", | ||
"description": "Add thousand separators on number. Single character string or boolean true (true is default to ,)", | ||
"type": ["string", "boolean"], | ||
"maxLength": 1, | ||
"examples": [true, ",", "."] | ||
} | ||
}, | ||
"allOf": [{ | ||
"if": { | ||
"properties": { "fixedDecimalScale": { "const": true } }, | ||
"required": ["fixedDecimalScale"] | ||
}, | ||
"then": { | ||
"required": ["decimalScale"] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"$id": "https://altinncdn.no/schemas/json/layout/layout-sets.schema.v1.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Altinn layout sets", | ||
"description": "Schema that describes the different layout sets for an Altinn application and when to use them", | ||
"type": "object", | ||
"additionalProperties": true, | ||
"properties": { | ||
"sets": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/layoutset" | ||
} | ||
}, | ||
"definitions": { | ||
"layoutset": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"description": "Settings regarding a specific layoutset", | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"title": "id", | ||
"description": "The layoutset ID. Must be unique within a given application." | ||
}, | ||
"type": { | ||
"type": "string", | ||
"title": "dataType", | ||
"description": "The datatype to use this layoyut." | ||
}, | ||
"tasks": { | ||
"$ref": "#/definitions/tasks" | ||
} | ||
} | ||
}, | ||
"tasks": { | ||
"additionalProperties": false, | ||
"description": "An array specifying which task to use a layoutset", | ||
"type": "array", | ||
"items": { | ||
"description": "A layoutSet name, for instance 'Form1'", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.