Skip to content

Commit

Permalink
ci: validate schematics package (#8700)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Aug 28, 2024
1 parent 59712a2 commit 50f8d0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions scripts/check-dist.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from 'node:path';
import {resolve} from 'node:path';
import * as process from 'node:process';

import {getValueByFlag, hasFlag} from './shared/argv.utils';
Expand All @@ -7,17 +7,21 @@ import {checkIncorrectImports} from './shared/check-incorrect-imports';
import {checkPrivateExports} from './shared/check-private-exports';
import {checkRequireWithSrc} from './shared/check-require-with-src';

const pathToSearch = path.resolve(getValueByFlag('--path', './dist'));

(async function main(): Promise<void> {
const path = resolve(getValueByFlag('--path', './dist'));

try {
await Promise.all([
checkIncorrectImports(pathToSearch),
checkImportWithSrc(pathToSearch),
checkIncorrectImports(path),
checkImportWithSrc(path),
hasFlag('--skip-check-private-exports')
? Promise.resolve()
: checkPrivateExports(pathToSearch),
checkRequireWithSrc(pathToSearch),
: checkPrivateExports(path),
checkRequireWithSrc(path),
checkIncorrectImports(
resolve(path, 'cdk/schematics'),
'@taiga-ui/cdk/schematics',
),
]);
} catch (error) {
console.error(error);
Expand Down
4 changes: 2 additions & 2 deletions scripts/shared/check-incorrect-imports.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {TuiGrepException} from './grep.exception';
import {grepByPattern} from './grep-by-pattern';

export async function checkIncorrectImports(path: string): Promise<void> {
const includePattern = 'import("../';
export async function checkIncorrectImports(path: string, pattern = ''): Promise<void> {
const includePattern = pattern || 'import("../';
const result = await grepByPattern({includePattern, path});

if (result.length > 0) {
Expand Down

0 comments on commit 50f8d0e

Please sign in to comment.