Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 1fa9cc4

Browse files
author
Giedrius Grabauskas
committed
Fixed build.
1 parent 078b7a3 commit 1fa9cc4

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

dist/main.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const fs = require('fs');
1414
const JS_EXTENSION = ".js";
1515
const MINIFY_EXTENSION_PREFIX = ".min";
1616
class RejectionError {
17-
constructor(error, type = undefined) {
17+
constructor(error, type) {
1818
this.error = error;
1919
this.type = type;
2020
}
@@ -24,6 +24,10 @@ class RejectionError {
2424
get Error() {
2525
return this.error;
2626
}
27+
ThrowError() {
28+
console.log("Error type: ", this.type);
29+
console.error(this.error);
30+
}
2731
}
2832
class GlobsUglifyJs {
2933
constructor(globPattern, options) {
@@ -37,7 +41,11 @@ class GlobsUglifyJs {
3741
main() {
3842
return __awaiter(this, void 0, void 0, function* () {
3943
let rejected = false;
40-
let filesList = yield this.getGlobs(this.globPattern)
44+
let globOptions;
45+
if (this.options.Exclue !== undefined) {
46+
globOptions = { ignore: this.options.Exclue };
47+
}
48+
let filesList = yield this.getGlobs(this.globPattern, globOptions)
4149
.catch(error => {
4250
console.log(error);
4351
rejected = true;
@@ -50,25 +58,25 @@ class GlobsUglifyJs {
5058
return;
5159
}
5260
yield this.recursiveUglify(filesList.slice(0))
53-
.catch(error => {
54-
console.log(error);
61+
.catch((error) => {
62+
error.ThrowError();
5563
rejected = true;
5664
});
5765
if (rejected) {
5866
return;
5967
}
6068
if (this.options.RemoveSource) {
6169
yield this.deleteFiles(filesList.slice(0))
62-
.catch(error => {
63-
console.log(error);
70+
.catch((error) => {
71+
error.ThrowError();
6472
rejected = true;
6573
});
6674
if (rejected) {
6775
return;
6876
}
6977
yield this.deleteEmptyDirectories(this.options.RootDir)
70-
.catch(error => {
71-
console.log(error);
78+
.catch((error) => {
79+
error.ThrowError();
7280
rejected = true;
7381
});
7482
if (rejected) {
@@ -161,7 +169,7 @@ class GlobsUglifyJs {
161169
yield this.recursiveUglify(filesList)
162170
.catch(error => {
163171
rejected = true;
164-
reject(new RejectionError(error, "recursiveUglify"));
172+
reject(error);
165173
});
166174
if (!rejected) {
167175
resolve();

dist/options.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface Options {
99
RootDir?: string;
1010
RemoveSource?: boolean;
1111
Debug?: boolean;
12+
exclude?: Array<string>;
1213
}
1314
export default class OptionsConstructor implements Options {
1415
constructor(importData?: Options);
@@ -20,4 +21,5 @@ export default class OptionsConstructor implements Options {
2021
readonly RootDir: string;
2122
readonly RemoveSource: boolean;
2223
readonly Debug: boolean;
24+
readonly Exclue: Array<string> | undefined;
2325
}

dist/options.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ class OptionsConstructor {
88
Cwd: undefined,
99
RootDir: "",
1010
RemoveSource: false,
11-
Debug: false
11+
Debug: false,
12+
exclude: undefined
1213
};
1314
if (importData != null) {
1415
if (importData.Cwd != null) {
@@ -46,6 +47,9 @@ class OptionsConstructor {
4647
get Debug() {
4748
return this.options.Debug;
4849
}
50+
get Exclue() {
51+
return this.options.exclude;
52+
}
4953
}
5054
Object.defineProperty(exports, "__esModule", { value: true });
5155
exports.default = OptionsConstructor;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "glob-uglifyjs",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Uglify files with glob pattern.",
55
"main": "dist/main.js",
66
"scripts": {

0 commit comments

Comments
 (0)