Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reuse some custom utils from ng-morph #9271

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion projects/cdk/schematics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export * from './ng-add/schema';
export * from './utils/add-import-to-closest-module';
export * from './utils/add-unique-import';
export * from './utils/angular-json-manipulations';
export * from './utils/colored-log';
export * from './utils/create-angular-json';
export * from './utils/get-component-from-identifier';
export * from './utils/get-execution-time';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {getImports, Node} from 'ng-morph';
import {getImports, Node, SMALL_TAB_SYMBOL, SUCCESS_SYMBOL, successLog} from 'ng-morph';

import {ALL_TS_FILES} from '../../../constants';
import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {SMALL_TAB_SYMBOL, SUCCESS_SYMBOL, successLog} from '../../../utils/colored-log';
import {removeImport} from '../../../utils/import-manipulations';
import {setupProgressLogger} from '../../../utils/progress';
import type {ReplacementIdentifier} from '../../interfaces/replacement-identifier';
Expand Down
8 changes: 4 additions & 4 deletions projects/cdk/schematics/ng-update/steps/remove-module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Node} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../utils/colored-log';
} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {getNamedImportReferences} from '../../utils/get-named-import-references';
import {removeImport} from '../../utils/import-manipulations';
import type {RemovedModule} from '../interfaces/removed-module';
Expand Down
13 changes: 7 additions & 6 deletions projects/cdk/schematics/ng-update/steps/rename-types.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import type {ImportSpecifier} from 'ng-morph';
import {getImports, Node} from 'ng-morph';
import type {TypeNode} from 'ts-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {addUniqueImport} from '../../utils/add-unique-import';
import {
getImports,
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../utils/colored-log';
} from 'ng-morph';
import type {TypeNode} from 'ts-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {addUniqueImport} from '../../utils/add-unique-import';
import {getNamedImportReferences} from '../../utils/get-named-import-references';
import {removeImport, renameImport} from '../../utils/import-manipulations';
import type {ReplacementType} from '../interfaces/replacement-type';
Expand Down
11 changes: 6 additions & 5 deletions projects/cdk/schematics/ng-update/steps/replace-deep-import.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {editImports, getImports} from 'ng-morph';

import {ALL_TS_FILES} from '../../constants';
import type {TuiSchema} from '../../ng-add/schema';
import {
editImports,
getImports,
infoLog,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../utils/colored-log';
} from 'ng-morph';

import {ALL_TS_FILES} from '../../constants';
import type {TuiSchema} from '../../ng-add/schema';

const DEEP_REGEX = /(@taiga-ui\/\w+)\/.*/;

Expand Down
8 changes: 4 additions & 4 deletions projects/cdk/schematics/ng-update/steps/replace-enums.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type {ImportSpecifier, VariableDeclaration} from 'ng-morph';
import {Node} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../utils/colored-log';
} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {getNamedImportReferences} from '../../utils/get-named-import-references';
import {removeImport} from '../../utils/import-manipulations';
import type {ReplacementEnum} from '../interfaces/replacement-enum';
Expand Down
11 changes: 6 additions & 5 deletions projects/cdk/schematics/ng-update/steps/replace-identifier.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {Node, ts} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {addUniqueImport} from '../../utils/add-unique-import';
import {
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../utils/colored-log';
ts,
} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {addUniqueImport} from '../../utils/add-unique-import';
import {getNamedImportReferences} from '../../utils/get-named-import-references';
import {removeImport} from '../../utils/import-manipulations';
import {setupProgressLogger} from '../../utils/progress';
Expand Down
11 changes: 6 additions & 5 deletions projects/cdk/schematics/ng-update/steps/replace-services.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import type {PropertyAccessExpression, TypeReferenceNode} from 'ng-morph';
import {Node, SyntaxKind} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {addUniqueImport} from '../../utils/add-unique-import';
import {
infoLog,
Node,
PROCESSING_SYMBOL,
processLog,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../utils/colored-log';
SyntaxKind,
} from 'ng-morph';

import type {TuiSchema} from '../../ng-add/schema';
import {addUniqueImport} from '../../utils/add-unique-import';
import {getNamedImportReferences} from '../../utils/get-named-import-references';
import {removeImport} from '../../utils/import-manipulations';
import type {ReplacementService} from '../interfaces/replacement-service';
Expand Down
3 changes: 1 addition & 2 deletions projects/cdk/schematics/ng-update/v4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import {performance} from 'node:perf_hooks';
import type {Rule, SchematicContext, Tree} from '@angular-devkit/schematics';
import {chain} from '@angular-devkit/schematics';
import {NodePackageInstallTask} from '@angular-devkit/schematics/tasks';
import {saveActiveProject} from 'ng-morph';
import {FINISH_SYMBOL, saveActiveProject, START_SYMBOL, titleLog} from 'ng-morph';

