@adamlui/minify.js 1.4.2 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +59 -46
  2. package/minify.js +92 -52
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,9 +18,9 @@
18
18
 
19
19
  ### Recursively minify all JavaScript files.
20
20
 
21
- <a href="https://www.npmjs.com/package/@adamlui/minify.js"><img height=31 src="https://img.shields.io/npm/dt/%40adamlui%2Fminify.js?logo=npm&logoColor=white&labelColor=464646&style=for-the-badge"></a>
22
- <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-red.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
23
- <a href="https://www.npmjs.com/package/@adamlui/minify.js?activeTab=versions"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.4.2-fc7811.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
21
+ <a href="https://www.npmjs.com/package/@adamlui/minify.js"><img height=31 src="https://img.shields.io/npm/dt/%40adamlui%2Fminify.js?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
22
+ <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
23
+ <a href="https://www.npmjs.com/package/@adamlui/minify.js?activeTab=versions"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.4.4-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
24
24
  <a href="https://www.npmjs.com/package/@adamlui/minify.js?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/%40adamlui%2Fminify.js?style=for-the-badge&logo=ebox&logoColor=white&labelColor=464646&color=blue"></a>
25
25
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:minify.js/minify.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Aminify.js%2Fminify.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
26
26
 
@@ -28,34 +28,38 @@
28
28
 
29
29
  <br>
30
30
 
31
- <img height=8px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
31
+ <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
32
32
 
33
33
  ## ⚡ Installation
34
34
 
35
35
  As a **global utility**:
36
36
 
37
37
  ```
38
- npm install -g @adamlui/minify.js
38
+ $ npm install -g @adamlui/minify.js
39
39
  ```
40
40
 
41
41
  As a **dev dependency** (e.g. for build scripts), from your project root:
42
42
 
43
43
  ```
44
- npm install -D @adamlui/minify.js
44
+ $ npm install -D @adamlui/minify.js
45
45
  ```
46
46
 
47
47
  As a **runtime dependency** (e.g. for on-the-fly minification), from your project root:
48
48
 
49
49
  ```
50
- npm install @adamlui/minify.js
50
+ $ npm install @adamlui/minify.js
51
51
  ```
52
52
 
53
+ <br>
54
+
55
+ <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
56
+
53
57
  ## 💻 Command line usage
54
58
 
55
59
  The basic **global command** is:
56
60
 
57
61
  ```
58
- minify-js
62
+ $ minify-js
59
63
  ```
60
64
 
61
65
  **💡 Note:** Pass `-n` or `--dry-run` to only see what files will be processed.
@@ -65,7 +69,7 @@ minify-js
65
69
  To specify **input/output** paths:
66
70
 
67
71
  ```
68
- minify-js [input_path] [output_path]
72
+ $ minify-js [input_path] [output_path]
69
73
  ```
70
74
 
71
75
  - `[input_path]`: Path to JS file or directory containing JS files to be minified, relative to the current working directory.
@@ -84,34 +88,37 @@ To use as a **package script**, in your project's `package.json`:
84
88
  ```
85
89
 
86
90
  Replace `<minify-js-cmd>` with `minify-js` + optional args. Then, `npm run build:js` can be used to run the command.
87
- <br><br>
91
+
92
+ #
88
93
 
89
94
  ### Example commands
90
95
 
91
96
  Minify all JavaScript files in the **current directory** (outputs to `min/`):
92
97
 
93
98
  ```
94
- minify-js
99
+ $ minify-js
95
100
  ```
96
101
 
97
102
  Minify all JavaScript files in a **specific directory** (outputs to `path/to/your/directory/min/`):
98
103
 
99
104
  ```
100
- minify-js path/to/your/directory
105
+ $ minify-js path/to/your/directory
101
106
  ```
102
107
 
103
108
  Minify a **specific file** (outputs to `path/to/your/min/file.min.js`):
104
109
 
105
110
  ```
