Skip to content

Commit

Permalink
fix(angular): set proper dest property for accessor copy (#543)
Browse files Browse the repository at this point in the history
* fix(angular): set proper dest property for accessor copy

* remove angular directives to verify same generation

* add missing dependency

* bring back radio accessor

* set prettierignore for Angular project

* prettier ignore generated files

* set gitattributes

* upgrade prettier

* fix test

* use vitest for unit test

* use inline snapshot matcher
  • Loading branch information
christian-bromann authored Nov 7, 2024
1 parent 528ba3a commit e9c6056
Show file tree
Hide file tree
Showing 31 changed files with 2,912 additions and 5,616 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
11 changes: 11 additions & 0 deletions .github/workflows/actions/check-git-context/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Check Git Context'
description: 'checks for a dirty git context, failing if the context is dirty'
runs:
using: composite
steps:
- name: Git status check
# here we check that there are no changed / new files.
# we use `git status`, grep out the build zip used throughout CI,
# and check if there are more than 0 lines in the output.
run: if [[ $(git status --short | grep -c -v stencil-core-build.zip) -ne 0 ]]; then STATUS=$(git status --verbose); printf "%s" "$STATUS"; git diff | cat; exit 1; fi
shell: bash
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:

- name: Test
run: pnpm test

- name: Check Git Context
uses: ./.github/workflows/actions/check-git-context
format:
name: Format
uses: ./.github/workflows/format.yml
2 changes: 2 additions & 0 deletions example-project/component-library-angular/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# autogenerated files from stencil
src/directives/*.ts
3 changes: 2 additions & 1 deletion example-project/component-library-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
"build.ng": "pnpm run build.es2015 && pnpm run build.es5",
"build.es2015": "ngc -p tsconfig.json && rollup --config ./scripts/rollup.config.mjs",
"build.es5": "ngc -p tsconfig.legacy.json && rollup --config ./scripts/rollup.config.legacy.mjs",
"clean": "rimraf dist build src/directives",
"lint": "echo \"lint not configured\" && exit 0",
"prerelease": "pnpm run validate && np prerelease --yolo --any-branch --tag next",
"prettier": "pnpm run prettier.base --write",
"prettier.base": "prettier \"./({scripts,src,__tests__}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\"",
"prettier.base": "prettier \"./({scripts,src,__tests__,!src/directives}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\" --ignore-path=\"./.prettierignore\"",
"prettier.dry-run": "pnpm run prettier.base --list-different",
"test": "jest",
"tsc": "tsc -p .",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { ValueAccessor } from './value-accessor';
/* tslint:disable-next-line:directive-selector */
selector: 'my-checkbox',
host: {
'(myChange)': 'handleChangeEvent($event.target.checked)',
'(myChange)': 'handleChangeEvent($event.target.checked)'
},
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: BooleanValueAccessor,
multi: true,
},
],
multi: true
}
]
})
export class BooleanValueAccessor extends ValueAccessor {
constructor(el: ElementRef) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import { ValueAccessor } from './value-accessor';
/* tslint:disable-next-line:directive-selector */
selector: 'my-input[type=number]',
host: {
'(myChange)': 'handleChangeEvent($event.target.value)',
'(myChange)': 'handleChangeEvent($event.target.value)'
},
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: NumericValueAccessor,
multi: true,
},
],
multi: true
}
]
})
export class NumericValueAccessor extends ValueAccessor {
constructor(el: ElementRef) {
super(el);
}
override registerOnChange(fn: (_: number | null) => void) {
super.registerOnChange((value) => {
super.registerOnChange(value => {
fn(value === '' ? null : parseFloat(value));
});
}
Expand Down
Loading

0 comments on commit e9c6056

Please sign in to comment.