Skip to content

Commit

Permalink
chore: fix v4 migration `TypeError: Cannot read properties of null …
Browse files Browse the repository at this point in the history
…(reading 'getSourceFiles')` (#6987)
  • Loading branch information
nsbarsukov authored Mar 12, 2024
1 parent 9bdd5da commit 6aad3d6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/schematics.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- run: npx nx run cdk:schematics --v=4

concurrency:
group: schematics-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
12 changes: 12 additions & 0 deletions projects/cdk/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
9 changes: 3 additions & 6 deletions projects/cdk/schematics/ng-update/v4/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 6aad3d6

Please sign in to comment.