strictr 0.2.2 → 0.2.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/lib/check.d.ts +5 -5
- package/lib/check.js +96 -96
- package/lib/functions/add.use.strict.d.ts +3 -3
- package/lib/functions/add.use.strict.js +48 -48
- package/lib/functions/bail.d.ts +3 -3
- package/lib/functions/bail.js +9 -9
- package/lib/functions/check.folder.d.ts +3 -3
- package/lib/functions/check.folder.js +41 -41
- package/lib/functions/convert.files.to.objects.d.ts +3 -3
- package/lib/functions/convert.files.to.objects.js +40 -40
- package/lib/functions/fix.extension.d.ts +3 -3
- package/lib/functions/fix.extension.js +10 -10
- package/lib/functions/get.config.d.ts +3 -3
- package/lib/functions/get.config.js +74 -74
- package/lib/functions/get.files.listing.d.ts +3 -3
- package/lib/functions/get.files.listing.js +51 -51
- package/lib/functions/get.table.from.file.objects.d.ts +4 -4
- package/lib/functions/get.table.from.file.objects.js +41 -41
- package/lib/functions/missing.strict.statement.d.ts +3 -3
- package/lib/functions/missing.strict.statement.js +35 -35
- package/lib/strictr.d.ts +2 -2
- package/lib/strictr.js +18 -18
- package/package.json +8 -8
package/lib/check.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const _default: {
|
|
3
|
-
run(commander: any): void;
|
|
4
|
-
};
|
|
5
|
-
export default _default;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const _default: {
|
|
3
|
+
run(commander: any): void;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
package/lib/check.js
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const path = __importStar(require("path"));
|
|
31
|
-
const _ = __importStar(require("lodash"));
|
|
32
|
-
const bail_1 = __importDefault(require("./functions/bail"));
|
|
33
|
-
const get_config_1 = __importDefault(require("./functions/get.config"));
|
|
34
|
-
const check_folder_1 = __importDefault(require("./functions/check.folder"));
|
|
35
|
-
const add_use_strict_1 = __importDefault(require("./functions/add.use.strict"));
|
|
36
|
-
const get_files_listing_1 = __importDefault(require("./functions/get.files.listing"));
|
|
37
|
-
const convert_files_to_objects_1 = __importDefault(require("./functions/convert.files.to.objects"));
|
|
38
|
-
const missing_strict_statement_1 = __importDefault(require("./functions/missing.strict.statement"));
|
|
39
|
-
const get_table_from_file_objects_1 = __importDefault(require("./functions/get.table.from.file.objects"));
|
|
40
|
-
const clc = require('cli-color');
|
|
41
|
-
exports.default = {
|
|
42
|
-
run(commander) {
|
|
43
|
-
console.log(clc.blue.bgGreen.bold('\n*** STRICTR ***'));
|
|
44
|
-
const options = _.pick(commander, ['config', 'add']);
|
|
45
|
-
const { add = false } = options;
|
|
46
|
-
const root = process.cwd();
|
|
47
|
-
const config = (0, get_config_1.default)(root, options === null || options === void 0 ? void 0 : options.config);
|
|
48
|
-
const { srcFolderName, testFolderName } = config;
|
|
49
|
-
let { filesExtension } = config;
|
|
50
|
-
const srcFolder = path.join(root, srcFolderName);
|
|
51
|
-
(0, check_folder_1.default)(srcFolder, 'Source');
|
|
52
|
-
const testFolder = path.join(root, testFolderName);
|
|
53
|
-
(0, check_folder_1.default)(testFolder, 'Test');
|
|
54
|
-
let srcFiles = (0, get_files_listing_1.default)(srcFolder, filesExtension);
|
|
55
|
-
let testFiles = (0, get_files_listing_1.default)(testFolder, filesExtension);
|
|
56
|
-
srcFiles = _.filter(srcFiles, missing_strict_statement_1.default);
|
|
57
|
-
if (!_.isEmpty(srcFiles)) {
|
|
58
|
-
console.log(clc.red('\nStrictr: Source files missing the ' + clc.italic("'use strict';") + ' statement:'));
|
|
59
|
-
console.log(clc.red((0, get_table_from_file_objects_1.default)((0, convert_files_to_objects_1.default)(srcFiles)).toString()));
|
|
60
|
-
}
|
|
61
|
-
else
|
|
62
|
-
console.log(clc.green('\n✅ Strictr: No source files are missing the ' + clc.italic("'use strict';") + ' statement.'));
|
|
63
|
-
testFiles = _.filter(testFiles, missing_strict_statement_1.default);
|
|
64
|
-
if (!_.isEmpty(testFiles)) {
|
|
65
|
-
console.log(clc.red('\nStrictr: Test files missing the ' + clc.italic("'use strict';") + ' statement:'));
|
|
66
|
-
console.log(clc.red((0, get_table_from_file_objects_1.default)((0, convert_files_to_objects_1.default)(testFiles)).toString()));
|
|
67
|
-
}
|
|
68
|
-
else
|
|
69
|
-
console.log(clc.green('\n✅ Strictr: No test files are missing the ' + clc.italic("'use strict';") + ' statement.'));
|
|
70
|
-
if (add) {
|
|
71
|
-
if (_.isEmpty(srcFiles) && _.isEmpty(testFiles)) {
|
|
72
|
-
return console.log(clc.green('\n✅ ' + clc.bold('Strictr') + ': Everything is awesome!\n'));
|
|
73
|
-
}
|
|
74
|
-
console.log(clc.blue('\n🔍 Strictr: Add is set to true. Adding ' + clc.italic("'use strict';") + ' where I can...\n'));
|
|
75
|
-
_.each(srcFiles, (file) => {
|
|
76
|
-
(0, add_use_strict_1.default)(file);
|
|
77
|
-
});
|
|
78
|
-
console.log('');
|
|
79
|
-
_.each(testFiles, (file) => {
|
|
80
|
-
(0, add_use_strict_1.default)(file);
|
|
81
|
-
});
|
|
82
|
-
console.log('\n');
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
if (_.isEmpty(srcFiles) && _.isEmpty(testFiles)) {
|
|
86
|
-
return console.log(clc.green('\n✅ ' + clc.bold('Strictr') + ': Everything is awesome!\n'));
|
|
87
|
-
}
|
|
88
|
-
let message = '\n';
|
|
89
|
-
if (!_.isEmpty(srcFiles))
|
|
90
|
-
message += clc.bold('Strictr ERROR:') + ' There are source files missing the ' + clc.italic("'use strict';") + ' statement!\n';
|
|
91
|
-
if (!_.isEmpty(testFiles))
|
|
92
|
-
message += clc.bold('Strictr ERROR:') + ' There are test files missing the ' + clc.italic("'use strict';") + ' statement!\n';
|
|
93
|
-
(0, bail_1.default)(clc.red(message));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
const path = __importStar(require("path"));
|
|
31
|
+
const _ = __importStar(require("lodash"));
|
|
32
|
+
const bail_1 = __importDefault(require("./functions/bail"));
|
|
33
|
+
const get_config_1 = __importDefault(require("./functions/get.config"));
|
|
34
|
+
const check_folder_1 = __importDefault(require("./functions/check.folder"));
|
|
35
|
+
const add_use_strict_1 = __importDefault(require("./functions/add.use.strict"));
|
|
36
|
+
const get_files_listing_1 = __importDefault(require("./functions/get.files.listing"));
|
|
37
|
+
const convert_files_to_objects_1 = __importDefault(require("./functions/convert.files.to.objects"));
|
|
38
|
+
const missing_strict_statement_1 = __importDefault(require("./functions/missing.strict.statement"));
|
|
39
|
+
const get_table_from_file_objects_1 = __importDefault(require("./functions/get.table.from.file.objects"));
|
|
40
|
+
const clc = require('cli-color');
|
|
41
|
+
exports.default = {
|
|
42
|
+
run(commander) {
|
|
43
|
+
console.log(clc.blue.bgGreen.bold('\n*** STRICTR ***'));
|
|
44
|
+
const options = _.pick(commander, ['config', 'add']);
|
|
45
|
+
const { add = false } = options;
|
|
46
|
+
const root = process.cwd();
|
|
47
|
+
const config = (0, get_config_1.default)(root, options === null || options === void 0 ? void 0 : options.config);
|
|
48
|
+
const { srcFolderName, testFolderName } = config;
|
|
49
|
+
let { filesExtension } = config;
|
|
50
|
+
const srcFolder = path.join(root, srcFolderName);
|
|
51
|
+
(0, check_folder_1.default)(srcFolder, 'Source');
|
|
52
|
+
const testFolder = path.join(root, testFolderName);
|
|
53
|
+
(0, check_folder_1.default)(testFolder, 'Test');
|
|
54
|
+
let srcFiles = (0, get_files_listing_1.default)(srcFolder, filesExtension);
|
|
55
|
+
let testFiles = (0, get_files_listing_1.default)(testFolder, filesExtension);
|
|
56
|
+
srcFiles = _.filter(srcFiles, missing_strict_statement_1.default);
|
|
57
|
+
if (!_.isEmpty(srcFiles)) {
|
|
58
|
+
console.log(clc.red('\nStrictr: Source files missing the ' + clc.italic("'use strict';") + ' statement:'));
|
|
59
|
+
console.log(clc.red((0, get_table_from_file_objects_1.default)((0, convert_files_to_objects_1.default)(srcFiles)).toString()));
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
console.log(clc.green('\n✅ Strictr: No source files are missing the ' + clc.italic("'use strict';") + ' statement.'));
|
|
63
|
+
testFiles = _.filter(testFiles, missing_strict_statement_1.default);
|
|
64
|
+
if (!_.isEmpty(testFiles)) {
|
|
65
|
+
console.log(clc.red('\nStrictr: Test files missing the ' + clc.italic("'use strict';") + ' statement:'));
|
|
66
|
+
console.log(clc.red((0, get_table_from_file_objects_1.default)((0, convert_files_to_objects_1.default)(testFiles)).toString()));
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
console.log(clc.green('\n✅ Strictr: No test files are missing the ' + clc.italic("'use strict';") + ' statement.'));
|
|
70
|
+
if (add) {
|
|
71
|
+
if (_.isEmpty(srcFiles) && _.isEmpty(testFiles)) {
|
|
72
|
+
return console.log(clc.green('\n✅ ' + clc.bold('Strictr') + ': Everything is awesome!\n'));
|
|
73
|
+
}
|
|
74
|
+
console.log(clc.blue('\n🔍 Strictr: Add is set to true. Adding ' + clc.italic("'use strict';") + ' where I can...\n'));
|
|
75
|
+
_.each(srcFiles, (file) => {
|
|
76
|
+
(0, add_use_strict_1.default)(file);
|
|
77
|
+
});
|
|
78
|
+
console.log('');
|
|
79
|
+
_.each(testFiles, (file) => {
|
|
80
|
+
(0, add_use_strict_1.default)(file);
|
|
81
|
+
});
|
|
82
|
+
console.log('\n');
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
if (_.isEmpty(srcFiles) && _.isEmpty(testFiles)) {
|
|
86
|
+
return console.log(clc.green('\n✅ ' + clc.bold('Strictr') + ': Everything is awesome!\n'));
|
|
87
|
+
}
|
|
88
|
+
let message = '\n';
|
|
89
|
+
if (!_.isEmpty(srcFiles))
|
|
90
|
+
message += clc.bold('Strictr ERROR:') + ' There are source files missing the ' + clc.italic("'use strict';") + ' statement!\n';
|
|
91
|
+
if (!_.isEmpty(testFiles))
|
|
92
|
+
message += clc.bold('Strictr ERROR:') + ' There are test files missing the ' + clc.italic("'use strict';") + ' statement!\n';
|
|
93
|
+
(0, bail_1.default)(clc.red(message));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
97
|
//# sourceMappingURL=check.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const addUseStrict: (path: string) => void;
|
|
3
|
-
export default addUseStrict;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const addUseStrict: (path: string) => void;
|
|
3
|
+
export default addUseStrict;
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const fs = __importStar(require("fs"));
|
|
28
|
-
const lodash_1 = require("lodash");
|
|
29
|
-
const clc = require('cli-color');
|
|
30
|
-
const addUseStrict = (path) => {
|
|
31
|
-
if (!fs.existsSync(path))
|
|
32
|
-
return console.log(clc.red('\nStrictr ERROR: ' + clc.bold(`${path}`) + ' does not exist.'));
|
|
33
|
-
const content = fs.readFileSync(path, 'utf-8');
|
|
34
|
-
let lines = (0, lodash_1.split)((0, lodash_1.trim)(content), '\n');
|
|
35
|
-
const one = (0, lodash_1.trim)((0, lodash_1.first)(lines));
|
|
36
|
-
const hasBang = (0, lodash_1.startsWith)(one, '#!/');
|
|
37
|
-
let allButFirst = hasBang
|
|
38
|
-
? (0, lodash_1.tail)(lines)
|
|
39
|
-
: lines;
|
|
40
|
-
allButFirst = (0, lodash_1.split)((0, lodash_1.trim)((0, lodash_1.join)(allButFirst, '\n')), '\n');
|
|
41
|
-
lines = ["'use strict';", '', ...allButFirst];
|
|
42
|
-
lines = hasBang
|
|
43
|
-
? [one, ...lines]
|
|
44
|
-
: lines;
|
|
45
|
-
fs.writeFileSync(path, (0, lodash_1.join)(lines, '\n'), 'utf-8');
|
|
46
|
-
console.log(clc.blue(' - Strictr Added ' + clc.italic("'use strict';") + ' to' + clc.bold(path) + '...'));
|
|
47
|
-
};
|
|
48
|
-
exports.default = addUseStrict;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const lodash_1 = require("lodash");
|
|
29
|
+
const clc = require('cli-color');
|
|
30
|
+
const addUseStrict = (path) => {
|
|
31
|
+
if (!fs.existsSync(path))
|
|
32
|
+
return console.log(clc.red('\nStrictr ERROR: ' + clc.bold(`${path}`) + ' does not exist.'));
|
|
33
|
+
const content = fs.readFileSync(path, 'utf-8');
|
|
34
|
+
let lines = (0, lodash_1.split)((0, lodash_1.trim)(content), '\n');
|
|
35
|
+
const one = (0, lodash_1.trim)((0, lodash_1.first)(lines));
|
|
36
|
+
const hasBang = (0, lodash_1.startsWith)(one, '#!/');
|
|
37
|
+
let allButFirst = hasBang
|
|
38
|
+
? (0, lodash_1.tail)(lines)
|
|
39
|
+
: lines;
|
|
40
|
+
allButFirst = (0, lodash_1.split)((0, lodash_1.trim)((0, lodash_1.join)(allButFirst, '\n')), '\n');
|
|
41
|
+
lines = ["'use strict';", '', ...allButFirst];
|
|
42
|
+
lines = hasBang
|
|
43
|
+
? [one, ...lines]
|
|
44
|
+
: lines;
|
|
45
|
+
fs.writeFileSync(path, (0, lodash_1.join)(lines, '\n'), 'utf-8');
|
|
46
|
+
console.log(clc.blue(' - Strictr Added ' + clc.italic("'use strict';") + ' to' + clc.bold(path) + '...'));
|
|
47
|
+
};
|
|
48
|
+
exports.default = addUseStrict;
|
|
49
49
|
//# sourceMappingURL=add.use.strict.js.map
|
package/lib/functions/bail.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const bail: (message?: string) => void;
|
|
3
|
-
export default bail;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const bail: (message?: string) => void;
|
|
3
|
+
export default bail;
|
package/lib/functions/bail.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const { exit } = require('node:process');
|
|
5
|
-
const bail = (message) => {
|
|
6
|
-
console.error(message);
|
|
7
|
-
exit(2);
|
|
8
|
-
};
|
|
9
|
-
exports.default = bail;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const { exit } = require('node:process');
|
|
5
|
+
const bail = (message) => {
|
|
6
|
+
console.error(message);
|
|
7
|
+
exit(2);
|
|
8
|
+
};
|
|
9
|
+
exports.default = bail;
|
|
10
10
|
//# sourceMappingURL=bail.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const checkFolder: (folder: string, type: string) => void;
|
|
3
|
-
export default checkFolder;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const checkFolder: (folder: string, type: string) => void;
|
|
3
|
+
export default checkFolder;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const fs = __importStar(require("fs"));
|
|
31
|
-
const bail_1 = __importDefault(require("./bail"));
|
|
32
|
-
const clc = require('cli-color');
|
|
33
|
-
const checkFolder = (folder, type) => {
|
|
34
|
-
if (!fs.existsSync(folder)) {
|
|
35
|
-
(0, bail_1.default)(clc.red(`\nERROR: ${type} folder ` + clc.bold(`${folder}`) + ' does not exist.'));
|
|
36
|
-
}
|
|
37
|
-
if (!fs.lstatSync(folder).isDirectory()) {
|
|
38
|
-
(0, bail_1.default)(clc.red(`\nERROR: ${type} folder ` + clc.bold(`${folder}`) + ' is not a directory.'));
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
exports.default = checkFolder;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
31
|
+
const bail_1 = __importDefault(require("./bail"));
|
|
32
|
+
const clc = require('cli-color');
|
|
33
|
+
const checkFolder = (folder, type) => {
|
|
34
|
+
if (!fs.existsSync(folder)) {
|
|
35
|
+
(0, bail_1.default)(clc.red(`\nERROR: ${type} folder ` + clc.bold(`${folder}`) + ' does not exist.'));
|
|
36
|
+
}
|
|
37
|
+
if (!fs.lstatSync(folder).isDirectory()) {
|
|
38
|
+
(0, bail_1.default)(clc.red(`\nERROR: ${type} folder ` + clc.bold(`${folder}`) + ' is not a directory.'));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.default = checkFolder;
|
|
42
42
|
//# sourceMappingURL=check.folder.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const convertFilesToObjects: (files: string[]) => any[];
|
|
3
|
-
export default convertFilesToObjects;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const convertFilesToObjects: (files: string[]) => any[];
|
|
3
|
+
export default convertFilesToObjects;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const os = __importStar(require("node:os"));
|
|
28
|
-
const _ = __importStar(require("lodash"));
|
|
29
|
-
const convertFilesToObjects = (files) => {
|
|
30
|
-
const platform = os.platform();
|
|
31
|
-
const separator = 'win32' === platform ? '\\' : '/';
|
|
32
|
-
return _.map(files, (f) => {
|
|
33
|
-
const parts = _.split(f, separator);
|
|
34
|
-
const name = parts.pop();
|
|
35
|
-
const path = _.join(parts, separator);
|
|
36
|
-
const full = path + separator + name;
|
|
37
|
-
return { name, path, full };
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
exports.default = convertFilesToObjects;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
const os = __importStar(require("node:os"));
|
|
28
|
+
const _ = __importStar(require("lodash"));
|
|
29
|
+
const convertFilesToObjects = (files) => {
|
|
30
|
+
const platform = os.platform();
|
|
31
|
+
const separator = 'win32' === platform ? '\\' : '/';
|
|
32
|
+
return _.map(files, (f) => {
|
|
33
|
+
const parts = _.split(f, separator);
|
|
34
|
+
const name = parts.pop();
|
|
35
|
+
const path = _.join(parts, separator);
|
|
36
|
+
const full = path + separator + name;
|
|
37
|
+
return { name, path, full };
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
exports.default = convertFilesToObjects;
|
|
41
41
|
//# sourceMappingURL=convert.files.to.objects.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const fixExtension: (ext: string) => string;
|
|
3
|
-
export default fixExtension;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const fixExtension: (ext: string) => string;
|
|
3
|
+
export default fixExtension;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const fixExtension = (ext) => {
|
|
6
|
-
if (!(0, lodash_1.startsWith)(ext, '.'))
|
|
7
|
-
ext = '.' + ext;
|
|
8
|
-
return (0, lodash_1.toLower)(ext);
|
|
9
|
-
};
|
|
10
|
-
exports.default = fixExtension;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const fixExtension = (ext) => {
|
|
6
|
+
if (!(0, lodash_1.startsWith)(ext, '.'))
|
|
7
|
+
ext = '.' + ext;
|
|
8
|
+
return (0, lodash_1.toLower)(ext);
|
|
9
|
+
};
|
|
10
|
+
exports.default = fixExtension;
|
|
11
11
|
//# sourceMappingURL=fix.extension.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const getConfig: (root: string, configFile: string) => any;
|
|
3
|
-
export default getConfig;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const getConfig: (root: string, configFile: string) => any;
|
|
3
|
+
export default getConfig;
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const fs = __importStar(require("fs"));
|
|
31
|
-
const path_1 = __importDefault(require("path"));
|
|
32
|
-
const lodash_1 = require("lodash");
|
|
33
|
-
const fix_extension_1 = __importDefault(require("./fix.extension"));
|
|
34
|
-
const _hasJS = (srcFolder) => {
|
|
35
|
-
const files = fs.readdirSync(srcFolder);
|
|
36
|
-
const hasJS = (0, lodash_1.find)(files, (file) => {
|
|
37
|
-
const ext = path_1.default.extname(file);
|
|
38
|
-
return ext === '.js';
|
|
39
|
-
});
|
|
40
|
-
return !!hasJS;
|
|
41
|
-
};
|
|
42
|
-
const _getDefaultConfig = (root) => {
|
|
43
|
-
const defaultConfig = {
|
|
44
|
-
srcFolderName: 'src',
|
|
45
|
-
testFolderName: 'test',
|
|
46
|
-
filesExtension: '.ts'
|
|
47
|
-
};
|
|
48
|
-
try {
|
|
49
|
-
let config = (0, lodash_1.cloneDeep)(defaultConfig);
|
|
50
|
-
const srcFolder = path_1.default.join(root, 'src');
|
|
51
|
-
if (fs.lstatSync(srcFolder).isDirectory()) {
|
|
52
|
-
if (_hasJS(srcFolder)) {
|
|
53
|
-
(0, lodash_1.set)(config, 'filesExtension', '.js');
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return config;
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
return defaultConfig;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const getConfig = (root, configFile) => {
|
|
63
|
-
const defaultConfig = _getDefaultConfig(root);
|
|
64
|
-
try {
|
|
65
|
-
const userConfig = require(path_1.default.join(root, configFile));
|
|
66
|
-
const config = Object.assign(Object.assign({}, defaultConfig), userConfig);
|
|
67
|
-
(0, lodash_1.set)(config, 'filesExtension', (0, fix_extension_1.default)(config.filesExtension));
|
|
68
|
-
return config;
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return defaultConfig;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
exports.default = getConfig;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const lodash_1 = require("lodash");
|
|
33
|
+
const fix_extension_1 = __importDefault(require("./fix.extension"));
|
|
34
|
+
const _hasJS = (srcFolder) => {
|
|
35
|
+
const files = fs.readdirSync(srcFolder);
|
|
36
|
+
const hasJS = (0, lodash_1.find)(files, (file) => {
|
|
37
|
+
const ext = path_1.default.extname(file);
|
|
38
|
+
return ext === '.js';
|
|
39
|
+
});
|
|
40
|
+
return !!hasJS;
|
|
41
|
+
};
|
|
42
|
+
const _getDefaultConfig = (root) => {
|
|
43
|
+
const defaultConfig = {
|
|
44
|
+
srcFolderName: 'src',
|
|
45
|
+
testFolderName: 'test',
|
|
46
|
+
filesExtension: '.ts'
|
|
47
|
+
};
|
|
48
|
+
try {
|
|
49
|
+
let config = (0, lodash_1.cloneDeep)(defaultConfig);
|
|
50
|
+
const srcFolder = path_1.default.join(root, 'src');
|
|
51
|
+
if (fs.lstatSync(srcFolder).isDirectory()) {
|
|
52
|
+
if (_hasJS(srcFolder)) {
|
|
53
|
+
(0, lodash_1.set)(config, 'filesExtension', '.js');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return config;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return defaultConfig;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const getConfig = (root, configFile) => {
|
|
63
|
+
const defaultConfig = _getDefaultConfig(root);
|
|
64
|
+
try {
|
|
65
|
+
const userConfig = require(path_1.default.join(root, configFile));
|
|
66
|
+
const config = Object.assign(Object.assign({}, defaultConfig), userConfig);
|
|
67
|
+
(0, lodash_1.set)(config, 'filesExtension', (0, fix_extension_1.default)(config.filesExtension));
|
|
68
|
+
return config;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return defaultConfig;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.default = getConfig;
|
|
75
75
|
//# sourceMappingURL=get.config.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const getFilesListing: (root: string, ext: string) => any[];
|
|
3
|
-
export default getFilesListing;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const getFilesListing: (root: string, ext: string) => any[];
|
|
3
|
+
export default getFilesListing;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const fs = __importStar(require("fs"));
|
|
31
|
-
const path = __importStar(require("path"));
|
|
32
|
-
const _ = __importStar(require("lodash"));
|
|
33
|
-
const fix_extension_1 = __importDefault(require("./fix.extension"));
|
|
34
|
-
const getFilesListing = (root, ext) => {
|
|
35
|
-
ext = (0, fix_extension_1.default)(ext);
|
|
36
|
-
let files = [];
|
|
37
|
-
const children = fs.readdirSync(root);
|
|
38
|
-
const subfiles = _.filter(children, (child) => !fs.lstatSync(path.join(root, child)).isDirectory());
|
|
39
|
-
_.each(subfiles, (file) => {
|
|
40
|
-
const fileExt = path.extname(file);
|
|
41
|
-
if (ext === _.toLower(fileExt))
|
|
42
|
-
files.push(path.join(root, file));
|
|
43
|
-
});
|
|
44
|
-
const subfolders = _.filter(children, (child) => fs.lstatSync(path.join(root, child)).isDirectory());
|
|
45
|
-
_.each(subfolders, (folder) => {
|
|
46
|
-
const folderFullPath = path.join(root, folder);
|
|
47
|
-
files = _.concat(files, getFilesListing(folderFullPath, ext));
|
|
48
|
-
});
|
|
49
|
-
return _.sortBy(files);
|
|
50
|
-
};
|
|
51
|
-
exports.default = getFilesListing;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const _ = __importStar(require("lodash"));
|
|
33
|
+
const fix_extension_1 = __importDefault(require("./fix.extension"));
|
|
34
|
+
const getFilesListing = (root, ext) => {
|
|
35
|
+
ext = (0, fix_extension_1.default)(ext);
|
|
36
|
+
let files = [];
|
|
37
|
+
const children = fs.readdirSync(root);
|
|
38
|
+
const subfiles = _.filter(children, (child) => !fs.lstatSync(path.join(root, child)).isDirectory());
|
|
39
|
+
_.each(subfiles, (file) => {
|
|
40
|
+
const fileExt = path.extname(file);
|
|
41
|
+
if (ext === _.toLower(fileExt))
|
|
42
|
+
files.push(path.join(root, file));
|
|
43
|
+
});
|
|
44
|
+
const subfolders = _.filter(children, (child) => fs.lstatSync(path.join(root, child)).isDirectory());
|
|
45
|
+
_.each(subfolders, (folder) => {
|
|
46
|
+
const folderFullPath = path.join(root, folder);
|
|
47
|
+
files = _.concat(files, getFilesListing(folderFullPath, ext));
|
|
48
|
+
});
|
|
49
|
+
return _.sortBy(files);
|
|
50
|
+
};
|
|
51
|
+
exports.default = getFilesListing;
|
|
52
52
|
//# sourceMappingURL=get.files.listing.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import Table from 'cli-table';
|
|
3
|
-
declare const getTableFromFileObjects: (objects: string[], includeNewPath?: boolean) => Table;
|
|
4
|
-
export default getTableFromFileObjects;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import Table from 'cli-table';
|
|
3
|
+
declare const getTableFromFileObjects: (objects: string[], includeNewPath?: boolean) => Table;
|
|
4
|
+
export default getTableFromFileObjects;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const _ = __importStar(require("lodash"));
|
|
31
|
-
const cli_table_1 = __importDefault(require("cli-table"));
|
|
32
|
-
const getTableFromFileObjects = (objects, includeNewPath) => {
|
|
33
|
-
let columns = ['#', 'File', 'Path'];
|
|
34
|
-
if (includeNewPath)
|
|
35
|
-
columns.push('New Path');
|
|
36
|
-
const table = new cli_table_1.default({ style: { head: ['black'], compact: true }, head: columns });
|
|
37
|
-
let id = 0;
|
|
38
|
-
_.each(objects, (o) => table.push([++id, ..._.values(_.omit(o, ['full']))]));
|
|
39
|
-
return table;
|
|
40
|
-
};
|
|
41
|
-
exports.default = getTableFromFileObjects;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
const _ = __importStar(require("lodash"));
|
|
31
|
+
const cli_table_1 = __importDefault(require("cli-table"));
|
|
32
|
+
const getTableFromFileObjects = (objects, includeNewPath) => {
|
|
33
|
+
let columns = ['#', 'File', 'Path'];
|
|
34
|
+
if (includeNewPath)
|
|
35
|
+
columns.push('New Path');
|
|
36
|
+
const table = new cli_table_1.default({ style: { head: ['black'], compact: true }, head: columns });
|
|
37
|
+
let id = 0;
|
|
38
|
+
_.each(objects, (o) => table.push([++id, ..._.values(_.omit(o, ['full']))]));
|
|
39
|
+
return table;
|
|
40
|
+
};
|
|
41
|
+
exports.default = getTableFromFileObjects;
|
|
42
42
|
//# sourceMappingURL=get.table.from.file.objects.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
declare const missingStrictStatement: (file: string) => boolean;
|
|
3
|
-
export default missingStrictStatement;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const missingStrictStatement: (file: string) => boolean;
|
|
3
|
+
export default missingStrictStatement;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const fs = __importStar(require("fs"));
|
|
28
|
-
const lodash_1 = require("lodash");
|
|
29
|
-
const missingStrictStatement = (file) => {
|
|
30
|
-
const content = fs.readFileSync(file, 'utf-8');
|
|
31
|
-
let lines = (0, lodash_1.split)(content, '\n');
|
|
32
|
-
lines = (0, lodash_1.map)(lines, lodash_1.trim);
|
|
33
|
-
return !(0, lodash_1.find)(lines, (line) => (0, lodash_1.includes)(line, 'use strict'));
|
|
34
|
-
};
|
|
35
|
-
exports.default = missingStrictStatement;
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const lodash_1 = require("lodash");
|
|
29
|
+
const missingStrictStatement = (file) => {
|
|
30
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
31
|
+
let lines = (0, lodash_1.split)(content, '\n');
|
|
32
|
+
lines = (0, lodash_1.map)(lines, lodash_1.trim);
|
|
33
|
+
return !(0, lodash_1.find)(lines, (line) => (0, lodash_1.includes)(line, 'use strict'));
|
|
34
|
+
};
|
|
35
|
+
exports.default = missingStrictStatement;
|
|
36
36
|
//# sourceMappingURL=missing.strict.statement.js.map
|
package/lib/strictr.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
export {};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export {};
|
package/lib/strictr.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const commander_1 = require("commander");
|
|
8
|
-
const check_1 = __importDefault(require("./check"));
|
|
9
|
-
const commander = new commander_1.Command();
|
|
10
|
-
const packageJson = require('../package.json');
|
|
11
|
-
commander
|
|
12
|
-
.version(packageJson.version)
|
|
13
|
-
.description('Check for missing strict statement in files.\nUse .strictr.json config file to override default settings.')
|
|
14
|
-
.option('-a, --add', 'Add missing strict statements', false)
|
|
15
|
-
.option('-c, --config <config>', 'Alternative config file (must be .json)', '.strictr.json')
|
|
16
|
-
.parse(process.argv);
|
|
17
|
-
const options = commander.opts();
|
|
18
|
-
check_1.default.run(options);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const check_1 = __importDefault(require("./check"));
|
|
9
|
+
const commander = new commander_1.Command();
|
|
10
|
+
const packageJson = require('../package.json');
|
|
11
|
+
commander
|
|
12
|
+
.version(packageJson.version)
|
|
13
|
+
.description('Check for missing strict statement in files.\nUse .strictr.json config file to override default settings.')
|
|
14
|
+
.option('-a, --add', 'Add missing strict statements', false)
|
|
15
|
+
.option('-c, --config <config>', 'Alternative config file (must be .json)', '.strictr.json')
|
|
16
|
+
.parse(process.argv);
|
|
17
|
+
const options = commander.opts();
|
|
18
|
+
check_1.default.run(options);
|
|
19
19
|
//# sourceMappingURL=strictr.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strictr",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "strict statement checker",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16.0.0"
|
|
@@ -60,26 +60,26 @@
|
|
|
60
60
|
"@types/cli-table": "^0.3.1",
|
|
61
61
|
"cli-color": "^2.0.3",
|
|
62
62
|
"cli-table": "^0.3.11",
|
|
63
|
-
"commander": "^
|
|
63
|
+
"commander": "^10.0.1",
|
|
64
64
|
"lodash": "^4.17.21"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@types/chai": "^4.3.
|
|
67
|
+
"@types/chai": "^4.3.5",
|
|
68
68
|
"@types/commander": "^2.12.2",
|
|
69
|
-
"@types/lodash": "^4.14.
|
|
69
|
+
"@types/lodash": "^4.14.194",
|
|
70
70
|
"@types/mocha": "^10.0.1",
|
|
71
|
-
"@types/node": "^
|
|
71
|
+
"@types/node": "^20.1.1",
|
|
72
72
|
"chai": "^4.3.7",
|
|
73
73
|
"mocha": "^10.2.0",
|
|
74
74
|
"nyc": "^15.1.0",
|
|
75
|
-
"prettier": "^2.8.
|
|
75
|
+
"prettier": "^2.8.8",
|
|
76
76
|
"source-map-support": "^0.5.21",
|
|
77
77
|
"ts-node": "^10.4.0",
|
|
78
78
|
"tslint": "^6.1.3",
|
|
79
79
|
"tslint-config-prettier": "^1.18.0",
|
|
80
80
|
"tslint-etc": "^1.13.10",
|
|
81
81
|
"tslint-no-unused-expression-chai": "^0.1.4",
|
|
82
|
-
"typedoc": "^0.
|
|
83
|
-
"typescript": "^
|
|
82
|
+
"typedoc": "^0.24.7",
|
|
83
|
+
"typescript": "^5.0.4"
|
|
84
84
|
}
|
|
85
85
|
}
|