106
- minify-js path/to/your/file.js
111
+ $ minify-js path/to/your/file.js
107
112
  ```
108
113
 
109
114
  Specify both **input and output** directories (outputs to `output_folder/`):
110
115
 
111
116
  ```
112
- minify-js input_folder output_folder
117
+ $ minify-js input_folder output_folder
113
118
  ```
114
119
 
120
+ #
121
+
115
122
  ### Command line options
116
123
 
117
124
  ```
@@ -129,7 +136,11 @@ Info commands:
129
136
  -v, --version Show version number.
130
137
  ```
131
138
 
132
- ## 🔌 API reference
139
+ <br>
140
+
141
+ <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
142
+
143
+ ## 🔌 API usage
133
144
 
134
145
  You can also import **minify.js** into your app to use its API methods, both as an ECMAScript module or a CommonJS module.
135
146
 
@@ -145,17 +156,20 @@ import * as minifyJS from '@adamlui/minify.js';
145
156
  const minifyJS = require('@adamlui/minify.js');
146
157
  ```
147
158
 
148
- ### minify(input, options)
159
+ #
160
+
161
+ ### `minify(input[, options])`
149
162
 
150
- This function minifies JavaScript code based on the string input supplied.
163
+ Minifies JavaScript code based on the string input supplied.
151
164
 
152
165
  If **source code** is passed, it is directly minified, then an object containing `srcPath` + `code` + `error` is returned:
153
166
 
154
167
  ```js
155
168
  const srcCode = 'function add(first, second) { return first + second; }',
156
169
  minifyResult = minifyJS.minify(srcCode);
157
- console.log(minifyResult.error); // runtime error, or `undefined` if no error
158
- console.log(minifyResult.code); // minified output: function add(n,d){return n+d}
170
+
171
+ console.log(minifyResult.error); // outputs runtime error, or `undefined` if no error
172
+ console.log(minifyResult.code); // outputs minified JS: function add(n,d){return n+d}
159
173
  ```
160
174
 
161
175
  If a **file path** is passed, the file's code is loaded then minified, returning an object like above.
@@ -163,57 +177,56 @@ If a **file path** is passed, the file's code is loaded then minified, returning
163
177
  If a **directory path** is passed, JavaScript files are searched for (recursively by default), each one's code is loaded then minified, then an array of objects containing `srcPath` + `code` + `error` is returned:
164
178
 
165
179
  ```js
166
- const results = minifyJS.minify('.');
167
- results.forEach(result =>
168
- console.log(result.srcPath)); // paths to JS files in working directory + all nested directories
169
- console.log(results[1].code); // minified code of 2nd JS file if found, or `undefined` if not found
180
+ // Outputs paths to source JS files in working directory + all nested directories
181
+ const minifyResults = minifyJS.minify('.');
182
+ minifyResults.forEach(result => console.log(result.srcPath));
183
+
184
+ // Outputs minified code of 2nd JS file if found, or `undefined` if not found
185
+ console.log(minifyResults[1].code);
170
186
  ```
171
187
 
172
188
  Options are boolean, passed as object properties. For example:
173
189
 
174
190
  ```js
191
+ // Returns data object where dotfiles are also processed if `input` is a path
175
192
  minifyJS.minify(input, { dotFiles: true });
176
- // returns data object where dotfiles are also processed if `input` is a path
177
193
  ```
178
194
 
179
195
  Possible parameters (and their default settings) are:
180
196
 
181
- ```
182
- recursive (true) Recursively search for nested files if dir path
183
- passed.
184
- verbose (true) Show logging in console/terminal.
185
- dotFolders (false) Include dotfolders in file search.
186
- dotFiles (false) Include dotfiles in file search.
187
- mangle (true) Shorten variable names (typically to one character).
188
- ```
197
+ Name | Desciption | Default value
198
+ -------------|---------------------------------------------------------|---------------
199
+ `recursive` | Recursively search for nested files if dir path passed. | `true`
200
+ `verbose` | Show logging in console/terminal. | `true`
201
+ `dotFolders` | Include dotfolders in file search. | `false`
202
+ `dotFiles` | Include dotfiles in file search. | `false`
203
+ `mangle` | Shorten variable names (typically to one character). | `true`
189
204
 
