Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tag instead of main branch when importing tokens #57

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@

# Compound Android

[![](https://img.shields.io/github/license/vector-im/compound)](https://github.com/vector-im/compound/blob/main/LICENSE)
[![](https://img.shields.io/github/license/element-hq/compound)](https://github.com/element-hq/compound/blob/main/LICENSE)

This module contains the theme tokens for the application, including those auto-generated from [Compound](https://github.com/vector-im/compound-design-tokens) and its mappings.
This module contains the theme tokens for the application, including those auto-generated from [Compound](https://github.com/element-hq/compound-design-tokens) and its mappings.

## Importing tokens

To update the token from [Compound](https://github.com/element-hq/compound-design-tokens), you need to set the tag in the file [import_tokens.sh](./scripts/import_tokens.sh) and run the script.

It's also possible to provide the tag (or a branch) as a parameter to the script:

```bash
./scripts/import_tokens.sh -t <tag>
```

## Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Files inside this package are generated automatically from the Compound project (https://github.com/vector-im/compound-design-tokens) and will be batch-replaced when new tokens are generated.
Files inside this package are generated automatically from the Compound project (https://github.com/element-hq/compound-design-tokens) and will be batch-replaced when new tokens are generated.
14 changes: 7 additions & 7 deletions scripts/import_tokens.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

set -e

SHORT=b,:
LONG=branch,:
BRANCH='main'
SHORT=t,:
LONG=tag,:
TAG='v1.4.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, are we sure about this? I'd either set main as default or force the user to input a tag.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that to properly handle https://element-io.atlassian.net/browse/PSB-700 we should just have an hard-coded value of the tag somewhere and not allow passing it as command line parameter, to avoid any mistake. WDYT @giomfo


while getopts b: flag
while getopts t: flag
do
case "${flag}" in
b) BRANCH=${OPTARG};;
t) TAG=${OPTARG};;
esac
done

echo "Branch used: $BRANCH"
echo "Tag used: $TAG"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use 'Ref' instead of tag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maybe...


echo "Cloning the compound-design-tokens repository..."
if [ -d tmp ]; then
Expand All @@ -22,7 +22,7 @@ if [ -d tmp ]; then
fi
mkdir tmp
pushd tmp
git clone --branch $BRANCH https://github.com/vector-im/compound-design-tokens
git clone --depth 1 --branch $TAG https://github.com/element-hq/compound-design-tokens

echo "Copying files from tokens repository..."
cp -R compound-design-tokens/assets/android/res/drawable ../compound/src/main/res/
Expand Down
Loading