diff --git a/.github/workflows/schematics.yml b/.github/workflows/schematics.yml new file mode 100644 index 000000000000..c24a16575bb7 --- /dev/null +++ b/.github/workflows/schematics.yml @@ -0,0 +1,19 @@ +name: ⚙️ Schematics +on: + pull_request: + paths: + - 'projects/cdk/schematics/**' + +jobs: + schematics: + if: ${{ !contains(github.head_ref , 'release/') }} + runs-on: ubuntu-latest + name: Run the latest migration + steps: + - uses: taiga-family/ci/actions/setup/checkout@v1.51.14 + - uses: taiga-family/ci/actions/setup/node@v1.51.14 + - run: npx nx run cdk:schematics --v=4 + +concurrency: + group: schematics-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true diff --git a/projects/cdk/project.json b/projects/cdk/project.json index 0e981d0413ba..32b22f34d9db 100644 --- a/projects/cdk/project.json +++ b/projects/cdk/project.json @@ -34,6 +34,18 @@ "command": "tsc -p ./projects/cdk/schematics/tsconfig.schematics.json" } }, + "schematics": { + "executor": "nx:run-commands", + "options": { + "command": "schematics ./dist/cdk:updateToV{args.v} --allow-private --dry-run true" + }, + "dependsOn": [ + { + "target": "build", + "params": "ignore" + } + ] + }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/cdk"], diff --git a/projects/cdk/schematics/ng-update/v4/index.ts b/projects/cdk/schematics/ng-update/v4/index.ts index 41293d37d86a..9f0f7901e191 100644 --- a/projects/cdk/schematics/ng-update/v4/index.ts +++ b/projects/cdk/schematics/ng-update/v4/index.ts @@ -1,15 +1,14 @@ import type {Rule, SchematicContext, Tree} from '@angular-devkit/schematics'; import {chain} from '@angular-devkit/schematics'; -import {createProject, saveActiveProject} from 'ng-morph'; +import {saveActiveProject} from 'ng-morph'; import {performance} from 'perf_hooks'; -import {ALL_FILES} from '../../constants'; 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 {projectRoot} from '../../utils/project-root'; import {removeModules, replaceIdentifiers, showWarnings} from '../steps'; +import {getFileSystem} from '../utils/get-file-system'; import { migrateDestroyService, migrateLegacyMask, @@ -25,9 +24,7 @@ import { function main(options: TuiSchema): Rule { return (tree: Tree, context: SchematicContext) => { - const project = createProject(tree, projectRoot(), ALL_FILES); - - const fileSystem = project.getFileSystem().fs; + const fileSystem = getFileSystem(tree); replaceIdentifiers(options, IDENTIFIERS_TO_REPLACE); removeModules(options, MODULES_TO_REMOVE);