Thank you all.
You all gave me greate ideas.
Josh, no need to spend time on this.
I will create my own script (remove the .DS files is also a good idea - I
hate the mac pollute all my folders with that).

Harbs <harbs.li...@gmail.com> escreveu no dia quinta, 9/03/2023 à(s) 21:56:

> Yes. My script also has some "aws s3 sync", "aws s3 cp” and "aws
> cloudfront create-invalidation” commands to upload the app after updating
> the version info.
>
> The sync commands (for the whole release directory has these arguments:
>
>  --exclude "*.DS_Store*" --delete --cache-control max-age=2592000 --acl
> public-read
>
> The cp command for the index.html file has these arguments:
>
>  --metadata-directive REPLACE --cache-control max-age=60,public
> --content-type text/html --acl public-read
>
>
> > On Mar 9, 2023, at 11:42 PM, Hugo Ferreira <hferreira...@gmail.com>
> wrote:
> >
> > Thank you.
> >
> > OK, after you build-release you run a script that does exactly that.
> >
> > Harbs <harbs.li...@gmail.com> escreveu no dia quinta, 9/03/2023 à(s)
> 21:37:
> >
> >> I have a bash script to stage my app that looks like this:
> >>
> >> version=$(cat $DIR/releases.json | jq '.version')
> >> version="${version%\"}"
> >> version="${version#\"}"
> >>
> >> build=$(node -e 'console.log(Date.now())')
> >> jq '.build = '$build releases.json > tmp.$$.json && mv tmp.$$.json
> >> releases.json
> >>
> >> sed -ie "s/MyApp.js/MyApp.js?{build_number}/g" bin/js-release/index.html
> >> sed -ie "s/{build_number}/$build/g" bin/js-release/index.html
> >> sed -ie "s/{version_number}/$version/g" bin/js-release/index.html
> >>
> >> releases.json has the version and the build number is updated by this
> >> script.
> >>
> >> The template html has this:
> >>
> >>                <meta name="build" content="{build_number}">
> >>                <meta name="version" content="{version_number}">
> >>                <link rel="stylesheet" type="text/css"
> >> href="${application}.css?{build_number}">
> >>
> >> The HTML file on the server has a very short TTL. The rest of the files
> >> have a much longer TTL. The build script busts the cache when it’s
> deployed.
> >>
> >> Change “MyApp” to the name of your app.
> >>
> >> HTH,
> >> Harbs
> >>
> >>
> >>> On Mar 9, 2023, at 10:43 PM, Hugo Ferreira <hferreira...@gmail.com>
> >> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I'm releasing now updates more often and sometimes (many times), the
> >>> browser cache my App.js
> >>> In a quick google search I found a solution (more a workaround) =>
> >>>
> >>
> https://stackoverflow.com/questions/1011605/clear-the-cache-in-javascript
> >>> When I build - release with VS Code, it inject this line on my html
> >>> file:<script type="text/javascript" src="./App.js"></script>
> >>> So, I don't have control over it.
> >>>
> >>> What I would like to do is something like have a version flag of my App
> >> in
> >>> the asconfig.json and when I build - relase the compiler inject
> something
> >>> like:<script type="text/javascript" src="./App.js?v=1"></script>
> >>> <script type="text/javascript" src="./App.js?v=2"></script>
> >>> ...
> >>>
> >>> This is possible today ?
> >>>
> >>> Regards,
> >>> Hugo.
> >>
> >>
>
>

Reply via email to