MCPcopy Create free account
hub / github.com/cloudle/ruui / buildCache

Function buildCache

cli-local/util/cache.js:55–88  ·  view source on GitHub ↗
(callback, isAutoRun = false, cacheType = 'nope')

Source from the content-addressed store, hash-verified

53};
54
55function buildCache(callback, isAutoRun = false, cacheType = 'nope') {
56 console.log('Building common chunks (cache), this may take a while...');
57
58 if (cacheType === 'initial') {
59 console.log(
60 chalk.gray('No previous cache was found, first time cache will take longer time than normal!\n'),
61 chalk.gray('Grab a cup of coffee and enjoy while waiting for this ;)\n'));
62 } else if (cacheType === 'changed') {
63 console.log(chalk.gray('Dependency change detected, rebuilding cache..\n'));
64 } else if (cacheType === 'force') {
65 console.log(chalk.gray('Using force option, building cache..\n'));
66 }
67
68 setTimeout(() => {
69 const vendorConfigs = require('../tools/webpack.vendor'),
70 compiler = webpack(vendorConfigs);
71
72 compiler.run((error, stats) => {
73 if (error) console.log(error);
74 else {
75 const currentPackageJson = require(paths.packageJson);
76
77 mkdirp.sync(paths.ruui);
78 fs.writeFileSync(paths.ruuiJson, JSON.stringify({
79 ...configs.ruuiJson,
80 dependencies: currentPackageJson.dependencies || {},
81 devDependencies: currentPackageJson.devDependencies || {},
82 }, null, 2));
83
84 if (lodash.isFunction(callback)) callback();
85 }
86 });
87 }, 0);
88}
89
90function foundDependencyChange(currentDeps, previousDeps, excludes = []) {
91 const currentClone = { ...currentDeps },

Callers 3

runFunction · 0.85
runFunction · 0.85
cache.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected