Skip to content

Commit

Permalink
Merge pull request #29 from gobstones/update-build-to-06x
Browse files Browse the repository at this point in the history
build: update build configuration to scripts 0.6.x
  • Loading branch information
fidel-ml authored Dec 30, 2023
2 parents 4db9555 + eb92008 commit 0cd2f8d
Show file tree
Hide file tree
Showing 112 changed files with 294 additions and 5,740 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/on-tag-publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: on-tag-publish-docs

on:
push:
tags:
- 'v*'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
cancel-in-progress: false

jobs:
publish-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node version
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Installing project dependencies
run: npm install
- name: Building the docs
run: npm run doc
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
36 changes: 22 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
# Node files #
node_modules/
npm-debug.log
yarn-error.log
.rollup.cache

# OS generated files #
# OS generated files
.DS_Store
Thumbs.db
.tmp/

# Dist #
dist/
coverage/
tsconfig.build.json

# IDE #
# IDE generated file
.idea/

# PackageManager specific #
# PackageManager specific lock files
pnpm-lock.yaml
package-lock.json
yarn.lock

# Node generated files
node_modules/
npm-debug.log
yarn-error.log

# Build process generated files
.rollup.cache
tsconfig.build.json

# Test coverage generated folder
coverage/

# Dist generated folder
dist/

# Docs generated folder
docs/

34 changes: 32 additions & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
# This hook is invoked by git-commit and git-merge, and can be
# bypassed with the --no-verify option. It takes a single
# parameter, the name of the file that holds the proposed commit
# log message.

# Exiting with a non-zero status causes the command to abort.

# The hook is allowed to edit the message file in place, and can
# be used to normalize the message into some project standard format.
# It can also be used to refuse the commit after inspecting the
# message file.

# The default commit-msg hook, when enabled, detects duplicate
# Signed-off-by trailers, and aborts the commit if one is found.

# Load husky
. "$(dirname -- "$0")/_/husky.sh";

# Read parameters
COMMIT_MSG_FILE=$1;

# We use this hook to run "commitlint", that verifies that the
# message sent has the correct format for the project, aborting otherwise.

# Show welcome message
echo "**************************";
echo "Linting the commit message";
echo "**************************";
echo "";

# Run commitlint
npx --no -- commitlint --edit ${1};
51 changes: 47 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx gobstones-scripts run husky.commit
git add --all
exit
# This hook is invoked by git-commit, and can be bypassed with the
# --no-verify option. It takes no parameters, and is invoked before
# obtaining the proposed commit log message and making a commit.
# Exiting with a non-zero status from this script causes the git
# commit command to abort before creating a commit.

# The default pre-commit hook, when enabled, catches introduction of
# lines with trailing whitespaces and aborts the commit when such a
# line is found.

# All the git commit hooks are invoked with the environment variable
# GIT_EDITOR=: if the command will not bring up an editor to modify
# the commit message.

# The default pre-commit hook, when enabled and with the hooks.allownonascii
# config option unset or set to false prevents the use of non-ASCII filenames.

# Load husky
. "$(dirname -- "$0")/_/husky.sh";

# Read parameters
# NOTHING TO READ HERE

# We currently use this hook to update the changelog of the project
# and make sure all files are prettified before sending them to the commit.
# Generated files are added to the commit.

# Show welcome message
echo "**************************";
echo "Running pre commit hooks";
echo "**************************";
echo "";

# Run prettify
echo "Run prettify\n";
npx --no -- gobstones-scripts run prettify --silent ;

# Run changelog
echo "\nRun changelog\n";
npx --no gobstones-scripts run changelog --silent ;

# Add all generated files
echo "\nAdd generated files to commit\n";
git add --all;

# Exit
exit 0;
72 changes: 70 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,73 @@
#!/usr/bin/env sh

# This hook is called by git-push and can be used to prevent a
# push from taking place. The hook is called with two parameters
# which provide the name and location of the destination remote,
# if a named remote is not being used both values will be the same.

# Information about what is to be pushed is provided on the hook’s
# standard input with lines of the form:
# <local ref> SP <local object name> SP <remote ref> SP <remote object name> LF

# For instance, if the command git push origin master:foreign were
# run the hook would receive a line like the following:
# refs/heads/master 67890 refs/heads/foreign 12345

# although the full object name would be supplied. If the foreign ref
# does not yet exist the <remote object name> will be the all-zeroes
# object name. If a ref is to be deleted, the <local ref> will be
# supplied as (delete) and the <local object name> will be the
# all-zeroes object name. If the local commit was specified by
# something other than a name which could be expanded
# (such as HEAD~, or an object name) it will be supplied as it was
# originally given.

