@node-minify/cli 7.1.0 → 8.0.0-beta.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/dist/index.d.ts +14 -0
- package/dist/index.js +131 -0
- package/dist/index.mjs +109 -0
- package/package.json +24 -7
- package/lib/cli.js +0 -82
- package/lib/compress.js +0 -53
- package/lib/spinner.js +0 -57
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
|
|
25
|
+
// src/index.ts
|
|
26
|
+
var src_exports = {};
|
|
27
|
+
__export(src_exports, {
|
|
28
|
+
run: () => run
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
32
|
+
|
|
33
|
+
// src/compress.ts
|
|
34
|
+
var import_core = __toESM(require("@node-minify/core"));
|
|
35
|
+
var import_utils = require("@node-minify/utils");
|
|
36
|
+
var compress = (options) => {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
(0, import_core.default)(options).then(() => {
|
|
39
|
+
if (options.output.includes("$1")) {
|
|
40
|
+
return resolve({
|
|
41
|
+
compressorLabel: options.compressorLabel,
|
|
42
|
+
compressor: options.compressor,
|
|
43
|
+
size: 0,
|
|
44
|
+
sizeGzip: 0
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
import_utils.utils.getFilesizeGzippedInBytes(options.output).then((sizeGzip) => {
|
|
48
|
+
resolve({
|
|
49
|
+
compressorLabel: options.compressorLabel,
|
|
50
|
+
compressor: options.compressor,
|
|
51
|
+
size: import_utils.utils.getFilesizeInBytes(options.output),
|
|
52
|
+
sizeGzip
|
|
53
|
+
});
|
|
54
|
+
}).catch(reject);
|
|
55
|
+
}).catch(reject);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// src/spinner.ts
|
|
60
|
+
var import_chalk = __toESM(require("chalk"));
|
|
61
|
+
var import_ora = __toESM(require("ora"));
|
|
62
|
+
var spinner = (0, import_ora.default)();
|
|
63
|
+
var start = (options) => {
|
|
64
|
+
spinner.text = "Compressing file(s) with " + import_chalk.default.green(options.compressorLabel) + "...";
|
|
65
|
+
spinner.start();
|
|
66
|
+
};
|
|
67
|
+
var stop = (result) => {
|
|
68
|
+
spinner.text = "File(s) compressed successfully with " + import_chalk.default.green(result.compressorLabel) + " (" + import_chalk.default.green(result.size) + " minified, " + import_chalk.default.green(result.sizeGzip) + " gzipped)";
|
|
69
|
+
spinner.succeed();
|
|
70
|
+
};
|
|
71
|
+
var error = (options) => {
|
|
72
|
+
spinner.text = "Error - file(s) not compressed with " + import_chalk.default.red(options.compressorLabel);
|
|
73
|
+
spinner.fail();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// src/index.ts
|
|
77
|
+
var silence = false;
|
|
78
|
+
var runOne = (cli) => {
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
const compressor = typeof cli.compressor === "string" ? require(`@node-minify/${cli.compressor}`).default : cli.compressor;
|
|
81
|
+
const options = {
|
|
82
|
+
compressorLabel: cli.compressor,
|
|
83
|
+
compressor,
|
|
84
|
+
input: typeof cli.input === "string" ? cli.input.split(",") : "",
|
|
85
|
+
output: cli.output
|
|
86
|
+
};
|
|
87
|
+
if (cli.option) {
|
|
88
|
+
options.options = JSON.parse(cli.option);
|
|
89
|
+
}
|
|
90
|
+
if (!silence) {
|
|
91
|
+
start(options);
|
|
92
|
+
}
|
|
93
|
+
return compress(options).then((result) => {
|
|
94
|
+
if (!silence) {
|
|
95
|
+
stop(result);
|
|
96
|
+
}
|
|
97
|
+
resolve(result);
|
|
98
|
+
}).catch((err) => {
|
|
99
|
+
if (!silence) {
|
|
100
|
+
error(options);
|
|
101
|
+
}
|
|
102
|
+
reject(err);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
var run = (cli) => {
|
|
107
|
+
silence = !!cli.silence;
|
|
108
|
+
if (!silence) {
|
|
109
|
+
console.log("");
|
|
110
|
+
console.log(import_chalk2.default.bgBlue.black(" INFO "), "Starting compression...");
|
|
111
|
+
console.log("");
|
|
112
|
+
}
|
|
113
|
+
return new Promise((resolve, reject) => {
|
|
114
|
+
runOne(cli).then(() => {
|
|
115
|
+
if (!silence) {
|
|
116
|
+
console.log("");
|
|
117
|
+
console.log(import_chalk2.default.bgGreen.black(" DONE "), import_chalk2.default.green("Done!"));
|
|
118
|
+
console.log("");
|
|
119
|
+
}
|
|
120
|
+
}).then(resolve).catch(reject);
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
run
|
|
126
|
+
});
|
|
127
|
+
/*!
|
|
128
|
+
* node-minify
|
|
129
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
130
|
+
* MIT Licensed
|
|
131
|
+
*/
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined")
|
|
5
|
+
return require.apply(this, arguments);
|
|
6
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// src/index.ts
|
|
10
|
+
import chalk2 from "chalk";
|
|
11
|
+
|
|
12
|
+
// src/compress.ts
|
|
13
|
+
import minify from "@node-minify/core";
|
|
14
|
+
import { utils } from "@node-minify/utils";
|
|
15
|
+
var compress = (options) => {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
minify(options).then(() => {
|
|
18
|
+
if (options.output.includes("$1")) {
|
|
19
|
+
return resolve({
|
|
20
|
+
compressorLabel: options.compressorLabel,
|
|
21
|
+
compressor: options.compressor,
|
|
22
|
+
size: 0,
|
|
23
|
+
sizeGzip: 0
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
utils.getFilesizeGzippedInBytes(options.output).then((sizeGzip) => {
|
|
27
|
+
resolve({
|
|
28
|
+
compressorLabel: options.compressorLabel,
|
|
29
|
+
compressor: options.compressor,
|
|
30
|
+
size: utils.getFilesizeInBytes(options.output),
|
|
31
|
+
sizeGzip
|
|
32
|
+
});
|
|
33
|
+
}).catch(reject);
|
|
34
|
+
}).catch(reject);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/spinner.ts
|
|
39
|
+
import chalk from "chalk";
|
|
40
|
+
import ora from "ora";
|
|
41
|
+
var spinner = ora();
|
|
42
|
+
var start = (options) => {
|
|
43
|
+
spinner.text = "Compressing file(s) with " + chalk.green(options.compressorLabel) + "...";
|
|
44
|
+
spinner.start();
|
|
45
|
+
};
|
|
46
|
+
var stop = (result) => {
|
|
47
|
+
spinner.text = "File(s) compressed successfully with " + chalk.green(result.compressorLabel) + " (" + chalk.green(result.size) + " minified, " + chalk.green(result.sizeGzip) + " gzipped)";
|
|
48
|
+
spinner.succeed();
|
|
49
|
+
};
|
|
50
|
+
var error = (options) => {
|
|
51
|
+
spinner.text = "Error - file(s) not compressed with " + chalk.red(options.compressorLabel);
|
|
52
|
+
spinner.fail();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/index.ts
|
|
56
|
+
var silence = false;
|
|
57
|
+
var runOne = (cli) => {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
const compressor = typeof cli.compressor === "string" ? __require(`@node-minify/${cli.compressor}`).default : cli.compressor;
|
|
60
|
+
const options = {
|
|
61
|
+
compressorLabel: cli.compressor,
|
|
62
|
+
compressor,
|
|
63
|
+
input: typeof cli.input === "string" ? cli.input.split(",") : "",
|
|
64
|
+
output: cli.output
|
|
65
|
+
};
|
|
66
|
+
if (cli.option) {
|
|
67
|
+
options.options = JSON.parse(cli.option);
|
|
68
|
+
}
|
|
69
|
+
if (!silence) {
|
|
70
|
+
start(options);
|
|
71
|
+
}
|
|
72
|
+
return compress(options).then((result) => {
|
|
73
|
+
if (!silence) {
|
|
74
|
+
stop(result);
|
|
75
|
+
}
|
|
76
|
+
resolve(result);
|
|
77
|
+
}).catch((err) => {
|
|
78
|
+
if (!silence) {
|
|
79
|
+
error(options);
|
|
80
|
+
}
|
|
81
|
+
reject(err);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
var run = (cli) => {
|
|
86
|
+
silence = !!cli.silence;
|
|
87
|
+
if (!silence) {
|
|
88
|
+
console.log("");
|
|
89
|
+
console.log(chalk2.bgBlue.black(" INFO "), "Starting compression...");
|
|
90
|
+
console.log("");
|
|
91
|
+
}
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
runOne(cli).then(() => {
|
|
94
|
+
if (!silence) {
|
|
95
|
+
console.log("");
|
|
96
|
+
console.log(chalk2.bgGreen.black(" DONE "), chalk2.green("Done!"));
|
|
97
|
+
console.log("");
|
|
98
|
+
}
|
|
99
|
+
}).then(resolve).catch(reject);
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
run
|
|
104
|
+
};
|
|
105
|
+
/*!
|
|
106
|
+
* node-minify
|
|
107
|
+
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
108
|
+
* MIT Licensed
|
|
109
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-beta.0",
|
|
4
4
|
"description": "CLI - command line interface for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -13,17 +13,24 @@
|
|
|
13
13
|
"bin": {
|
|
14
14
|
"node-minify": "bin/cli.js"
|
|
15
15
|
},
|
|
16
|
-
"main": "lib/cli.js",
|
|
17
16
|
"engines": {
|
|
18
17
|
"node": ">=14.0.0"
|
|
19
18
|
},
|
|
20
19
|
"directories": {
|
|
21
|
-
"lib": "
|
|
20
|
+
"lib": "dist",
|
|
22
21
|
"test": "__tests__"
|
|
23
22
|
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./dist/index.mjs",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
"require": "./dist/index.js",
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"types": "./dist/index.d.ts"
|
|
30
|
+
},
|
|
24
31
|
"files": [
|
|
25
32
|
"bin",
|
|
26
|
-
"
|
|
33
|
+
"dist/**/*"
|
|
27
34
|
],
|
|
28
35
|
"publishConfig": {
|
|
29
36
|
"access": "public"
|
|
@@ -35,13 +42,23 @@
|
|
|
35
42
|
"bugs": {
|
|
36
43
|
"url": "https://github.com/srod/node-minify/issues"
|
|
37
44
|
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"clean": "pnpm dlx rimraf dist",
|
|
47
|
+
"build": "npm run clean && tsup src/index.ts --format cjs,esm --dts --clean",
|
|
48
|
+
"prepublishOnly": "npm run build"
|
|
49
|
+
},
|
|
38
50
|
"dependencies": {
|
|
39
|
-
"@node-minify/core": "
|
|
40
|
-
"@node-minify/utils": "
|
|
51
|
+
"@node-minify/core": "8.0.0-beta.0",
|
|
52
|
+
"@node-minify/utils": "8.0.0-beta.0",
|
|
41
53
|
"chalk": "4.1.2",
|
|
42
54
|
"commander": "9.4.1",
|
|
43
55
|
"ora": "5.4.1",
|
|
44
56
|
"update-notifier": "6.0.2"
|
|
45
57
|
},
|
|
46
|
-
"
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@node-minify/types": "8.0.0-beta.0",
|
|
60
|
+
"@types/chalk": "^2.2.0",
|
|
61
|
+
"@types/ora": "^3.2.0"
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "0507c6190577e1939997a8231b07952ba167a780"
|
|
47
64
|
}
|
package/lib/cli.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.run = void 0;
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var _compress = require("./compress");
|
|
9
|
-
var _spinner = require("./spinner");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
/*!
|
|
12
|
-
* node-minify
|
|
13
|
-
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
14
|
-
* MIT Licensed
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Module dependencies.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Module variables.
|
|
23
|
-
*/
|
|
24
|
-
let silence = false;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Run one compressor.
|
|
28
|
-
*/
|
|
29
|
-
const runOne = cli => {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
const compressor = typeof cli.compressor === 'string' ? require(`@node-minify/${cli.compressor}`) : cli.compressor;
|
|
32
|
-
const options = {
|
|
33
|
-
compressorLabel: cli.compressor,
|
|
34
|
-
compressor,
|
|
35
|
-
input: cli.input.split(','),
|
|
36
|
-
output: cli.output
|
|
37
|
-
};
|
|
38
|
-
if (cli.option) {
|
|
39
|
-
options.options = JSON.parse(cli.option);
|
|
40
|
-
}
|
|
41
|
-
if (!silence) {
|
|
42
|
-
(0, _spinner.spinnerStart)(options);
|
|
43
|
-
}
|
|
44
|
-
return (0, _compress.compress)(options).then(result => {
|
|
45
|
-
if (!silence) {
|
|
46
|
-
(0, _spinner.spinnerStop)(result);
|
|
47
|
-
}
|
|
48
|
-
resolve(result);
|
|
49
|
-
}).catch(err => {
|
|
50
|
-
if (!silence) {
|
|
51
|
-
(0, _spinner.spinnerError)(options);
|
|
52
|
-
}
|
|
53
|
-
reject(err);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Run cli.
|
|
60
|
-
*/
|
|
61
|
-
const run = cli => {
|
|
62
|
-
silence = !!cli.silence;
|
|
63
|
-
if (!silence) {
|
|
64
|
-
console.log('');
|
|
65
|
-
console.log(_chalk.default.bgBlue.black(' INFO '), 'Starting compression...');
|
|
66
|
-
console.log('');
|
|
67
|
-
}
|
|
68
|
-
return new Promise((resolve, reject) => {
|
|
69
|
-
runOne(cli).then(() => {
|
|
70
|
-
if (!silence) {
|
|
71
|
-
console.log('');
|
|
72
|
-
console.log(_chalk.default.bgGreen.black(' DONE '), _chalk.default.green('Done!'));
|
|
73
|
-
console.log('');
|
|
74
|
-
}
|
|
75
|
-
}).then(resolve).catch(reject);
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Expose `run()`.
|
|
81
|
-
*/
|
|
82
|
-
exports.run = run;
|
package/lib/compress.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.compress = void 0;
|
|
7
|
-
var _core = _interopRequireDefault(require("@node-minify/core"));
|
|
8
|
-
var _utils = require("@node-minify/utils");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
/*!
|
|
11
|
-
* node-minify
|
|
12
|
-
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
13
|
-
* MIT Licensed
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Module dependencies.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Run compression.
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} options
|
|
24
|
-
*/
|
|
25
|
-
const compress = options => {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
(0, _core.default)(options).then(() => {
|
|
28
|
-
if (options.output.includes('$1')) {
|
|
29
|
-
// TODO handle $1 output
|
|
30
|
-
// npx node-minify --compressor uglify-js --input 'source/**/*.js' --output 'source/$1.min.js' --option '{"warnings": true, "mangle": false}'
|
|
31
|
-
return resolve({
|
|
32
|
-
compressorLabel: options.compressorLabel,
|
|
33
|
-
compressor: options.compressor,
|
|
34
|
-
size: 0,
|
|
35
|
-
sizeGzip: 0
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
_utils.utils.getFilesizeGzippedInBytes(options.output).then(sizeGzip => {
|
|
39
|
-
resolve({
|
|
40
|
-
compressorLabel: options.compressorLabel,
|
|
41
|
-
compressor: options.compressor,
|
|
42
|
-
size: _utils.utils.getFilesizeInBytes(options.output),
|
|
43
|
-
sizeGzip: sizeGzip
|
|
44
|
-
});
|
|
45
|
-
}).catch(reject);
|
|
46
|
-
}).catch(reject);
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Expose `compress()`.
|
|
52
|
-
*/
|
|
53
|
-
exports.compress = compress;
|
package/lib/spinner.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.spinnerStop = exports.spinnerStart = exports.spinnerError = void 0;
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var _ora = _interopRequireDefault(require("ora"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
/*!
|
|
11
|
-
* node-minify
|
|
12
|
-
* Copyright(c) 2011-2022 Rodolphe Stoclin
|
|
13
|
-
* MIT Licensed
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Module dependencies.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const spinner = (0, _ora.default)();
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Start spinner.
|
|
24
|
-
*
|
|
25
|
-
* @param {Object} options
|
|
26
|
-
*/
|
|
27
|
-
const start = options => {
|
|
28
|
-
spinner.text = 'Compressing file(s) with ' + _chalk.default.green(options.compressorLabel) + '...';
|
|
29
|
-
spinner.start();
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Stop spinner.
|
|
34
|
-
*
|
|
35
|
-
* @param {Object} result
|
|
36
|
-
*/
|
|
37
|
-
exports.spinnerStart = start;
|
|
38
|
-
const stop = result => {
|
|
39
|
-
spinner.text = 'File(s) compressed successfully with ' + _chalk.default.green(result.compressorLabel) + ' (' + _chalk.default.green(result.size) + ' minified, ' + _chalk.default.green(result.sizeGzip) + ' gzipped)';
|
|
40
|
-
spinner.succeed();
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Mark spinner as failed.
|
|
45
|
-
*
|
|
46
|
-
* @param {Object} options
|
|
47
|
-
*/
|
|
48
|
-
exports.spinnerStop = stop;
|
|
49
|
-
const error = options => {
|
|
50
|
-
spinner.text = 'Error - file(s) not compressed with ' + _chalk.default.red(options.compressorLabel);
|
|
51
|
-
spinner.fail();
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Expose `start(), stop() and error()`.
|
|
56
|
-
*/
|
|
57
|
-
exports.spinnerError = error;
|