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", "dep-graph": "nx dep-graph",
"help": "nx help", "help": "nx help",
"build:schematics": "cd scripts && yarn && yarn build:schematics && cd ..", "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", "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": "./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", "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", "type": "git",
"url": "https://github.com/abpframework/abp.git" "url": "https://github.com/abpframework/abp.git"
}, },
"dependencies": {
"tslib": "^2.3.0"
},
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
} }

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

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

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

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

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

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

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

@ -14,7 +14,7 @@
"executor": "@nx/vitest:test", "executor": "@nx/vitest:test",
"outputs": ["{options.reportsDirectory}"], "outputs": ["{options.reportsDirectory}"],
"options": { "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 { JsonArray, JsonValue } from '@angular-devkit/core';
import { Rule, SchematicsException, Tree, chain } from '@angular-devkit/schematics'; import { Rule, SchematicsException, Tree, chain } from '@angular-devkit/schematics';
import { ProjectDefinition } from '@angular-devkit/core/src/workspace';
import * as ts from 'typescript'; import * as ts from 'typescript';
import { allStyles, importMap, styleMap } from './style-map'; import { allStyles, importMap, styleMap } from './style-map';
import { ChangeThemeOptions } from './model'; import { ChangeThemeOptions } from './model';
@ -11,6 +10,7 @@ import {
isLibrary, isLibrary,
isStandaloneApp, isStandaloneApp,
updateWorkspace, updateWorkspace,
ProjectDefinition,
WorkspaceDefinition, WorkspaceDefinition,
getAppConfigPath, getAppConfigPath,
cleanEmptyExprFromModule, 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', 'withEventReplay',
'@angular/platform-browser', '@angular/platform-browser',
)}(), ${external( )}(), ${external(
'withIncrementalHydration', 'withNoIncrementalHydration',
'@angular/platform-browser', '@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": { "compilerOptions": {
"baseUrl": "tsconfig", "module": "node16",
"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,
"skipLibCheck": true, "skipLibCheck": true,
"sourceMap": true, "moduleResolution": "node16"
"strictNullChecks": true,
"target": "es2020",
"types": ["jest", "node"]
}, },
"include": ["src/**/*"], "files": [],
"exclude": ["node_modules", "dist", "src/*/files/**/*", "**/*.spec.ts", "jest.config.ts"] "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 execa from 'execa';
import fse from 'fs-extra'; 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 { class FileCopy {
src: string; src: string;
@ -76,16 +80,16 @@ async function* copyPackageFiles(packageName: string) {
await execa('yarn', ['install'], { stdout: 'inherit', cwd: `../packages/${PACKAGE_TO_BUILD}` }); await execa('yarn', ['install'], { stdout: 'inherit', cwd: `../packages/${PACKAGE_TO_BUILD}` });
await execa( await execa(
'tsc', TSC_PATH,
[ [
'-p', '-p',
`packages/${PACKAGE_TO_BUILD}/tsconfig.json`, `packages/${PACKAGE_TO_BUILD}/tsconfig.lib.json`,
'--outDir', '--outDir',
`dist/packages/${PACKAGE_TO_BUILD}`, `dist/packages/${PACKAGE_TO_BUILD}`,
], ],
{ {
stdout: 'inherit', stdout: 'inherit',
cwd: '../', cwd: NG_PACKS_ROOT,
}, },
); );

Loading…
Cancel
Save