# If this hook exits with a non-zero status, git push will abort without
# pushing anything. Information about why the push is rejected may be
# sent to the user by writing to standard error.

# Load husky
. "$(dirname -- "$0")/_/husky.sh"

npx gobstones-scripts run husky.push
exit
# Read parameters
REMOTE_NAME=$1;
REMOTE_URL=$2;
# Read the input and split it approprietly
INPUT=$(cat);
INPUT_ARR=($INPUT);

LOCAL_REF=${INPUT_ARR[0]}
LOCAL_OBJ_NAME=${INPUT_ARR[1]}
REMOTE_REF=${INPUT_ARR[2]}
REMOTE_OBJ_NAME=${INPUT_ARR[3]}

# We currently use this hook to verify that any commit (to any branch)
# passes the tests configured.
# If a tag is being pushed, then, we generate the documentation
# and publish the generated folder to the corresponding docs branch
# on the origin remote.
# This particular project also updated the version of the library
# to match that of the tag.

# Show welcome message
echo "**************************";
echo "Running pre push hooks";
echo "**************************";
echo "";

# Run all the tests
echo "Running tests";
npx --no -- gobstones-scripts run test --silent;

# If pushing a tag, generate doc and push them as
# a "docs" branch in the remote.
case "$LOCAL_REF" in
refs\/tags*)
# Apply specific code when publishing tags
echo "\nYour tag is being pushed...\n";;
*)
# Apply specific code when publishing any branch
echo "\nYour branch is being pushed...\n";;
esac

exit 0;
82 changes: 75 additions & 7 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -1,11 +1,79 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
# This hook is invoked by git-commit right after preparing
# the default log message, and before the editor is started.

if [ $COMMIT_SOURCE = 'commit' ] && [ -n $SHA1 ]; then
exit 0;
# It takes one to three parameters.

# The first is the name of the file that contains the commit log message.
# The second is the source of the commit message, and can be:
# * message (if a -m or -F option was given);
# * template (if a -t option was given or the configuration option
# commit.template is set);
# * merge (if the commit is a merge or a .git/MERGE_MSG file exists);
# * squash (if a .git/SQUASH_MSG file exists);
# * commit (if a -c, -C or --amend option was given)
# The third is a commit object name if source is commit.

# If the exit status is non-zero, git commit will abort.
# The purpose of the hook is to edit the message file in place,
# and it is not suppressed by the --no-verify option. A non-zero
# exit means a failure of the hook and aborts the commit. It
# should not be used as a replacement for the pre-commit hook.

# The sample prepare-commit-msg hook that comes with Git removes
# the help message found in the commented portion of the commit template.

# Load husky
. "$(dirname -- "$0")/_/husky.sh";

# Read parameters
COMMIT_MSG_FILE=$1;
COMMIT_SOURCE=$2;
SHA1=$3;

# We use this hook to run "cz", that forces the build of a
# semantic commit message through a prompt.

# Show welcome message
echo "**************************";
echo "Generate commit message";
echo "**************************";
echo "";

# Check if we are doing an amend
if [ "$COMMIT_SOURCE" = 'commit' ] && [ -n $SHA1 ]; then
# Amends do not call the "cz" command.
exit 0;
fi
exec < /dev/tty && npx cz --hook || true

# Check if we are doing an squash
if [ "$COMMIT_SOURCE" = 'squash' ]; then
# Squashes should not trigger the cz command.
exit 0;
fi

# Check if we are doing an merge
if [ "$COMMIT_SOURCE" = 'merge' ]; then
# Merging should not trigger the cz command.
exit 0;
fi

# Check if we are using a template
if [ "$COMMIT_SOURCE" = 'template' ]; then
# Cannot use templates, warn the user and fail.
echo "Setting a template through -t or commit.template in this project ";
echo "has been disabled. Please run a simple commit.\n";
exit 1;
fi

# Check if a message was given
if [ "$COMMIT_SOURCE" = 'message' ]; then
# Cannot use message, warn the user and fail.
echo "Setting a message through -m or -F option in this project ";
echo "has been disabled. Please run a simple commit.\n";
exit 1;
fi

# Regular commit has been performed, run the command.
exec < /dev/tty && npx cz --hook || true;
1 change: 0 additions & 1 deletion docs/.nojekyll

This file was deleted.

Loading

0 comments on commit 0cd2f8d

Please sign in to comment.