|
1 | 1 | import {task} from 'gulp'; |
2 | | -import {execNodeTask} from '../util/task_helpers'; |
3 | | -import {join} from 'path'; |
4 | | -import {buildConfig} from 'lib-build-tools'; |
5 | | -import {red} from 'chalk'; |
6 | | - |
7 | | -// These types lack of type definitions |
8 | | -const madge = require('madge'); |
| 2 | +import {execNodeTask} from '../util/task-helpers'; |
9 | 3 |
|
10 | 4 | /** Glob that matches all SCSS or CSS files that should be linted. */ |
11 | | -const stylesGlob = '+(tools|src)/**/!(*.bundle).+(css|scss)'; |
| 5 | +const styleGlob = 'src/lib/**/*.+(css|scss)'; |
12 | 6 |
|
13 | 7 | /** List of flags that will passed to the different TSLint tasks. */ |
14 | 8 | const tsLintBaseFlags = ['-c', 'tslint.json', '--project', './tsconfig.json']; |
15 | 9 |
|
16 | | -/** Path to the output of the Flex-Layout package. */ |
17 | | -const libOutPath = join(buildConfig.outputDir, 'packages', 'flex-layout'); |
18 | | - |
19 | | -task('lint', ['tslint', 'stylelint', 'madge']); |
20 | | - |
21 | | - |
| 10 | +task('lint', ['tslint', 'stylelint']); |
22 | 11 |
|
23 | | -/** Task to lint Angular Flex-Layout's scss stylesheets. */ |
| 12 | +/** Task to lint Angular Layout's scss stylesheets. */ |
24 | 13 | task('stylelint', execNodeTask( |
25 | | - 'stylelint', [stylesGlob, '--config', 'stylelint-config.json', '--syntax', 'scss'] |
| 14 | + 'stylelint', [styleGlob, '--config', 'stylelint-config.json', '--syntax', 'scss'] |
26 | 15 | )); |
27 | 16 |
|
28 | 17 | /** Task to run TSLint against the e2e/ and src/ directories. */ |
29 | 18 | task('tslint', execNodeTask('tslint', tsLintBaseFlags)); |
30 | 19 |
|
31 | 20 | /** Task that automatically fixes TSLint warnings. */ |
32 | 21 | task('tslint:fix', execNodeTask('tslint', [...tsLintBaseFlags, '--fix'])); |
33 | | - |
34 | | -/** Task that runs madge to detect circular dependencies. */ |
35 | | -task('madge', ['flex-layout:clean-build'], () => { |
36 | | - madge([libOutPath]).then((res: any) => { |
37 | | - const circularModules = res.circular(); |
38 | | - |
39 | | - if (circularModules.length) { |
40 | | - console.error(); |
41 | | - console.error(red(`Madge found modules with circular dependencies.`)); |
42 | | - console.error(formatMadgeCircularModules(circularModules)); |
43 | | - console.error(); |
44 | | - } |
45 | | - }); |
46 | | -}); |
47 | | - |
48 | | -/** Returns a string that formats the graph of circular modules. */ |
49 | | -function formatMadgeCircularModules(circularModules: string[][]): string { |
50 | | - return circularModules.map((modulePaths: string[]) => `\n - ${modulePaths.join(' > ')}`).join(''); |
51 | | -} |
0 commit comments