Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.

Commit c0b2644

Browse files
Change the manifest file’s name to use a hash instead of the time
1 parent 45cf4b8 commit c0b2644

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/renderer/lib/includes-helper.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const fs = require('fs');
44
const fse = require('fs-extra');
55
const path = require('path');
6+
const crypto = require('crypto');
67

78
let appPkg = require(`${__dirname}/../../../package.json`);
89

@@ -12,20 +13,20 @@ const generate = function (folderpath, manifest) {
1213
const outPath = path.resolve(`${folderpath}${appPkg.config.commonFolder}/${appPkg.config.includesFilename}`);
1314

1415
fs.readFile(includesJsPath, 'utf8', (e, patternBotIncludesFunction) => {
15-
const manifestTmpFilename = `patternManifest_${Date.now()}`;
1616
const manifestJson = JSON.stringify(manifest, null, 2);
17+
const manifestHash = crypto.createHash('sha1').update(manifestJson).digest('hex');
1718
const outFileBits = [
1819
'(function () {',
1920
patternBotIncludesFunction,
2021
'',
2122
'/** ',
2223
' * Patternbot library manifest',
2324
` * ${folderpath}`,
24-
` * @version ${Date.now()}`,
25+
` * @version ${manifestHash}`,
2526
' */',
26-
`const ${manifestTmpFilename} = ${manifestJson};`,
27+
`const patternManifest_${manifestHash} = ${manifestJson};`,
2728
'',
28-
`patternBotIncludes(${manifestTmpFilename});`,
29+
`patternBotIncludes(patternManifest_${manifestHash});`,
2930
'}());',
3031
];
3132

0 commit comments

Comments
 (0)