ไม่มีการโฮสต์ฝั่งเซิร์ฟเวอร์ฟังก์ชั่นคลาวด์แบบไม่มีเซิร์ฟเวอร์หรือฐานข้อมูลที่จำเป็น Suri Static Sites สามารถนำไปใช้กับ vercel, netlify และอื่น ๆ (โดยปกติฟรี) ในไม่กี่นาที
Suri doesn't care about "technically superior" 3xx server redirects. Suri แค่ต้องการให้คุณใช้โดเมนนั้นในที่สุดคุณใช้จ่าย $ 59/ปีและนำลิงก์สั้น ๆ ของคุณกลับมาจาก Bitlys และ Tinyurls ของเว็บ
https://surishort.link/gh ⇒ https://github.com/surishortlink/suri
https://surishort.link เป็นเว็บไซต์ตัวอย่างที่แสดงให้เห็นว่า Suri กำลังดำเนินการ คุณสามารถตรวจสอบที่เก็บข้อมูลสำหรับเว็บไซต์และไฟล์ที่จัดการลิงค์เพื่อดูว่ามันทำงานอย่างไร
Suri มีที่เก็บแม่แบบที่ทำให้ง่ายต่อการเริ่มต้น เลือกแพลตฟอร์มที่คุณปรับใช้และทำตามคำแนะนำทีละขั้นตอน:
ไม่ได้ปรับใช้กับหนึ่งในแพลตฟอร์มเหล่านั้น? ไม่ต้องกังวล นี่คือตัวเลือกทั่วไปบางอย่างที่ครอบคลุมสถานการณ์อื่น ๆ ส่วนใหญ่ไม่ว่าจะเป็นผู้ให้บริการคลาวด์ที่แตกต่างกันหรือโฮสต์ด้วยตัวเอง:
At the heart of Suri is the links.json file, located in the src directory, where you manage your links. ที่เก็บแม่แบบทั้งหมดรวมไฟล์นี้ที่มีตัวอย่างบางส่วน:
{
"/" : " https://www.youtube.com/watch?v=CsHiG-43Fzg " ,
"1" : " https://fee.org/articles/the-use-of-knowledge-in-society/ " ,
"gh" : " https://github.com/surishortlink/suri "
} มันไม่ง่ายกว่า: คีย์คือเส้นทาง "ลิงก์สั้น" ที่ได้รับการเปลี่ยนเส้นทางและค่าคือ URL เป้าหมาย คีย์อาจสั้นหรือนานเท่าที่คุณต้องการโดยใช้ส่วนผสมของตัวละครที่คุณต้องการ / is a special entry for redirecting the root path.
Suri ships with a suri executable file that generates the static site from the links.json file. The static site is output to a directory named build .
All of the template repositories are configured with a build script that invokes this executable, making the command you run simple:
npm run build When you make a change to the links.json file, simply re-run this command to re-generate the static site, which can then be re-deployed. หลายแพลตฟอร์มที่ Suri มีที่เก็บแม่แบบสำหรับได้รับการกำหนดค่าให้ทำสิ่งนี้โดยอัตโนมัติ
Configuration is handled through the suri.config.json file in the root directory. มีเพียงตัวเลือกเดียว ณ จุดนี้:
| ตัวเลือก | คำอธิบาย | พิมพ์ | ค่าเริ่มต้น |
|---|---|---|---|
js | Whether to redirect with JavaScript instead of a <meta> refresh. | บูลีน | false |
Finally, any files in the public directory will be copied over to the build directory without modification when the static site is built. This can be useful for files like favicon.ico or robots.txt (that said, Suri provides sensible defaults for both).
หากก่อนหน้านี้คุณแยก/โคลนที่เก็บนี้เมื่ออยู่ในเวอร์ชัน 0.1 ถึง 0.5.1 คุณจะสังเกตเห็นความแตกต่างเล็กน้อยในขณะนี้ด้วยเวอร์ชัน 1
เวอร์ชัน 1 แก้ปัญหาหลักสามฉบับด้วยเวอร์ชัน 0:
render.yaml for Render and app.json for Heroku (among others) in your repository. V1 แก้ไขปัญหานี้โดยมีที่เก็บแม่แบบแยกต่างหากสำหรับแต่ละแพลตฟอร์มซึ่งรวมไฟล์ที่จำเป็นสำหรับแพลตฟอร์มนั้นเท่านั้น แล้วคุณจะอัปเกรดได้อย่างไร? If you only ever edited your links.json file, upgrading is simple:
links.json file.public directory, copy those over.SURI_JS to 1 , change js to true in suri.config.json . If you edited any of the Eleventy files – such as the links.njk template – you probably just want to stick to v0 and continue using Eleventy.
มีการเปลี่ยนแปลงที่น่าสังเกตอีกสองสามอย่างใน V1 นอกเหนือจากนั้น:
build instead of _site .suri.config.json file instead of environment variables.npm run clean to delete the build directory. npm run build does this automatically before each new build. มิฉะนั้นคุณสามารถเพิ่มกลับมาด้วยตนเองหากคุณพบว่ามีประโยชน์npm run dev to build, watch, and serve the static site during development. มันเกินความจริงสำหรับหน้า HTML ขนาดเล็กที่ Suri สร้างขึ้นnpm run lint to lint with Prettier. คุณสามารถเพิ่มกลับมาด้วยตนเองหากคุณพบว่ามีประโยชน์npm run release to release a new version of Suri. คุณสามารถเพิ่มมันกลับมาด้วยตนเองหากคุณต้องการแท็กที่เก็บเวอร์ชันของคุณjstayton user on GitHub to a new surishortlink organization for all Suri-related repositories. The only prerequisite is a compatible version of Node.js (see engines.node in package.json ).
ติดตั้งการพึ่งพาด้วย NPM:
npm installโมดูลทดสอบ Node.js ในตัวและโมดูลการยืนยันใช้สำหรับการทดสอบ
เพื่อเรียกใช้การทดสอบ:
npm testในระหว่างการพัฒนาขอแนะนำให้เรียกใช้การทดสอบโดยอัตโนมัติเกี่ยวกับการเปลี่ยนแปลงไฟล์:
npm test -- --watchJSDOC ใช้เพื่อจัดทำเอกสารรหัส
To generate the docs as HTML to the (git-ignored) docs directory:
npm run docsPrettier คือการตั้งค่าเพื่อบังคับใช้รูปแบบรหัสที่สอดคล้องกัน ขอแนะนำอย่างยิ่งให้เพิ่มการรวมเข้ากับตัวแก้ไขของคุณซึ่งจัดรูปแบบโดยอัตโนมัติในการบันทึก
ESLINT ถูกตั้งค่าด้วยกฎ "แนะนำ" เพื่อบังคับใช้ระดับคุณภาพของรหัส นอกจากนี้ยังขอแนะนำให้เพิ่มการรวมเข้ากับเครื่องมือแก้ไขของคุณซึ่งจัดรูปแบบโดยอัตโนมัติในการบันทึก
เพื่อเรียกใช้ผ่านบรรทัดคำสั่ง:
npm run lint When the development branch is ready for release, Release It! ใช้ในการจัดทำกระบวนการเผยแพร่:
npm run release Once the release process is complete, merge the development branch into the main branch, which should always reflect the latest release.