Skip to content

Commit

Permalink
feat(Taskfile): add node and GitHub Copilot commands
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jun 29, 2023
1 parent 072cad1 commit 54501a2
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 31 deletions.
82 changes: 51 additions & 31 deletions Taskfile.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tasks:

clone-global-taskfile:
desc: Clone the global Taskfile.dist.yaml to the current directory
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- cp $HOME/Taskfile.dist.yaml Taskfile.dist.yaml

Expand Down Expand Up @@ -64,134 +64,134 @@ tasks:

init-hyperfast-project:
desc: Create a new project using the hyperfast template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- copier copy --UNSAFE gh:entelecheia/hyperfast-template .

init-hyfi-project:
desc: Create a new project using the hyfi template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- copier copy --UNSAFE gh:entelecheia/hyfi-template .

init-hyperfast-python-project:
desc: Create a new Python project using the hyperfast template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- copier copy --UNSAFE gh:entelecheia/hyperfast-python-template .

init-hyperfast-docker-project:
desc: Create a new Docker project using the hyperfast template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- copier copy --UNSAFE gh:entelecheia/hyperfast-docker-template .

reinit-hyperfast-python-project:
desc: Reinitialize a project using the hyperfast python template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- args=(); while IFS= read -r file; do args+=("--skip" "$file"); done < .copierignore; copier copy "${args[@]}" --answers-file .copier-config.yaml --UNSAFE gh:entelecheia/hyperfast-python-template .

reinit-hyperfast-docker-project:
desc: Reinitialize a project using the hyperfast docker template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- args=(); while IFS= read -r file; do args+=("--skip" "$file"); done < .copierignore; copier copy "${args[@]}" --answers-file .copier-config.yaml --UNSAFE gh:entelecheia/hyperfast-docker-template .

reinit-hyperfast-project:
desc: Reinitialize a project using the hyperfast template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- args=(); while IFS= read -r file; do args+=("--skip" "$file"); done < .copierignore; copier copy "${args[@]}" --answers-file .copier-config.yaml --UNSAFE gh:entelecheia/hyperfast-template .

reinit-hyfi-project:
desc: Reinitialize a project using the hyfi template
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- args=(); while IFS= read -r file; do args+=("--skip" "$file"); done < .copierignore; copier copy "${args[@]}" --data 'code_template_source=gh:entelecheia/hyfi-template' --answers-file .copier-config.yaml --UNSAFE gh:entelecheia/hyperfast-python-template .

semantic-release-version:
desc: Print the current version using semantic-release
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- semantic-release print-version --current

semantic-release-next-version:
desc: Print the next version using semantic-release
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- semantic-release print-version --next

semantic-release-changelog:
desc: Print the changelog using semantic-release
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- semantic-release changelog --released

semantic-release-next-change:
desc: Print the next change using semantic-release
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- semantic-release changelog --unreleased

semantic-release-noop:
desc: Run semantic-release in noop mode (dry run)
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- semantic-release --noop -v DEBUG

semantic-prerelease-noop:
desc: Run semantic-release in noop mode (dry run) for a prerelease
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- semantic-release --noop --prerelease -v DEBUG

git-show-branches:
desc: Show branches in the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git show-branch --list

git-show-tags:
desc: Show tags in the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git tag --list

git-show-remotes:
desc: Show remotes in the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git remote --verbose

git-show-refs:
desc: Show refs in the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git show-ref

git-checkout-branch:
desc: Checkout a branch in the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git checkout {{.CLI_ARGS}}

git-checkout-main:
desc: Checkout the main branch in the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git checkout main

git-checkout-branch-upstream:
desc: Checkout a branch in the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git checkout -B {{.CLI_ARGS}}
- git push --set-upstream origin {{.CLI_ARGS}}

git-sync-fork-main:
desc: Sync a fork with the main branch of the upstream repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git fetch upstream
- git checkout main
Expand All @@ -201,13 +201,13 @@ tasks:
# ref: https://adamj.eu/tech/2023/02/13/git-skip-hooks/
git-disable-hook:
desc: Disable a Git hook (Skip “unskippable” hooks, e.g. lfs hooks)
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git config core.hooksPath /dev/null

git-enable-hook:
desc: Enable a Git hook (unset core.hooksPath)
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git config --unset core.hooksPath

Expand All @@ -225,25 +225,25 @@ tasks:

git-clone-skip-smudge:
desc: Clone a Git repository with LFS smudge filter set to skip
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- GIT_LFS_SKIP_SMUDGE=1 git clone {{.CLI_ARGS}}

git-lfs-install:
desc: Install Git LFS
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git lfs install

git-lfs-track:
desc: Track files with Git LFS
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git lfs track {{.CLI_ARGS}}

git-lfs-track-preset:
desc: Track files with Git LFS using a preset
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git lfs track "*.parquet"
- git lfs track "*.pkl"
Expand Down Expand Up @@ -276,13 +276,13 @@ tasks:

git-lfs-migrate:
desc: Migrate files to Git LFS
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git lfs migrate import --everything --include={{.CLI_ARGS}}

lfs-folderstore-init:
desc: Initialize the LFS folderstore for the current Git repository
dir: '{{.USER_WORKING_DIR}}'
dir: "{{.USER_WORKING_DIR}}"
cmds:
- git config --add lfs.customtransfer.lfs-folder.path "${HOME}/.local/bin/lfs-folderstore"
- git config --add lfs.customtransfer.lfs-folder.args "/home/yj.lee/workspace/onedrive/lfs-folderstore"
Expand All @@ -308,3 +308,23 @@ tasks:
desc: Print system information using inxi
cmds:
- inxi -F

install-node-lts:
desc: Install the latest LTS version of Node.js
cmds:
- export NVM_DIR="${HOME}/.nvm"; [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"; nvm install --lts

nvm-ls:
desc: List installed Node.js versions
cmds:
- export NVM_DIR="${HOME}/.nvm"; [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"; nvm ls

set-default-node:
desc: Set the default Node.js version
cmds:
- export NVM_DIR="${HOME}/.nvm"; [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"; nvm alias default node

install-github-copilot-cli:
desc: Install the GitHub Copilot CLI
cmds:
- npm install -g @githubnext/github-copilot-cli
20 changes: 20 additions & 0 deletions chezmoi/Taskfile.dist.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ tasks:
cmds:
- ps aux | grep {{"{{.CLI_ARGS}}"}} | awk {{"'{print $2}'"}} | xargs kill -9

install-node-lts:
desc: Install the latest LTS version of Node.js
cmds:
- export NVM_DIR="${HOME}/.nvm"; [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"; nvm install --lts

nvm-ls:
desc: List installed Node.js versions
cmds:
- export NVM_DIR="${HOME}/.nvm"; [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"; nvm ls

set-default-node:
desc: Set the default Node.js version
cmds:
- export NVM_DIR="${HOME}/.nvm"; [ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"; nvm alias default node

install-github-copilot-cli:
desc: Install the GitHub Copilot CLI
cmds:
- npm install -g @githubnext/github-copilot-cli

tmux-new:
desc: Create a new tmux session
cmds:
Expand Down

0 comments on commit 54501a2

Please sign in to comment.