1 | "use strict";
|
2 |
|
3 | var systemPath = require("path");
|
4 |
|
5 | var mm = require("micromatch");
|
6 |
|
7 | var tsDeclarationExtTest = /\.d\.tsx?$/;
|
8 | var jsonYamlExtTest = /\.(json|ya?ml)$/;
|
9 |
|
10 | function isTestFile(filePath) {
|
11 | var testPatterns = ["**/__tests__/**/*.(js|ts)?(x)", "**/(*.)+(spec|test).(js|ts)?(x)"];
|
12 | return mm.isMatch(filePath, testPatterns);
|
13 | }
|
14 |
|
15 | module.exports = function (path) {
|
16 |
|
17 |
|
18 |
|
19 | var parsedPath = systemPath.parse(path);
|
20 | return parsedPath.name.slice(0, 1) !== "_" && parsedPath.name.slice(0, 1) !== "." && parsedPath.name.slice(0, 9) !== "template-" && !tsDeclarationExtTest.test(parsedPath.base) && !jsonYamlExtTest.test(parsedPath.base) && !isTestFile(path);
|
21 | }; |
\ | No newline at end of file |