Skip to content

Commit

Permalink
Use strictTemplates Compiler Option (#100)
Browse files Browse the repository at this point in the history
* feature (Angular compiler): use strictTemplates compiler option

* tests (github-ci): use strictTemplates compiler option on github-ci

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): make separate groups of tests

* tests (github-ci): use central version matrix

* tests (github-ci): use central version matrix

* Revert "tests (github-ci): use central version matrix"

This reverts commit 472f31c.

* Revert "tests (github-ci): use central version matrix"

This reverts commit a3ff022.

* tests (github-ci): set env for e2e

* fix (operations): tell compiler that everything is ok (temp. solution)

* fix (template compilation issues): use $any() to make it compile, fix issues later

* refactor (sort button): remove $any() hack

* refactor (github-ci): try to use "defaults" for version matrix

* refactor (github-ci): try to use "defaults" for version matrix

* Revert "refactor (github-ci): try to use "defaults" for version matrix"

This reverts commit 809a921.

* Revert "refactor (github-ci): try to use "defaults" for version matrix"

This reverts commit 0dc8847.

* refactor (github-ci): try to use "defaults" for version matrix

* Revert "refactor (github-ci): try to use "defaults" for version matrix"

This reverts commit d8f5f7a.

* refactor (github-ci): make e2e required for build job

* refactor (list value comp.): remove $any() hack

* tests (github-ci): use central version matrix

* Revert "tests (github-ci): use central version matrix"

This reverts commit 4d27154.
  • Loading branch information
tobiasschweizer committed Jun 11, 2020
1 parent 9604a57 commit 79741a7
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 26 deletions.
59 changes: 49 additions & 10 deletions .github/workflows/main.yml
Expand Up @@ -20,12 +20,6 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
repository: dasch-swiss/dsp-ci-assets
token: ${{ secrets.ci_assets_pat }} # `GitHub_PAT` is a secret that contains the PAT.
path: ci
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
Expand All @@ -41,16 +35,61 @@ jobs:
env:
TZ: Europe/Zurich
CI: true

build-dev:
name: Build lib in dev mode
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build-lib-dev
- run: npm run build-app


e2e-test:
name: E2E Tests
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
repository: dasch-swiss/dsp-ci-assets
token: ${{ secrets.ci_assets_pat }} # `GitHub_PAT` is a secret that contains the PAT.
path: ci
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build-lib
- run: |
sudo apt-get install expect
make clone-knora-stack
make knora-stack
npm run webdriver-update
npm run e2e
- run: npm run webdriver-update
- run: npm run e2e
env:
TZ: Europe/Zurich
CI: true


publish:
name: Publish to npm / Update release notes
needs: [build-test]
needs: [build-test, e2e-test]
runs-on: ubuntu-latest
env:
dist-directory: ./dist/@dasch-swiss/dsp-ui/
Expand Down
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -63,6 +63,7 @@ clone-knora-stack:

