From 3f7c8a7a378ab802e58016afe98ebe128d5bbf3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Mon, 9 Jul 2018 17:19:45 +0200 Subject: [PATCH 1/3] feat(templates): Use `searchClient` in Angular --- src/templates/Angular InstantSearch/package.json | 1 + src/templates/Angular InstantSearch/src/app/app.component.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/templates/Angular InstantSearch/package.json b/src/templates/Angular InstantSearch/package.json index 3cfc7947f..fed24afc4 100644 --- a/src/templates/Angular InstantSearch/package.json +++ b/src/templates/Angular InstantSearch/package.json @@ -20,6 +20,7 @@ "@angular/platform-browser": "6.0.7", "@angular/platform-browser-dynamic": "6.0.7", "@angular/router": "6.0.7", + "algoliasearch": "3.29.0", "angular-instantsearch": "{{libraryVersion}}", "core-js": "2.5.7", "rxjs": "6.2.1", diff --git a/src/templates/Angular InstantSearch/src/app/app.component.ts b/src/templates/Angular InstantSearch/src/app/app.component.ts index 32ee0bfa7..3e6c6bead 100644 --- a/src/templates/Angular InstantSearch/src/app/app.component.ts +++ b/src/templates/Angular InstantSearch/src/app/app.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import * as algoliasearch from "algoliasearch"; @Component({ selector: 'app-root', @@ -7,8 +8,7 @@ import { Component } from '@angular/core'; }) export class AppComponent { config = { - appId: '{{appId}}', - apiKey: '{{apiKey}}', indexName: '{{indexName}}', + searchClient: algoliasearch('{{appId}}', '{{apiKey}}'), }; } From 0a6babd548a5165fd78d5a3f2298d74057cc1828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Mon, 9 Jul 2018 17:20:05 +0200 Subject: [PATCH 2/3] feat(templates): Downgrade TypeScript This version was not compatible with Angular. --- src/templates/Angular InstantSearch/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/Angular InstantSearch/package.json b/src/templates/Angular InstantSearch/package.json index fed24afc4..d2f73cf79 100644 --- a/src/templates/Angular InstantSearch/package.json +++ b/src/templates/Angular InstantSearch/package.json @@ -29,7 +29,7 @@ "devDependencies": { "@angular/compiler-cli": "6.0.7", "@angular-devkit/build-angular": "0.6.8", - "typescript": "2.9.2", + "typescript": "2.7.2", "@angular/cli": "6.0.8", "@angular/language-service": "6.0.7", "@types/jasmine": "2.8.8", From 78ec23ed6ac4227067fdd9ef502c642f44b155f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Mon, 9 Jul 2018 17:22:51 +0200 Subject: [PATCH 3/3] test(snapshots): Update Angular snapshots --- scripts/__snapshots__/e2e-templates.test.js.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__snapshots__/e2e-templates.test.js.snap b/scripts/__snapshots__/e2e-templates.test.js.snap index c2722694e..5f7a7be70 100644 --- a/scripts/__snapshots__/e2e-templates.test.js.snap +++ b/scripts/__snapshots__/e2e-templates.test.js.snap @@ -378,6 +378,7 @@ describe('AppComponent', () => { exports[`Templates Angular InstantSearch File content: src/app/app.component.ts 1`] = ` "import { Component } from '@angular/core'; +import * as algoliasearch from \\"algoliasearch\\"; @Component({ selector: 'app-root', @@ -386,9 +387,8 @@ exports[`Templates Angular InstantSearch File content: src/app/app.component.ts }) export class AppComponent { config = { - appId: 'appId', - apiKey: 'apiKey', indexName: 'indexName', + searchClient: algoliasearch('appId', 'apiKey'), }; }" `;