mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 18:45:38 +00:00
182eaa4329
* Basic webpack build started. * Get build working with electron-packager. Not fully satisfied, might investigate electron-builder. * Custom title bar * Rewrite all webpack configs to use common function. Organize webpack utils. Split into multiple dist folders. * Replace electron build with electron-builder. Leave around packager for a bit. * Check in progress on updater. * Update modal flow. * Fix tscheck. * Adjust publish info. * Arbitrary version bump. * Bump version again. * 5.0.2 bump fix autodownload. * 5.0.2 bump again, readd dmg * 5.0.3 bump * Turn auto update back off. Log errors. Revert versions. * Add os-specific builds. Improve update failure. * Open external links in browser in electron. * Remove custom title bar temporarily. * Add info about the update download to the modal. * Turn off development changes. * Take the postBuild sorting script and move it into a webpack config. * Initial conversion to typescript and electron-webpack. * Switch from electron-webpack back to custom config, clean up unused code, typify electron bridge. * Better typing for bridge. * Remove unnecessary file. * Reminify. * Add shared folder resolving to jest config. * Add enum to electron events
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
// Makes for a deterministic cache file by sorting it
|
|
'use strict';
|
|
const fs = require('fs');
|
|
const klawSync = require('klaw-sync');
|
|
|
|
const CACHE_FILE_REGEX = /.*icons-[a-z0-9]*\/\.cache$/;
|
|
const findCacheFile = item => CACHE_FILE_REGEX.test(item.path);
|
|
|
|
function SortCachePlugin() {};
|
|
SortCachePlugin.prototype.apply = function(compiler) {
|
|
compiler.plugin('done', (stats) => {
|
|
const buildDir = stats.compilation.compiler.outputPath;
|
|
const cacheFilePaths = klawSync(buildDir, { filter: findCacheFile });
|
|
|
|
if (!cacheFilePaths.length) {
|
|
throw new Error('Could not find .cache file');
|
|
}
|
|
if (cacheFilePaths.length > 1) {
|
|
throw new Error('More than one possible .cache file detected');
|
|
}
|
|
|
|
const cacheFilePath = cacheFilePaths[0].path;
|
|
const rawCacheFile = fs.readFileSync(cacheFilePath, 'utf8');
|
|
const cache = JSON.parse(rawCacheFile);
|
|
|
|
cache.result.files = cache.result.files.sort();
|
|
|
|
fs.writeFileSync(cacheFilePath, JSON.stringify(cache), 'utf8');
|
|
});
|
|
};
|
|
|
|
module.exports = SortCachePlugin;
|