Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Angular wrapper #3267

Closed
wants to merge 42 commits into from
Closed

Conversation

DavideMininni-Fincons
Copy link
Contributor

No description provided.

Copy link
Contributor

@jeripeierSBB jeripeierSBB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stunning work. Only very partial review

package.json Outdated
@@ -71,12 +74,23 @@
"lit": "3.2.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to go to Angular 19 for all angular deps

Suggested change
"@angular-devkit/build-angular": "^18.2.3",
"@angular-devkit/build-angular": "18.2.3",

package.json Outdated
"@commitlint/cli": "19.6.0",
"@commitlint/config-conventional": "19.6.0",
"@custom-elements-manifest/analyzer": "0.10.3",
"@custom-elements-manifest/to-markdown": "0.1.0",
"@eslint/eslintrc": "3.2.0",
"@eslint/eslintrc": "3.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downgrade needed?

package.json Outdated
@@ -125,13 +139,15 @@
"lint-staged": "15.2.10",
"lit-analyzer": "2.0.3",
"madge": "8.0.0",
"npm-run-all2": "7.0.1",
"ng-packagr": "18.2.1",
"npm-run-all2": "7.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downgrade needed?

package.json Outdated
@@ -145,7 +161,8 @@
"typescript-eslint": "8.16.0",
"urlpattern-polyfill": "10.0.0",
"vite": "5.4.11",
"vite-plugin-dts": "4.3.0"
"vite-plugin-dts": "4.3.0",
"zone.js": "~0.14.10"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we try to avoid zone.js at all?

@@ -20,6 +20,8 @@
"@sbb-esta/lyne-elements/*": ["src/elements/*"],
"@sbb-esta/lyne-elements-experimental": ["src/elements-experimental"],
"@sbb-esta/lyne-elements-experimental/*": ["src/elements-experimental/*"],
"@sbb-esta/lyne-angular": ["src/angular"],
"@sbb-esta/lyne-angular/*": ["src/angular/*"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

angular experimental entries needed?

tools/vite/dts.ts Show resolved Hide resolved
@@ -0,0 +1,10 @@
// TODO check if makes sense or they are just duplicated and possibily remove.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to standardize todo / fixmes like TODO:

Suggested change
// TODO check if makes sense or they are just duplicated and possibily remove.
// TODO: check if makes sense or they are just duplicated and can possibily be removed.

Copy link
Contributor

@kyubisation kyubisation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial impression is positive. Amazing work! 😃
I guess to test it, we need to generate the code.

@DavideMininni-Fincons
Copy link
Contributor Author

Initial impression is positive. Amazing work! 😃 I guess to test it, we need to generate the code.

I started yesterday, found some little detail to fix; i'll hope to finish it tomorrow

// FIXME add import from esta core/attribute-transform
if (member.type.getText() === 'boolean') {
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: booleanAttribute }`);

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of }.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to ensure that all occurrences of the substring } are replaced, not just the first one. This can be achieved by using a regular expression with the global flag (g). This change will ensure that the replacement is applied to all instances of the substring within the string.

Specifically, we will modify the input.replace call on line 391 to use a regular expression with the global flag. This change will be made in the file tools/eslint/angular-generator-rule.ts.

Suggested changeset 1
tools/eslint/angular-generator-rule.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tools/eslint/angular-generator-rule.ts b/tools/eslint/angular-generator-rule.ts
--- a/tools/eslint/angular-generator-rule.ts
+++ b/tools/eslint/angular-generator-rule.ts
@@ -390,3 +390,3 @@
                     if (input.includes('alias')) {
-                      input = input.replace(`}`, `, transform: booleanAttribute }`);
+                      input = input.replace(/}/g, `, transform: booleanAttribute }`);
                     } else {
EOF
@@ -390,3 +390,3 @@
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: booleanAttribute }`);
input = input.replace(/}/g, `, transform: booleanAttribute }`);
} else {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
}
} else if (member.type.getText() === 'number') {
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: numberAttribute }`);

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of }.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to ensure that all occurrences of the string to be replaced are handled. This can be achieved by using a regular expression with the global flag (g). Specifically, we will replace the input.replace call with a regular expression to ensure that all instances of the matched string are replaced.

Suggested changeset 1
tools/eslint/angular-generator-rule.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tools/eslint/angular-generator-rule.ts b/tools/eslint/angular-generator-rule.ts
--- a/tools/eslint/angular-generator-rule.ts
+++ b/tools/eslint/angular-generator-rule.ts
@@ -390,3 +390,3 @@
                     if (input.includes('alias')) {
-                      input = input.replace(`}`, `, transform: booleanAttribute }`);
+                      input = input.replace(/}/g, `, transform: booleanAttribute }`);
                     } else {
@@ -396,3 +396,3 @@
                     if (input.includes('alias')) {
-                      input = input.replace(`}`, `, transform: numberAttribute }`);
+                      input = input.replace(/}/g, `, transform: numberAttribute }`);
                     } else {
EOF
@@ -390,3 +390,3 @@
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: booleanAttribute }`);
input = input.replace(/}/g, `, transform: booleanAttribute }`);
} else {
@@ -396,3 +396,3 @@
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: numberAttribute }`);
input = input.replace(/}/g, `, transform: numberAttribute }`);
} else {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
if (paramType) {
if (paramType.getText() === 'boolean') {
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: booleanAttribute }`);

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of }.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to ensure that all occurrences of the string to be replaced are handled. This can be achieved by using a regular expression with the global flag. Specifically, we will replace the input.replace call with a version that uses a regular expression to replace all occurrences of the string.

