Total Pageviews

Wednesday, 25 December 2024

搭建基于github issue的静态博客程序 portable-cli

npm install -g portable-cli


portable-cli create blog portable-cli-blog (会在当前目录下,生成portable-cli-blog 目录)
显示:
...
📦 Creating project in C:\Users\12799\portable-cli-blog.

⠋  Download project template. This might take a while...

🎉  Successfully created project portable-cli-blog.

$ cd portable-cli-blog
 ~/portable-cli-blog (main)$ ls
README.md  assets/  config.js  favicon.ico  index.html  index.js

~/portable-cli-blog (main)$ serve -l 1234
访问http://localhost:1234
~/portable-cli-blog (main)$ nano config.js
~/portable-cli-blog (main)$ cat config.js
var config = {
  /** 博客名称 */
  blogname: 'Blog',
  /** document.title 的分割 */
  sep: ' - ',
  /** GitHub账号 */
  user: 'briteming',
  /** GitHub repo 名称 */
  repo: 'portable-cli',
  /** 每页多少篇博客 */
  per_page: 3,
};

~/portable-cli-blog (main)$ serve -l 1234
访问http://localhost:1234 

~/portable-cli-blog (main)$ npm install -g vercel (会生成可执行文件vc)

~/portable-cli-blog (main)$ vc --cwd .

显示:
Vercel CLI 39.1.3
? Set up and deploy “~\portable-cli-blog”? yes
? Which scope should contain your project? luckypoem's projects
? Link to existing project? no
? What’s your project’s name? pcb
? In which directory is your code located? ./
Local settings detected in vercel.json:
No framework detected. Default Project Settings:
- Build Command: `npm run vercel-build` or `npm run build`
- Development Command: None
- Install Command: `yarn install`, `pnpm install`, `npm install`, or `bun install`
- Output Directory: `public` if it exists, or `.`
? Want to modify these settings? no
🔗  Linked to luckypoems-projects/pcb (created .vercel and added it to .gitignore)
🔍  Inspect: https://vercel.com/luckypoems-projects/pcb/BEFj7VJrR1ujXZ88G5YazTBH2fvs [2s]
✅  Production: https://pcb-j0xbweplh-luckypoems-projects.vercel.app [2s]
📝  Deployed to production. Run `vercel --prod` to overwrite later (https://vercel.link/2F).
💡  To change the domain or build command, go to https://vercel.com/luckypoems-projects/pcb/settings

或者上传静态网站的根目录~/portable-cli-blog/的内容到app.netlify.com/drop, 得到的网址是

https://darling-salmiakki-7393eb.netlify.app

演示网址:

https://pcb-j0xbweplh-luckypoems-projects.vercel.app

https://darling-salmiakki-7393eb.netlify.app

项目地址:

https://github.com/niexia/portable-cli

https://github.com/briteming/portable-cli

这个程序好像有点神奇。通常直接从静态网站的根目录上传内容到vercel.com空间或netlify.com空间,得到的网站是无法更新的。而这次,我在https://github.com/briteming/portable-cli/issues/new这里提交新的issue后,我的这个博客网站https://pcb-j0xbweplh-luckypoems-projects.vercel.app竟然自动更新了上传到netlify.com空间后,得到的网站https://darling-salmiakki-7393eb.netlify.app也自动更新了

------------------------------------------------------------------------

我今天才注意到 在vercel.com部署的网站需要访问者登录 vercel.com后,才能访问。如果要禁用这一要求,步骤如下:

To make your Vercel deployment publicly accessible without requiring visitors to log in, you can adjust the deployment protection settings. Here's how you can do it:

  1. Go to the Vercel Dashboard: Log in to your Vercel account and navigate to the dashboard.

  2. Select Your Project: Choose the project you want to make publicly accessible.

  3. Access Deployment Protection Settings: Go to the "Settings" tab for your project, then select "Deployment Protection."

  4. Disable Vercel Authentication: In the Vercel Authentication section, use the toggle to disable the feature. This will remove the login requirement for accessing your deployment.

  5. Save Changes: Make sure to save your changes to apply the new settings.

By following these steps, your deployment should become publicly accessible without requiring visitors to log in to Vercel.

现在,你无需登录vercel.com, 就可访问我的网站:

https://pcb-j0xbweplh-luckypoems-projects.vercel.app









No comments:

Post a Comment