import { Tree, Rule } from '@angular-devkit/schematics'; import { updateWorkspace } from '@schematics/angular/utility/workspace'; import { VERSION } from './lib-versions'; import { addPackage } from './package'; import { BUILD_TARGET_LINT, getProjectFromWorkspace } from './workspace'; /** * 修复主要依赖的版本号 */ export function UpgradeMainVersions(tree: Tree, version: string = VERSION): void { addPackage( tree, ['abc', 'acl', 'auth', 'cache', 'form', 'mock', 'theme', 'util', 'chart', 'bis', 'bcs', 'socket'].map( name => `@yelon/${name}@${version}` ) ); addPackage( tree, [ `angular-eslint@^20.1.1`, `@typescript-eslint/eslint-plugin@^8.38.0`, `@typescript-eslint/parser@^8.38.0`, `@typescript-eslint/utils@^8.38.0`, `eslint@^9.31.0`, `eslint-config-prettier@^10.1.8`, `eslint-plugin-import@~2.32.0`, `eslint-plugin-jsdoc@~51.4.1`, `eslint-plugin-prefer-arrow@~1.2.3`, `eslint-plugin-prettier@~5.5.3`, `eslint-plugin-unused-imports@^4.1.4`, `typescript-eslint@^8.38.0`, `prettier@^3.6.2`, `husky@^9.1.7`, `ng-yunzai@${version}`, `ng-yunzai-plugin-theme@latest`, `source-map-explorer@^2.5.3`, `ngx-tinymce@^20.0.0`, `@ng-util/monaco-editor@^20.0.3`, `@yelon/testing@${version}` ], 'devDependencies' ); addPackage(tree, [`rxjs@~7.8.2`, `ng-zorro-antd@^20.1.0`]); } export function addESLintRule(projectName: string): Rule { return updateWorkspace(async workspace => { const project = getProjectFromWorkspace(workspace, projectName); if (project == null) return; if (project.targets.has(BUILD_TARGET_LINT)) { project.targets.delete(BUILD_TARGET_LINT); } project.targets.set(BUILD_TARGET_LINT, { builder: '@angular-eslint/builder:lint', options: { lintFilePatterns: ['src/**/*.ts', 'src/**/*.html'] } }); }); }