ngx-tethys 17.0.0-next.4 → 17.0.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esm2022/version.mjs +2 -2
  3. package/fesm2022/ngx-tethys.mjs +1 -1
  4. package/fesm2022/ngx-tethys.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/schematics/ng-update/core/complete.d.ts +0 -1
  7. package/schematics/ng-update/core/complete.js +1 -10
  8. package/schematics/ng-update/update-17/class-name-migration.d.ts +12 -0
  9. package/schematics/ng-update/update-17/class-name-migration.js +62 -0
  10. package/schematics/ng-update/update-17/index.js +4 -3
  11. package/schematics/ng-update/update-17/index.spec.js +57 -0
  12. package/schematics/ng-update/update-17/update-data.d.ts +2 -0
  13. package/schematics/ng-update/update-17/update-data.js +804 -0
  14. package/schematics/version.d.ts +1 -1
  15. package/schematics/version.js +1 -1
  16. package/schematics/ng-update/core/html-parsing.d.ts +0 -175
  17. package/schematics/ng-update/core/html-parsing.js +0 -237
  18. package/schematics/ng-update/core/module-specifiers.d.ts +0 -4
  19. package/schematics/ng-update/core/module-specifiers.js +0 -20
  20. package/schematics/ng-update/core/upgrade-data.d.ts +0 -14
  21. package/schematics/ng-update/core/upgrade-data.js +0 -12
  22. package/schematics/ng-update/data/after-insert-element.d.ts +0 -40
  23. package/schematics/ng-update/data/after-insert-element.js +0 -27
  24. package/schematics/ng-update/data/attribute-selectors.d.ts +0 -2
  25. package/schematics/ng-update/data/attribute-selectors.js +0 -53
  26. package/schematics/ng-update/data/before-insert-element.d.ts +0 -40
  27. package/schematics/ng-update/data/before-insert-element.js +0 -27
  28. package/schematics/ng-update/data/class-names.d.ts +0 -2
  29. package/schematics/ng-update/data/class-names.js +0 -837
  30. package/schematics/ng-update/data/constructor-checks.d.ts +0 -2
  31. package/schematics/ng-update/data/constructor-checks.js +0 -4
  32. package/schematics/ng-update/data/css-selectors.d.ts +0 -20
  33. package/schematics/ng-update/data/css-selectors.js +0 -49
  34. package/schematics/ng-update/data/element-selectors.d.ts +0 -2
  35. package/schematics/ng-update/data/element-selectors.js +0 -33
  36. package/schematics/ng-update/data/entry-points.d.ts +0 -18
  37. package/schematics/ng-update/data/entry-points.js +0 -21
  38. package/schematics/ng-update/data/index.d.ts +0 -17
  39. package/schematics/ng-update/data/index.js +0 -53
  40. package/schematics/ng-update/data/input-names-removal.d.ts +0 -33
  41. package/schematics/ng-update/data/input-names-removal.js +0 -43
  42. package/schematics/ng-update/data/input-names.d.ts +0 -2
  43. package/schematics/ng-update/data/input-names.js +0 -69
  44. package/schematics/ng-update/data/input-values.d.ts +0 -40
  45. package/schematics/ng-update/data/input-values.js +0 -132
  46. package/schematics/ng-update/data/method-call-checks.d.ts +0 -2
  47. package/schematics/ng-update/data/method-call-checks.js +0 -4
  48. package/schematics/ng-update/data/output-names-removal.d.ts +0 -33
  49. package/schematics/ng-update/data/output-names-removal.js +0 -19
  50. package/schematics/ng-update/data/output-names.d.ts +0 -2
  51. package/schematics/ng-update/data/output-names.js +0 -4
  52. package/schematics/ng-update/data/property-names.d.ts +0 -2
  53. package/schematics/ng-update/data/property-names.js +0 -4
  54. package/schematics/ng-update/data/symbol-removal.d.ts +0 -11
  55. package/schematics/ng-update/data/symbol-removal.js +0 -4
  56. package/schematics/ng-update/migrations/after-insert-element.d.ts +0 -17
  57. package/schematics/ng-update/migrations/after-insert-element.js +0 -53
  58. package/schematics/ng-update/migrations/before-insert-element.d.ts +0 -17
  59. package/schematics/ng-update/migrations/before-insert-element.js +0 -53
  60. package/schematics/ng-update/migrations/checks/action-menu-removal-rule.d.ts +0 -13
  61. package/schematics/ng-update/migrations/checks/action-menu-removal-rule.js +0 -80
  62. package/schematics/ng-update/migrations/checks/label-removal-rule.d.ts +0 -9
  63. package/schematics/ng-update/migrations/checks/label-removal-rule.js +0 -77
  64. package/schematics/ng-update/migrations/class-names.d.ts +0 -50
  65. package/schematics/ng-update/migrations/class-names.js +0 -105
  66. package/schematics/ng-update/migrations/entry-points.d.ts +0 -17
  67. package/schematics/ng-update/migrations/entry-points.js +0 -69
  68. package/schematics/ng-update/migrations/input-names-removal.d.ts +0 -16
  69. package/schematics/ng-update/migrations/input-names-removal.js +0 -43
  70. package/schematics/ng-update/migrations/input-values.d.ts +0 -16
  71. package/schematics/ng-update/migrations/input-values.js +0 -65
  72. package/schematics/ng-update/migrations/output-names-removal.d.ts +0 -16
  73. package/schematics/ng-update/migrations/output-names-removal.js +0 -43
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ # [17.0.0-next.6](https://github.com/atinc/ngx-tethys/compare/17.0.0-next.5...17.0.0-next.6) (2024-03-07)
6
+
7
+
8
+ ### Features
9
+
10
+ * **schematics:** improve schematics for select and custom-select in template #INFR-11735 ([#3047](https://github.com/atinc/ngx-tethys/issues/3047)) ([acb4f95](https://github.com/atinc/ngx-tethys/commit/acb4f95b05e9fce85b03601f173ea74d7f935039)), closes [#INFR-11735](https://github.com/atinc/ngx-tethys/issues/INFR-11735)
11
+
12
+
13
+
14
+ # [17.0.0-next.5](https://github.com/atinc/ngx-tethys/compare/17.0.0-next.4...17.0.0-next.5) (2024-03-06)
15
+
16
+
17
+ ### Features
18
+
19
+ * **schematics:** provide schematics for renaming standalone components and select module in v17 #INFR-11732 ([#3044](https://github.com/atinc/ngx-tethys/issues/3044)) ([90b300e](https://github.com/atinc/ngx-tethys/commit/90b300e2889084a9e11d38183c23a1a7aea020fd)), closes [#INFR-11732](https://github.com/atinc/ngx-tethys/issues/INFR-11732)
20
+
21
+
22
+
5
23
  # [17.0.0-next.4](https://github.com/atinc/ngx-tethys/compare/17.0.0-next.3...17.0.0-next.4) (2024-03-05)
