Skip to content

Commit

Permalink
feat(package): add Angular 16 support
Browse files Browse the repository at this point in the history
closes #288

BREAKING CHANGE:
- Angular v15 is no longer supported with this version. Pin `ng-recaptcha` to `v11.x.x` to retain support for a previous Angular version
  • Loading branch information
Ashley Medway authored and DethAriel committed May 24, 2023
1 parent e41e89a commit 77a7d1f
Show file tree
Hide file tree
Showing 10 changed files with 4,404 additions and 4,144 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
18
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Besides specifying these options on the component itself, you can provide a glob

| `ng-recaptcha` version | Supported Angular versions |
| -------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `12.x.x` | `16.x.x` |
| `11.x.x` | `15.x.x` |
| `10.x.x` | `14.x.x` |
| `9.x.x` | `13.x.x` |
Expand Down
20 changes: 20 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
"headless": true,
"browser": "electron",
"configFile": "projects/demo/cypress/cypress.config.ts"
},
"configurations": {
"production": {
"devServerTarget": "demo:serve:production"
}
}
},
"cypress-open": {
Expand All @@ -123,6 +128,21 @@
"browser": "electron",
"configFile": "projects/demo/cypress/cypress.config.ts"
}
},
"e2e": {
"builder": "@cypress/schematic:cypress",
"options": {
"devServerTarget": "demo:serve",
"watch": false,
"headless": true,
"browser": "electron",
"configFile": "projects/demo/cypress/cypress.config.ts"
},
"configurations": {
"production": {
"devServerTarget": "demo:serve:production"
}
}
}
}
}
Expand Down
46 changes: 24 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"preversion": "yarn version:lib && yarn lib:build",
"version": "yarn changelog && git add CHANGELOG.md",
"lint": "eslint projects --ext .js,.ts,.html",
"prepare": "husky install"
"prepare": "husky install",
"e2e": "ng e2e"
},
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
Expand All @@ -27,24 +28,24 @@
},
"peerDependencies": {},
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.0",
"@angular-eslint/builder": "15.0.0",
"@angular-eslint/eslint-plugin": "15.0.0",
"@angular-eslint/eslint-plugin-template": "15.0.0",
"@angular-eslint/schematics": "15.0.0",
"@angular-eslint/template-parser": "15.0.0",
"@angular/animations": "^15.0.0",
"@angular/cdk": "^15.0.1",
"@angular/cli": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/compiler-cli": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/forms": "^15.0.0",
"@angular/material": "^15.0.1",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"@angular-devkit/build-angular": "^16.0.0",
"@angular-eslint/builder": "16.0.0",
"@angular-eslint/eslint-plugin": "16.0.0",
"@angular-eslint/eslint-plugin-template": "16.0.0",
"@angular-eslint/schematics": "16.0.0",
"@angular-eslint/template-parser": "16.0.0",
"@angular/animations": "^16.0.0",
"@angular/cdk": "^16.0.0",
"@angular/cli": "^16.0.0",
"@angular/common": "^16.0.0",
"@angular/compiler": "^16.0.0",
"@angular/compiler-cli": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/forms": "^16.0.0",
"@angular/material": "^16.0.0",
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "^16.0.0",
"@cypress/schematic": "2.4.0",
"@types/core-js": "^2.5.4",
"@types/jasmine": "^3.8.1",
Expand All @@ -56,6 +57,7 @@
"coveralls": "^3.1.1",
"cypress": "^11.2.0",
"eslint": "^8.28.0",
"eslint-utils": "^3.0.0",
"eslint-config-prettier": "^8.3.0",
"highlight.js": "^11.1.0",
"http-server": "^0.12.3",
Expand All @@ -68,13 +70,13 @@
"karma-jasmine": "^4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"lint-staged": "^11.0.1",
"ng-packagr": "^15.0.0",
"ng-packagr": "^16.0.0",
"prettier": "^2.3.2",
"rimraf": "^3.0.2",
"rxjs": "^6.5.3",
"ts-node": "^10.8.1",
"typescript": "^4.8.4",
"typescript": "^4.9.3",
"typescript-eslint": "^0.0.1-alpha.0",
"zone.js": "~0.11.4"
"zone.js": "~0.13.0"
}
}
2 changes: 1 addition & 1 deletion projects/ng-recaptcha/README.md
2 changes: 1 addition & 1 deletion projects/ng-recaptcha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"ng-recaptcha"
],
"peerDependencies": {
"@angular/core": "^15.0.0"
"@angular/core": "^16.0.0"
},
"dependencies": {
"@types/grecaptcha": "^3.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe("RecaptchaLoaderService", () => {
const mockGrecaptchaValue = new MockGrecaptcha();

// Act
const callArgs = loadScriptStub.calls.mostRecent().args as Parameters<typeof loader["loadScript"]>;
const callArgs = loadScriptStub.calls.mostRecent().args as Parameters<(typeof loader)["loadScript"]>;
callArgs[1](mockGrecaptchaValue);

// Assert
Expand Down
2 changes: 1 addition & 1 deletion projects/ng-recaptcha/src/lib/recaptcha-v3.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("ReCaptchaV3Service", () => {

function onGrecaptchaLoad(grecaptcha: MockGrecaptcha) {
expect(loadScriptStub).toHaveBeenCalled();
const loadArgs = loadScriptStub.calls.mostRecent().args as Parameters<typeof loader["loadScript"]>;
const loadArgs = loadScriptStub.calls.mostRecent().args as Parameters<(typeof loader)["loadScript"]>;
loadArgs[1](grecaptcha);
}

Expand Down
2 changes: 1 addition & 1 deletion projects/ng-recaptcha/src/lib/recaptcha.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class RecaptchaComponent implements AfterViewInit, OnDestroy {
}

if (this.widget != null) {
this.grecaptcha.execute(this.widget);
void this.grecaptcha.execute(this.widget);
} else {
// delay execution of recaptcha until it actually renders
this.executeRequested = true;
Expand Down
Loading

0 comments on commit 77a7d1f

Please sign in to comment.