.PHONY: knora-stack
knora-stack: ## runs the knora-stack
sudo apt-get install expect
$(MAKE) -C $(CURRENT_DIR)/.tmp/knora-stack stack-without-api
$(MAKE) -C $(CURRENT_DIR)/.tmp/knora-stack print-env-file
$(MAKE) -C $(CURRENT_DIR)/.tmp/knora-stack stack-config
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -14,6 +14,7 @@
"test-lib": "ng t --watch=false --browsers=ChromeHeadless --project @dasch-swiss/dsp-ui",
"test-lib-local": "ng t --project @dasch-swiss/dsp-ui",
"build-lib": "ng b --prod --project @dasch-swiss/dsp-ui",
"build-lib-dev": "ng b --project @dasch-swiss/dsp-ui",
"yalc-publish-lib": "ng b --prod --project @dasch-swiss/dsp-ui && yalc publish dist/@dasch-swiss/dsp-ui",
"build-app": "ng b --prod",
"lint": "ng lint",
Expand Down
Expand Up @@ -11,21 +11,21 @@ <h4 class="label">
</div>
<div class="value-component">
<span [ngSwitch]="valueTypeOrClass">
<dsp-text-value-as-string class="parent-value-component" #displayVal *ngSwitchCase="'ReadTextValueAsString'" [mode]="mode" [displayValue]="displayValue"></dsp-text-value-as-string>
<dsp-text-value-as-html class="parent-value-component" #displayVal *ngSwitchCase="'ReadTextValueAsHtml'" [mode]="mode" [displayValue]="displayValue"></dsp-text-value-as-html>
<dsp-int-value class="parent-value-component" #displayVal *ngSwitchCase="constants.IntValue" [mode]="mode" [displayValue]="displayValue"></dsp-int-value>
<dsp-boolean-value class="parent-value-component" #displayVal *ngSwitchCase="constants.BooleanValue" [mode]="mode" [displayValue]="displayValue"></dsp-boolean-value>
<dsp-uri-value class="parent-value-component" #displayVal *ngSwitchCase="constants.UriValue" [mode]="mode" [displayValue]="displayValue"></dsp-uri-value>
<dsp-decimal-value class="parent-value-component" #displayVal *ngSwitchCase="constants.DecimalValue" [mode]="mode" [displayValue]="displayValue"></dsp-decimal-value>
<dsp-color-value class="parent-value-component" #displayVal *ngSwitchCase="constants.ColorValue" [mode]="mode" [displayValue]="displayValue"></dsp-color-value>
<dsp-interval-value class="parent-value-component" #displayVal *ngSwitchCase="constants.IntervalValue" [mode]="mode" [displayValue]="displayValue"></dsp-interval-value>
<dsp-time-value class="parent-value-component" #displayVal *ngSwitchCase="constants.TimeValue" [mode]="mode" [displayValue]="displayValue"></dsp-time-value>
<dsp-geoname-value class="parent-value-component" #displayVal *ngSwitchCase="constants.GeonameValue" [mode]="mode" [displayValue]="displayValue"></dsp-geoname-value>
<dsp-link-value class="parent-value-component" #displayVal *ngSwitchCase="constants.LinkValue" [mode]="mode" [displayValue]="displayValue"
<dsp-text-value-as-string class="parent-value-component" #displayVal *ngSwitchCase="'ReadTextValueAsString'" [mode]="mode" [displayValue]="$any(displayValue)"></dsp-text-value-as-string>
<dsp-text-value-as-html class="parent-value-component" #displayVal *ngSwitchCase="'ReadTextValueAsHtml'" [mode]="mode" [displayValue]=$any(displayValue)></dsp-text-value-as-html>
<dsp-int-value class="parent-value-component" #displayVal *ngSwitchCase="constants.IntValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-int-value>
<dsp-boolean-value class="parent-value-component" #displayVal *ngSwitchCase="constants.BooleanValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-boolean-value>
<dsp-uri-value class="parent-value-component" #displayVal *ngSwitchCase="constants.UriValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-uri-value>
<dsp-decimal-value class="parent-value-component" #displayVal *ngSwitchCase="constants.DecimalValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-decimal-value>
<dsp-color-value class="parent-value-component" #displayVal *ngSwitchCase="constants.ColorValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-color-value>
<dsp-interval-value class="parent-value-component" #displayVal *ngSwitchCase="constants.IntervalValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-interval-value>
<dsp-time-value class="parent-value-component" #displayVal *ngSwitchCase="constants.TimeValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-time-value>
<dsp-geoname-value class="parent-value-component" #displayVal *ngSwitchCase="constants.GeonameValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-geoname-value>
<dsp-link-value class="parent-value-component" #displayVal *ngSwitchCase="constants.LinkValue" [mode]="mode" [displayValue]=$any(displayValue)
[parentResource]="parentResource" [propIri]="displayValue.property"></dsp-link-value>
<dsp-date-value class="parent-value-component" #displayVal *ngSwitchCase="constants.DateValue" [mode]="mode" [displayValue]="displayValue"></dsp-date-value>
<dsp-list-value class="parent-value-component" #displayVal *ngSwitchCase="constants.ListValue" [mode]="mode" [displayValue]="displayValue"
[propertyDef]="parentResource.entityInfo.properties[displayValue.property]"></dsp-list-value>
<dsp-date-value class="parent-value-component" #displayVal *ngSwitchCase="constants.DateValue" [mode]="mode" [displayValue]=$any(displayValue)></dsp-date-value>
<dsp-list-value class="parent-value-component" #displayVal *ngSwitchCase="constants.ListValue" [mode]="mode" [displayValue]=$any(displayValue)
[propertyDef]="$any(parentResource.entityInfo.properties[displayValue.property])"></dsp-list-value>
<span *ngSwitchDefault>{{displayValue.strval}}</span>
</span>
</div>
Expand Down
3 changes: 2 additions & 1 deletion projects/dsp-ui/tsconfig.lib.json
Expand Up @@ -16,7 +16,8 @@
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
"enableResourceInlining": true,
"strictTemplates": true
},
"exclude": [
"src/test.ts",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -29,6 +29,7 @@
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
"strictInjectionParameters": true,
"strictTemplates": true
}
}

0 comments on commit 79741a7

Please sign in to comment.