import {TAIGA_VERSION} from '../../ng-add/constants/versions';
import type {TuiSchema} from '../../ng-add/schema';
import {FINISH_SYMBOL, START_SYMBOL, titleLog} from '../../utils/colored-log';
import {getExecutionTime} from '../../utils/get-execution-time';
import {
removeModules,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import type {Rule, SchematicContext, Tree} from '@angular-devkit/schematics';
import {chain} from '@angular-devkit/schematics';
import {getPackageJsonDependency, getSourceFiles, saveActiveProject} from 'ng-morph';

import {ALL_TS_FILES} from '../../../constants/file-globs';
import type {TuiSchema} from '../../../ng-add/schema';
import {
FINISH_SYMBOL,
getPackageJsonDependency,
getSourceFiles,
infoLog,
REPLACE_SYMBOL,
saveActiveProject,
SMALL_TAB_SYMBOL,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import {ALL_TS_FILES} from '../../../constants/file-globs';
import type {TuiSchema} from '../../../ng-add/schema';
import {renameTypes, replaceIdentifiers} from '../../steps';
import {removeModules} from '../../steps/remove-module';
import {getFileSystem} from '../../utils/get-file-system';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type {Rule, SchematicContext, Tree} from '@angular-devkit/schematics';
import {chain} from '@angular-devkit/schematics';
import {saveActiveProject} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {
FINISH_SYMBOL,
infoLog,
REPLACE_SYMBOL,
saveActiveProject,
SMALL_TAB_SYMBOL,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {getFileSystem} from '../../utils/get-file-system';
import {renameCssVars} from './rename-css-vars';

Expand Down
9 changes: 5 additions & 4 deletions projects/cdk/schematics/ng-update/v4/migrate-icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import type {Rule, SchematicContext, Tree} from '@angular-devkit/schematics';
import {chain} from '@angular-devkit/schematics';
import {getPackageJsonDependency, saveActiveProject} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {
FINISH_SYMBOL,
getPackageJsonDependency,
infoLog,
REPLACE_SYMBOL,
saveActiveProject,
SMALL_TAB_SYMBOL,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {getFileSystem} from '../../utils/get-file-system';
import {renameIcons} from './rename-icons';
import {renameProprietaryIcons} from './rename-proprietary-icons';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {getImports} from 'ng-morph';

import {ALL_TS_FILES} from '../../../constants/file-globs';
import type {TuiSchema} from '../../../ng-add/schema';
import {
FINISH_SYMBOL,
getImports,
infoLog,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import {ALL_TS_FILES} from '../../../constants/file-globs';
import type {TuiSchema} from '../../../ng-add/schema';

export function dropUniversalMock(options: TuiSchema): void {
const moduleSpecifier = '@ng-web-apis/universal/mocks';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import type {ObjectLiteralExpression, PropertyAccessExpression} from 'ng-morph';
import {Node, SyntaxKind} from 'ng-morph';
import type {CallExpression, ObjectLiteralElementLike} from 'ts-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../../utils/colored-log';
SyntaxKind,
} from 'ng-morph';
import type {CallExpression, ObjectLiteralElementLike} from 'ts-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {getNamedImportReferences} from '../../../utils/get-named-import-references';

const OPTIONS_MIGRATIONS: Record<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {SyntaxKind} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {
FINISH_SYMBOL,
infoLog,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SyntaxKind,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {getNamedImportReferences} from '../../../utils/get-named-import-references';

export function migrateAllCountryIsoCodes(options: TuiSchema): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import {Node, SyntaxKind} from 'ng-morph';
import type {CallExpression} from 'ts-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {
FINISH_SYMBOL,
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SyntaxKind,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';
import type {CallExpression} from 'ts-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {getNamedImportReferences} from '../../../utils/get-named-import-references';
import {removeImport} from '../../../utils/import-manipulations';
import {insertTodo} from '../../../utils/insert-todo';
Expand Down
12 changes: 7 additions & 5 deletions projects/cdk/schematics/ng-update/v4/steps/migrate-editor.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/// <reference lib="es2021" />
import type {DevkitFileSystem} from 'ng-morph';
import {getPackageJsonDependency, getSourceFiles, saveActiveProject} from 'ng-morph';

import {ALL_TS_FILES} from '../../../constants/file-globs';
import type {TuiSchema} from '../../../ng-add/schema';
import {
FINISH_SYMBOL,
getPackageJsonDependency,
getSourceFiles,
infoLog,
REPLACE_SYMBOL,
saveActiveProject,
SMALL_TAB_SYMBOL,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import {ALL_TS_FILES} from '../../../constants/file-globs';
import type {TuiSchema} from '../../../ng-add/schema';
import {replaceIdentifiers} from '../../steps/replace-identifier';
import {replacePackageName} from '../../steps/replace-package-name';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {Node} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {
FINISH_SYMBOL,
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {getNamedImportReferences} from '../../../utils/get-named-import-references';
import {removeImport} from '../../../utils/import-manipulations';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type {ImportSpecifier} from 'ng-morph';
import {SyntaxKind} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {
FINISH_SYMBOL,
infoLog,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SyntaxKind,
titleLog,
} from '../../../utils/colored-log';
} from 'ng-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {addUniqueImport} from '../../../utils/add-unique-import';
import {getNamedImportReferences} from '../../../utils/get-named-import-references';
import {removeImport} from '../../../utils/import-manipulations';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import {Node, SyntaxKind} from 'ng-morph';
import type {ObjectLiteralElementLike} from 'ts-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {
infoLog,
Node,
REPLACE_SYMBOL,
SMALL_TAB_SYMBOL,
SUCCESS_SYMBOL,
successLog,
} from '../../../utils/colored-log';
SyntaxKind,
} from 'ng-morph';
import type {ObjectLiteralElementLike} from 'ts-morph';

import type {TuiSchema} from '../../../ng-add/schema';
import {getNamedImportReferences} from '../../../utils/get-named-import-references';

const OPTIONS_MIGRATIONS: Record<
Expand Down
Loading
Loading