Suggested changeset 1
tools/eslint/angular-generator-rule.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tools/eslint/angular-generator-rule.ts b/tools/eslint/angular-generator-rule.ts
--- a/tools/eslint/angular-generator-rule.ts
+++ b/tools/eslint/angular-generator-rule.ts
@@ -455,3 +455,3 @@
                       if (input.includes('alias')) {
-                        input = input.replace(`}`, `, transform: booleanAttribute }`);
+                        input = input.replace(/}/g, `, transform: booleanAttribute }`);
                       } else {
@@ -461,3 +461,3 @@
                       if (input.includes('alias')) {
-                        input = input.replace(`}`, `, transform: numberAttribute }`);
+                        input = input.replace(/}/g, `, transform: numberAttribute }`);
                       } else {
EOF
@@ -455,3 +455,3 @@
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: booleanAttribute }`);
input = input.replace(/}/g, `, transform: booleanAttribute }`);
} else {
@@ -461,3 +461,3 @@
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: numberAttribute }`);
input = input.replace(/}/g, `, transform: numberAttribute }`);
} else {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
}
} else if (paramType.getText() === 'number') {
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: numberAttribute }`);

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of }.

Copilot Autofix AI about 1 month ago

To fix the problem, we need to ensure that all occurrences of the string to be replaced are handled. This can be achieved by using a regular expression with the global flag. Specifically, we will replace the input.replace call with a version that uses a regular expression to match all occurrences of the closing curly brace }.

Suggested changeset 1
tools/eslint/angular-generator-rule.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tools/eslint/angular-generator-rule.ts b/tools/eslint/angular-generator-rule.ts
--- a/tools/eslint/angular-generator-rule.ts
+++ b/tools/eslint/angular-generator-rule.ts
@@ -455,3 +455,3 @@
                       if (input.includes('alias')) {
-                        input = input.replace(`}`, `, transform: booleanAttribute }`);
+                        input = input.replace(/}/g, `, transform: booleanAttribute }`);
                       } else {
@@ -461,3 +461,3 @@
                       if (input.includes('alias')) {
-                        input = input.replace(`}`, `, transform: numberAttribute }`);
+                        input = input.replace(/}/g, `, transform: numberAttribute }`);
                       } else {
EOF
@@ -455,3 +455,3 @@
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: booleanAttribute }`);
input = input.replace(/}/g, `, transform: booleanAttribute }`);
} else {
@@ -461,3 +461,3 @@
if (input.includes('alias')) {
input = input.replace(`}`, `, transform: numberAttribute }`);
input = input.replace(/}/g, `, transform: numberAttribute }`);
} else {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@DavideMininni-Fincons DavideMininni-Fincons marked this pull request as ready for review December 9, 2024 16:11
@github-actions github-actions bot added the pr: peer review required A peer review is required for this pull request label Dec 9, 2024
@jeripeierSBB
Copy link
Contributor

@DavideMininni-Fincons Could this PR be closed?

@DavideMininni-Fincons
Copy link
Contributor Author

DavideMininni-Fincons commented Jan 7, 2025

PR closed: this feature will be implemented in sbb-design-systems/lyne-angular#1

@github-actions github-actions bot added pr: peer review required A peer review is required for this pull request and removed pr: peer review required A peer review is required for this pull request labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: peer review required A peer review is required for this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants