Browse Source

Merge pull request #13886 from abpframework/update-angular-14

Update angular 14
pull/14122/head
Alper Ebiçoğlu 4 years ago
committed by GitHub
parent
commit
981d007ee6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      npm/ng-packs/angular.json
  2. 3
      npm/ng-packs/apps/dev-app/jest.config.ts
  3. 3
      npm/ng-packs/apps/dev-app/tsconfig.app.json
  4. 3
      npm/ng-packs/apps/dev-app/tsconfig.json
  5. 2
      npm/ng-packs/apps/dev-app/tsconfig.spec.json
  6. 5
      npm/ng-packs/jest.config.js
  7. 5
      npm/ng-packs/jest.config.ts
  8. 2
      npm/ng-packs/jest.preset.js
  9. 86
      npm/ng-packs/migrations.json
  10. 24
      npm/ng-packs/nx.json
  11. 95
      npm/ng-packs/package.json
  12. 3
      npm/ng-packs/packages/account-core/jest.config.ts
  13. 5
      npm/ng-packs/packages/account-core/tsconfig.json
  14. 4
      npm/ng-packs/packages/account-core/tsconfig.lib.json
  15. 2
      npm/ng-packs/packages/account-core/tsconfig.spec.json
  16. 3
      npm/ng-packs/packages/account/jest.config.ts
  17. 8
      npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts
  18. 6
      npm/ng-packs/packages/account/src/lib/components/forgot-password/forgot-password.component.ts
  19. 6
      npm/ng-packs/packages/account/src/lib/components/login/login.component.ts
  20. 4
      npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts
  21. 6
      npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts
  22. 6
      npm/ng-packs/packages/account/src/lib/components/register/register.component.ts
  23. 6
      npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts
  24. 5
      npm/ng-packs/packages/account/tsconfig.json
  25. 4
      npm/ng-packs/packages/account/tsconfig.lib.json
  26. 2
      npm/ng-packs/packages/account/tsconfig.spec.json
  27. 3
      npm/ng-packs/packages/components/jest.config.ts
  28. 2
      npm/ng-packs/packages/components/package.json
  29. 5
      npm/ng-packs/packages/components/tsconfig.json
  30. 4
      npm/ng-packs/packages/components/tsconfig.lib.json
  31. 2
      npm/ng-packs/packages/components/tsconfig.spec.json
  32. 3
      npm/ng-packs/packages/core/jest.config.ts
  33. 45
      npm/ng-packs/packages/core/src/lib/directives/ellipsis.directive.ts
  34. 8
      npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts
  35. 2
      npm/ng-packs/packages/core/src/lib/directives/permission.directive.ts
  36. 5
      npm/ng-packs/packages/core/src/lib/handlers/routes.handler.ts
  37. 17
      npm/ng-packs/packages/core/src/lib/services/config-state.service.ts
  38. 2
      npm/ng-packs/packages/core/src/lib/services/http-wait.service.ts
  39. 2
      npm/ng-packs/packages/core/src/lib/services/list.service.ts
  40. 2
      npm/ng-packs/packages/core/src/lib/services/router-wait.service.ts
  41. 9
      npm/ng-packs/packages/core/src/lib/tests/api.interceptor.spec.ts
  42. 2
      npm/ng-packs/packages/core/src/lib/tests/container.strategy.spec.ts
  43. 2
      npm/ng-packs/packages/core/src/lib/tests/dom.strategy.spec.ts
  44. 2
      npm/ng-packs/packages/core/src/lib/tests/environment-utils.spec.ts
  45. 36
      npm/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts
  46. 2
      npm/ng-packs/packages/core/src/lib/tests/generator-utils.spec.ts
  47. 12
      npm/ng-packs/packages/core/src/lib/tests/initial-utils.spec.ts
  48. 4
      npm/ng-packs/packages/core/src/lib/tests/internal-store.spec.ts
  49. 6
      npm/ng-packs/packages/core/src/lib/tests/lazy-load-utils.spec.ts
  50. 4
      npm/ng-packs/packages/core/src/lib/tests/lazy-load.service.spec.ts
  51. 6
      npm/ng-packs/packages/core/src/lib/tests/loading.strategy.spec.ts
  52. 4
      npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts
  53. 4
      npm/ng-packs/packages/core/src/lib/tests/localization.pipe.spec.ts
  54. 3
      npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts
  55. 2
      npm/ng-packs/packages/core/src/lib/tests/permission.directive.spec.ts
  56. 5
      npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts
  57. 18
      npm/ng-packs/packages/core/src/lib/tests/projection.strategy.spec.ts
  58. 4
      npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts
  59. 7
      npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts
  60. 2
      npm/ng-packs/packages/core/src/lib/tests/route-utils.spec.ts
  61. 4
      npm/ng-packs/packages/core/src/lib/tests/routes.handler.spec.ts
  62. 4
      npm/ng-packs/packages/core/src/lib/tests/routes.service.spec.ts
  63. 7
      npm/ng-packs/packages/core/src/lib/tests/validators.spec.ts
  64. 6
      npm/ng-packs/packages/core/src/lib/validators/url.validator.ts
  65. 3
      npm/ng-packs/packages/core/tsconfig.json
  66. 4
      npm/ng-packs/packages/core/tsconfig.lib.json
  67. 2
      npm/ng-packs/packages/core/tsconfig.spec.json
  68. 3
      npm/ng-packs/packages/feature-management/jest.config.ts
  69. 5
      npm/ng-packs/packages/feature-management/tsconfig.json
  70. 4
      npm/ng-packs/packages/feature-management/tsconfig.lib.json
  71. 2
      npm/ng-packs/packages/feature-management/tsconfig.spec.json
  72. 3
      npm/ng-packs/packages/identity/jest.config.ts
  73. 4
      npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts
  74. 10
      npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts
  75. 5
      npm/ng-packs/packages/identity/tsconfig.json
  76. 4
      npm/ng-packs/packages/identity/tsconfig.lib.json
  77. 2
      npm/ng-packs/packages/identity/tsconfig.spec.json
  78. 3
      npm/ng-packs/packages/permission-management/jest.config.ts
  79. 5
      npm/ng-packs/packages/permission-management/tsconfig.json
  80. 4
      npm/ng-packs/packages/permission-management/tsconfig.lib.json
  81. 2
      npm/ng-packs/packages/permission-management/tsconfig.spec.json
  82. 3
      npm/ng-packs/packages/schematics/jest.config.ts
  83. 9
      npm/ng-packs/packages/schematics/package.json
  84. 3
      npm/ng-packs/packages/schematics/src/commands/api/index.ts
  85. 2
      npm/ng-packs/packages/schematics/src/commands/create-lib/files-package/__libraryName@kebab__/tsconfig.lib.json.template
  86. 9
      npm/ng-packs/packages/schematics/src/commands/create-lib/index.ts
  87. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-add/index.ts
  88. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-index/index.ts
  89. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts
  90. 4
      npm/ng-packs/packages/schematics/src/commands/proxy-remove/index.ts
  91. 4
      npm/ng-packs/packages/schematics/src/models/api-definition.ts
  92. 2
      npm/ng-packs/packages/schematics/src/utils/angular/README.md
  93. 173
      npm/ng-packs/packages/schematics/src/utils/angular/dependency.ts
  94. 4
      npm/ng-packs/packages/schematics/src/utils/angular/find-module.ts
  95. 15
      npm/ng-packs/packages/schematics/src/utils/angular/generate-from-files.ts
  96. 7
      npm/ng-packs/packages/schematics/src/utils/angular/json-file.ts
  97. 25
      npm/ng-packs/packages/schematics/src/utils/angular/latest-versions/package.json
  98. 12
      npm/ng-packs/packages/schematics/src/utils/angular/ng-ast-utils.ts
  99. 13
      npm/ng-packs/packages/schematics/src/utils/angular/validation.ts
  100. 15
      npm/ng-packs/packages/schematics/src/utils/angular/workspace-models.ts

40
npm/ng-packs/angular.json

@ -2,6 +2,7 @@
"version": 1,
"projects": {
"account": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/account",
"sourceRoot": "packages/account/src",
@ -27,7 +28,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/account"],
"options": {
"jestConfig": "packages/account/jest.config.js",
"jestConfig": "packages/account/jest.config.ts",
"passWithNoTests": true
}
},
@ -43,6 +44,7 @@
"implicitDependencies": ["core", "theme-shared", "account-core"]
},
"account-core": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/account-core",
"sourceRoot": "packages/account-core/src",
@ -68,7 +70,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/account-core"],
"options": {
"jestConfig": "packages/account-core/jest.config.js",
"jestConfig": "packages/account-core/jest.config.ts",
"passWithNoTests": true
}
},
@ -87,6 +89,7 @@
"implicitDependencies": ["core", "theme-shared"]
},
"components": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/components",
"sourceRoot": "packages/components/src",
@ -112,7 +115,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/components"],
"options": {
"jestConfig": "packages/components/jest.config.js",
"jestConfig": "packages/components/jest.config.ts",
"passWithNoTests": true
}
},
@ -131,6 +134,7 @@
"implicitDependencies": ["core", "theme-shared"]
},
"core": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/core",
"sourceRoot": "packages/core/src",
@ -156,7 +160,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/core"],
"options": {
"jestConfig": "packages/core/jest.config.js",
"jestConfig": "packages/core/jest.config.ts",
"passWithNoTests": true
}
},
@ -171,6 +175,7 @@
"tags": []
},
"dev-app": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"root": "apps/dev-app",
"sourceRoot": "apps/dev-app/src",
@ -290,13 +295,14 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/apps/dev-app"],
"options": {
"jestConfig": "apps/dev-app/jest.config.js",
"jestConfig": "apps/dev-app/jest.config.ts",
"passWithNoTests": true
}
}
}
},
"dev-app-e2e": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"root": "apps/dev-app-e2e",
"sourceRoot": "apps/dev-app-e2e/src",
"projectType": "application",
@ -326,6 +332,7 @@
"implicitDependencies": ["dev-app"]
},
"feature-management": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/feature-management",
"sourceRoot": "packages/feature-management/src",
@ -351,7 +358,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/feature-management"],
"options": {
"jestConfig": "packages/feature-management/jest.config.js",
"jestConfig": "packages/feature-management/jest.config.ts",
"passWithNoTests": true
}
},
@ -370,6 +377,7 @@
"implicitDependencies": ["core", "theme-shared"]
},
"identity": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/identity",
"sourceRoot": "packages/identity/src",
@ -395,7 +403,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/identity"],
"options": {
"jestConfig": "packages/identity/jest.config.js",
"jestConfig": "packages/identity/jest.config.ts",
"passWithNoTests": true
}
},
@ -411,6 +419,7 @@
"implicitDependencies": ["core", "theme-shared", "permission-management"]
},
"permission-management": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/permission-management",
"sourceRoot": "packages/permission-management/src",
@ -436,7 +445,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/permission-management"],
"options": {
"jestConfig": "packages/permission-management/jest.config.js",
"jestConfig": "packages/permission-management/jest.config.ts",
"passWithNoTests": true
}
},
@ -455,6 +464,7 @@
"implicitDependencies": ["core", "theme-shared"]
},
"schematics": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/schematics",
"sourceRoot": "packages/schematics/src",
@ -464,7 +474,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/schematics"],
"options": {
"jestConfig": "packages/schematics/jest.config.js",
"jestConfig": "packages/schematics/jest.config.ts",
"passWithNoTests": true
}
},
@ -482,6 +492,7 @@
"tags": []
},
"setting-management": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/setting-management",
"sourceRoot": "packages/setting-management/src",
@ -507,7 +518,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/setting-management"],
"options": {
"jestConfig": "packages/setting-management/jest.config.js",
"jestConfig": "packages/setting-management/jest.config.ts",
"passWithNoTests": true
}
},
@ -526,6 +537,7 @@
"implicitDependencies": ["core", "theme-shared", "components"]
},
"tenant-management": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/tenant-management",
"sourceRoot": "packages/tenant-management/src",
@ -551,7 +563,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/tenant-management"],
"options": {
"jestConfig": "packages/tenant-management/jest.config.js",
"jestConfig": "packages/tenant-management/jest.config.ts",
"passWithNoTests": true
}
},
@ -570,6 +582,7 @@
"implicitDependencies": ["core", "theme-shared", "feature-management"]
},
"theme-basic": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/theme-basic",
"sourceRoot": "packages/theme-basic/src",
@ -595,7 +608,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/theme-basic"],
"options": {
"jestConfig": "packages/theme-basic/jest.config.js",
"jestConfig": "packages/theme-basic/jest.config.ts",
"passWithNoTests": true
}
},
@ -614,6 +627,7 @@
"implicitDependencies": ["core", "theme-shared", "account-core"]
},
"theme-shared": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "packages/theme-shared",
"sourceRoot": "packages/theme-shared/src",
@ -639,7 +653,7 @@
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/packages/theme-shared"],
"options": {
"jestConfig": "packages/theme-shared/jest.config.js",
"jestConfig": "packages/theme-shared/jest.config.ts",
"passWithNoTests": true
}
},

3
npm/ng-packs/apps/dev-app/jest.config.js → npm/ng-packs/apps/dev-app/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'dev-app',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

3
npm/ng-packs/apps/dev-app/tsconfig.app.json

@ -5,5 +5,6 @@
"types": []
},
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["src/**/*.d.ts"]
"include": ["src/**/*.d.ts"],
"exclude": ["jest.config.ts"]
}

3
npm/ng-packs/apps/dev-app/tsconfig.json