190
- ### findJS(searchDir, options)
205
+ #
206
+
207
+ ### `findJS(searchDir[, options])`
191
208
 
192
- This function searches for all unminified JavaScript files within the `searchDir` string passed (useful for discovering what files [`minify()`](#minifyinput-options) will process) and returns an array containing their filepaths.
209
+ Searches for all unminified JavaScript files within the `searchDir` string passed (useful for discovering what files [`minify()`](#minifyinput-options) will process) and returns an array containing their filepaths.
193
210
 
194
211
  Options are boolean, passed as object properties. For example:
195
212
 
196
213
  ```js
214
+ // Returns array containing filepaths to unminified JS files in exactly `searchDir`
197
215
  minifyJS.findJS(searchDir, { recursive: false });
198
- // returns array containing filepaths to unminified JS files in exactly `searchDir`
199
216
  ```
200
217
 
201
218
  Possible parameters (and their default settings) are:
202
219
 
203
- ```
204
- recursive (true) Recursively search for nested files if dir path
205
- passed.
206
- verbose (false) Show logging in console/terminal.
207
- dotFolders (false) Include dotfolders in file search.
208
- dotFiles (false) Include dotfiles in file search.
209
- ```
220
+ Name | Desciption | Default value
221
+ -------------|---------------------------------------------------------|---------------
222
+ `recursive` | Recursively search for nested files if dir path passed. | `true`
223
+ `verbose` | Show logging in console/terminal. | `true`
224
+ `dotFolders` | Include dotfolders in file search. | `false`
225
+ `dotFiles` | Include dotfiles in file search. | `false`
210
226
 
211
227
  <br>
212
228
 
213
- ## 💖 Support
214
-
215
- Please consider [giving a GitHub ⭐](https://github.com/adamlui/js-utils) if this helped you!
216
- <br><br>
229
+ <img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
217
230
 
218
231
  ## 🏛️ MIT License
219
232
 
package/minify.js CHANGED
@@ -8,31 +8,47 @@ const fs = require('fs'),
8
8
  // Define MAIN functions
9
9
 
10
10
  function findJS(searchDir, options = {}) {
11
- const defaultOptions = { recursive: true, verbose: false, dotFolders: false, dotFiles: false };
11
+
12
+ // Init options
13
+ const defaultOptions = { recursive: true, verbose: true, dotFolders: false, dotFiles: false };
12
14
  options = { ...defaultOptions, ...options };
15
+
16
+ // Search for unminified JS
13
17
  const dirFiles = fs.readdirSync(searchDir), jsFiles = [];
18
+ if (options.verbose && !options.isRecursing) console.info('\nSearching for unminified JS files...');
14
19
  dirFiles.forEach(file => {
15
20
  const filePath = path.resolve(searchDir, file);
16
21
  if (fs.statSync(filePath).isDirectory() && file != 'node_modules'
17
- && (options.dotFolders || !file.startsWith('.')) && options.recursive) {
18
- if (options.verbose) console.info(`Searching for unminified JS files in: ${filePath}...`);
22
+ && (options.dotFolders || !file.startsWith('.')) && options.recursive)
19
23
  jsFiles.push( // recursively find unminified JS in eligible dir
20
24
  ...findJS(filePath, { ...options, isRecursing: true }));
21
- } else if (/\.js(?<!\.min\.js)$/.test(file)
25
+ else if (/\.js(?<!\.min\.js)$/.test(file)
22
26
  && (options.dotFiles || !file.startsWith('.')))
23
27
  jsFiles.push(filePath); // store eligible unminified JS file for minification
24
28
  });
25
- if (options.isRecursing || jsFiles.length > 0) return jsFiles;
26
- else if (options.verbose) console.info('\nNo unminified JavaScript files found.');
29
+
30
+ // Log/return final result
31
+ if (!options.isRecursing && options.verbose) {
32
+ console.info('Search complete. '
33
+ + ( jsFiles.length === 0 ? 'No' : jsFiles.length )
34
+ + ` file${ jsFiles.length > 1 ? 's' : '' } found.`);
35
+ }
36
+ return options.isRecursing || jsFiles.length > 0 ? jsFiles : [];
27
37
  }
28
38
 
29
39
  function minify(input, options = {}) {
40
+
41
+ // Init options
30
42
  const defaultOptions = {
31
43
  recursive: true, verbose: true, dotFolders: false, dotFiles: false, mangle: true };
32
44
  options = { ...defaultOptions, ...options };
45
+
46
+ // Validate input
33
47
  if (typeof input !== 'string')
34
48
  return console.error('ERROR:'
35
49
  + ' First argument must be a string of source code or file/folder path.');
50
+
51
+ // Minify JS based on input
36
52
  const minifyOptions = { mangle: options.mangle ? { toplevel: true } : false };
37
53
  if (fs.existsSync(input)) { // minify based on path arg
38
54
  if (input.endsWith('.js')) { // file path passed
@@ -41,10 +57,9 @@ function minify(input, options = {}) {
41
57
  if (minifyResult.error) console.error(`ERROR: ${ minifyResult.error.message }`);
42
58
  return { code: minifyResult.code, srcPath: input, error: minifyResult.error };
43
59
  } else { // dir path passed
44
- if (options.verbose) console.info('Searching for unminified JS files...');
45
- return findJS(input, { recursive: options.recursive,
46
- dotFolders: options.dotFolders, dotFiles: options.dotFiles })
47
- ?.map(jsPath => { // minify found JS files
60
+ return findJS(input, { recursive: options.recursive, verbosity: options.verbose,
61
+ dotFolders: options.dotFolders, dotFiles: options.dotFiles
62
+ })?.map(jsPath => { // minify found JS files
48
63
  if (options.verbose) console.info(`Minifying ${ jsPath }...`);
49
64
  const srcCode = fs.readFileSync(jsPath, 'utf8'),
50
65
  minifyResult = uglifyJS.minify(srcCode, minifyOptions);
@@ -66,52 +81,42 @@ if (require.main !== module) module.exports = { minify, findJS };
66
81
  else { // run as CLI tool
67
82
 
68
83
  // Init UI colors
69
- const nc = '\x1b[0m', // no color
84
+ const nc = '\x1b[0m', // no color
70
85
  br = '\x1b[1;91m', // bright red
71
86
  by = '\x1b[1;33m', // bright yellow
72
87
  bg = '\x1b[1;92m'; // bright green
73
88
 
74
89
  // Load FLAG settings
75
- const config = {
76
- dryRun: process.argv.some(arg => /^--?(?:n|dry-?run)$/.test(arg)),
77
- includeDotFolders: process.argv.some(arg =>
78
- /^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?)$/.test(arg)),
79
- includeDotFiles: process.argv.some(arg =>
80
- /^--?(?:df|D|(?:include-?)?dot-?files?)$/.test(arg)),
81
- noRecursion: process.argv.some(arg =>
82
- /^--?(?:R|(?:disable|no)-?recursion)$/.test(arg)),
83
- noMangle: process.argv.some(arg =>
84
- /^--?(?:M|(?:disable|no)-?mangle)$/.test(arg)),
85
- quietMode: process.argv.some(arg => /^--?q(?:uiet)?$/.test(arg))
90
+ const config = {};
91
+ const argRegex = {
92
+ 'dryRun': /^--?(?:n|dry-?run)$/,
93
+ 'includeDotFolders': /^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?=?(?:true|1)?)$/,
94
+ 'includeDotFiles': /^--?(?:df|D|(?:include-?)?dot-?files?=?(?:true|1)?)$/,
95
+ 'noRecursion': /^--?(?:R|(?:disable|no)-?recursion|recursion=(?:false|0))$/,
96
+ 'noMangle': /^--?(?:M|(?:disable|no)-?mangle|mangle=(?:false|0))$/,
97
+ 'quietMode': /^--?q(?:uiet)?(?:-?mode)?$/,
98
+ 'help': /^--?h(?:elp)?$/,
99
+ 'version': /^--?ve?r?s?i?o?n?$/
86
100
  };
101
+ process.argv.forEach(arg => {
102
+ if (!arg.startsWith('-')) return;
103
+ const matchedFlag = Object.keys(argRegex).find(flag => argRegex[flag].test(arg));
104
+ if (matchedFlag) config[matchedFlag] = true;
105
+ else {
106
+ console.error(`\n${br}ERROR: Arg '${ arg }' not recognized.${nc}`);
107
+ console.info(`\n${by}Valid arguments are below.${nc}`);
108
+ printHelpScreen(['configOptions', 'infoCmds']);
109
+ process.exit(1);
110
+ }});
87
111
 
88
112
  // Show HELP screen if -h or --help passed
89
- if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
90
- printHelp(`\n${by}minify-js [inputPath] [outputPath] [options]${nc}`);
91
- printHelp('\nPath arguments:');
92
- printHelp(' [inputPath] '
93
- + 'Path to JS file or directory containing JS files to be minified,'
94
- + ' relative to the current working directory.');
95
- printHelp(' [outputPath] '
96
- + 'Path to file or directory where minified files will be stored,'
97
- + ' relative to original file location (if not provided, min/ is used).');
98
- printHelp('\nConfig options:');
99
- printHelp(' -n, --dry-run Don\'t actually minify the file(s),'
100
- + ' just show if they will be processed.');
101
- printHelp(' -d, --include-dotfolders Include dotfolders in file search.');
102
- printHelp(' -D, --include-dotfiles Include dotfiles in file search.');
103
- printHelp(' -R, --no-recursion Disable recursive file searching.');
104
- printHelp(' -M, --no-mangle Disable mangling names.');
105
- printHelp(' -q, --quiet Suppress all logging except errors.');
106
- printHelp('\nInfo commands:');
107
- printHelp(' -h, --help Display this help screen.');
108
- printHelp(' -v, --version Show version number.');
113
+ if (process.argv.some(arg => argRegex.help.test(arg))) printHelpScreen();
109
114
 
110
115
  // Show VERSION number if -v or --version passed
111
- } else if (process.argv.some(arg => /^--?ve?r?s?i?o?n?$/.test(arg))) {
116
+ else if (process.argv.some(arg => argRegex.version.test(arg)))
112
117
  console.info('v' + require('./package.json').version);
113
118
 
114
- } else { // run MAIN routine
119
+ else { // run MAIN routine
115
120
 
116
121
  // Init I/O args
117
122
  const [inputArg = '', outputArg = ''] = ( // default to empty strings for error-less handling
@@ -131,19 +136,20 @@ else { // run as CLI tool
131
136
  }
132
137
 
133
138
  // Find all eligible JavaScript files or arg-passed file
134
- printIfNotQuiet('Searching for unminified JS files...');
135
139
  const unminnedJSfiles = inputArg.endsWith('.js') ? [inputPath]
136
- : findJS(inputPath, { recursive: !config.noRecursion });
140
+ : findJS(inputPath, { recursive: !config.noRecursion, verbose: !config.quietMode });
137
141
 
138
- if (config.dryRun && unminnedJSfiles?.length > 0) { // print files to be processed
139
- console.info(`\n${by}JS files to be minified:${nc}`);
140
- unminnedJSfiles?.forEach(file => console.info(file));
142
+ if (config.dryRun) { // -n or --dry-run passed
143
+ if (unminnedJSfiles.length > 0) { // print files to be processed
144
+ console.info(`\n${by}JS files to be minified:${nc}`);
145
+ unminnedJSfiles.forEach(file => console.info(file));
146
+ } else console.info(`${by}\nNo JS files will be minified.${nc}`);
141
147
 
142
148
  } else { // actually minify JavaScript files
143
149
 
144
150
  // Build array of minification data
145
151
  const failedPaths = [];
146
- const minifyData = unminnedJSfiles?.map(jsPath => {
152
+ const minifyData = unminnedJSfiles.map(jsPath => {
147
153
  const minifyResult = minify(jsPath, { verbose: !config.quietMode, mangle: !config.noMangle });
148
154
  if (minifyResult.error) failedPaths.push(jsPath);
149
155
  return minifyResult;
@@ -172,7 +178,7 @@ else { // run as CLI tool
172
178
  printIfNotQuiet(`\n${bg}Minification complete!${nc}`);
173
179
  printIfNotQuiet(
174
180
  `${ minifyData.length } file${ minifyData.length > 1 ? 's' : '' } minified.`);
175
- } else printIfNotQuiet(`${by}No unminified JavaScript files processed successfully.${nc}`);
181
+ } else printIfNotQuiet(`${by}No unminified JavaScript files processed.${nc}`);
176
182
  if (failedPaths.length > 0) {
177
183
  printIfNotQuiet(`\n${br}`
178
184
  + `${ failedPaths.length } file${ failedPaths.length > 1 ? 's' : '' }`
@@ -184,7 +190,7 @@ else { // run as CLI tool
184
190
 
185
191
  // Define LOGGING functions
186
192
 
187
- function printHelp(msg) { // wrap msg + indent 2nd+ lines (for --help screen)
193
+ function printHelpMsg(msg) { // wrap msg + indent 2nd+ lines (for --help screen)
188
194
  const terminalWidth = process.stdout.columns || 80,
189
195
  indentation = 29, lines = [], words = msg.match(/\S+|\s+/g);
190
196
 
@@ -207,5 +213,39 @@ else { // run as CLI tool
207
213
  ));
208
214
  }
209
215
 
216
+ function printHelpScreen(includeSections = ['sampleCmd', 'pathArgs', 'configOptions', 'infoCmds']) {
217
+ const sections = {
218
+ 'sampleCmd': [
219
+ `\n${by}minify-js [inputPath] [outputPath] [options]${nc}`
220
+ ],
221
+ 'pathArgs': [
222
+ '\nPath arguments:',
223
+ ' [inputPath] '
224
+ + 'Path to JS file or directory containing JS files to be minified,'
225
+ + ' relative to the current working directory.',
226
+ ' [outputPath] '
227
+ + 'Path to file or directory where minified files will be stored,'
228
+ + ' relative to original file location (if not provided, min/ is used).'
229
+ ],
230
+ 'configOptions': [
231
+ '\nConfig options:',
232
+ ' -n, --dry-run Don\'t actually minify the file(s),'
233
+ + ' just show if they will be processed.',
234
+ ' -d, --include-dotfolders Include dotfolders in file search.',
235
+ ' -D, --include-dotfiles Include dotfiles in file search.',
236
+ ' -R, --no-recursion Disable recursive file searching.',
237
+ ' -M, --no-mangle Disable mangling names.',
238
+ ' -q, --quiet Suppress all logging except errors.'
239
+ ],
240
+ 'infoCmds': [
241
+ '\nInfo commands:',
242
+ ' -h, --help Display help screen.',
243
+ ' -v, --version Show version number.'
244
+ ]
245
+ };
246
+ includeSections.forEach(section => { // print valid arg elems
247
+ if (sections[section]) sections[section].forEach(line => printHelpMsg(line)); });
248
+ }
249
+
210
250
  function printIfNotQuiet(msg) { if (!config.quietMode) console.info(msg); }
211
251
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/minify.js",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "Recursively minify all JavaScript files",
5
5
  "author": {
6
6
  "name": "Adam Lui",