6
24
 
7
25
 
@@ -1,3 +1,3 @@
1
1
  import { Version } from '@angular/core';
2
- export const VERSION = new Version('17.0.0-next.4');
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFeEMsTUFBTSxDQUFDLE1BQU0sT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLGVBQWUsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgVmVyc2lvbiB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5leHBvcnQgY29uc3QgVkVSU0lPTiA9IG5ldyBWZXJzaW9uKCcxNy4wLjAtbmV4dC40Jyk7XG4iXX0=
2
+ export const VERSION = new Version('17.0.0-next.6');
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFeEMsTUFBTSxDQUFDLE1BQU0sT0FBTyxHQUFHLElBQUksT0FBTyxDQUFDLGVBQWUsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgVmVyc2lvbiB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuXG5leHBvcnQgY29uc3QgVkVSU0lPTiA9IG5ldyBWZXJzaW9uKCcxNy4wLjAtbmV4dC42Jyk7XG4iXX0=
@@ -1,6 +1,6 @@
1
1
  import { Version } from '@angular/core';
2
2
 
3
- const VERSION = new Version('17.0.0-next.4');
3
+ const VERSION = new Version('17.0.0-next.6');
4
4
 
5
5
  /**
6
6
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-tethys.mjs","sources":["../../../src/version.ts","../../../src/ngx-tethys.ts"],"sourcesContent":["import { Version } from '@angular/core';\n\nexport const VERSION = new Version('17.0.0-next.4');\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAEa,OAAO,GAAG,IAAI,OAAO,CAAC,eAAe;;ACFlD;;AAEG;;;;"}
1
+ {"version":3,"file":"ngx-tethys.mjs","sources":["../../../src/version.ts","../../../src/ngx-tethys.ts"],"sourcesContent":["import { Version } from '@angular/core';\n\nexport const VERSION = new Version('17.0.0-next.6');\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAEa,OAAO,GAAG,IAAI,OAAO,CAAC,eAAe;;ACFlD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-tethys",
3
- "version": "17.0.0-next.4",
3
+ "version": "17.0.0-next.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@github.com/atinc/ngx-tethys.git"
@@ -1,4 +1,3 @@
1
1
  import { SchematicContext } from '@angular-devkit/schematics';
2
2
  import { TargetVersion } from '@angular/cdk/schematics';
3
3
  export declare function onMigrationComplete(context: SchematicContext, targetVersion: TargetVersion, hasFailures: boolean): void;
4
- export declare function onV17MigrationComplete(context: SchematicContext, targetVersion: TargetVersion, hasFailures: boolean): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onV17MigrationComplete = exports.onMigrationComplete = void 0;
3
+ exports.onMigrationComplete = void 0;
4
4
  function onMigrationComplete(context, targetVersion, hasFailures) {
5
5
  context.logger.info('');
6
6
  context.logger.info(` ✓ Updated NGX-TETHYS to ${targetVersion}`);
@@ -11,12 +11,3 @@ function onMigrationComplete(context, targetVersion, hasFailures) {
11
11
  }
12
12
  }
13
13
  exports.onMigrationComplete = onMigrationComplete;
14
- function onV17MigrationComplete(context, targetVersion, hasFailures) {
15
- context.logger.info('');
16
- context.logger.info(` ✓ Updated NGX-TETHYS to ${targetVersion}`);
17
- context.logger.info('');
18
- if (hasFailures) {
19
- context.logger.warn(' ⚠ Some issues were detected but could not be fixed automatically. Please check the output above against documentation, fix these issues manually. Especially check the replace input with variable value in template, if it has a corresponding useless variable value, delete it manually. Finally prettier your code please.');
20
- }
21
- }
22
- exports.onV17MigrationComplete = onV17MigrationComplete;
@@ -0,0 +1,12 @@
1
+ import { ClassNameUpgradeData, Migration, UpgradeData } from '@angular/cdk/schematics';
2
+ import * as ts from 'typescript';
3
+ export declare class ClassNamesMigration extends Migration<UpgradeData> {
4
+ data: ClassNameUpgradeData[];
5
+ trustedIdentifiers: Set<string>;
6
+ trustedNamespaces: Set<string>;
7
+ enabled: boolean;
8
+ visitNode(node: ts.Node): void;
9
+ private visitIdentifier;
10
+ private isNgxTethysDeclaration;
11
+ private createFailureWithReplacement;
12
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClassNamesMigration = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const schematics_1 = require("@angular/cdk/schematics");
6
+ const ts = tslib_1.__importStar(require("typescript"));
7
+ class ClassNamesMigration extends schematics_1.Migration {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.data = (0, schematics_1.getVersionUpgradeData)(this, 'classNames');
11
+ this.trustedIdentifiers = new Set();
12
+ this.trustedNamespaces = new Set();
13
+ this.enabled = this.data.length !== 0;
14
+ }
15
+ visitNode(node) {
16
+ if (ts.isIdentifier(node)) {
17
+ this.visitIdentifier(node);
18
+ }
19
+ }
20
+ visitIdentifier(identifier) {
21
+ if (!this.data.some(data => data.replace === identifier.text)) {
22
+ return;
23
+ }
24
+ if ((0, schematics_1.isNamespaceImportNode)(identifier) && this.isNgxTethysDeclaration((0, schematics_1.getImportDeclaration)(identifier))) {
25
+ this.trustedNamespaces.add(identifier.text);
26
+ return this.createFailureWithReplacement(identifier);
27
+ }
28
+ if ((0, schematics_1.isExportSpecifierNode)(identifier) && this.isNgxTethysDeclaration((0, schematics_1.getExportDeclaration)(identifier))) {
29
+ return this.createFailureWithReplacement(identifier);
30
+ }
31
+ if ((0, schematics_1.isImportSpecifierNode)(identifier) && this.isNgxTethysDeclaration((0, schematics_1.getImportDeclaration)(identifier))) {
32
+ this.trustedIdentifiers.add(identifier.text);
33
+ return this.createFailureWithReplacement(identifier);
34
+ }
35
+ if (ts.isPropertyAccessExpression(identifier.parent)) {
36
+ const expression = identifier.parent.expression;
37
+ if (ts.isIdentifier(expression) && this.trustedNamespaces.has(expression.text)) {
38
+ return this.createFailureWithReplacement(identifier);
39
+ }
40
+ }
41
+ else if (this.trustedIdentifiers.has(identifier.text)) {
42
+ return this.createFailureWithReplacement(identifier);
43
+ }
44
+ }
45
+ isNgxTethysDeclaration(declaration) {
46
+ if (!declaration.moduleSpecifier) {
47
+ return false;
48
+ }
49
+ const ngxTethysModuleSpecifier = 'ngx-tethys';
50
+ const moduleSpecifier = declaration.moduleSpecifier.getText();
51
+ return moduleSpecifier.indexOf(ngxTethysModuleSpecifier) !== -1;
52
+ }
53
+ createFailureWithReplacement(identifier) {
54
+ const classData = this.data.find(data => data.replace === identifier.text);
55
+ const filePath = this.fileSystem.resolve(identifier.getSourceFile().fileName);
56
+ this.fileSystem
57
+ .edit(filePath)
58
+ .remove(identifier.getStart(), identifier.getWidth())
59
+ .insertRight(identifier.getStart(), classData.replaceWith);
60
+ }
61
+ }
62
+ exports.ClassNamesMigration = ClassNamesMigration;
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const schematics_1 = require("@angular/cdk/schematics");
4
4
  const complete_1 = require("../core/complete");
5
- const data_1 = require("../data");
6
- const migrations = [];
5
+ const update_data_1 = require("./update-data");
6
+ const class_name_migration_1 = require("./class-name-migration");
7
+ const migrations = [class_name_migration_1.ClassNamesMigration];
7
8
  function main() {
8
- return (0, schematics_1.createMigrationSchematicRule)(schematics_1.TargetVersion.V17, migrations, data_1.ruleUpgradeData, complete_1.onV17MigrationComplete);
9
+ return (0, schematics_1.createMigrationSchematicRule)(schematics_1.TargetVersion.V17, migrations, update_data_1.upgradeData, complete_1.onMigrationComplete);
9
10
  }
10
11
  exports.default = main;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ const schematics_1 = require("@angular-devkit/schematics");
4
5
  const testing_1 = require("@angular-devkit/schematics/testing");
5
6
  const testing_2 = require("../../testing");
6
7
  describe('ng-update v17 Schematic', () => {
@@ -20,4 +21,60 @@ describe('ng-update v17 Schematic', () => {
20
21
  const packageJSON = JSON.parse(file.content.toString());
21
22
  expect(packageJSON['dependencies']['@angular/core']).toContain('^17.');
22
23
  }));
24
+ describe('should provide schematics for v17', () => {
25
+ let tree;
26
+ const schematicRunner = new testing_1.SchematicTestRunner('migrations', require.resolve('../migration-collection.json'));
27
+ const TEST_COMPONENT_PATH = '/projects/update17test/src/app/app.component.ts';
28
+ const TEST_COMPONENT_CONTENT = `
29
+ import { ThyButtonComponent } from 'ngx-tethys/button';
30
+ import { ThyOptionComponent } from 'ngx-tethys/shared';
31
+ import { ThySelectComponent, ThySelectCustomComponent } from 'ngx-tethys/select';
32
+
33
+ @Component({
34
+ selector: 'app-root',
35
+ standalone: true,
36
+ imports: [
37
+ CommonModule,
38
+ FormsModule,
39
+ RouterOutlet,
40
+ ThySelectComponent,
41
+ ThySelectCustomComponent,
42
+ ThyOptionComponent,
43
+ ThyButtonComponent
44
+ ],
45
+ templateUrl: './app.component.html',
46
+ styleUrls: ['./app.component.scss'],
47
+ })
48
+ export class AppComponent {}
49
+ `;
50
+ let workspaceTree;
51
+ beforeEach(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
52
+ const hostTree = new schematics_1.HostTree();
53
+ tree = yield schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', {
54
+ name: 'test-workspace',
55
+ version: '17.0.0',
56
+ newProjectRoot: 'projects'
57
+ }, hostTree);
58
+ yield schematicRunner.runExternalSchematic('@schematics/angular', 'application', { name: 'update17test' }, tree);
59
+ tree.overwrite(TEST_COMPONENT_PATH, TEST_COMPONENT_CONTENT);
60
+ workspaceTree = yield schematicRunner.runSchematic('migration-v17', {}, tree);
61
+ }));
62
+ it('should remove the Component suffix from standalone components', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
63
+ const result = workspaceTree.read(TEST_COMPONENT_PATH).toString();
64
+ expect(result).not.toContain(`ThyOptionComponent`);
65
+ expect(result).toContain('ThyOption');
66
+ expect(result).not.toContain(`ThyButtonComponent`);
67
+ expect(result).toContain('ThyButton');
68
+ }));
69
+ it('should rename ThySelectCustomComponent to ThySelect', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
70
+ const result = workspaceTree.read(TEST_COMPONENT_PATH).toString();
71
+ expect(result).not.toContain('ThySelectComponent');
72
+ expect(result).toContain('ThyNativeSelect');
73
+ }));
74
+ it('should rename ThySelectComponent to ThyNativeSelect', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
75
+ const result = workspaceTree.read(TEST_COMPONENT_PATH).toString();
76
+ expect(result).not.toContain(`ThySelectCustomComponent`);
77
+ expect(result).toContain('ThySelect');
78
+ }));
79
+ });
23
80
  });
@@ -0,0 +1,2 @@
1
+ import { UpgradeData } from '@angular/cdk/schematics';
2
+ export declare const upgradeData: UpgradeData;