Skip to content

Commit 04e8b0a

Browse files
committed
Generated meta file should be named meta.json
1 parent 49b23dd commit 04e8b0a

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ There are different approaches that work for different types of websites. I rece
99
- We want the site to load from the cache if there is no new version
1010
- We want to refresh the cache every time a new version of the app is deployed
1111
- We use npm package versioning to version our app and each deploy will be versioned incrementally
12-
- We build a `meta.json` file along with every build and it will act as a REST endpoint (won't be cached in browser)
12+
- We generate a `meta.json` file along with every build in the public dir and it will act as a REST endpoint (won't be cached in browser)
1313
- We refresh cache (`window.location.reload(true)`) in the browser whenever a new version is released
1414

1515
## License

generate-build-version.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ const packageJson = require('./package.json');
55
const appVersion = packageJson.version;
66

77
const jsonData = {
8-
appVersion: appVersion
8+
version: appVersion
99
};
1010

1111
var jsonContent = JSON.stringify(jsonData);
1212

13-
fs.writeFile('./public/version.json', jsonContent, 'utf8', function(err) {
13+
fs.writeFile('./public/meta.json', jsonContent, 'utf8', function(err) {
1414
if (err) {
15-
console.log('An error occured while writing JSON Object to version.json');
15+
console.log('An error occured while writing JSON Object to meta.json');
1616
return console.log(err);
1717
}
1818

19-
console.log('version.json file has been saved with latest version number');
19+
console.log('meta.json file has been saved with latest version number');
2020
});
2121

2222
/* eslint-enable */

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cache-busting-example",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"private": true,
55
"repository": {
66
"type": "git",

public/meta.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
{
2-
"version": "0.0.1"
3-
}
1+
{"version":"0.1.1"}

public/version.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)