ຂັ້ນຕອນການເຮັດວຽກ
Table of Contents
ຄຳແນະນຳເຫຼົ່ານີ້ຖືວ່າເຈົ້າມີບັນຊີ github ຢູ່ແລ້ວ ແລະ ໄດ້ຕິດຕັ້ງ Git ແລ້ວນຳ. ໃຫ້ແນ່ໃຈວ່າ git ຢູ່ໃນ PATH ຂອງເຈົ້າ ໂດຍການລັນຄຳສັ່ງ git ໃນ terminal ຫຼື cmd ແລະ ກວດເບິ່ງວ່າມັນບໍ່ໄດ້ແຈ້ງຂໍ້ຜິດພາດ ເຊັ່ນ “command not found”. ຖ້າເຈົ້າຍັງບໍ່ທັນໄດ້ຕິດຕັ້ງ git, ໃຫ້ປະຕິບັດຕາມຄຳແນະນຳນີ້.
#ການຂຽນເອກະສານສຳລັບຟີເຈີທີ່ຍັງບໍ່ທັນມີຂໍ້ມູນ
ພວກເຮົາມີຄວາມສົນໃຈເປັນພິເສດໃນການຂຽນເອກະສານສຳລັບ pull request ທີ່ຖືກປິດແລ້ວ ເຊິ່ງຈຳເປັນຕ້ອງເພີ່ມ ຫຼື ປ່ຽນແປງຂໍ້ມູນໃນຄູ່ມືນີ້. Pull request ທີ່ຕ້ອງການເອກະສານຈະຖືກຕິດປ້າຍ label ໃນ GitHub ວ່າ documentation: pending.
ຂັ້ນຕອນຫຼັກໆໃນການເຮັດມີດັ່ງນີ້:
-
ເບິ່ງລາຍການຂອງ Pull Requests ທີ່ຕ້ອງການເອກະສານ.
-
ເລືອກ Pull Request ທີ່ເຈົ້າເຂົ້າໃຈວ່າການປ່ຽນແປງນັ້ນແມ່ນຫຍັງ.
-
ຂຽນການປ່ຽນແປງຕາມລາຍລະອຽດໃນ workflow ດ້ານລຸ່ມ.
-
ເມື່ອເຈົ້າສ້າງ Pull Request, ໃຫ້ໃສ່ລິ້ງໄປຫາ pull request ຈາກຂັ້ນຕອນທີ 1 ນຳ.
#ຂັ້ນຕອນການເຮັດວຽກຂອງເອກະສານ
#ການຕັ້ງຄ່າຄັ້ງທຳອິດ
ຖ້າເຈົ້າຍັງບໍ່ທັນໄດ້ຕັ້ງຄ່າ git ໃນເຄື່ອງ, ໃຫ້ໃຊ້ສອງຄຳສັ່ງນີ້ເພື່ອຕັ້ງຄ່າຕົວຕົນຂອງເຈົ້າກ່ອນທີ່ຈະ commit:
-
git config --global user.email "you@example.com" -
git config --global user.name "Your Name"
ແລະ ຖ້າເຈົ້າຍັງບໍ່ທັນໄດ້ຢືນຢັນຕົວຕົນ git ໃນເຄື່ອງກັບ github, ໃຫ້ປະຕິບັດຕາມຄຳແນະນຳສຳລັບ GitHub CLI ທີ່ນີ້. ສິ່ງນີ້ຈະເຮັດໃຫ້ໝັ້ນໃຈວ່າເຈົ້າໄດ້ຕັ້ງຄ່າ keys ແລະ ຂໍ້ມູນການຢືນຢັນຕົວຕົນຢ່າງຖືກຕ້ອງ.
ຈາກນັ້ນ ເຈົ້າສາມາດ clone ສຳເນົາຂອງ dtdocs ລົງໃນຄອມພິວເຕີຂອງເຈົ້າໄດ້.
-
ໄປທີ່
https://github.com/darktable-org/dtdocs. -
ກົດປຸ່ມ
Forkແລ້ວຕາມດ້ວຍປຸ່ມCreate fork. -
ເຈົ້າຈະຖືກສົ່ງໄປຫາໜ້າ fork ຂອງເອກະສານ darktable ທີ່ເປັນຂອງເຈົ້າເອງ. ກົດປຸ່ມ
Codeແລ້ວກັອບປີ້ລິ້ງພາຍໃຕ້ HTTPS. -
ເປີດ terminal ຫຼື cmd ໃນໂຟນເດີທີ່ເຈົ້າຕ້ອງການໃຫ້ຄັງເກັບເອກະສານ darktable ຢູ່. ເຊັ່ນ ‘C:\Users\YourUser\Documents' ຫຼື ‘/home/youruser/Documents/builds’. ທັງໃນ windows ແລະ macOS/Linux ເຈົ້າສາມາດໃຊ້ຄຳສັ່ງຕໍ່ໄປນີ້ເພື່ອໄປຍັງໂຟນເດີທີ່ຕ້ອງການ:
cd C:\Users\YourUser\Documents\ໂດຍປ່ຽນເປັນຊື່ໂຟນເດີຂອງເຈົ້າເອງ. -
Clone ຄັງເກັບ dtdocs ໂດຍການລັນ:
git clone https://github.com/<your username>/dtdocs.gitໂດຍປ່ຽນ URL ເປັນລິ້ງທີ່ເຈົ້າກັອບປີ້ມາໃນຂັ້ນຕອນທີ 3. -
ຕອນນີ້ເຈົ້າມີສຳເນົາຂອງຄັງເກັບ dtdocs ໃນ PC ແລ້ວ. ຈະມີການຕັ້ງຄ່າອີກເລັກນ້ອຍກ່ອນທີ່ເຈົ້າຈະເລີ່ມແກ້ໄຂໄຟລ໌ໄດ້.
#ການຊິງໂຄຣໄນການປ່ຽນແປງ
-
ໄປທີ່ repositories ຂອງເຈົ້າໃນ github ແລ້ວເລືອກ darktable ທີ່ເຈົ້າ fork ມາ.
-
ກົດ
Sync fork. -
ເປີດ terminal ຫຼື cmd ໃນໂຟນເດີຄັງເກັບ darktable ຂອງເຈົ້າ.
-
ກວດເບິ່ງໃຫ້ແນ່ໃຈວ່າເຈົ້າບໍ່ມີການປ່ຽນແປງທີ່ຄ້າງຢູ່ໂດຍການລັນ
git statusແລ້ວລັນgit checkout master(ຖ້າເຈົ້າເຮັດຕາມຄູ່ມືນີ້ເປັນຄັ້ງທຳອິດ ເຈົ້າຈະຢູ່ທີ່ master ຢູ່ແລ້ວ). -
ລັນ
git pull(ສິ່ງນີ້ຈະເຮັດໃຫ້ສຳເນົາໃນເຄື່ອງຂອງເຈົ້າອັບເດດໃຫ້ກົງກັບ fork ໃນ github).
ຫຼື ເຈົ້າສາມາດຊິງໂຄຣໄນ fork ແລະ ສຳເນົາໃນເຄື່ອງຜ່ານ terminal ກໍໄດ້:
-
ກວດເບິ່ງໃຫ້ແນ່ໃຈວ່າບໍ່ມີການປ່ຽນແປງທີ່ຄ້າງຢູ່ໂດຍການລັນ
git statusແລ້ວລັນgit checkout master. -
ກວດເບິ່ງ remote repositories ຂອງເຈົ້າ:
git remote -v. ເຈົ້າຄວນເຫັນຢ່າງໜ້ອຍorigin(fork ຂອງເຈົ້າ). ຖ້າບໍ່ມີupstream, ໃຫ້ເພີ່ມມັນໃນຂັ້ນຕອນຕໍ່ໄປ. -
ເພີ່ມຄັງເກັບ dtdocs ເປັນ upstream (ເຮັດພຽງຄັ້ງດຽວ):
git remote add upstream https://github.com/darktable-org/dtdocs.git. -
Pull ສະຖານະປັດຈຸບັນຈາກຄັງເກັບຫຼັກມາຍັງສຳເນົາໃນເຄື່ອງ:
git pull upstream master. -
Push ສຳເນົາໃນເຄື່ອງທີ່ຊິງໂຄຣໄນແລ້ວໄປທີ່ fork ຂອງເຈົ້າ:
git push origin master.
#ການສ້າງ Branch, ແກ້ໄຂ ແລະ ສ້າງ pull request
-
ເປີດ terminal ຫຼື cmd ໃນໂຟນເດີຄັງເກັບເອກະສານ darktable ຂອງເຈົ້າ.
-
ລັນ
git pull origin masterເພື່ອດຶງການປ່ຽນແປງຫຼ້າສຸດຈາກ GitHub. -
ລັນ
git checkout -b branch-nameໂດຍປ່ຽນbranch-nameເປັນຊື່ branch ທີ່ເຈົ້າຕ້ອງການ. ໂດຍທົ່ວໄປຄວນຕັ້ງຊື່ໃຫ້ກ່ຽວຂ້ອງກັບວຽກທີ່ເຈົ້າເຮັດ. ຕົວຢ່າງ, ສຳລັບ PR ນີ້ https://github.com/darktable-org/darktable/pull/17589 ເຈົ້າອາດຈະຕັ້ງຊື່ວ່າdt-synch-edit-docs. -
ເລີ່ມເຮັດວຽກກ່ຽວກັບເອກະສານ.
-
ກວດສອບໄຟລ໌ທີ່ເຈົ້າປ່ຽນແປງດ້ວຍ
git status. ຖ້າເຈົ້າມີໄຟລ໌ທີ່ຖືກແກ້ໄຂຫຼາຍກວ່າທີ່ຕັ້ງໃຈຈະສົ່ງ, ເຈົ້າສາມາດໃຊ້git restore path/to/file/ເພື່ອຍົກເລີກການປ່ຽນແປງໃນໄຟລ໌ນັ້ນ. -
ລັນ
git add -A. ສິ່ງນີ້ຈະ stage ໄຟລ໌ທີ່ປ່ຽນແປງທັງໝົດ. -
ລັນ
git commit -m "Added documentation for yada yada". ພາຍໃນເຄື່ອງໝາຍ "" ໃຫ້ໃສ່ຂໍ້ຄວາມສັ້ນໆກ່ຽວກັບວຽກທີ່ເຈົ້າໄດ້ເຮັດ. -
ລັນ
git push --set-upstream origin branch-nameໂດຍປ່ຽນ branch-name ເປັນຊື່ທີ່ເຈົ້າເລືອກໄວ້ກ່ອນໜ້ານີ້. -
ສ້າງ pull request ຂອງເຈົ້າໂດຍປະຕິບັດຕາມຄຳແນະນຳດ້ານລຸ່ມ.
-
ຖ້າເຈົ້າຕ້ອງການແກ້ໄຂເພີ່ມເຕີມໃນ branch ເດີມ, ໃຫ້ເຮັດຂັ້ນຕອນ 3-8 ຊ້ຳຄືນ. ໃນຂັ້ນຕອນທີ 3 ເຈົ້າສາມາດຂ້າມ
-bໄປໄດ້ ແລະ ໃນຂັ້ນຕອນທີ 8 ເຈົ້າສາມາດລັນພຽງແຕ່git push. -
ຫຼັງຈາກທີ່ເຈົ້າເຮັດສຳເລັດແລ້ວ ແລະ pull request ຂອງເຈົ້າຖືກ merge ຫຼື ເຈົ້າສຳເລັດວຽກສຳລັບ pull request ນັ້ນແລ້ວ, ໃຫ້ລັນ
git checkout masterເພື່ອກັບໄປທີ່ master branch. ຂ້ອຍແນະນຳໃຫ້ເຮັດວຽກພຽງເທື່ອລະ branch/pr ຖ້າເຈົ້າຍັງບໍ່ຊຳນານໃນການໃຊ້ git.
#Pull request
-
ກົດ
compare across forks. ເລືອກ repository ຂອງເຈົ້າ, ແລ້ວເລືອກ branch ທີ່ເຈົ້າຫາພ້ອມແກ້ໄຂ. -
ກົດ
Create Pull Request
#Running hugo locally to preview changes
hugo can also be executed locally to create a local live preview of the docs. This is useful to check for formatting, links etc. Install hugo through the means fitting your OS and make sure dart-sass is installed/available in your path.
#1. Use a compatible Hugo version
The official deployment uses hugo v0.152.2+extended, it makes sense to use the same binary for local testing instead of the latest release, usually installed by your package manager. Download the matching binary from the Hugo releases page instead (hugo_extended_0.152.2_<os>-<arch>) and put it in your PATH, e.g. for Linux as follows:
mkdir -p ~/.local/opt/hugo-0.152.2 ~/.local/bin
curl -L https://github.com/gohugoio/hugo/releases/download/v0.152.2/hugo_extended_0.152.2_linux-amd64.tar.gz | tar xz -C ~/.local/opt/hugo-0.152.2
ln -s ~/.local/opt/hugo-0.152.2/hugo ~/.local/bin/hugo-0.152
You can now call that version with hugo-0.152.
#2. Generate the stylesheets
Before you can preview the site with Hugo you need to generate the stylesheets:
cd ./themes/hugo-darktable-docs-theme/assets/
yarn install
Instead of yarn install you can use npm install.
#3. Start the preview
Execute hugo-0.152 server -D --disableFastRender (or hugo server … to use a hugo version installed via package manager) from the base directory of your local repository. When no errors are encountered, the terminal reports Web Server is available at http://localhost:1313/usermanual/development/ and the site is available at that URL. Hugo will monitor the directory for changes and redeploy upon changing files automatically. When you have a specific page open and make changes to the corresponding .md file the browser should also reload the page after hugo has automatically redeployed.