Skip to content

Commit

Permalink
Merge pull request #10 from DanMad/develop
Browse files Browse the repository at this point in the history
General Updates
  • Loading branch information
DanMad authored Feb 18, 2023
2 parents e7f1844 + 23057a8 commit bf25610
Show file tree
Hide file tree
Showing 24 changed files with 1,741 additions and 2,137 deletions.
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"comments": false,
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
]
}
4 changes: 0 additions & 4 deletions .babelrc.json

This file was deleted.

23 changes: 23 additions & 0 deletions .github/scripts/check-package-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

PACKAGE_VERSION=$(cat package.json | jq -r .version)
GITHUB_ENDPOINT="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${PACKAGE_VERSION}"
GITHUB_ENDPOINT_STATUS=$(
curl \
-LI $GITHUB_ENDPOINT \
-o /dev/null \
-w '%{http_code}\n' \
-sH "Authorization: token ${GITHUB_TOKEN}" \
)

if [ "$GITHUB_ENDPOINT_STATUS" = "404" ]
then
echo "This version doesn't exist"
elif [ "$GITHUB_ENDPOINT_STATUS" = "200" ]
then
echo "This version already exists"
exit 1
else
echo "There was a problem connecting to GitHub"
exit 1
fi
32 changes: 32 additions & 0 deletions .github/scripts/create-github-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

PACKAGE_VERSION=$(cat package.json | jq -r .version)
PAYLOAD="{ \
\"tag_name\": \"v${PACKAGE_VERSION}\", \
\"target_commitish\": \"${GITHUB_SHA}\", \
\"name\": \"v${PACKAGE_VERSION}\",
\"body\": \"Release Version ${PACKAGE_VERSION}\", \
\"draft\": false, \
\"prerelease\": false \
}"
GITHUB_ENDPOINT="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases"
GITHUB_ENDPOINT_STATUS=$(
curl \
-H "Content-Type:application/json" $GITHUB_ENDPOINT \
-o /dev/null \
-w '%{http_code}\n' \
-d "${PAYLOAD}" \
-sH "Authorization: token ${GITHUB_TOKEN}" \
)

if [ "$GITHUB_ENDPOINT_STATUS" = "201" ]
then
echo "This version was released"
elif [ "$GITHUB_ENDPOINT_STATUS" = "404" ]
then
echo "This version wasn't released"
exit 1
else
echo "There was a problem connecting to GitHub"
exit 1
fi
22 changes: 22 additions & 0 deletions .github/workflows/main-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

name: Pull Request (main)

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

on:
pull_request:
branches:
- main

jobs:
check_package_version:
name: Check Package Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: |
chmod +x .github/scripts/check-package-version.sh
.github/scripts/check-package-version.sh
22 changes: 22 additions & 0 deletions .github/workflows/main-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---

name: Push (main)

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

on:
push:
branches:
- main

jobs:
create_github_release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: |
chmod +x .github/scripts/create-github-release.sh
.github/scripts/create-github-release.sh
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Artwork
*.fig
*.psd
*.sketch
# Bundle
# dist

# Dependencies
node_modules
# Logs
*.log

# MacOS
# Operating System
.DS_Store
Thumbs.db

# Packages
node_modules
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

3 changes: 2 additions & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"**/*": "prettier --write"
"package.json": "sort-package-json",
"{,src/**/,types/**/}*.{js,json,md,ts}": "prettier --write"
}
34 changes: 0 additions & 34 deletions .prettierignore

This file was deleted.

8 changes: 1 addition & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"printWidth": 80,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
"trailingComma": "all"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020–2021 DanMad
Copyright (c) 2020–2023 Daniel Maddison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit bf25610

Please sign in to comment.