@adamlui/minify.js 1.1.0 → 1.1.1

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 +1 -1
  2. package/minify.js +6 -5
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
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.1.0-fc7811.svg?logo=npm&logoColor=white&labelColor=464646&style=for-the-badge"></a>
5
+ <a href="https://www.npmjs.com/package/@adamlui/minify.js"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.1.1-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
@@ -19,9 +19,11 @@ const [inputArg = '', outputArg = ''] = ( // default to empty strings for error-
19
19
  );
20
20
 
21
21
  // Validate input arg (output arg can be anything)
22
- if (inputArg && !fs.existsSync(inputArg)) {
23
- console.error(`\n${br}Error: First arg must be an existing file or directory.${nc}`
24
- + '\nExample valid command: \n>> minify-js . output.min.js');
22
+ const inputPath = path.resolve(__dirname, inputArg);
23
+ if (inputArg && !fs.existsSync(inputPath)) {
24
+ console.error(`\n${br}Error: First arg must be an existing file or directory.`
25
+ + `\n${ inputPath } does not exist.${nc}`
26
+ + '\n\nExample valid command: \n>> minify-js . output.min.js');
25
27
  process.exit(1);
26
28
  }
27
29
 
@@ -32,8 +34,7 @@ const config = {
32
34
  };
33
35
 
34
36
  // Recursively find all eligible JavaScript files or arg-passed file
35
- const inputPath = path.resolve(process.cwd(), inputArg),
36
- jsFiles = [];
37
+ const jsFiles = [];
37
38
  if (inputArg.endsWith('.js')) jsFiles.push(inputPath);
38
39
  else (function findJSfiles(dir) {
39
40
  const files = fs.readdirSync(dir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/minify.js",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Minify JavaScript files",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -14,7 +14,7 @@
14
14
  "minify-js": "minify.js"
15
15
  },
16
16
  "scripts": {
17
- "test": "echo \"Error: no test specified\" && exit 1",
17
+ "test": "node test/test.js",
18
18
  "bump:patch": "bash utils/bump.sh patch",
19
19
  "bump:minor": "bash utils/bump.sh minor",
20
20
  "bump:major": "bash utils/bump.sh major",