From 1313e660b6b5b5802a2a215e2accbd7ee07b4764 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 16 May 2022 09:37:33 +0200 Subject: [PATCH 1/8] fix(js): update and simplify dependencies fixes #566 through simplification of the dependencies (no longer deasync, which was apparently problematic in some cases, i couldn't reproduce) --- src/templates/InstantSearch.js/index.html.hbs | 1 - .../InstantSearch.js/manifest.webmanifest | 15 ----------- src/templates/InstantSearch.js/package.json | 15 ++++------- src/templates/InstantSearch.js/src/app.js.hbs | 25 ++++++++++++++++--- 4 files changed, 27 insertions(+), 29 deletions(-) delete mode 100644 src/templates/InstantSearch.js/manifest.webmanifest diff --git a/src/templates/InstantSearch.js/index.html.hbs b/src/templates/InstantSearch.js/index.html.hbs index 9ca404aab..10bc9cf39 100644 --- a/src/templates/InstantSearch.js/index.html.hbs +++ b/src/templates/InstantSearch.js/index.html.hbs @@ -6,7 +6,6 @@ - diff --git a/src/templates/InstantSearch.js/manifest.webmanifest b/src/templates/InstantSearch.js/manifest.webmanifest deleted file mode 100644 index 20ac76f5c..000000000 --- a/src/templates/InstantSearch.js/manifest.webmanifest +++ /dev/null @@ -1,15 +0,0 @@ -{ - "short_name": "{{name}}", - "name": "{{name}} Sample", - "icons": [ - { - "src": "favicon.png", - "sizes": "64x64 32x32 24x24 16x16", - "type": "image/x-icon" - } - ], - "start_url": "./index.html", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/src/templates/InstantSearch.js/package.json b/src/templates/InstantSearch.js/package.json index c6ec874fa..92161b3bb 100644 --- a/src/templates/InstantSearch.js/package.json +++ b/src/templates/InstantSearch.js/package.json @@ -6,18 +6,13 @@ "scripts": { "start": "parcel index.html --port 3000", "build": "parcel build index.html", - "lint": "eslint .", - "lint:fix": "npm run lint -- --fix" + "lint": "eslint . && prettier --check .", + "lint:fix": "eslint . --fix && prettier --write ." }, "devDependencies": { - "babel-eslint": "10.0.3", - "eslint": "5.7.0", - "eslint-config-algolia": "13.2.3", - "eslint-config-prettier": "3.6.0", - "eslint-plugin-import": "2.19.1", - "eslint-plugin-prettier": "3.1.2", - "parcel-bundler": "1.12.5", - "prettier": "1.19.1" + "eslint": "8.15.0", + "parcel": "2.0.1", + "prettier": "2.6.2" }, "dependencies": { "algoliasearch": "4", diff --git a/src/templates/InstantSearch.js/src/app.js.hbs b/src/templates/InstantSearch.js/src/app.js.hbs index 6e1725b51..3abb8cf21 100644 --- a/src/templates/InstantSearch.js/src/app.js.hbs +++ b/src/templates/InstantSearch.js/src/app.js.hbs @@ -39,14 +39,27 @@ search.addWidgets([ instantsearch.widgets.dynamicWidgets({ container: '#dynamic-widgets', fallbackWidget({ container, attribute }) { - return instantsearch.widgets.refinementList({ + return instantsearch.widgets.panel({ + templates: { + header({ widgetParams: { attribute } }) { + return attribute; + }, + }, + })(instantsearch.widgets.refinementList)({ container, attribute, }); }, widgets: [ {{#each attributesForFaceting}} - container => instantsearch.widgets.refinementList({ + container => + instantsearch.widgets.panel({ + templates: { + header({ widgetParams: { attribute } }) { + return attribute; + }, + }, + })(instantsearch.widgets.refinementList)({ container, attribute: '{{this}}', }), @@ -55,7 +68,13 @@ search.addWidgets([ }), {{else}} {{#each attributesForFaceting}} - instantsearch.widgets.refinementList({ + instantsearch.widgets.panel({ + templates: { + header({ widgetParams: { attribute } }) { + return attribute; + }, + }, + })(instantsearch.widgets.refinementList)({ container: '#{{this}}-list', attribute: '{{this}}', }), From 48667cb277c1f4db19d2b4f7b0c10b1a1739d356 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 16 May 2022 11:57:19 +0200 Subject: [PATCH 2/8] update snapshots --- e2e/__snapshots__/templates.test.js.snap | 48 ++++++++++++------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index ef9733deb..0f686d2aa 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3082,7 +3082,6 @@ exports[`Templates InstantSearch.js File content: index.html 1`] = ` - @@ -3128,24 +3127,6 @@ exports[`Templates InstantSearch.js File content: index.html 1`] = ` " `; -exports[`Templates InstantSearch.js File content: manifest.webmanifest 1`] = ` -"{ - \\"short_name\\": \\"instantsearch.js-app\\", - \\"name\\": \\"instantsearch.js-app Sample\\", - \\"icons\\": [ - { - \\"src\\": \\"favicon.png\\", - \\"sizes\\": \\"64x64 32x32 24x24 16x16\\", - \\"type\\": \\"image/x-icon\\" - } - ], - \\"start_url\\": \\"./index.html\\", - \\"display\\": \\"standalone\\", - \\"theme_color\\": \\"#000000\\", - \\"background_color\\": \\"#ffffff\\" -}" -`; - exports[`Templates InstantSearch.js File content: package.json 1`] = ` "{ \\"name\\": \\"instantsearch.js-app\\", @@ -3155,8 +3136,8 @@ exports[`Templates InstantSearch.js File content: package.json 1`] = ` \\"scripts\\": { \\"start\\": \\"parcel index.html --port 3000\\", \\"build\\": \\"parcel build index.html\\", - \\"lint\\": \\"eslint .\\", - \\"lint:fix\\": \\"npm run lint -- --fix\\" + \\"lint\\": \\"eslint . && prettier --check .\\", + \\"lint:fix\\": \\"eslint . --fix && prettier --write .\\" }, \\"partialDependencies\\": { \\"instantsearch.js\\": \\"3.0.0\\" @@ -3260,19 +3241,37 @@ search.addWidgets([ instantsearch.widgets.dynamicWidgets({ container: '#dynamic-widgets', fallbackWidget({ container, attribute }) { - return instantsearch.widgets.refinementList({ + return instantsearch.widgets.panel({ + templates: { + header({ widgetParams: { attribute } }) { + return attribute; + }, + }, + })(instantsearch.widgets.refinementList)({ container, attribute, }); }, widgets: [ container => - instantsearch.widgets.refinementList({ + instantsearch.widgets.panel({ + templates: { + header({ widgetParams: { attribute } }) { + return attribute; + }, + }, + })(instantsearch.widgets.refinementList)({ container, attribute: 'facet1', }), container => - instantsearch.widgets.refinementList({ + instantsearch.widgets.panel({ + templates: { + header({ widgetParams: { attribute } }) { + return attribute; + }, + }, + })(instantsearch.widgets.refinementList)({ container, attribute: 'facet2', }), @@ -3342,7 +3341,6 @@ Array [ "README.md", "favicon.png", "index.html", - "manifest.webmanifest", "package.json", "src/app.css", "src/app.js", From 33daa3aab8f46f9303cfda5f66bf88005083ba8c Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 16 May 2022 14:27:57 +0200 Subject: [PATCH 3/8] remove wrong entry point --- e2e/__snapshots__/templates.test.js.snap | 1 - src/templates/InstantSearch.js/package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index 0f686d2aa..4f1657c6f 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3132,7 +3132,6 @@ exports[`Templates InstantSearch.js File content: package.json 1`] = ` \\"name\\": \\"instantsearch.js-app\\", \\"version\\": \\"1.0.0\\", \\"private\\": true, - \\"main\\": \\"src/app.js\\", \\"scripts\\": { \\"start\\": \\"parcel index.html --port 3000\\", \\"build\\": \\"parcel build index.html\\", diff --git a/src/templates/InstantSearch.js/package.json b/src/templates/InstantSearch.js/package.json index 92161b3bb..43ab029a1 100644 --- a/src/templates/InstantSearch.js/package.json +++ b/src/templates/InstantSearch.js/package.json @@ -2,7 +2,6 @@ "name": "{{name}}", "version": "1.0.0", "private": true, - "main": "src/app.js", "scripts": { "start": "parcel index.html --port 3000", "build": "parcel build index.html", From 05098f57ac388acadac1b56ddba5f0dd45067347 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 16 May 2022 15:16:13 +0200 Subject: [PATCH 4/8] remove node 10 --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a96a3b4e2..4c4d78e3d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,9 +99,9 @@ jobs: - build_app: template: 'Autocomplete.js 0' app: 'autocomplete.js' - - build_app: - template: 'InstantSearch.js' - app: 'instantsearch.js' + # - build_app: + # template: 'InstantSearch.js' + # app: 'instantsearch.js' - build_app: template: 'JavaScript Client' app: 'javascript-client' From a878016020b09f2ff006a4f26071819a6f2c42de Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Tue, 17 May 2022 11:36:01 +0200 Subject: [PATCH 5/8] undo coolness --- e2e/__snapshots__/templates.test.js.snap | 24 +++---------------- src/templates/InstantSearch.js/src/app.js.hbs | 16 ++----------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index 4f1657c6f..f09786039 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3240,37 +3240,19 @@ search.addWidgets([ instantsearch.widgets.dynamicWidgets({ container: '#dynamic-widgets', fallbackWidget({ container, attribute }) { - return instantsearch.widgets.panel({ - templates: { - header({ widgetParams: { attribute } }) { - return attribute; - }, - }, - })(instantsearch.widgets.refinementList)({ + return instantsearch.widgets.refinementList({ container, attribute, }); }, widgets: [ container => - instantsearch.widgets.panel({ - templates: { - header({ widgetParams: { attribute } }) { - return attribute; - }, - }, - })(instantsearch.widgets.refinementList)({ + instantsearch.widgets.refinementList({ container, attribute: 'facet1', }), container => - instantsearch.widgets.panel({ - templates: { - header({ widgetParams: { attribute } }) { - return attribute; - }, - }, - })(instantsearch.widgets.refinementList)({ + instantsearch.widgets.refinementList({ container, attribute: 'facet2', }), diff --git a/src/templates/InstantSearch.js/src/app.js.hbs b/src/templates/InstantSearch.js/src/app.js.hbs index 3abb8cf21..2cbbb7ebf 100644 --- a/src/templates/InstantSearch.js/src/app.js.hbs +++ b/src/templates/InstantSearch.js/src/app.js.hbs @@ -39,13 +39,7 @@ search.addWidgets([ instantsearch.widgets.dynamicWidgets({ container: '#dynamic-widgets', fallbackWidget({ container, attribute }) { - return instantsearch.widgets.panel({ - templates: { - header({ widgetParams: { attribute } }) { - return attribute; - }, - }, - })(instantsearch.widgets.refinementList)({ + return instantsearch.widgets.refinementList({ container, attribute, }); @@ -53,13 +47,7 @@ search.addWidgets([ widgets: [ {{#each attributesForFaceting}} container => - instantsearch.widgets.panel({ - templates: { - header({ widgetParams: { attribute } }) { - return attribute; - }, - }, - })(instantsearch.widgets.refinementList)({ + instantsearch.widgets.refinementList({ container, attribute: '{{this}}', }), From 3fdd28004e4b65de59c598d44b0f188d61c12797 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Tue, 17 May 2022 14:06:30 +0200 Subject: [PATCH 6/8] panle --- src/templates/InstantSearch.js/src/app.js.hbs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/templates/InstantSearch.js/src/app.js.hbs b/src/templates/InstantSearch.js/src/app.js.hbs index 2cbbb7ebf..1eb6c95e3 100644 --- a/src/templates/InstantSearch.js/src/app.js.hbs +++ b/src/templates/InstantSearch.js/src/app.js.hbs @@ -56,13 +56,7 @@ search.addWidgets([ }), {{else}} {{#each attributesForFaceting}} - instantsearch.widgets.panel({ - templates: { - header({ widgetParams: { attribute } }) { - return attribute; - }, - }, - })(instantsearch.widgets.refinementList)({ + instantsearch.widgets.refinementList({ container: '#{{this}}-list', attribute: '{{this}}', }), From 4327b2f4b84b1eb1732f84c9aab072038df65144 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Tue, 17 May 2022 14:07:25 +0200 Subject: [PATCH 7/8] upd --- e2e/__snapshots__/templates.test.js.snap | 18 ++++++++---------- src/templates/InstantSearch.js/src/app.js.hbs | 3 +-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index f09786039..2a051b38f 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3246,16 +3246,14 @@ search.addWidgets([ }); }, widgets: [ - container => - instantsearch.widgets.refinementList({ - container, - attribute: 'facet1', - }), - container => - instantsearch.widgets.refinementList({ - container, - attribute: 'facet2', - }), + container => instantsearch.widgets.refinementList({ + container, + attribute: 'facet1', + }), + container => instantsearch.widgets.refinementList({ + container, + attribute: 'facet2', + }), ], }), instantsearch.widgets.pagination({ diff --git a/src/templates/InstantSearch.js/src/app.js.hbs b/src/templates/InstantSearch.js/src/app.js.hbs index 1eb6c95e3..6e1725b51 100644 --- a/src/templates/InstantSearch.js/src/app.js.hbs +++ b/src/templates/InstantSearch.js/src/app.js.hbs @@ -46,8 +46,7 @@ search.addWidgets([ }, widgets: [ {{#each attributesForFaceting}} - container => - instantsearch.widgets.refinementList({ + container => instantsearch.widgets.refinementList({ container, attribute: '{{this}}', }), From 4a54441fc091a95b90801c37bdb4d3bffb1accea Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Tue, 17 May 2022 14:07:56 +0200 Subject: [PATCH 8/8] upd --- e2e/__snapshots__/templates.test.js.snap | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index 2a051b38f..f09786039 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -3246,14 +3246,16 @@ search.addWidgets([ }); }, widgets: [ - container => instantsearch.widgets.refinementList({ - container, - attribute: 'facet1', - }), - container => instantsearch.widgets.refinementList({ - container, - attribute: 'facet2', - }), + container => + instantsearch.widgets.refinementList({ + container, + attribute: 'facet1', + }), + container => + instantsearch.widgets.refinementList({ + container, + attribute: 'facet2', + }), ], }), instantsearch.widgets.pagination({