npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

deploy-web-entry

v0.0.5

Published

make change app entry file name, without client site old cache

Downloads

90

Readme

Why? 為什麼?

在寫網頁時不管使用原生或是前端框架,都會有一個網站的進入點,而要部屬到機器上時會使用到Web server像是Nginx或是Apache,而這個進入點會被使用者端的瀏覽器快取住,使得前端應用程式在更新版本之後,如果開發端不採取其他熱更新手段甚至放棄網站快取,則使用者必需清除網站的快取才能使用到最新的版本。

因此使用這個工具在每次部屬時執行Web server前,將進入點改為不一樣的名稱,並寫入Web server的設定檔,使執行Web server後使用者端拿到的進入點會與上一個應用程式版本不同而不會使用到上一個應用程式的快取。

When writing web pages, no matter whether you use native or front-end frameworks, there will be an entry point for the website, and when deploying to the machine, a web server such as Nginx or Apache will be used, and this entry point will be used by the user's browser. Cached, so that after the front-end application is updated, if the developer does not take other hot update methods or even abandons the website cache, the user must clear the website's cache to use the latest version.

So use this tool to change the entry point to a different name before executing the Web server every time you deploy, and write it into the Web server's configuration file, so that the entry point obtained by the user after executing the Web server will be the same as the previous one. The application version is different and will not use the cache of the previous application.

Usage 使用

命令參數

nginx-path 部屬位置 nginx.conf 的路徑
entry-file-path 部屬位置 進入點的路徑,通常為 index.html 所在路徑

使用 Nginx 部屬

將nginx.conf index改為 ${deploy_web_entry}

server {
    listen 80;
    root /usr/share/nginx/html;
    index ${deploy_web_entry};

    error_log /usr/local/error.log;
    access_log /usr/local/access.log main;


    location / {
        try_files $uri $uri/ @fallback;
        index index.html;
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
    }

    location @fallback {
        rewrite ^.*$ /index.html break;
        add_header Cache-Control no-cache;
    }

    # static files
    location ~ .*\\.(?:ico|js|gif|jpe?g|png|css|js|mp3) {
        expires max;
    }
}