Browse Source

upgrade: code generation packages to the angular v22 structure

pull/25690/head
sumeyye 4 months ago
parent
commit
b9e3668bb6
  1. 2
      npm/ng-packs/package.json
  2. 3
      npm/ng-packs/packages/generators/package.json
  3. 2
      npm/ng-packs/packages/generators/project.json
  4. 2
      npm/ng-packs/packages/generators/tsconfig.json
  5. 10
      npm/ng-packs/packages/schematics/package.json
  6. 2
      npm/ng-packs/packages/schematics/project.json
  7. 2
      npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts
  8. 8
      npm/ng-packs/packages/schematics/src/commands/ssr-add/server/index.ts
  9. 32
      npm/ng-packs/packages/schematics/tsconfig.json
  10. 21
      npm/ng-packs/packages/schematics/tsconfig.lib.json
  11. 10
      npm/ng-packs/scripts/build-schematics.ts

2
npm/ng-packs/package.json

@ -32,7 +32,7 @@
"dep-graph": "nx dep-graph",
"help": "nx help",
"build:schematics": "cd scripts && yarn && yarn build:schematics && cd ..",
"dev:schematics": "tsc -p packages/schematics/tsconfig.json -w",
"dev:schematics": "tsc -p packages/schematics/tsconfig.lib.json -w",
"mock:schematics": "cd scripts/mock-schematic && yarn && yarn start",
"debug:schematics": "./node_modules/.bin/nx g ./packages/schematics/src/collection.json:proxy-add --module identity --apiName __default --source __default --target __default --url https://localhost:44305 --serviceType application --entryPoint __default ",
"debug:schematics-dist": "./node_modules/.bin/ng g ./dist/packages/schematics/collection.json:proxy-add --module __default --apiName __default --source __default --target __default --url http://localhost:4300 --service-type application --entryPoint __default",

3
npm/ng-packs/packages/generators/package.json

@ -8,6 +8,9 @@
"type": "git",
"url": "https://github.com/abpframework/abp.git"
},
"dependencies": {
"tslib": "^2.3.0"
},
"publishConfig": {
"access": "public"
}

2
npm/ng-packs/packages/generators/project.json

@ -49,7 +49,7 @@
"executor": "@nx/vitest:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../coverage/packages/generators"
"reportsDirectory": "{projectRoot}/../../coverage/packages/generators"
}
}
}

2
npm/ng-packs/packages/generators/tsconfig.json

@ -3,7 +3,7 @@
"compilerOptions": {
"module": "commonjs",
"skipLibCheck": true,
"moduleResolution": "node"
"moduleResolution": "bundler"
},
"files": [],
"include": [],

10
npm/ng-packs/packages/schematics/package.json

@ -4,16 +4,16 @@
"author": "",
"schematics": "./collection.json",
"dependencies": {
"@angular-devkit/core": "~21.2.0",
"@angular-devkit/schematics": "~21.2.0",
"@angular/cli": "~21.2.0",
"@angular-devkit/core": "~22.0.0",
"@angular-devkit/schematics": "~22.0.0",
"@angular/cli": "~22.0.0",
"got": "^11.5.2",
"jsonc-parser": "^2.3.0",
"should-quote": "^1.0.0",
"typescript": "~5.9.0"
"typescript": "~6.0.3"
},
"devDependencies": {
"@schematics/angular": "~21.2.0",
"@schematics/angular": "~22.0.0",
"@types/jest": "29.4.4",
"@types/node": "20.2.5",
"jest": "29.4.3",

2
npm/ng-packs/packages/schematics/project.json

@ -14,7 +14,7 @@
"executor": "@nx/vitest:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../coverage/packages/schematics"
"reportsDirectory": "{projectRoot}/../../coverage/packages/schematics"
}
}
}

2
npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts

@ -1,6 +1,5 @@
import { JsonArray, JsonValue } from '@angular-devkit/core';
import { Rule, SchematicsException, Tree, chain } from '@angular-devkit/schematics';
import { ProjectDefinition } from '@angular-devkit/core/src/workspace';
import * as ts from 'typescript';
import { allStyles, importMap, styleMap } from './style-map';
import { ChangeThemeOptions } from './model';
@ -11,6 +10,7 @@ import {
isLibrary,
isStandaloneApp,
updateWorkspace,
ProjectDefinition,
WorkspaceDefinition,
getAppConfigPath,
cleanEmptyExprFromModule,

8
npm/ng-packs/packages/schematics/src/commands/ssr-add/server/index.ts

@ -259,9 +259,13 @@ export default function (options: ServerOptions): Rule {
'withEventReplay',
'@angular/platform-browser',
)}(), ${external(
'withIncrementalHydration',
'withNoIncrementalHydration',
'@angular/platform-browser',
)}(), ${external('withHttpTransferCacheOptions', '@angular/platform-browser')}({}))`,
)}(), ${external('withHttpTransferCacheOptions', '@angular/platform-browser')}({
filter: req =>
!req.url.includes('application-configuration') &&
!req.url.includes('application-localization'),
}))`,
),
]);
};

32
npm/ng-packs/packages/schematics/tsconfig.json

@ -1,24 +1,18 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "tsconfig",
"lib": ["es2020", "dom"],
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"rootDir": "src/",
"skipDefaultLibCheck": true,
"module": "node16",
"skipLibCheck": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "es2020",
"types": ["jest", "node"]
"moduleResolution": "node16"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "src/*/files/**/*", "**/*.spec.ts", "jest.config.ts"]
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

21
npm/ng-packs/packages/schematics/tsconfig.lib.json

@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"lib": ["es2020", "dom"],
"declaration": true,
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"rootDir": "src/",
"skipDefaultLibCheck": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "es2020",
"types": ["jest", "node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "src/*/files/**/*", "**/*.spec.ts", "jest.config.ts"]
}

10
npm/ng-packs/scripts/build-schematics.ts

@ -1,5 +1,9 @@
import execa from 'execa';
import fse from 'fs-extra';
import { join } from 'path';
const NG_PACKS_ROOT = join(__dirname, '..');
const TSC_PATH = join(NG_PACKS_ROOT, 'node_modules/typescript/bin/tsc');
class FileCopy {
src: string;
@ -76,16 +80,16 @@ async function* copyPackageFiles(packageName: string) {
await execa('yarn', ['install'], { stdout: 'inherit', cwd: `../packages/${PACKAGE_TO_BUILD}` });
await execa(
'tsc',
TSC_PATH,
[
'-p',
`packages/${PACKAGE_TO_BUILD}/tsconfig.json`,
`packages/${PACKAGE_TO_BUILD}/tsconfig.lib.json`,
'--outDir',
`dist/packages/${PACKAGE_TO_BUILD}`,
],
{
stdout: 'inherit',
cwd: '../',
cwd: NG_PACKS_ROOT,
},
);

Loading…
Cancel
Save