@ -18,7 +18,8 @@
"strict": false,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"target": "es2020"
},
"angularCompilerOptions": {
"strictInjectionParameters": true,

2
npm/ng-packs/apps/dev-app/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

5
npm/ng-packs/jest.config.js

@ -1,5 +0,0 @@
const { getJestProjects } = require('@nrwl/jest');
module.exports = {
projects: getJestProjects(),
};

5
npm/ng-packs/jest.config.ts

@ -0,0 +1,5 @@
import { getJestProjects } from '@nrwl/jest';
export default {
projects: getJestProjects(),
};

2
npm/ng-packs/jest.preset.js

@ -1,3 +1,3 @@
const nxPreset = require('@nrwl/jest/preset');
const nxPreset = require('@nrwl/jest/preset').default;
module.exports = { ...nxPreset };

86
npm/ng-packs/migrations.json

@ -1,84 +1,44 @@
{
"migrations": [
{
"version": "13.6.0-beta.0",
"description": "Remove old options that are no longer used",
"cli": "nx",
"implementation": "./src/migrations/update-13-6-0/remove-old-task-runner-options",
"package": "@nrwl/workspace",
"name": "13-6-0-remove-old-task-runner-options"
},
{
"version": "13.9.0-beta.0",
"description": "Replace @nrwl/tao with nx",
"cli": "nx",
"implementation": "./src/migrations/update-13-9-0/replace-tao-with-nx",
"package": "@nrwl/workspace",
"name": "13-9-0-replace-tao-with-nx"
},
{
"version": "13.10.0-beta.0",
"description": "Update the decorate-angular-cli script to require nx instead of @nrwl/cli",
"cli": "nx",
"implementation": "./src/migrations/update-13-10-0/update-decorate-cli",
"package": "@nrwl/workspace",
"name": "13-10-0-update-decorate-cli"
},
{
"version": "13.10.0-beta.0",
"description": "Update the tasks runner property to import it from the nx package instead of @nrwl/worksapce",
"cli": "nx",
"implementation": "./src/migrations/update-13-10-0/update-tasks-runner",
"package": "@nrwl/workspace",
"name": "13-10-0-update-tasks-runner"
},
{
"cli": "nx",
"version": "13.4.5-beta.7",
"description": "Remove the default for the invalid 'style' option for the library generator if configured.",
"factory": "./src/migrations/update-13-5-0/remove-library-generator-style-default",
"package": "@nrwl/angular",
"name": "remove-library-generator-style-default"
},
{
"cli": "nx",
"version": "13.5.0-beta.0",
"description": "A lot of changes to how MFEs operate were discovered and merged without appropriate migrations. This should cover migrating existing MFEs to the latest, using ESM and optmized production bundles.",
"factory": "./src/migrations/update-13-5-0/update-mfe-configs",
"version": "14.6.0-beta.0",
"description": "Update the @angular/cli package version to ~14.2.0.",
"factory": "./src/migrations/update-14-6-0/update-angular-cli",
"package": "@nrwl/angular",
"name": "fix-incorrect-mfe-setups"
"name": "update-angular-cli-version-14-2-0"
},
{
"cli": "nx",
"version": "13.8.1",
"description": "Angular doesn't attach styles.js to index.html with type=module in dev mode, meaning an error is written to the console. Cypress falls over on this error. Add logic to Cypress e2e projects to ignore this error.",
"factory": "./src/migrations/update-13-8-1/add-cypress-mfe-workaround",
"package": "@nrwl/angular",
"name": "add-cypress-mfe-workaround"
"version": "14.6.1-beta.0",
"description": "Change Cypress e2e and component testing presets to use __filename instead of __dirname and include a devServerTarget for component testing.",
"factory": "./src/migrations/update-14-6-1/update-cypress-configs-presets",
"package": "@nrwl/cypress",
"name": "update-cypress-configs-preset"
},
{
"cli": "nx",
"version": "13.8.4",
"description": "Karma coverage is broken since Angular 13 upgarde and the karma config is severely out of date. Bring it up to date fixing the coverage issue.",
"factory": "./src/migrations/update-13-8-4/migrate-karma-conf",
"package": "@nrwl/angular",
"name": "migrate-karma-config"
"version": "14.7.0-beta.0",
"description": "Update Cypress if using v10 to support latest component testing features",
"factory": "./src/migrations/update-14-7-0/update-cypress-version-if-10",
"package": "@nrwl/cypress",
"name": "update-cypress-if-v10"
},
{
"version": "14.6.0-beta.0",
"cli": "nx",
"version": "13.9.0-beta.4",
"description": "Set buildLibsFromSource property to false to not break existing usage.",
"factory": "./src/migrations/update-13-9-0/set-build-libs-from-source",
"package": "@nrwl/angular",
"name": "set-build-libs-from-source"
"description": "Update jest configs to support jest 28 changes (https://jestjs.io/docs/upgrading-to-jest28#configuration-options)",
"factory": "./src/migrations/update-14-6-0/update-configs-jest-28",
"package": "@nrwl/jest",
"name": "update-configs-jest-28"
},
{
"version": "13.4.4-beta.0",
"version": "14.6.0-beta.0",
"cli": "nx",
"description": "Create a root babel config file if it doesn't exist and using babel-jest in jest.config.js and add @nrwl/web as needed",
"factory": "./src/migrations/update-13-4-4/add-missing-root-babel-config",
"description": "Update jest test files to support jest 28 changes (https://jestjs.io/docs/upgrading-to-jest28)",
"factory": "./src/migrations/update-14-6-0/update-tests-jest-28",
"package": "@nrwl/jest",
"name": "add-missing-root-babel-config"
"name": "update-tests-jest-28"
}
]
}

24
npm/ng-packs/nx.json

@ -14,31 +14,17 @@
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e"
],
"cacheableOperations": ["build", "lint", "test", "e2e"],
"parallel": 3
}
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
},
"workspaceLayout": {
"libsDir": "packages",
"appsDir": ""
},
"cli": {
"analytics": false,
"defaultCollection": "@nrwl/angular"
"analytics": false
},
"defaultProject": "dev-app",
"generators": {
@ -67,5 +53,11 @@
"@nrwl/angular:component": {
"style": "scss"
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {
"build": {
"dependsOn": ["^build"]
}
}
}

95
npm/ng-packs/package.json

@ -15,7 +15,7 @@
"e2e": "ng e2e",
"affected:apps": "nx affected:apps",
"affected:libs": "nx affected:libs",
"affected:build": "nx affected:build",
"affected:build": "nx affected:build --parallel 1",
"affected:e2e": "nx affected:e2e",
"affected:test": "nx affected:test",
"affected:lint": "nx affected:lint",
@ -28,7 +28,7 @@
"workspace-generator": "nx workspace-generator",
"dep-graph": "nx dep-graph",
"help": "nx help",
"compile:ivy": "yarn ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points --tsconfig './tsconfig.prod.json' --source node_modules",
"compile:ivy": "yarn ngcc --properties es2020 browser module main --first-only --create-ivy-entry-points --tsconfig './tsconfig.prod.json' --source node_modules",
"postinstall": "node ./decorate-angular-cli.js && yarn compile:ivy",
"build:schematics": "cd scripts && yarn && yarn build:schematics && cd ..",
"dev:schematics": "tsc -p packages/schematics/tsconfig.json -w",
@ -41,24 +41,24 @@
"private": true,
"devDependencies": {
"@abp/utils": "~6.0.0-rc.4",
"@angular-devkit/build-angular": "13.3.5",
"@angular-devkit/build-angular": "14.2.1",
"@angular-devkit/build-ng-packagr": "^0.1002.0",
"@angular-devkit/schematics-cli": "~12.2.0",
"@angular-eslint/eslint-plugin": "13.0.1",
"@angular-eslint/eslint-plugin-template": "13.0.1",
"@angular-eslint/template-parser": "13.0.1",
"@angular/animations": "13.3.6",
"@angular/cli": "13.3.5",
"@angular/common": "13.3.6",
"@angular/compiler": "13.3.6",
"@angular/compiler-cli": "13.3.6",
"@angular/core": "13.3.6",
"@angular/forms": "13.3.6",
"@angular/language-service": "13.3.6",
"@angular/localize": "13.3.6",
"@angular/platform-browser": "13.3.6",
"@angular/platform-browser-dynamic": "13.3.6",
"@angular/router": "13.3.6",
"@angular-devkit/schematics-cli": "~14.2.1",
"@angular-eslint/eslint-plugin": "14.0.3",
"@angular-eslint/eslint-plugin-template": "14.0.3",
"@angular-eslint/template-parser": "14.0.3",
"@angular/animations": "14.2.1",
"@angular/cli": "~14.2.1",
"@angular/common": "14.2.1",
"@angular/compiler": "14.2.1",
"@angular/compiler-cli": "14.2.1",
"@angular/core": "14.2.1",
"@angular/forms": "14.2.1",
"@angular/language-service": "14.2.1",
"@angular/localize": "14.2.1",
"@angular/platform-browser": "14.2.1",
"@angular/platform-browser-dynamic": "14.2.1",
"@angular/router": "14.2.1",
"@abp/ng.account": "~6.0.0-rc.4",
"@abp/ng.account.core": "~6.0.0-rc.4",
"@abp/ng.core": "~6.0.0-rc.4",
@ -71,58 +71,59 @@
"@abp/ng.theme.basic": "~6.0.0-rc.4",
"@abp/ng.theme.shared": "~6.0.0-rc.4",
"@fortawesome/fontawesome-free": "^5.15.4",
"@ng-bootstrap/ng-bootstrap": "~12.0.0-beta.4",
"@ng-bootstrap/ng-bootstrap": "~13.0.0",
"@ngneat/spectator": "^10.0.0",
"@ngx-validate/core": "^0.1.2",
"@nrwl/angular": "13.10.3",
"@nrwl/cli": "13.10.3",
"@nrwl/cypress": "13.10.3",
"@nrwl/eslint-plugin-nx": "13.10.3",
"@nrwl/jest": "13.10.3",
"@nrwl/linter": "13.10.3",
"@nrwl/workspace": "13.10.3",
"@schematics/angular": "~12.2.0",
"@nrwl/angular": "14.7.5",
"@nrwl/cli": "14.7.5",
"@nrwl/cypress": "14.7.5",
"@nrwl/eslint-plugin-nx": "14.7.5",
"@nrwl/jest": "14.7.5",
"@nrwl/linter": "14.7.5",
"@nrwl/workspace": "14.7.5",
"@popperjs/core": "~2.11.2",
"@schematics/angular": "14.2.2",
"@swimlane/ngx-datatable": "^20.0.0",
"@types/jest": "27.0.2",
"@types/jest": "28.1.8",
"@types/node": "14.14.33",
"@typescript-eslint/eslint-plugin": "5.18.0",
"@typescript-eslint/parser": "5.18.0",
"@typescript-eslint/eslint-plugin": "5.33.1",
"@typescript-eslint/parser": "5.33.1",
"angular-oauth2-oidc": "^13.0.1",
"bootstrap": "^5.1.1",
"chart.js": "^3.5.1",
"cypress": "^7.3.0",
"dotenv": "10.0.0",
"eslint": "8.12.0",
"eslint": "8.15.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-cypress": "^2.10.3",
"got": "^11.5.2",
"jest": "27.2.3",
"jest": "28.1.3",
"jest-canvas-mock": "^2.3.1",
"jest-preset-angular": "11.1.1",
"jest-environment-jsdom": "28.1.1",
"jest-preset-angular": "12.2.2",
"jsonc-parser": "^2.3.0",
"just-clone": "^3.2.1",
"just-compare": "^1.4.0",
"lerna": "^4.0.0",
"ng-packagr": "13.3.1",
"ng-zorro-antd": "^13.0.0",
"@popperjs/core": "~2.11.2",
"ng-packagr": "14.2.1",
"ng-zorro-antd": "^14.0.0",
"nx": "14.7.5",
"postcss": "^8.3.9",
"postcss-import": "^14.0.2",
"postcss-preset-env": "^6.7.0",
"postcss-url": "^10.1.1",
"prettier": "2.6.2",
"postcss-import": "14.1.0",
"postcss-preset-env": "7.5.0",
"postcss-url": "10.1.3",
"prettier": "2.7.1",
"protractor": "~7.0.0",
"rxjs": "~6.6.0",
"rxjs": "7.5.6",
"should-quote": "^1.0.0",
"ts-jest": "27.0.5",
"ts-node": "~9.1.1",
"ts-jest": "28.0.8",
"ts-node": "10.9.1",
"ts-toolbelt": "6.15.4",
"tsickle": "^0.39.1",
"tslib": "^2.0.0",
"tslint": "~6.1.0",
"typescript": "4.6.4",
"zone.js": "0.11.4",
"nx": "13.10.3"
"typescript": "4.7.4",
"zone.js": "0.11.4"
},
"dependencies": {}
}

3
npm/ng-packs/packages/account-core/jest.config.js → npm/ng-packs/packages/account-core/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'account-core',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

5
npm/ng-packs/packages/account-core/tsconfig.json

@ -9,5 +9,8 @@
{
"path": "./tsconfig.spec.json"
}
]
],
"compilerOptions": {
"target": "es2020"
}
}

4
npm/ng-packs/packages/account-core/tsconfig.lib.json

@ -2,13 +2,13 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

2
npm/ng-packs/packages/account-core/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

3
npm/ng-packs/packages/account/jest.config.js → npm/ng-packs/packages/account/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'account',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

8
npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts

