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

Refactor run.sh: added custom build-plan file and build plan checks; improved messaging #12

Merged
merged 6 commits into from
Jun 16, 2022

Conversation

OnkelTem
Copy link
Contributor

@OnkelTem OnkelTem commented May 4, 2022

See: be5invis/Iosevka#1340

This PR adds some messaging and checks.

From the very beginning of the run.sh script:

  1. It prints which build-plans file it's gonna use
  2. It prints which build plan it's gonna use
  3. It doesn't dismiss the build plan anymore when there is no custom build-plains file. It's getting passed down to npm run build.

Sample session, without custom build-plans file and build plan:

$ docker run -it -v $(pwd):/build avivace/iosevka-build
Custom build-plans file not found, using the default one
Using build plan: contents::iosevka
Using font version: 15.2.0
Downloading and checking the validity of the source code...
...

With custom build-plans file, but without a build plan:

$ docker run -it -v $(pwd):/build avivace/iosevka-build
Found custom build-plans file: private-build-plans.toml
Using build plan: contents::iosevka-sans-q
Using font version: 15.2.0
Downloading and checking the validity of the source code...
...

With custom build-plans file and custom build plan:

$ docker run -it -v $(pwd):/build avivace/iosevka-build ttf::iosevka-sans-q
Found custom build-plans file: private-build-plans.toml
Using build plan: ttf::iosevka-sans-q
Using font version: 15.2.0
Downloading and checking the validity of the source code...
...

@OnkelTem
Copy link
Contributor Author

OnkelTem commented May 4, 2022

Wait, I found a mistake

run.sh Outdated
echo "Custom build-plans file not found, using the default one"
if [[ -n $1 ]]; then
echo -e "\nError: Custom build plan '$1' requested, but custom '$BUILD_FILE' file not found"
exit 1
Copy link
Contributor Author

@OnkelTem OnkelTem May 4, 2022

Choose a reason for hiding this comment

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

I'm thinking of a case when the above logic would prevent people from using the default build-plans file with custom build param. Currently the script would fail. Not sure if it's ok. Let's remove it. After all, if custom build plan is wrong, it will fail later at npm run build...

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, I guess you're right.. but what would be bad about leaving the error message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But maybe that the user knows what they're doing. For example, now it's possible to pass the param directly to the npm script. E.g to build only TTFs with the rest by default:

$ docker run -it -v $(pwd):/build avivace/iosevka-build ttf::iosevka

@nobk
Copy link

nobk commented Jun 16, 2022

iosevka-build can use like this, but you patch can not.
iosevka-build ttf::my_font1 ttf::my_font2 ttf::my_font3 ttf::my_font4 ttf::my_font5

@avivace avivace merged commit 9ca036d into avivace:master Jun 16, 2022
else
# User knows what they are doing and provided custom build arguments
# (manual mode)
BUILD_PARAM="$1"
Copy link

Choose a reason for hiding this comment

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

@avivace $1 should change to $@ to support several fonts build with in one pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants