@adamlui/minify.js 1.0.2 → 1.0.3
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.
- package/README.md +2 -2
- package/minify.js +2 -2
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# <> minify.js
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### Recursively minify all JavaScript files.
|
|
4
4
|
|
|
5
|
-
<a href="https://www.npmjs.com/package/@adamlui/minify.js"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.0.
|
|
5
|
+
<a href="https://www.npmjs.com/package/@adamlui/minify.js"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.0.3-fc7811.svg?logo=npm&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
6
6
|
<a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-fcde7b.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
7
7
|
|
|
8
8
|
<img src="https://github.com/adamlui/js-utils/blob/main/minify.js/media/images/minify-js-docs-demo.png">
|
package/minify.js
CHANGED
|
@@ -31,7 +31,7 @@ const jsFiles = inputArg.endsWith('.js') ? [inputPath]
|
|
|
31
31
|
const files = fs.readdirSync(dir);
|
|
32
32
|
files.forEach(file => {
|
|
33
33
|
const filePath = path.join(dir, file);
|
|
34
|
-
if (fs.statSync(filePath).isDirectory())
|
|
34
|
+
if (fs.statSync(filePath).isDirectory() && file !== 'node_modules')
|
|
35
35
|
findJSfiles(filePath); // recursively find unminified JS
|
|
36
36
|
else if (/\.js(?<!\.min\.js)$/.test(file)) // unminified JS file found
|
|
37
37
|
fileList.push(filePath); // store it for minification
|
|
@@ -47,7 +47,7 @@ jsFiles.forEach(jsPath => {
|
|
|
47
47
|
path.dirname(jsPath), // path of file to be minified
|
|
48
48
|
/so?u?rce?$/.test(path.dirname(jsPath)) ? '../min' // + ../min/ if in *(src|source)/
|
|
49
49
|
: outputArg.endsWith('.js') ? path.dirname(outputArg) // or path from file output arg
|
|
50
|
-
: outputArg || 'min' // or path from
|
|
50
|
+
: outputArg || 'min' // or path from folder output arg or min/ if no output arg passed
|
|
51
51
|
);
|
|
52
52
|
const outputFilename = (
|
|
53
53
|
outputArg.endsWith('.js') && inputArg.endsWith('.js')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamlui/minify.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Minify JavaScript files",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Adam Lui",
|
|
@@ -39,5 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"uglify-js": "^3.17.4"
|
|
42
|
+
},
|
|
43
|
+
"funding": {
|
|
44
|
+
"type": "github",
|
|
45
|
+
"url": "https://github.com/sponsors/adamlui"
|
|
42
46
|
}
|
|
43
47
|
}
|