-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnode-modules-packer.js
More file actions
38 lines (29 loc) · 939 Bytes
/
node-modules-packer.js
File metadata and controls
38 lines (29 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const { prepareEnvironment, getSuiteDir, getOutputSize, getFormattedEndTime } = require('./utils');
const Run = require('@h4ad/node-modules-packer/lib/commands/run').default;
async function zipDependencies(withMinification) {
await Run.headless({
dir: getSuiteDir(),
outputFile: 'lib.zip',
outputPath: __dirname,
minify: withMinification,
});
}
async function runSuite(withMinification) {
prepareEnvironment();
console.log('Running NodeModulesPacker Suite.');
const time = new Date();
console.time('NodeModulesPacker');
await zipDependencies(withMinification);
console.timeEnd('NodeModulesPacker');
console.log('Finished running NodeModulesPacker Suite.');
const endTime = new Date() - time;
const outputSize = getOutputSize('lib.zip');
console.log(`OutputSize: ${outputSize}`);
return {
endTime: getFormattedEndTime(endTime),
outputSize,
};
}
module.exports = {
runSuite,
};