@node-minify/cli 6.0.0 → 6.4.0
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/LICENSE +1 -1
- package/bin/cli.js +55 -54
- package/lib/cli.js +14 -14
- package/lib/compress.js +12 -12
- package/lib/spinner.js +2 -2
- package/package.json +9 -9
package/LICENSE
CHANGED
package/bin/cli.js
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* node-minify
|
|
5
|
-
* Copyright(c) 2011-
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const updateNotifier = require('update-notifier');
|
|
10
|
-
const program = require('commander');
|
|
11
|
-
const cli = require('../lib/cli');
|
|
12
|
-
const pkg = require('../package.json');
|
|
13
|
-
|
|
14
|
-
updateNotifier({ pkg: pkg }).notify();
|
|
15
|
-
|
|
16
|
-
program
|
|
17
|
-
.
|
|
18
|
-
.
|
|
19
|
-
.option('-
|
|
20
|
-
.option('-
|
|
21
|
-
.option('-
|
|
22
|
-
.option('-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
console.log('');
|
|
27
|
-
console.log('
|
|
28
|
-
console.log(' -
|
|
29
|
-
console.log(' -
|
|
30
|
-
console.log(' -
|
|
31
|
-
console.log(' -
|
|
32
|
-
console.log(' - uglify-
|
|
33
|
-
console.log(' -
|
|
34
|
-
console.log('');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* node-minify
|
|
5
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const updateNotifier = require('update-notifier');
|
|
10
|
+
const program = require('commander');
|
|
11
|
+
const cli = require('../lib/cli');
|
|
12
|
+
const pkg = require('../package.json');
|
|
13
|
+
|
|
14
|
+
updateNotifier({ pkg: pkg }).notify();
|
|
15
|
+
|
|
16
|
+
program
|
|
17
|
+
.storeOptionsAsProperties()
|
|
18
|
+
.version(pkg.version, '-v, --version')
|
|
19
|
+
.option('-c, --compressor [compressor]', 'use the specified compressor [uglify-js]', 'uglify-js')
|
|
20
|
+
.option('-i, --input [file]', 'input file path')
|
|
21
|
+
.option('-o, --output [file]', 'output file path')
|
|
22
|
+
.option('-s, --silence', 'no output will be printed')
|
|
23
|
+
.option('-O, --option [option]', 'option for the compressor as JSON object', '');
|
|
24
|
+
|
|
25
|
+
program.on('--help', function () {
|
|
26
|
+
console.log(' List of compressors:');
|
|
27
|
+
console.log('');
|
|
28
|
+
console.log(' - babel-minify');
|
|
29
|
+
console.log(' - gcc');
|
|
30
|
+
console.log(' - html-minifier');
|
|
31
|
+
console.log(' - terser');
|
|
32
|
+
console.log(' - uglify-js');
|
|
33
|
+
console.log(' - uglify-es');
|
|
34
|
+
console.log(' - yui');
|
|
35
|
+
console.log('');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
program.parse(process.argv);
|
|
39
|
+
|
|
40
|
+
const options = program.opts();
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Show help if missing mandatory.
|
|
44
|
+
*/
|
|
45
|
+
if (!options.compressor || !options.input || !options.output) {
|
|
46
|
+
program.help();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
cli
|
|
50
|
+
.run(options)
|
|
51
|
+
.then(() => process.exit())
|
|
52
|
+
.catch(err => {
|
|
53
|
+
console.error(err);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
});
|
package/lib/cli.js
CHANGED
|
@@ -13,22 +13,22 @@ var _spinner = require("./spinner");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
/*!
|
|
17
|
-
* node-minify
|
|
18
|
-
* Copyright(c) 2011-
|
|
19
|
-
* MIT Licensed
|
|
16
|
+
/*!
|
|
17
|
+
* node-minify
|
|
18
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
19
|
+
* MIT Licensed
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Module dependencies.
|
|
22
|
+
/**
|
|
23
|
+
* Module dependencies.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* Module variables.
|
|
26
|
+
/**
|
|
27
|
+
* Module variables.
|
|
28
28
|
*/
|
|
29
29
|
let silence = false;
|
|
30
|
-
/**
|
|
31
|
-
* Run one compressor.
|
|
30
|
+
/**
|
|
31
|
+
* Run one compressor.
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
const runOne = cli => {
|
|
@@ -64,8 +64,8 @@ const runOne = cli => {
|
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
/**
|
|
68
|
-
* Run cli.
|
|
67
|
+
/**
|
|
68
|
+
* Run cli.
|
|
69
69
|
*/
|
|
70
70
|
|
|
71
71
|
|
|
@@ -88,8 +88,8 @@ const run = cli => {
|
|
|
88
88
|
}).then(resolve).catch(reject);
|
|
89
89
|
});
|
|
90
90
|
};
|
|
91
|
-
/**
|
|
92
|
-
* Expose `run()`.
|
|
91
|
+
/**
|
|
92
|
+
* Expose `run()`.
|
|
93
93
|
*/
|
|
94
94
|
|
|
95
95
|
|
package/lib/compress.js
CHANGED
|
@@ -11,20 +11,20 @@ var _utils = require("@node-minify/utils");
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
/*!
|
|
15
|
-
* node-minify
|
|
16
|
-
* Copyright(c) 2011-
|
|
17
|
-
* MIT Licensed
|
|
14
|
+
/*!
|
|
15
|
+
* node-minify
|
|
16
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
17
|
+
* MIT Licensed
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Module dependencies.
|
|
20
|
+
/**
|
|
21
|
+
* Module dependencies.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Run compression.
|
|
26
|
-
*
|
|
27
|
-
* @param {Object} options
|
|
24
|
+
/**
|
|
25
|
+
* Run compression.
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} options
|
|
28
28
|
*/
|
|
29
29
|
const compress = options => {
|
|
30
30
|
return new Promise((resolve, reject) => {
|
|
@@ -51,8 +51,8 @@ const compress = options => {
|
|
|
51
51
|
}).catch(reject);
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
* Expose `compress()`.
|
|
54
|
+
/**
|
|
55
|
+
* Expose `compress()`.
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
58
|
|
package/lib/spinner.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.spinnerStop = exports.spinnerStart = exports.spinnerError = void 0;
|
|
7
7
|
|
|
8
8
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
|
|
14
14
|
/*!
|
|
15
15
|
* node-minify
|
|
16
|
-
* Copyright(c) 2011-
|
|
16
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
17
17
|
* MIT Licensed
|
|
18
18
|
*/
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "CLI - command line interface for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "lib/cli.js",
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=12.0.0"
|
|
19
19
|
},
|
|
20
20
|
"directories": {
|
|
21
21
|
"lib": "lib",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"url": "https://github.com/srod/node-minify/issues"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@node-minify/core": "^6.
|
|
40
|
-
"@node-minify/utils": "^6.
|
|
41
|
-
"chalk": "4.1.
|
|
42
|
-
"commander": "
|
|
43
|
-
"ora": "4.
|
|
44
|
-
"update-notifier": "
|
|
39
|
+
"@node-minify/core": "^6.4.0",
|
|
40
|
+
"@node-minify/utils": "^6.4.0",
|
|
41
|
+
"chalk": "4.1.2",
|
|
42
|
+
"commander": "8.3.0",
|
|
43
|
+
"ora": "5.4.1",
|
|
44
|
+
"update-notifier": "5.1.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "d529747a661487597e9be510d3d9e2df1bc0f556"
|
|
47
47
|
}
|