@asunlabs/setup-template
Content
Git
Commit convention
Run
git config --local commit.template .gitmessage.txt
Tag
Run
# create
git tag [tag-name-here]
# push
git push origin [tag-name-here]
# remove from local
git tag -d [tag-name-here]
# remove from remote
git push origin :[tag-name-here]
Or use package manager for semver
.
pnpm version patch
pnpm version minor
pnpm version major
Hook
pnpm format
and pnpm lint
is hooked up on pre-push. Check out .husky/pre-push
and package.json
.
Config
Check out .gitconfig.example
and configure it at .git/config
# list of alias
h = help
aa = add . # add all
c = commit
p = pull
pom = pull origin main
ps = push
pf = push -f
cn = checkout -b # check out to a new branch
sm = switch main # check out to main
Submodule
Get what you need from another repo with git submodule.
Run to add
git submodule add https://github.com/developerasun/developerasun.git
Check status.
git submodule
# result
# 52d2c4b80553858db28cbe92ee3923a4c1fec531 developerasun (heads/main)
Run to update
cd submodule
# get latest commit
git pull
Run to remove
# step 1
git submodule deinit -f <submodule-name>
# step 2
rm -rf .git/modules/<submodule-name>
# step 3
git rm -f <submodule-name>
Empty submodule
If submodule directory is empty, try below.
Clone this repo with --recursive flag to clone with all the submodules.
git clone <https-url> --recursive
Or, if you already cloned,
git submodule update --init
Husky
Run
# Mac
pnpm dlx husky-init && pnpm install # pnpm
# Windows
pnpm dlx husky-init -and pnpm install # pnpm
Edit .husky/pre-push
and package.json
for pre-push hook.
Dependencies
Run preinstall
for global dependency if there is any.
pnpm preinstall
Check node, npm, package manager version.
"packageManager": "[email protected]",
"engines": {
"node": ">=18.12.1",
"npm": ">=8.19.2"
}
Package manager
Use ni
if there are more than one single package manager in project.
Run
# CLI
npm i -g @antfu/ni
# From package.json
pnpm preinstall
And then,
ni <package-name># install
nun <package-name># uninstall
nr format # run prettier
nr lint # run eslint
D2 diagram
- D2 works in UNIX OS.
Install
# install
curl -fsSL https://d2lang.com/install.sh | sh -s --
# uninstall
curl -fsSL https://d2lang.com/install.sh | sh -s -- --uninstall
Write diagram in d2
# Actors
hans: Hans Niemann
defendants: {
mc: Magnus Carlsen
playmagnus: Play Magnus Group
chesscom: Chess.com
naka: Hikaru Nakamura
mc -> playmagnus: Owns majority
playmagnus <-> chesscom: Merger talks
chesscom -> naka: Sponsoring
}
# Accusations
hans -> defendants: 'sueing for $100M'
# Offense
defendants.naka -> hans: Accused of cheating on his stream
defendants.mc -> hans: Lost then withdrew with accusations
defendants.chesscom -> hans: 72 page report of cheating
Render it in browser.
d2 --watch sample.d2 test.svg
Prettier
Run
pnpm format
Edit .prettierrc.js
for more detailed configuration.
ESLint
Install with
pnpm create @eslint/config
Basic setup is as follows.
- targeting typescript
- running in node
- ESM
- configuring with Javascript file
Edit .eslinrc.js
for more detailed configuration.
Run
pnpm lint
Contribution
Star History
Contact
🔊