ko-lints 1.0.0-alpha.1 → 2.0.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/README.md +1 -3
- package/index.d.ts +18 -2
- package/lib/eslint.js +69 -0
- package/lib/factory.js +57 -0
- package/lib/index.js +27 -24
- package/lib/interfaces.js +2 -0
- package/lib/prettier.js +60 -35
- package/lib/stylelint.js +59 -0
- package/package.json +16 -19
- package/lib/cli.js +0 -13
- package/lib/constants.js +0 -5
- package/lib/utils.js +0 -47
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Pattern } from 'fast-glob';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type IOpts = {
|
|
4
|
+
write: boolean;
|
|
5
|
+
configPath: string;
|
|
6
|
+
patterns: Pattern[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type IKeys = 'eslint' | 'prettier' | 'stylelint';
|
|
10
|
+
|
|
11
|
+
declare class Lints {
|
|
12
|
+
private runner;
|
|
13
|
+
private opts;
|
|
14
|
+
state: 0 | 1;
|
|
15
|
+
constructor(opts: IOpts);
|
|
16
|
+
run(key: IKeys): Promise<true | string[]>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default Lints;
|
package/lib/eslint.js
CHANGED
|
@@ -1 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ko_lint_config_1 = require("ko-lint-config");
|
|
7
|
+
const factory_1 = __importDefault(require("./factory"));
|
|
8
|
+
const { ESLint } = ko_lint_config_1.eslint;
|
|
9
|
+
class ESlintRunner extends factory_1.default {
|
|
10
|
+
constructor(opts) {
|
|
11
|
+
super();
|
|
12
|
+
this.stdout = [];
|
|
13
|
+
this.opts = opts;
|
|
14
|
+
this.generateConfig();
|
|
15
|
+
}
|
|
16
|
+
generateConfig() {
|
|
17
|
+
if (this.opts.configPath) {
|
|
18
|
+
this.config = this.getConfigFromFile(this.opts.configPath);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const localConfigPath = this.detectLocalRunnerConfig('eslint');
|
|
22
|
+
if (localConfigPath) {
|
|
23
|
+
this.config = this.getConfigFromFile(localConfigPath);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async start() {
|
|
28
|
+
const { write, patterns } = this.opts;
|
|
29
|
+
const entries = await this.getEntries(patterns, [
|
|
30
|
+
...ESlintRunner.IGNORE_FILES,
|
|
31
|
+
]);
|
|
32
|
+
if (entries.length === 0) {
|
|
33
|
+
console.log(`No files matched with pattern:${patterns} via ${ESlintRunner.NAME}`);
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
const eslintInstance = new ESLint({
|
|
37
|
+
fix: write,
|
|
38
|
+
overrideConfig: this.config,
|
|
39
|
+
useEslintrc: false,
|
|
40
|
+
extensions: ESlintRunner.EXTENSIONS,
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
const formatter = await eslintInstance.loadFormatter();
|
|
44
|
+
const eslintFilesPromises = entries.map(async (file) => {
|
|
45
|
+
const result = await eslintInstance.lintFiles(file);
|
|
46
|
+
if (result[0].errorCount) {
|
|
47
|
+
const resultText = formatter.format(result);
|
|
48
|
+
this.stdout.push(resultText);
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
const result = await Promise.all(eslintFilesPromises);
|
|
54
|
+
if (result.includes(false)) {
|
|
55
|
+
return this.stdout;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (ex) {
|
|
62
|
+
console.error(ex);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
ESlintRunner.EXTENSIONS = ['ts', 'tsx', 'js', 'jsx'];
|
|
68
|
+
ESlintRunner.IGNORE_FILES = ['.eslintignore'];
|
|
69
|
+
ESlintRunner.NAME = 'eslint';
|
|
70
|
+
exports.default = ESlintRunner;
|
package/lib/factory.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const assert_1 = __importDefault(require("assert"));
|
|
9
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
|
+
class LintRunnerFactory {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.cwd = process.cwd();
|
|
13
|
+
}
|
|
14
|
+
async getEntries(patterns, ignoreFiles) {
|
|
15
|
+
return (0, fast_glob_1.default)(patterns, {
|
|
16
|
+
dot: true,
|
|
17
|
+
ignore: this.getIgnorePatterns(...ignoreFiles),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
getIgnorePatterns(...ignoreFiles) {
|
|
21
|
+
return ['.gitignore', ...ignoreFiles]
|
|
22
|
+
.map(fileName => {
|
|
23
|
+
const filePath = (0, path_1.join)(this.cwd, fileName);
|
|
24
|
+
if ((0, fs_1.existsSync)(filePath)) {
|
|
25
|
+
return (0, fs_1.readFileSync)(filePath, 'utf-8')
|
|
26
|
+
.split('\n')
|
|
27
|
+
.filter(str => str && !str.startsWith('#'));
|
|
28
|
+
}
|
|
29
|
+
return [];
|
|
30
|
+
})
|
|
31
|
+
.reduce((acc, current) => {
|
|
32
|
+
current.forEach(p => {
|
|
33
|
+
if (!acc.includes(p)) {
|
|
34
|
+
acc.push(p);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return acc;
|
|
38
|
+
}, []);
|
|
39
|
+
}
|
|
40
|
+
getConfigFromFile(filepath) {
|
|
41
|
+
(0, assert_1.default)((0, path_1.isAbsolute)(filepath), 'only accept absolute config filepath');
|
|
42
|
+
return require(filepath);
|
|
43
|
+
}
|
|
44
|
+
detectLocalRunnerConfig(name) {
|
|
45
|
+
const cwd = process.cwd();
|
|
46
|
+
const files = (0, fs_1.readdirSync)(cwd).filter(path => !(0, fs_1.statSync)(path).isDirectory());
|
|
47
|
+
let ret = '';
|
|
48
|
+
for (let file of files) {
|
|
49
|
+
if (file.includes(name) && !file.includes('ignore')) {
|
|
50
|
+
ret = file;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return ret ? (0, path_1.join)(cwd, ret) : ret;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = LintRunnerFactory;
|
package/lib/index.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
6
|
+
const eslint_1 = __importDefault(require("./eslint"));
|
|
7
|
+
const prettier_1 = __importDefault(require("./prettier"));
|
|
8
|
+
const stylelint_1 = __importDefault(require("./stylelint"));
|
|
9
|
+
class Lints {
|
|
10
|
+
constructor(opts) {
|
|
11
|
+
this.opts = opts;
|
|
12
|
+
}
|
|
13
|
+
async run(key) {
|
|
14
|
+
switch (key) {
|
|
15
|
+
case 'eslint':
|
|
16
|
+
this.runner = new eslint_1.default(this.opts);
|
|
17
|
+
break;
|
|
18
|
+
case 'prettier':
|
|
19
|
+
this.runner = new prettier_1.default(this.opts);
|
|
20
|
+
break;
|
|
21
|
+
case 'stylelint':
|
|
22
|
+
this.runner = new stylelint_1.default(this.opts);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
this.runner.generateConfig();
|
|
26
|
+
const result = await this.runner.start();
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
|
-
exports.default =
|
|
30
|
+
exports.default = Lints;
|
package/lib/prettier.js
CHANGED
|
@@ -1,48 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const promises_1 = require("fs/promises");
|
|
7
|
+
const ko_lint_config_1 = require("ko-lint-config");
|
|
8
|
+
const factory_1 = __importDefault(require("./factory"));
|
|
9
|
+
const { format, check } = ko_lint_config_1.prettier;
|
|
10
|
+
class PrettierRunner extends factory_1.default {
|
|
11
|
+
constructor(opts) {
|
|
12
|
+
super();
|
|
13
|
+
this.stdout = [];
|
|
14
|
+
this.opts = opts;
|
|
15
|
+
this.generateConfig();
|
|
16
|
+
}
|
|
17
|
+
generateConfig() {
|
|
18
|
+
if (this.opts.configPath) {
|
|
19
|
+
this.config = this.getConfigFromFile(this.opts.configPath);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const localConfigPath = this.detectLocalRunnerConfig('prettier');
|
|
23
|
+
if (localConfigPath) {
|
|
24
|
+
this.config = this.getConfigFromFile(localConfigPath);
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
}
|
|
28
|
+
async start() {
|
|
29
|
+
const { write, patterns } = this.opts;
|
|
30
|
+
const entries = await this.getEntries(patterns, [
|
|
31
|
+
...PrettierRunner.IGNORE_FILES,
|
|
32
|
+
]);
|
|
33
|
+
if (entries.length === 0) {
|
|
34
|
+
console.log(`No files matched with pattern:${patterns} via ${PrettierRunner.NAME}`);
|
|
35
|
+
process.exit(0);
|
|
26
36
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
try {
|
|
38
|
+
const formatFilesPromises = entries.map(async (file) => {
|
|
39
|
+
const source = await (0, promises_1.readFile)(file, 'utf-8');
|
|
40
|
+
const opts = { ...this.config, filepath: file };
|
|
41
|
+
if (write) {
|
|
42
|
+
const formatContent = format(source, opts);
|
|
43
|
+
await (0, promises_1.writeFile)(file, formatContent, 'utf-8');
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
if (check(source, opts)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.stdout.push(`file ${opts.filepath} doesn't match prettier config`);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const result = await Promise.all(formatFilesPromises);
|
|
32
57
|
if (result.includes(false)) {
|
|
33
|
-
stdout
|
|
58
|
+
return this.stdout;
|
|
34
59
|
}
|
|
35
60
|
else {
|
|
36
|
-
|
|
61
|
+
return true;
|
|
37
62
|
}
|
|
38
63
|
}
|
|
39
|
-
|
|
40
|
-
|
|
64
|
+
catch (ex) {
|
|
65
|
+
console.error(ex);
|
|
66
|
+
process.exit(1);
|
|
41
67
|
}
|
|
42
|
-
console.log(stdout);
|
|
43
|
-
}
|
|
44
|
-
catch (ex) {
|
|
45
|
-
console.error('prettier failed:', ex);
|
|
46
68
|
}
|
|
47
69
|
}
|
|
48
|
-
|
|
70
|
+
PrettierRunner.EXTENSIONS = ['ts', 'tsx', 'js', 'jsx', 'json'];
|
|
71
|
+
PrettierRunner.IGNORE_FILES = ['.prettierignore'];
|
|
72
|
+
PrettierRunner.NAME = 'prettier';
|
|
73
|
+
exports.default = PrettierRunner;
|
package/lib/stylelint.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ko_lint_config_1 = require("ko-lint-config");
|
|
7
|
+
const factory_1 = __importDefault(require("./factory"));
|
|
8
|
+
const { lint, formatters } = ko_lint_config_1.stylelint;
|
|
9
|
+
class StyleLintRunner extends factory_1.default {
|
|
10
|
+
constructor(opts) {
|
|
11
|
+
super();
|
|
12
|
+
this.stdout = [];
|
|
13
|
+
this.opts = opts;
|
|
14
|
+
this.generateConfig();
|
|
15
|
+
}
|
|
16
|
+
generateConfig() {
|
|
17
|
+
if (this.opts.configPath) {
|
|
18
|
+
this.config = this.getConfigFromFile(this.opts.configPath);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const localConfigPath = this.detectLocalRunnerConfig(StyleLintRunner.NAME);
|
|
22
|
+
if (localConfigPath) {
|
|
23
|
+
this.config = this.getConfigFromFile(localConfigPath);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async start() {
|
|
28
|
+
const { write, patterns } = this.opts;
|
|
29
|
+
const entries = await this.getEntries(patterns, [
|
|
30
|
+
...StyleLintRunner.IGNORE_FILES,
|
|
31
|
+
]);
|
|
32
|
+
if (entries.length === 0) {
|
|
33
|
+
console.log(`No files matched with pattern:${patterns} via ${StyleLintRunner.NAME}`);
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const result = await lint({
|
|
38
|
+
fix: write,
|
|
39
|
+
config: this.config,
|
|
40
|
+
files: entries,
|
|
41
|
+
});
|
|
42
|
+
if (result.errored) {
|
|
43
|
+
this.stdout = [formatters.string(result.results)];
|
|
44
|
+
return this.stdout;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (ex) {
|
|
51
|
+
console.error(ex);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
StyleLintRunner.EXTENSIONS = ['css', 'less', 'sass', 'scss'];
|
|
57
|
+
StyleLintRunner.IGNORE_FILES = ['.stylelintignore'];
|
|
58
|
+
StyleLintRunner.NAME = 'stylelint';
|
|
59
|
+
exports.default = StyleLintRunner;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ko-lints",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "lint tools used by ko",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ko",
|
|
@@ -16,31 +16,28 @@
|
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "https://github.com/DTStack/ko",
|
|
19
|
-
"directory": "packages/ko-
|
|
19
|
+
"directory": "packages/ko-lints"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"bin": {
|
|
25
|
-
"ko-lint": "./lib/cli.js"
|
|
26
|
-
},
|
|
22
|
+
"typings": "index.d.ts",
|
|
23
|
+
"main": "lib/index.js",
|
|
27
24
|
"files": [
|
|
28
25
|
"lib/*",
|
|
29
26
|
"index.d.ts"
|
|
30
27
|
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"prepublishOnly": "tsc",
|
|
33
|
-
"build": "tsc",
|
|
34
|
-
"debug": "tsc --sourcemap -w"
|
|
35
|
-
},
|
|
36
28
|
"dependencies": {
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"ko-config": "
|
|
29
|
+
"fast-glob": "^3.2.11"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"ko-lint-config": "1.0.0"
|
|
41
33
|
},
|
|
42
34
|
"devDependencies": {
|
|
43
|
-
"typescript": "^4.
|
|
35
|
+
"typescript": "^4.6.4",
|
|
36
|
+
"ko-lint-config": "1.0.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"debug": "tsc --sourcemap -w"
|
|
44
41
|
},
|
|
45
|
-
"
|
|
46
|
-
}
|
|
42
|
+
"readme": "# ko-lint\n\nThis package is used by [ko](https://github.com/DTStack/ko)\n"
|
|
43
|
+
}
|
package/lib/cli.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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 index_1 = __importDefault(require("./index"));
|
|
9
|
-
const pkg = require('../package.json');
|
|
10
|
-
const program = new commander_1.Command();
|
|
11
|
-
program.description('ko lint tools').version(pkg.version, '-v --version');
|
|
12
|
-
index_1.default(program);
|
|
13
|
-
program.parse();
|
package/lib/constants.js
DELETED
package/lib/utils.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTargetFiles = exports.findRealPath = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const fast_glob_1 = require("fast-glob");
|
|
7
|
-
const constants_1 = require("./constants");
|
|
8
|
-
function findRealPath(configPath) {
|
|
9
|
-
if (!fs_1.realpathSync(configPath)) {
|
|
10
|
-
configPath = path_1.join(process.cwd(), configPath);
|
|
11
|
-
}
|
|
12
|
-
if (fs_1.existsSync(configPath)) {
|
|
13
|
-
return configPath;
|
|
14
|
-
}
|
|
15
|
-
throw new Error('config file is not exist, please checkout config file path!');
|
|
16
|
-
}
|
|
17
|
-
exports.findRealPath = findRealPath;
|
|
18
|
-
/**
|
|
19
|
-
* @link Pattern syntax: https://github.com/mrmlnc/fast-glob#pattern-syntax
|
|
20
|
-
*/
|
|
21
|
-
function getTargetFiles(patterns, ignoreFile) {
|
|
22
|
-
if (!ignoreFile) {
|
|
23
|
-
ignoreFile = path_1.join(process.cwd(), constants_1.defaultIgnoreFile);
|
|
24
|
-
}
|
|
25
|
-
return fast_glob_1.sync(patterns, {
|
|
26
|
-
ignore: getIgnorePatterns(ignoreFile),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
exports.getTargetFiles = getTargetFiles;
|
|
30
|
-
function getIgnorePatterns(ignoreFile) {
|
|
31
|
-
const gitIgnorePath = path_1.join(process.cwd(), '.gitignore');
|
|
32
|
-
const gitIgnorePatterns = getFilePatterns(gitIgnorePath);
|
|
33
|
-
const ignorePatterns = getFilePatterns(ignoreFile);
|
|
34
|
-
return ignorePatterns.reduce((accumlator, currentValue) => {
|
|
35
|
-
if (!accumlator.includes(currentValue)) {
|
|
36
|
-
accumlator.push(currentValue);
|
|
37
|
-
}
|
|
38
|
-
return accumlator;
|
|
39
|
-
}, gitIgnorePatterns);
|
|
40
|
-
}
|
|
41
|
-
function getFilePatterns(filePath) {
|
|
42
|
-
let patterns = [];
|
|
43
|
-
if (fs_1.existsSync(filePath)) {
|
|
44
|
-
patterns = fs_1.readFileSync(filePath, 'utf-8').split('\n');
|
|
45
|
-
}
|
|
46
|
-
return patterns;
|
|
47
|
-
}
|