@ -1,7 +1,7 @@
import { ProfileService } from '@abp/ng.account.core/proxy';
import { getPasswordValidators, ToasterService } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { comparePasswords, Validation } from '@ngx-validate/core';
import { finalize } from 'rxjs/operators';
import { Account } from '../../models/account';
@ -19,7 +19,7 @@ const PASSWORD_FIELDS = ['newPassword', 'repeatNewPassword'];
export class ChangePasswordComponent
implements OnInit, Account.ChangePasswordComponentInputs, Account.ChangePasswordComponentOutputs
{
form: FormGroup;
form: UntypedFormGroup;
inProgress: boolean;
@ -32,7 +32,7 @@ export class ChangePasswordComponent
};
constructor(
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private injector: Injector,
private toasterService: ToasterService,
private profileService: ProfileService,
@ -86,7 +86,7 @@ export class ChangePasswordComponent
if (this.hideCurrentPassword) {
this.hideCurrentPassword = false;
this.form.addControl('password', new FormControl('', [required]));
this.form.addControl('password', new UntypedFormControl('', [required]));
}
},
error: err => {

6
npm/ng-packs/packages/account/src/lib/components/forgot-password/forgot-password.component.ts

@ -1,6 +1,6 @@
import { AccountService } from '@abp/ng.account.core/proxy';
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { finalize } from 'rxjs/operators';
@Component({
@ -8,13 +8,13 @@ import { finalize } from 'rxjs/operators';
templateUrl: 'forgot-password.component.html',
})
export class ForgotPasswordComponent {
form: FormGroup;
form: UntypedFormGroup;
inProgress: boolean;
isEmailSent = false;
constructor(private fb: FormBuilder, private accountService: AccountService) {
constructor(private fb: UntypedFormBuilder, private accountService: AccountService) {
this.form = this.fb.group({
email: ['', [Validators.required, Validators.email]],
});

6
npm/ng-packs/packages/account/src/lib/components/login/login.component.ts

@ -1,7 +1,7 @@
import { AuthService, ConfigStateService } from '@abp/ng.core';
import { ToasterService } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { throwError } from 'rxjs';
import { catchError, finalize } from 'rxjs/operators';
import { eAccountComponents } from '../../enums/components';
@ -14,7 +14,7 @@ const { maxLength, required } = Validators;
templateUrl: './login.component.html',
})
export class LoginComponent implements OnInit {
form: FormGroup;
form: UntypedFormGroup;
inProgress: boolean;
@ -24,7 +24,7 @@ export class LoginComponent implements OnInit {
constructor(
protected injector: Injector,
protected fb: FormBuilder,
protected fb: UntypedFormBuilder,
protected toasterService: ToasterService,
protected authService: AuthService,
protected configState: ConfigStateService,

4
npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings-half-row.component.ts

@ -4,7 +4,7 @@ import {
FormProp,
EXTENSIBLE_FORM_VIEW_PROVIDER,
} from '@abp/ng.theme.shared/extensions';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
@Component({
selector: 'abp-personal-settings-half-row',
@ -27,7 +27,7 @@ export class PersonalSettingsHalfRowComponent {
public displayName: string;
public name: string;
public id: string;
public formGroup: FormGroup;
public formGroup: UntypedFormGroup;
constructor(@Inject(EXTENSIONS_FORM_PROP) private propData: FormProp) {
this.displayName = propData.displayName;

6
npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.ts

@ -1,7 +1,7 @@
import { ProfileDto, ProfileService } from '@abp/ng.account.core/proxy';
import { ToasterService } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit, ViewEncapsulation } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { finalize } from 'rxjs/operators';
import { Account } from '../../models/account';
import { ManageProfileStateService } from '../../services/manage-profile.state.service';
@ -31,12 +31,12 @@ export class PersonalSettingsComponent
{
selected: ProfileDto;
form: FormGroup;
form: UntypedFormGroup;
inProgress: boolean;
constructor(
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private toasterService: ToasterService,
private profileService: ProfileService,
private manageProfileState: ManageProfileStateService,

6
npm/ng-packs/packages/account/src/lib/components/register/register.component.ts

@ -2,7 +2,7 @@ import { AccountService, RegisterDto } from '@abp/ng.account.core/proxy';
import { AuthService, ConfigStateService } from '@abp/ng.core';
import { getPasswordValidators, ToasterService } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { throwError } from 'rxjs';
import { catchError, finalize, switchMap } from 'rxjs/operators';
import { eAccountComponents } from '../../enums/components';
@ -15,7 +15,7 @@ const { maxLength, required, email } = Validators;
templateUrl: './register.component.html',
})
export class RegisterComponent implements OnInit {
form: FormGroup;
form: UntypedFormGroup;
inProgress: boolean;
@ -24,7 +24,7 @@ export class RegisterComponent implements OnInit {
authWrapperKey = eAccountComponents.AuthWrapper;
constructor(
protected fb: FormBuilder,
protected fb: UntypedFormBuilder,
protected accountService: AccountService,
protected configState: ConfigStateService,
protected toasterService: ToasterService,

6
npm/ng-packs/packages/account/src/lib/components/reset-password/reset-password.component.ts

@ -1,7 +1,7 @@
import { AccountService } from '@abp/ng.account.core/proxy';
import { getPasswordValidators } from '@abp/ng.theme.shared';
import { Component, Injector, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { comparePasswords, Validation } from '@ngx-validate/core';
import { finalize } from 'rxjs/operators';
@ -13,7 +13,7 @@ const PASSWORD_FIELDS = ['password', 'confirmPassword'];
templateUrl: './reset-password.component.html',
})
export class ResetPasswordComponent implements OnInit {
form: FormGroup;
form: UntypedFormGroup;
inProgress = false;
@ -26,7 +26,7 @@ export class ResetPasswordComponent implements OnInit {
};
constructor(
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private accountService: AccountService,
private route: ActivatedRoute,
private router: Router,

5
npm/ng-packs/packages/account/tsconfig.json

@ -9,5 +9,8 @@
{
"path": "./tsconfig.spec.json"
}
]
],
"compilerOptions": {
"target": "es2020"
}
}

4
npm/ng-packs/packages/account/tsconfig.lib.json

@ -2,13 +2,13 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

2
npm/ng-packs/packages/account/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

3
npm/ng-packs/packages/components/jest.config.js → npm/ng-packs/packages/components/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'components',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

2
npm/ng-packs/packages/components/package.json

@ -13,7 +13,7 @@
},
"dependencies": {
"chart.js": "^3.5.1",
"ng-zorro-antd": "^13.0.0",
"ng-zorro-antd": "^14.0.0",
"tslib": "^2.0.0"
},
"publishConfig": {

5
npm/ng-packs/packages/components/tsconfig.json

@ -9,5 +9,8 @@
{
"path": "./tsconfig.spec.json"
}
]
],
"compilerOptions": {
"target": "es2020"
}
}

4
npm/ng-packs/packages/components/tsconfig.lib.json

@ -2,13 +2,13 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

2
npm/ng-packs/packages/components/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

3
npm/ng-packs/packages/core/jest.config.js → npm/ng-packs/packages/core/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'core',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

45
npm/ng-packs/packages/core/src/lib/directives/ellipsis.directive.ts

@ -1,45 +0,0 @@
import {
AfterViewInit,
ChangeDetectorRef,
Directive,
ElementRef,
HostBinding,
Input,
} from '@angular/core';
@Directive({
selector: '[abpEllipsis]',
})
export class EllipsisDirective implements AfterViewInit {
@Input('abpEllipsis')
width: string;
@HostBinding('title')
@Input()
title: string;
@Input('abpEllipsisEnabled')
enabled = true;
@HostBinding('class.abp-ellipsis-inline')
get inlineClass() {
return this.enabled && this.width;
}
@HostBinding('class.abp-ellipsis')
get class() {
return this.enabled && !this.width;
}
@HostBinding('style.max-width')
get maxWidth() {
return this.enabled && this.width ? this.width || '170px' : undefined;
}
constructor(private cdRef: ChangeDetectorRef, private elRef: ElementRef) {}
ngAfterViewInit() {
this.title = this.title || (this.elRef.nativeElement as HTMLElement).innerText;
this.cdRef.detectChanges();
}
}

8
npm/ng-packs/packages/core/src/lib/directives/form-submit.directive.ts

@ -8,12 +8,12 @@ import {
Output,
Self,
} from '@angular/core';
import { FormControl, FormGroup, FormGroupDirective } from '@angular/forms';
import { UntypedFormControl, UntypedFormGroup, FormGroupDirective } from '@angular/forms';
import { fromEvent } from 'rxjs';
import { debounceTime, filter } from 'rxjs/operators';
import { SubscriptionService } from '../services/subscription.service';
type Controls = { [key: string]: FormControl } | FormGroup[];
type Controls = { [key: string]: UntypedFormControl } | UntypedFormGroup[];
/**
* @deprecated FormSubmitDirective will be removed in V7.0.0. Use `ngSubmit` instead.
*/
@ -73,7 +73,7 @@ export class FormSubmitDirective implements OnInit {
markAsDirty() {
const { form } = this.formGroupDirective;
setDirty(form.controls as { [key: string]: FormControl });
setDirty(form.controls as { [key: string]: UntypedFormControl });
form.markAsDirty();
this.cdRef.detectChanges();
@ -83,7 +83,7 @@ export class FormSubmitDirective implements OnInit {
function setDirty(controls: Controls) {
if (Array.isArray(controls)) {
controls.forEach(group => {
setDirty(group.controls as { [key: string]: FormControl });
setDirty(group.controls as { [key: string]: UntypedFormControl });
});
return;
}

2
npm/ng-packs/packages/core/src/lib/directives/permission.directive.ts

@ -23,7 +23,7 @@ export class PermissionDirective implements OnDestroy, OnChanges, AfterViewInit
subscription!: Subscription;
cdrSubject = new ReplaySubject();
cdrSubject = new ReplaySubject<void>();
rendered = false;

5
npm/ng-packs/packages/core/src/lib/handlers/routes.handler.ts

@ -1,5 +1,5 @@
import { Injectable, Optional } from '@angular/core';
import { Router } from '@angular/router';
import { Route, Router } from '@angular/router';
import { ABP } from '../models';
import { RoutesService } from '../services/routes.service';
@ -12,7 +12,7 @@ export class RoutesHandler {
}
addRoutes() {
this.router?.config?.forEach(({ path = '', data }) => {
this.router?.config?.forEach(({ path = '', data }: RouteData) => {
if (!data?.routes) return;
if (Array.isArray(data.routes)) {
@ -43,3 +43,4 @@ function flatRoutes(routes: RouteDef[], parent: any) {
}
type RouteDef = ABP.Route & { children: RouteDef[] };
type RouteData = Route & { data: { routes: RouteDef | Array<RouteDef> } };

17
npm/ng-packs/packages/core/src/lib/services/config-state.service.ts

@ -2,7 +2,10 @@ import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { map, switchMap, take } from 'rxjs/operators';
import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service';
import { ApplicationConfigurationDto, ApplicationGlobalFeatureConfigurationDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models';
import {
ApplicationConfigurationDto,
ApplicationGlobalFeatureConfigurationDto,
} from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models';
import { InternalStore } from '../utils/internal-store-utils';
@Injectable({
@ -15,7 +18,7 @@ export class ConfigStateService {
return this.store.sliceUpdate;
}
private updateSubject = new Subject();
private updateSubject = new Subject<void>();
constructor(private abpConfigService: AbpApplicationConfigurationService) {
this.initUpdateStream();
@ -147,8 +150,11 @@ export class ConfigStateService {
return this.store.sliceState(state => state.globalFeatures);
}
private isGlobalFeatureEnabled(key: string, globalFeatures: ApplicationGlobalFeatureConfigurationDto) {
const features = globalFeatures.enabledFeatures || []
private isGlobalFeatureEnabled(
key: string,
globalFeatures: ApplicationGlobalFeatureConfigurationDto,
) {
const features = globalFeatures.enabledFeatures || [];
return features.some(f => key === f);
}
@ -159,9 +165,6 @@ export class ConfigStateService {
getGlobalFeatureIsEnabled$(key: string) {
return this.store.sliceState(state => this.isGlobalFeatureEnabled(key, state.globalFeatures));
}
}
function splitKeys(keys: string[] | string): string[] {

2
npm/ng-packs/packages/core/src/lib/services/http-wait.service.ts

@ -24,7 +24,7 @@ export class HttpWaitService {
});
private delay: number;
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
constructor(injector: Injector) {
this.delay = injector.get(LOADER_DELAY, 500);

2
npm/ng-packs/packages/core/src/lib/services/list.service.ts

@ -80,7 +80,7 @@ export class ListService<QueryParamsType = ABP.PageQueryParams | any> implements
private _isLoading$ = new BehaviorSubject(false);
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
private delay: MonoTypeOperatorFunction<QueryParamsType>;

2
npm/ng-packs/packages/core/src/lib/services/router-wait.service.ts

@ -15,7 +15,7 @@ export interface RouterWaitState {
})
export class RouterWaitService {
private store = new InternalStore<RouterWaitState>({ loading: false });
private destroy$ = new Subject();
private destroy$ = new Subject<void>();
private delay: number;
constructor(private routerEvents: RouterEvents, injector: Injector) {
this.delay = injector.get(LOADER_DELAY, 500);

9
npm/ng-packs/packages/core/src/lib/tests/api.interceptor.spec.ts

@ -3,8 +3,9 @@ import { SpyObject } from '@ngneat/spectator';
import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest';
import { OAuthService } from 'angular-oauth2-oidc';
import { Subject, timer } from 'rxjs';
import { ApiInterceptor } from '../interceptors';
import { HttpWaitService, SessionStateService } from '../services';
import { ApiInterceptor } from '../interceptors/api.interceptor';
import { HttpWaitService } from '../services/http-wait.service';
import { SessionStateService } from '../services/session-state.service';
import { TENANT_KEY } from '../tokens/tenant-key.token';
describe('ApiInterceptor', () => {
@ -36,7 +37,7 @@ describe('ApiInterceptor', () => {
sessionState.getTenant.andReturn({ id: 'Volosoft', name: 'Volosoft' });
const request = new HttpRequest('GET', 'https://abp.io');
const handleRes$ = new Subject();
const handleRes$ = new Subject<void>();
const handler = {
handle: (req: HttpRequest<any>) => {
@ -59,7 +60,7 @@ describe('ApiInterceptor', () => {
const spyDeleteRequest = jest.spyOn(httpWaitService, 'deleteRequest');
const request = new HttpRequest('GET', 'https://abp.io');
const handleRes$ = new Subject();
const handleRes$ = new Subject<void>();
const handler = {
handle: (req: HttpRequest<any>) => {

2
npm/ng-packs/packages/core/src/lib/tests/container.strategy.spec.ts

@ -3,7 +3,7 @@ import {
ClearContainerStrategy,
CONTAINER_STRATEGY,
InsertIntoContainerStrategy,
} from '../strategies';
} from '../strategies/container.strategy';
describe('ClearContainerStrategy', () => {
const containerRef = {

2
npm/ng-packs/packages/core/src/lib/tests/dom.strategy.spec.ts

@ -1,4 +1,4 @@
import { DomStrategy, DOM_STRATEGY } from '../strategies';
import { DOM_STRATEGY, DomStrategy } from '../strategies/dom.strategy';
describe('DomStrategy', () => {
describe('#insertElement', () => {

2
npm/ng-packs/packages/core/src/lib/tests/environment-utils.spec.ts

@ -3,7 +3,7 @@ import { Component, Injector } from '@angular/core';
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest';
import { BehaviorSubject } from 'rxjs';
import { Environment, RemoteEnv } from '../models/environment';
import { EnvironmentService } from '../services';
import { EnvironmentService } from '../services/environment.service';
import { getRemoteEnv } from '../utils/environment-utils';
import { deepMerge } from '../utils/object-utils';

36
npm/ng-packs/packages/core/src/lib/tests/environment.service.spec.ts

@ -1,7 +1,7 @@
import { waitForAsync } from '@angular/core/testing';
import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest';
import { Environment } from '../models';
import { EnvironmentService } from '../services';
import { Environment } from '../models/environment';
import { EnvironmentService } from '../services/environment.service';
export const ENVIRONMENT_DATA = {
production: false,
@ -41,27 +41,21 @@ describe('Environment', () => {
});
describe('#getEnvironment', () => {
it(
'should return ENVIRONMENT_DATA',
waitForAsync(() => {
expect(environment.getEnvironment()).toEqual(ENVIRONMENT_DATA);
environment.getEnvironment$().subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA));
}),
);
it('should return ENVIRONMENT_DATA', waitForAsync(() => {
expect(environment.getEnvironment()).toEqual(ENVIRONMENT_DATA);
environment.getEnvironment$().subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA));
}));
});
describe('#getApiUrl', () => {
it(
'should return api url',
waitForAsync(() => {
expect(environment.getApiUrl('default')).toEqual(ENVIRONMENT_DATA.apis.default.url);
environment
.getApiUrl$('other')
.subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.other.url));
environment
.getApiUrl$('yetAnother')
.subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.default.url));
}),
);
it('should return api url', waitForAsync(() => {
expect(environment.getApiUrl('default')).toEqual(ENVIRONMENT_DATA.apis.default.url);
environment
.getApiUrl$('other')
.subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.other.url));
environment
.getApiUrl$('yetAnother')
.subscribe(data => expect(data).toEqual(ENVIRONMENT_DATA.apis.default.url));
}));
});
});

2
npm/ng-packs/packages/core/src/lib/tests/generator-utils.spec.ts

@ -1,4 +1,4 @@
import { generateHash, generatePassword } from '../utils';
import { generateHash, generatePassword } from '../utils/generator-utils';
describe('GeneratorUtils', () => {
describe('#generateHash', () => {

12
npm/ng-packs/packages/core/src/lib/tests/initial-utils.spec.ts

@ -4,15 +4,13 @@ import { OAuthService } from 'angular-oauth2-oidc';
import { of } from 'rxjs';
import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service';
import { ApplicationConfigurationDto } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/models';
import {
AuthService,
ConfigStateService,
EnvironmentService,
SessionStateService,
} from '../services';
import { SessionStateService } from '../services/session-state.service';
import { EnvironmentService } from '../services/environment.service';
import { AuthService } from '../services/auth.service';
import { ConfigStateService } from '../services/config-state.service';
import * as AuthFlowStrategy from '../strategies/auth-flow.strategy';
import { CORE_OPTIONS } from '../tokens/options.token';
import { checkAccessToken, getInitialData, localeInitializer } from '../utils';
import { checkAccessToken, getInitialData, localeInitializer } from '../utils/initial-utils';
import * as environmentUtils from '../utils/environment-utils';
import * as multiTenancyUtils from '../utils/multi-tenancy-utils';

4
npm/ng-packs/packages/core/src/lib/tests/internal-store.spec.ts

@ -1,7 +1,7 @@
import clone from 'just-clone';
import { take } from 'rxjs/operators';
import { DeepPartial } from '../models';
import { InternalStore } from '../utils';
import { DeepPartial } from '../models/utility';
import { InternalStore } from '../utils/internal-store-utils';
const mockInitialState = {
foo: {

6
npm/ng-packs/packages/core/src/lib/tests/lazy-load-utils.spec.ts

@ -1,6 +1,6 @@
import { DomStrategy, DOM_STRATEGY } from '../strategies';
import { CrossOriginStrategy, CROSS_ORIGIN_STRATEGY } from '../strategies/cross-origin.strategy';
import { uuid } from '../utils';
import { DOM_STRATEGY, DomStrategy } from '../strategies';
import { CROSS_ORIGIN_STRATEGY, CrossOriginStrategy } from '../strategies/cross-origin.strategy';
import { uuid } from '../utils/generator-utils';
import { fromLazyLoad } from '../utils/lazy-load-utils';
describe('Lazy Load Utils', () => {

4
npm/ng-packs/packages/core/src/lib/tests/lazy-load.service.spec.ts

@ -1,8 +1,8 @@
import { of, throwError } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { LazyLoadService } from '../services/lazy-load.service';
import { ScriptLoadingStrategy } from '../strategies';
import { ResourceWaitService } from '../services';
import { ScriptLoadingStrategy } from '../strategies/loading.strategy';
import { ResourceWaitService } from '../services/resource-wait.service';
describe('LazyLoadService', () => {
describe('#load', () => {

6
npm/ng-packs/packages/core/src/lib/tests/loading.strategy.spec.ts

@ -1,10 +1,10 @@
import { CROSS_ORIGIN_STRATEGY } from '../strategies/cross-origin.strategy';
import {
CROSS_ORIGIN_STRATEGY,
DOM_STRATEGY,
LOADING_STRATEGY,
ScriptLoadingStrategy,
StyleLoadingStrategy,
} from '../strategies';
} from '../strategies/loading.strategy';
import { DOM_STRATEGY } from '../strategies/dom.strategy';
const path = 'http://example.com/';

4
npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts

@ -1,8 +1,8 @@
import { Component, LOCALE_ID } from '@angular/core';
import { createRoutingFactory, SpectatorRouting } from '@ngneat/spectator/jest';
import { differentLocales } from '../constants/different-locales';
import { LocaleId } from '../providers';
import { LocalizationService } from '../services';
import { LocaleId } from '../providers/locale.provider';
import { LocalizationService } from '../services/localization.service';
@Component({ selector: 'abp-dummy', template: '' })
export class DummyComponent {}

4
npm/ng-packs/packages/core/src/lib/tests/localization.pipe.spec.ts

@ -1,6 +1,6 @@
import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest';
import { LocalizationPipe } from '../pipes';
import { LocalizationService } from '../services';
import { LocalizationPipe } from '../pipes/localization.pipe';
import { LocalizationService } from '../services/localization.service';
describe('LocalizationPipe', () => {
let spectator: SpectatorService<LocalizationPipe>;

3
npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts

@ -3,7 +3,8 @@ import { Router } from '@angular/router';
import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest';
import { BehaviorSubject } from 'rxjs';
import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service';
import { ConfigStateService, SessionStateService } from '../services';
import { ConfigStateService } from '../services/config-state.service';
import { SessionStateService } from '../services/session-state.service';
import { LocalizationService } from '../services/localization.service';
import { CORE_OPTIONS } from '../tokens/options.token';
import { CONFIG_STATE_DATA } from './config-state.service.spec';

2
npm/ng-packs/packages/core/src/lib/tests/permission.directive.spec.ts

@ -1,7 +1,7 @@
import { createDirectiveFactory, SpectatorDirective } from '@ngneat/spectator/jest';
import { Subject } from 'rxjs';
import { PermissionDirective } from '../directives/permission.directive';
import { PermissionService } from '../services';
import { PermissionService } from '../services/permission.service';
import { ChangeDetectorRef } from '@angular/core';
describe('PermissionDirective', () => {

5
npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts

@ -5,9 +5,10 @@ import { RouterModule } from '@angular/router';
import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest';
import { of } from 'rxjs';
import { PermissionGuard } from '../guards/permission.guard';
import { HttpErrorReporterService, PermissionService } from '../services';
import { HttpErrorReporterService } from '../services/http-error-reporter.service';
import { PermissionService } from '../services/permission.service';
import { RoutesService } from '../services/routes.service';
import { CORE_OPTIONS } from '../tokens';
import { CORE_OPTIONS } from '../tokens/options.token';
describe('PermissionGuard', () => {
let spectator: SpectatorService<PermissionGuard>;

18
npm/ng-packs/packages/core/src/lib/tests/projection.strategy.spec.ts

@ -1,15 +1,21 @@
import { Component, ComponentRef, EmbeddedViewRef, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
import {
Component,
ComponentRef,
EmbeddedViewRef,
TemplateRef,
ViewChild,
ViewContainerRef,
} from '@angular/core';
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest';
import {
ComponentProjectionStrategy,
CONTAINER_STRATEGY,
ContainerStrategy,
CONTEXT_STRATEGY,
DOM_STRATEGY,
PROJECTION_STRATEGY,
RootComponentProjectionStrategy,
TemplateProjectionStrategy,
} from '../strategies';
} from '../strategies/projection.strategy';
import { CONTAINER_STRATEGY, ContainerStrategy } from '../strategies/container.strategy';
import { DOM_STRATEGY } from '../strategies/dom.strategy';
import { CONTEXT_STRATEGY } from '../strategies/context.strategy';
describe('ComponentProjectionStrategy', () => {
@Component({

4
npm/ng-packs/packages/core/src/lib/tests/replaceable-template.directive.spec.ts

@ -2,8 +2,8 @@ import { Component, EventEmitter, Inject, Input, Optional, Output } from '@angul
import { Router } from '@angular/router';
import { createDirectiveFactory, SpectatorDirective } from '@ngneat/spectator/jest';
import { BehaviorSubject } from 'rxjs';
import { ReplaceableTemplateDirective } from '../directives';
import { ReplaceableComponents } from '../models';
import { ReplaceableTemplateDirective } from '../directives/replaceable-template.directive';
import { ReplaceableComponents } from '../models/replaceable-components';
import { ReplaceableComponentsService } from '../services/replaceable-components.service';
@Component({

7
npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts

@ -2,10 +2,11 @@ import { createHttpFactory, HttpMethod, SpectatorHttp, SpyObject } from '@ngneat
import { OAuthService } from 'angular-oauth2-oidc';
import { of, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { Rest } from '../models';
import { EnvironmentService, HttpErrorReporterService } from '../services';
import { Rest } from '../models/rest';
import { EnvironmentService } from '../services/environment.service';
import { HttpErrorReporterService } from '../services/http-error-reporter.service';
import { RestService } from '../services/rest.service';
import { CORE_OPTIONS } from '../tokens';
import { CORE_OPTIONS } from '../tokens/options.token';
describe('HttpClient testing', () => {
let spectator: SpectatorHttp<RestService>;

2
npm/ng-packs/packages/core/src/lib/tests/route-utils.spec.ts

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { createRoutingFactory, SpectatorRouting } from '@ngneat/spectator/jest';
import { RouterOutletComponent } from '../components';
import { RouterOutletComponent } from '../components/router-outlet.component';
import { RoutesService } from '../services/routes.service';
import { findRoute, getRoutePath } from '../utils/route-utils';

4
npm/ng-packs/packages/core/src/lib/tests/routes.handler.spec.ts

@ -1,6 +1,6 @@
import { Router } from '@angular/router';
import { RoutesHandler } from '../handlers';
import { RoutesService } from '../services';
import { RoutesHandler } from '../handlers/routes.handler';
import { RoutesService } from '../services/routes.service';
describe('Routes Handler', () => {
describe('#add', () => {

4
npm/ng-packs/packages/core/src/lib/tests/routes.service.spec.ts

@ -1,10 +1,10 @@
import { Subject } from 'rxjs';
import { take } from 'rxjs/operators';
import { RoutesService } from '../services';
import { RoutesService } from '../services/routes.service';
import { DummyInjector } from './utils/common.utils';
import { mockPermissionService } from './utils/permission-service.spec.utils';
const updateStream$ = new Subject();
const updateStream$ = new Subject<void>();
export const mockRoutesService = (injectorPayload = {} as { [key: string]: any }) => {
const injector = new DummyInjector({

7
npm/ng-packs/packages/core/src/lib/tests/validators.spec.ts

@ -1,10 +1,13 @@
import { FormControl, Validators } from '@angular/forms';
import { AbpValidators, validateMinAge, validateRange } from '../validators';
import { validateMinAge } from '../validators/age.validator';
import { validateRange } from '../validators/range.validator';
import { validateCreditCard } from '../validators/credit-card.validator';
import { validateRequired } from '../validators/required.validator';
import { validateStringLength } from '../validators/string-length.validator';
import { validateUrl } from '../validators/url.validator';
const emailAddress = () => Validators.email;
describe('Validators', () => {
describe('Credit Card Validator', () => {
const error = { creditCard: true };
@ -41,7 +44,7 @@ describe('Validators', () => {
describe('Email Validator', () => {
it('should return email validator of Angular', () => {
expect(AbpValidators.emailAddress()).toBe(Validators.email);
expect(emailAddress()).toBe(Validators.email);
});
});

6
npm/ng-packs/packages/core/src/lib/validators/url.validator.ts

@ -1,5 +1,5 @@
import { AbstractControl, ValidatorFn } from '@angular/forms';
import { isNullOrUndefined } from '../utils';
import { isNullOrEmpty } from '../utils';
export interface UrlError {
url: true;
@ -7,11 +7,11 @@ export interface UrlError {
export function validateUrl(): ValidatorFn {
return (control: AbstractControl): UrlError | null => {
if (isNullOrUndefined(control.value)) return null;
if (isNullOrEmpty(control.value)) return null;
return isValidUrl(control.value) ? null : { url: true };
};
}
}
function isValidUrl(value: string): boolean {
if (/^http(s)?:\/\/[^/]/.test(value) || /^ftp:\/\/[^/]/.test(value)) {

3
npm/ng-packs/packages/core/tsconfig.json

@ -11,6 +11,7 @@
}
],
"compilerOptions": {
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"target": "es2020"
}
}

4
npm/ng-packs/packages/core/tsconfig.lib.json

@ -2,13 +2,13 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

2
npm/ng-packs/packages/core/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.ts"]
}

3
npm/ng-packs/packages/feature-management/jest.config.js → npm/ng-packs/packages/feature-management/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'feature-management',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

5
npm/ng-packs/packages/feature-management/tsconfig.json

@ -9,5 +9,8 @@
{
"path": "./tsconfig.spec.json"
}
]
],
"compilerOptions": {
"target": "es2020"
}
}

4
npm/ng-packs/packages/feature-management/tsconfig.lib.json

@ -2,13 +2,13 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

2
npm/ng-packs/packages/feature-management/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

3
npm/ng-packs/packages/identity/jest.config.js → npm/ng-packs/packages/identity/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'identity',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

4
npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts

@ -8,7 +8,7 @@ import {
generateFormFromProps,
} from '@abp/ng.theme.shared/extensions';
import { Component, Injector, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { UntypedFormGroup } from '@angular/forms';
import { finalize } from 'rxjs/operators';
import { eIdentityComponents } from '../../enums/components';
@ -26,7 +26,7 @@ import { eIdentityComponents } from '../../enums/components';
export class RolesComponent implements OnInit {
data: PagedResultDto<IdentityRoleDto> = { items: [], totalCount: 0 };
form: FormGroup;
form: UntypedFormGroup;
selected: IdentityRoleDto;

10
npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts

@ -20,7 +20,7 @@ import {
TrackByFunction,
ViewChild,
} from '@angular/core';
import { AbstractControl, FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { AbstractControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { finalize, switchMap, tap } from 'rxjs/operators';
import { eIdentityComponents } from '../../enums/components';
@ -41,7 +41,7 @@ export class UsersComponent implements OnInit {
@ViewChild('modalContent', { static: false })
modalContent: TemplateRef<any>;
form: FormGroup;
form: UntypedFormGroup;
selected: IdentityUserDto;
@ -67,8 +67,8 @@ export class UsersComponent implements OnInit {
this.visiblePermissions = event;
};
get roleGroups(): FormGroup[] {
return ((this.form.get('roleNames') as FormArray)?.controls as FormGroup[]) || [];
get roleGroups(): UntypedFormGroup[] {
return ((this.form.get('roleNames') as UntypedFormArray)?.controls as UntypedFormGroup[]) || [];
}
constructor(
@ -76,7 +76,7 @@ export class UsersComponent implements OnInit {
protected confirmationService: ConfirmationService,
protected service: IdentityUserService,
private toasterService: ToasterService,
protected fb: FormBuilder,
protected fb: UntypedFormBuilder,
protected injector: Injector,
) {}

5
npm/ng-packs/packages/identity/tsconfig.json

@ -9,5 +9,8 @@
{
"path": "./tsconfig.spec.json"
}
]
],
"compilerOptions": {
"target": "es2020"
}
}

4
npm/ng-packs/packages/identity/tsconfig.lib.json

@ -2,13 +2,13 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

2
npm/ng-packs/packages/identity/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

3
npm/ng-packs/packages/permission-management/jest.config.js → npm/ng-packs/packages/permission-management/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'permission-management',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

5
npm/ng-packs/packages/permission-management/tsconfig.json

@ -9,5 +9,8 @@
{
"path": "./tsconfig.spec.json"
}
]
],
"compilerOptions": {
"target": "es2020"
}
}

4
npm/ng-packs/packages/permission-management/tsconfig.lib.json

@ -2,13 +2,13 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

2
npm/ng-packs/packages/permission-management/tsconfig.spec.json

@ -7,5 +7,5 @@
"esModuleInterop": true
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

3
npm/ng-packs/packages/schematics/jest.config.js → npm/ng-packs/packages/schematics/jest.config.ts

@ -1,4 +1,5 @@
module.exports = {
/* eslint-disable */
export default {
displayName: 'schematics',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],

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

@ -9,15 +9,16 @@
"license": "MIT",
"schematics": "./collection.json",
"dependencies": {
"@angular-devkit/core": "~13.3.9",
"@angular-devkit/schematics": "~13.3.9",
"@angular-devkit/core": "~14.2.1",
"@angular/cli": "~14.2.1",
"@angular-devkit/schematics": "~14.2.1",
"got": "^11.5.2",
"jsonc-parser": "^2.3.0",
"should-quote": "^1.0.0",
"typescript": "~4.6.4"
"typescript": "~4.7.4"
},
"devDependencies": {
"@schematics/angular": "~11.0.2",
"@schematics/angular": "~14.2.1",
"@types/jest": "^26.0.0",
"@types/node": "^12.11.1",
"jest": "^26.0.0",

3
npm/ng-packs/packages/schematics/src/commands/api/index.ts

@ -4,7 +4,6 @@ import {
branchAndMerge,
chain,
move,
SchematicContext,
SchematicsException,
Tree,
url,
@ -36,7 +35,7 @@ export default function (schema: GenerateProxySchema) {
const moduleName = params.module || 'app';
return chain([
async (tree: Tree, _context: SchematicContext) => {
async (tree: Tree) => {
const getRootNamespace = createRootNamespaceGetter(params);
const solution = await getRootNamespace(tree);

2
npm/ng-packs/packages/schematics/src/commands/create-lib/files-package/__libraryName@kebab__/tsconfig.lib.json.template

@ -3,7 +3,7 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,

9
npm/ng-packs/packages/schematics/src/commands/create-lib/index.ts

@ -4,7 +4,6 @@ import {
move,
noop,
Rule,
SchematicContext,
SchematicsException,
Tree,
url,
@ -59,7 +58,7 @@ async function checkLibExist(options: GenerateLibSchema, tree: Tree) {
}
function createLibrary(options: GenerateLibSchema): Rule {
return async (tree: Tree, _context: SchematicContext) => {
return async (tree: Tree) => {
const target = await resolveProject(tree, options.packageName, null);
if (!target || options.override) {
if (options.isModuleTemplate) {
@ -83,9 +82,7 @@ async function resolvePackagesDirFromAngularJson(host: Tree) {
function readFirstLibInAngularJson(workspace: WorkspaceDefinition): ProjectDefinition | undefined {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, props] =
Array.from(workspace.projects.entries()).find(([_, value]) => isLibrary(value)) || [];
return props;
return Array.from(workspace.projects.values()).find(value => isLibrary(value));
}
async function createLibFromModuleTemplate(tree: Tree, options: GenerateLibSchema) {
@ -107,7 +104,7 @@ async function createLibFromModuleTemplate(tree: Tree, options: GenerateLibSchem
}
export function addLibToWorkspaceIfNotExist(name: string, packagesDir: string): Rule {
return async (tree: Tree, _: SchematicContext) => {
return async (tree: Tree) => {
const workspace = await getWorkspace(tree);
const packageName = kebab(name);
const isProjectExist = workspace.projects.has(packageName);

4
npm/ng-packs/packages/schematics/src/commands/proxy-add/index.ts

@ -1,4 +1,4 @@
import { chain, SchematicContext, Tree } from '@angular-devkit/schematics';
import { chain, Tree } from '@angular-devkit/schematics';
import { GenerateProxySchema } from '../../models';
import {
buildTargetPath,
@ -19,7 +19,7 @@ export default function (schema: GenerateProxySchema) {
const moduleName = params.module || 'app';
return chain([
async (host: Tree, _context: SchematicContext) => {
async (host: Tree) => {
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);
const readProxyConfig = createProxyConfigReader(targetPath);

4
npm/ng-packs/packages/schematics/src/commands/proxy-index/index.ts

@ -1,4 +1,4 @@
import { SchematicContext, Tree } from '@angular-devkit/schematics';
import { Tree } from '@angular-devkit/schematics';
import {
buildTargetPath,
createProxyIndexGenerator,
@ -9,7 +9,7 @@ import {
export default function (schema: { target?: string; entryPoint?: string }) {
const params = removeDefaultPlaceholders(schema);
return async (host: Tree, _context: SchematicContext) => {
return async (host: Tree) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);

4
npm/ng-packs/packages/schematics/src/commands/proxy-refresh/index.ts

@ -1,4 +1,4 @@
import { chain, SchematicContext, Tree } from '@angular-devkit/schematics';
import { chain, Tree } from '@angular-devkit/schematics';
import { GenerateProxySchema } from '../../models';
import {
buildTargetPath,
@ -16,7 +16,7 @@ import {
export default function (schema: GenerateProxySchema) {
const params = removeDefaultPlaceholders(schema);
return async (host: Tree, _context: SchematicContext) => {
return async (host: Tree) => {
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);

4
npm/ng-packs/packages/schematics/src/commands/proxy-remove/index.ts

@ -1,4 +1,4 @@
import { chain, SchematicContext, Tree } from '@angular-devkit/schematics';
import { chain, Tree } from '@angular-devkit/schematics';
import { GenerateProxySchema } from '../../models';
import {
buildTargetPath,
@ -17,7 +17,7 @@ export default function (schema: GenerateProxySchema) {
const params = removeDefaultPlaceholders(schema);
const moduleName = params.module || 'app';
return async (host: Tree, _context: SchematicContext) => {
return async (host: Tree) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const target = await resolveProject(host, params.target!);
const targetPath = buildTargetPath(target.definition, params.entryPoint);

4
npm/ng-packs/packages/schematics/src/models/api-definition.ts

@ -56,6 +56,8 @@ export interface ParameterInSignature {
type: string;
typeSimple: string;
isOptional: boolean;
// eslint-disable-next-line
// @typescript-eslint/no-explicit-any
defaultValue: any;
}
@ -66,6 +68,8 @@ export interface ParameterInBody {
type: string;
typeSimple: string;
isOptional: boolean;
// eslint-disable-next-line
// @typescript-eslint/no-explicit-any
defaultValue: any;
constraintTypes: string[] | null;
bindingSourceId: eBindingSourceId;

2
npm/ng-packs/packages/schematics/src/utils/angular/README.md

@ -1,5 +1,5 @@
**DISCLAIMER**
This directory is a direct copy of https://github.com/angular/angular-cli/tree/d091bb0c7b76a73e1b7d4b5690c532c68452b1d6 and is used under terms and permissions by the MIT license granted by Google, Inc.
This directory is a direct copy of https://github.com/angular/angular-cli/tree/c5ef701639755d5b390e64287963ee35faab2cd4/packages/schematics/angular/utility and is used under terms and permissions by the MIT license granted by Google, LLC.
All credits go to Angular team for building these utilities.

173
npm/ng-packs/packages/schematics/src/utils/angular/dependency.ts

@ -0,0 +1,173 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Rule, SchematicContext } from '@angular-devkit/schematics';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import * as path from 'path';
const installTasks = new WeakMap<SchematicContext, Set<string>>();
interface MinimalPackageManifest {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
peerDependencies?: Record<string, string>;
}
/**
* An enum used to specify the type of a dependency found within a package manifest
* file (`package.json`).
*/
export enum DependencyType {
Default = 'dependencies',
Dev = 'devDependencies',
Peer = 'peerDependencies',
}
/**
* An enum used to specify the dependency installation behavior for the {@link addDependency}
* schematics rule. The installation behavior affects if and when {@link NodePackageInstallTask}
* will be scheduled when using the rule.
*/
export enum InstallBehavior {
/**
* No installation will occur as a result of the rule when specified.
*
* NOTE: This does not prevent other rules from scheduling a {@link NodePackageInstallTask}
* which may install the dependency.
*/
None,
/**
* Automatically determine the need to schedule a {@link NodePackageInstallTask} based on
* previous usage of the {@link addDependency} within the schematic.
*/
Auto,
/**
* Always schedule a {@link NodePackageInstallTask} when the rule is executed.
*/
Always,
}
/**
* An enum used to specify the existing dependency behavior for the {@link addDependency}
* schematics rule. The existing behavior affects whether the named dependency will be added
* to the `package.json` when the dependency is already present with a differing specifier.
*/
export enum ExistingBehavior {
/**
* The dependency will not be added or otherwise changed if it already exists.
*/
Skip,
/**
* The dependency's existing specifier will be replaced with the specifier provided in the
* {@link addDependency} call. A warning will also be shown during schematic execution to
* notify the user of the replacement.
*/
Replace,
}
/**
* Adds a package as a dependency to a `package.json`. By default the `package.json` located
* at the schematic's root will be used. The `manifestPath` option can be used to explicitly specify
* a `package.json` in different location. The type of the dependency can also be specified instead
* of the default of the `dependencies` section by using the `type` option for either `devDependencies`
* or `peerDependencies`.
*
* When using this rule, {@link NodePackageInstallTask} does not need to be included directly by
* a schematic. A package manager install task will be automatically scheduled as needed.
*
* @param name The name of the package to add.
* @param specifier The package specifier for the package to add. Typically a SemVer range.
* @param options An optional object that can contain the `type` of the dependency
* and/or a path (`packageJsonPath`) of a manifest file (`package.json`) to modify.
* @returns A Schematics {@link Rule}
*/
export function addDependency(
name: string,
specifier: string,
options: {
/**
* The type of the dependency determines the section of the `package.json` to which the
* dependency will be added. Defaults to {@link DependencyType.Default} (`dependencies`).
*/
type?: DependencyType;
/**
* The path of the package manifest file (`package.json`) that will be modified.
* Defaults to `/package.json`.
*/
packageJsonPath?: string;
/**
* The dependency installation behavior to use to determine whether a
* {@link NodePackageInstallTask} should be scheduled after adding the dependency.
* Defaults to {@link InstallBehavior.Auto}.
*/
install?: InstallBehavior;
/**
* The behavior to use when the dependency already exists within the `package.json`.
* Defaults to {@link ExistingBehavior.Replace}.
*/
existing?: ExistingBehavior;
} = {},
): Rule {
const {
type = DependencyType.Default,
packageJsonPath = '/package.json',
install = InstallBehavior.Auto,
existing = ExistingBehavior.Replace,
} = options;
return (tree, context) => {
const manifest = tree.readJson(packageJsonPath) as MinimalPackageManifest;
const dependencySection = manifest[type];
if (!dependencySection) {
// Section is not present. The dependency can be added to a new object literal for the section.
manifest[type] = { [name]: specifier };
} else {
const existingSpecifier = dependencySection[name];
if (existingSpecifier === specifier) {
// Already present with same specifier
return;
}
if (existingSpecifier) {
// Already present but different specifier
if (existing === ExistingBehavior.Skip) {
return;
}
// ExistingBehavior.Replace is the only other behavior currently
context.logger.warn(
`Package dependency "${name}" already exists with a different specifier. ` +
`"${existingSpecifier}" will be replaced with "${specifier}".`,
);
}
// Add new dependency in alphabetical order
const entries = Object.entries(dependencySection);
entries.push([name, specifier]);
entries.sort((a, b) => a[0].localeCompare(b[0]));
manifest[type] = Object.fromEntries(entries);
}
tree.overwrite(packageJsonPath, JSON.stringify(manifest, null, 2));
const installPaths = installTasks.get(context) ?? new Set<string>();
if (
install === InstallBehavior.Always ||
(install === InstallBehavior.Auto && !installPaths.has(packageJsonPath))
) {
context.addTask(
new NodePackageInstallTask({ workingDirectory: path.dirname(packageJsonPath) }),
);
installPaths.add(packageJsonPath);
installTasks.set(context, installPaths);
}
};
}

4
npm/ng-packs/packages/schematics/src/utils/angular/find-module.ts

@ -17,6 +17,7 @@ export interface ModuleOptions {
skipImport?: boolean;
moduleExt?: string;
routingModuleExt?: string;
standalone?: boolean;
}
export const MODULE_EXT = '.module.ts';
@ -26,8 +27,7 @@ export const ROUTING_MODULE_EXT = '-routing.module.ts';
* Find the module referred by a set of options passed to the schematics.
*/
export function findModuleFromOptions(host: Tree, options: ModuleOptions): Path | undefined {
// eslint-disable-next-line no-prototype-builtins
if (options.hasOwnProperty('skipImport') && options.skipImport) {
if (options.standalone || options.skipImport) {
return undefined;
}

15
npm/ng-packs/packages/schematics/src/utils/angular/generate-from-files.ts

@ -6,8 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/
import { strings } from '@angular-devkit/core';
import {
Rule,
Tree,
apply,
applyTemplates,
chain,
@ -15,11 +16,11 @@ import {
mergeWith,
move,
noop,
Rule,
Tree,
strings,
url,
} from '@angular-devkit/schematics';
import { parseName } from './parse-name';
import { validateClassName } from './validation';
import { createDefaultPath } from './workspace';
export interface GenerateFromFilesOptions {
@ -36,18 +37,18 @@ export function generateFromFiles(
extraTemplateValues: Record<string, string | ((v: string) => string)> = {},
): Rule {
return async (host: Tree) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
options.path ??= await createDefaultPath(host, options.project as string);
options.prefix ??= '';
options.flat ??= true;
const parsedPath = parseName(options.path!, options.name);
const parsedPath = parseName(options.path, options.name);
options.name = parsedPath.name;
options.path = parsedPath.path;
validateClassName(strings.classify(options.name));
const templateSource = apply(url('./files'), [
options.skipTests ? filter(path => !path.endsWith('.spec.ts.template')) : noop(),
options.skipTests ? filter((path) => !path.endsWith('.spec.ts.template')) : noop(),
applyTemplates({
...strings,
...options,

7
npm/ng-packs/packages/schematics/src/utils/angular/json-file.ts

@ -27,12 +27,7 @@ export class JSONFile {
content: string;
constructor(private readonly host: Tree, private readonly path: string) {
const buffer = this.host.read(this.path);
if (buffer) {
this.content = buffer.toString();
} else {
throw new Error(`Could not read '${path}'.`);
}
this.content = this.host.readText(this.path);
}
private _jsonAst: Node | undefined;

25
npm/ng-packs/packages/schematics/src/utils/angular/latest-versions/package.json

@ -1,20 +1,23 @@
{
"description": "Package versions used by schematics in @schematics/angular.",
"comment": "This file is needed so that depedencies are synced by Renovate.",
"comment": "This file is needed so that dependencies are synced by Renovate.",
"private": true,
"dependencies": {
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"jasmine-core": "~4.0.0",
"@types/jasmine": "~4.0.0",
"@types/node": "^14.15.0",
"jasmine-core": "~4.3.0",
"jasmine-spec-reporter": "~7.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine-html-reporter": "~1.7.0",
"karma-jasmine": "~4.0.0",
"karma": "~6.3.0",
"ng-packagr": "^13.0.0",
"rxjs": "~6.6.7",
"karma-coverage": "~2.2.0",
"karma-jasmine-html-reporter": "~2.0.0",
"karma-jasmine": "~5.1.0",
"karma": "~6.4.0",
"ng-packagr": "^14.2.0",
"protractor": "~7.0.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"typescript": "~4.6.2",
"ts-node": "~10.9.0",
"typescript": "~4.7.2",
"zone.js": "~0.11.4"
}
}

12
npm/ng-packs/packages/schematics/src/utils/angular/ng-ast-utils.ts

@ -13,11 +13,7 @@ import * as ts from 'typescript';
import { findNode, getSourceNodes } from './ast-utils';
export function findBootstrapModuleCall(host: Tree, mainPath: string): ts.CallExpression | null {
const mainBuffer = host.read(mainPath);
if (!mainBuffer) {
throw new SchematicsException(`Main file (${mainPath}) not found`);
}
const mainText = mainBuffer.toString('utf-8');
const mainText = host.readText(mainPath);
const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
const allNodes = getSourceNodes(source);
@ -58,11 +54,7 @@ export function findBootstrapModulePath(host: Tree, mainPath: string): string {
const bootstrapModule = bootstrapCall.arguments[0];
const mainBuffer = host.read(mainPath);
if (!mainBuffer) {
throw new SchematicsException(`Client application main file (${mainPath}) not found`);
}
const mainText = mainBuffer.toString('utf-8');
const mainText = host.readText(mainPath);
const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
const allNodes = getSourceNodes(source);
const bootstrapModuleRelativePath = allNodes

13
npm/ng-packs/packages/schematics/src/utils/angular/validation.ts

@ -6,16 +6,23 @@
* found in the LICENSE file at https://angular.io/license
*/
import { tags } from '@angular-devkit/core';
import { SchematicsException } from '@angular-devkit/schematics';
// Must start with a letter, and must contain only alphanumeric characters or dashes.
// When adding a dash the segment after the dash must also start with a letter.
export const htmlSelectorRe = /^[a-zA-Z][.0-9a-zA-Z]*(:?-[a-zA-Z][.0-9a-zA-Z]*)*$/;
// See: https://github.com/tc39/proposal-regexp-unicode-property-escapes/blob/fe6d07fad74cd0192d154966baa1e95e7cda78a1/README.md#other-examples
const ecmaIdentifierNameRegExp = /^(?:[$_\p{ID_Start}])(?:[$_\u200C\u200D\p{ID_Continue}])*$/u;
export function validateHtmlSelector(selector: string): void {
if (selector && !htmlSelectorRe.test(selector)) {
throw new SchematicsException(tags.oneLine`Selector (${selector})
is invalid.`);
throw new SchematicsException(`Selector "${selector}" is invalid.`);
}
}
export function validateClassName(className: string): void {
if (!ecmaIdentifierNameRegExp.test(className)) {
throw new SchematicsException(`Class name "${className}" is invalid.`);
}
}

15
npm/ng-packs/packages/schematics/src/utils/angular/workspace-models.ts

@ -11,6 +11,12 @@ export enum ProjectType {
Library = 'library',
}
/**
* An enum of the official Angular builders.
* Each enum value provides the fully qualified name of the associated builder.
* This enum can be used when analyzing the `builder` fields of project configurations from the
* `angular.json` workspace file.
*/
export enum Builders {
AppShell = '@angular-devkit/build-angular:app-shell',
Server = '@angular-devkit/build-angular:server',
@ -129,10 +135,15 @@ export type ServeBuilderTarget = BuilderTarget<Builders.DevServer, ServeBuilderO
export type ExtractI18nBuilderTarget = BuilderTarget<Builders.ExtractI18n, ExtractI18nOptions>;
export type E2EBuilderTarget = BuilderTarget<Builders.Protractor, E2EOptions>;
interface WorkspaceCLISchema {
warnings?: Record<string, boolean>;
schematicCollections?: string[];
defaultCollection?: string;
}
export interface WorkspaceSchema {
version: 1;
defaultProject?: string;
cli?: { warnings?: Record<string, boolean> };
cli?: WorkspaceCLISchema;
projects: {
[key: string]: WorkspaceProject<ProjectType.Application | ProjectType.Library>;
};
@ -148,7 +159,7 @@ export interface WorkspaceProject<TProjectType extends ProjectType = ProjectType
sourceRoot: string;
prefix: string;
cli?: { warnings?: Record<string, boolean> };
cli?: WorkspaceCLISchema;
/**
* Tool options.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save