diff --git a/e2e/__image_snapshots__/vue-instantsearch-2.x/public/favicon.png-snap.png b/e2e/__image_snapshots__/vue-instantsearch-2.x/public/favicon.png-snap.png new file mode 100644 index 000000000..f1db2815c Binary files /dev/null and b/e2e/__image_snapshots__/vue-instantsearch-2.x/public/favicon.png-snap.png differ diff --git a/e2e/__snapshots__/templates.test.js.snap b/e2e/__snapshots__/templates.test.js.snap index b28b9c835..35198bbc5 100644 --- a/e2e/__snapshots__/templates.test.js.snap +++ b/e2e/__snapshots__/templates.test.js.snap @@ -5199,6 +5199,308 @@ Array [ ] `; +exports[`Templates Vue InstantSearch 2 File content: .editorconfig 1`] = ` +"root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true" +`; + +exports[`Templates Vue InstantSearch 2 File content: .eslintrc.js 1`] = ` +"module.exports = { + // extends from 'prettier/vue' until we update the Algolia configuration + extends: ['algolia/vue', 'prettier/vue'], + rules: { + 'import/no-commonjs': 'off', + // enable the rule until we update the Algolia configuration + 'vue/component-name-in-template-casing': ['error', 'kebab-case'], + }, +};" +`; + +exports[`Templates Vue InstantSearch 2 File content: .gitignore 1`] = ` +".DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw?" +`; + +exports[`Templates Vue InstantSearch 2 File content: .prettierrc 1`] = ` +"{ + \\"singleQuote\\": true, + \\"proseWrap\\": \\"never\\", + \\"trailingComma\\": \\"es5\\" +}" +`; + +exports[`Templates Vue InstantSearch 2 File content: README.md 1`] = ` +"# vue-instantsearch-app + +_This project was generated with [create-instantsearch-app](https://github.com/algolia/create-instantsearch-app) by [Algolia](https://algolia.com)._ + +## Get started + +To run this project locally, install the dependencies and run the local server: + +\`\`\`sh +npm install +npm start +\`\`\` + +Alternatively, you may use [Yarn](https://http://yarnpkg.com/): + +\`\`\`sh +yarn +yarn start +\`\`\` + +Open http://localhost:3000 to see your app." +`; + +exports[`Templates Vue InstantSearch 2 File content: babel.config.js 1`] = ` +"module.exports = { + presets: ['@vue/app'], +};" +`; + +exports[`Templates Vue InstantSearch 2 File content: package.json 1`] = ` +"{ + \\"name\\": \\"vue-instantsearch-app\\", + \\"version\\": \\"1.0.0\\", + \\"private\\": true, + \\"scripts\\": { + \\"start\\": \\"vue-cli-service serve --port 3000\\", + \\"build\\": \\"vue-cli-service build\\", + \\"lint\\": \\"vue-cli-service lint\\", + \\"lint:fix\\": \\"npm run lint -- --fix\\" + }, + \\"browserslist\\": [ + \\"> 1%\\", + \\"last 2 versions\\", + \\"not ie <= 8\\" + ], + \\"partialDependencies\\": { + \\"vue-instantsearch\\": \\"2.0.0\\" + } +}" +`; + +exports[`Templates Vue InstantSearch 2 File content: public/index.html 1`] = ` +" + + + + + + favicon.png\\"> + + + vue-instantsearch-app + + + +
+ + +" +`; + +exports[`Templates Vue InstantSearch 2 File content: src/App.vue 1`] = ` +" + + + +" +`; + +exports[`Templates Vue InstantSearch 2 File content: src/main.js 1`] = ` +"import Vue from 'vue'; +import InstantSearch from 'vue-instantsearch'; +import App from './App.vue'; + +Vue.config.productionTip = false; + +Vue.use(InstantSearch); + +new Vue({ + render: h => h(App), +}).$mount('#app');" +`; + +exports[`Templates Vue InstantSearch 2 Folder structure: contains the right files 1`] = ` +Array [ + ".editorconfig", + ".eslintrc.js", + ".gitignore", + ".prettierrc", + "README.md", + "babel.config.js", + "package.json", + "public/favicon.png", + "public/index.html", + "src/App.vue", + "src/main.js", +] +`; + exports[`Templates Vue InstantSearch File content: .editorconfig 1`] = ` "root = true @@ -5302,7 +5604,7 @@ exports[`Templates Vue InstantSearch File content: package.json 1`] = ` \\"not ie <= 8\\" ], \\"partialDependencies\\": { - \\"vue-instantsearch\\": \\"2.0.0\\" + \\"vue-instantsearch\\": \\"3.0.0\\" } }" `; diff --git a/src/api/__tests__/__snapshots__/index.test.js.snap b/src/api/__tests__/__snapshots__/index.test.js.snap index 1bcaa5ec7..1c0d0297a 100644 --- a/src/api/__tests__/__snapshots__/index.test.js.snap +++ b/src/api/__tests__/__snapshots__/index.test.js.snap @@ -6,10 +6,10 @@ exports[`Options with invalid name throws 1`] = ` - name can only contain URL-friendly characters" `; -exports[`Options with unknown template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, InstantSearch.js 2, JavaScript Client, JavaScript Helper, JavaScript Helper 2, React InstantSearch, React InstantSearch Native, Vue InstantSearch, Vue InstantSearch 1"`; +exports[`Options with unknown template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, InstantSearch.js 2, JavaScript Client, JavaScript Helper, JavaScript Helper 2, React InstantSearch, React InstantSearch Native, Vue InstantSearch, Vue InstantSearch 1, Vue InstantSearch 2"`; -exports[`Options with wrong template path throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, InstantSearch.js 2, JavaScript Client, JavaScript Helper, JavaScript Helper 2, React InstantSearch, React InstantSearch Native, Vue InstantSearch, Vue InstantSearch 1"`; +exports[`Options with wrong template path throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, InstantSearch.js 2, JavaScript Client, JavaScript Helper, JavaScript Helper 2, React InstantSearch, React InstantSearch Native, Vue InstantSearch, Vue InstantSearch 1, Vue InstantSearch 2"`; exports[`Options without path throws 1`] = `"The option \`path\` is required."`; -exports[`Options without template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, InstantSearch.js 2, JavaScript Client, JavaScript Helper, JavaScript Helper 2, React InstantSearch, React InstantSearch Native, Vue InstantSearch, Vue InstantSearch 1"`; +exports[`Options without template throws 1`] = `"The template directory must contain a configuration file \`.template.js\` or must be one of those: Angular InstantSearch, Autocomplete.js, InstantSearch Android, InstantSearch iOS, InstantSearch.js, InstantSearch.js 2, JavaScript Client, JavaScript Helper, JavaScript Helper 2, React InstantSearch, React InstantSearch Native, Vue InstantSearch, Vue InstantSearch 1, Vue InstantSearch 2"`; diff --git a/src/templates/Vue InstantSearch 2/.editorconfig b/src/templates/Vue InstantSearch 2/.editorconfig new file mode 100644 index 000000000..9d08a1a82 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/src/templates/Vue InstantSearch 2/.eslintrc.js b/src/templates/Vue InstantSearch 2/.eslintrc.js new file mode 100644 index 000000000..1b63c5ea4 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/.eslintrc.js @@ -0,0 +1,9 @@ +module.exports = { + // extends from 'prettier/vue' until we update the Algolia configuration + extends: ['algolia/vue', 'prettier/vue'], + rules: { + 'import/no-commonjs': 'off', + // enable the rule until we update the Algolia configuration + 'vue/component-name-in-template-casing': ['error', 'kebab-case'], + }, +}; diff --git a/src/templates/Vue InstantSearch 2/.gitignore.template b/src/templates/Vue InstantSearch 2/.gitignore.template new file mode 100644 index 000000000..a0dddc6fb --- /dev/null +++ b/src/templates/Vue InstantSearch 2/.gitignore.template @@ -0,0 +1,21 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/src/templates/Vue InstantSearch 2/.prettierrc b/src/templates/Vue InstantSearch 2/.prettierrc new file mode 100644 index 000000000..833f03b62 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/.prettierrc @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "proseWrap": "never", + "trailingComma": "es5" +} diff --git a/src/templates/Vue InstantSearch 2/.template.js b/src/templates/Vue InstantSearch 2/.template.js new file mode 100644 index 000000000..1f4cfa053 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/.template.js @@ -0,0 +1,15 @@ +const install = require('../../tasks/node/install'); +const teardown = require('../../tasks/node/teardown'); + +module.exports = { + category: 'Web', + libraryName: 'vue-instantsearch', + templateName: 'vue-instantsearch-2.x', + supportedVersion: '>= 2.0.0 < 3.0.0', + appName: 'vue-instantsearch-app', + keywords: ['algolia', 'InstantSearch', 'Vue', 'vue-instantsearch'], + tasks: { + install, + teardown, + }, +}; diff --git a/src/templates/Vue InstantSearch 2/README.md b/src/templates/Vue InstantSearch 2/README.md new file mode 100644 index 000000000..f330c8c3e --- /dev/null +++ b/src/templates/Vue InstantSearch 2/README.md @@ -0,0 +1,21 @@ +# {{name}} + +_This project was generated with [create-instantsearch-app](https://github.com/algolia/create-instantsearch-app) by [Algolia](https://algolia.com)._ + +## Get started + +To run this project locally, install the dependencies and run the local server: + +```sh +npm install +npm start +``` + +Alternatively, you may use [Yarn](https://http://yarnpkg.com/): + +```sh +yarn +yarn start +``` + +Open http://localhost:3000 to see your app. diff --git a/src/templates/Vue InstantSearch 2/babel.config.js b/src/templates/Vue InstantSearch 2/babel.config.js new file mode 100644 index 000000000..4f45f32b5 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ['@vue/app'], +}; diff --git a/src/templates/Vue InstantSearch 2/package.json b/src/templates/Vue InstantSearch 2/package.json new file mode 100644 index 000000000..9a43fb875 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/package.json @@ -0,0 +1,36 @@ +{ + "name": "{{name}}", + "version": "1.0.0", + "private": true, + "scripts": { + "start": "vue-cli-service serve --port 3000", + "build": "vue-cli-service build", + "lint": "vue-cli-service lint", + "lint:fix": "npm run lint -- --fix" + }, + "dependencies": { + "algoliasearch": "3.32.0", + "core-js": "2.6.9", + "vue": "2.6.10", + "vue-instantsearch": "{{libraryVersion}}" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "3.6.0", + "@vue/cli-plugin-eslint": "3.6.0", + "@vue/cli-service": "3.6.0", + "babel-eslint": "10.0.2", + "eslint": "5.16.0", + "eslint-config-algolia": "13.2.3", + "eslint-config-prettier": "4.1.0", + "eslint-plugin-import": "2.19.1", + "eslint-plugin-prettier": "3.1.2", + "eslint-plugin-vue": "5.2.2", + "prettier": "1.19.1", + "vue-template-compiler": "2.6.10" + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 8" + ] +} diff --git a/src/templates/Vue InstantSearch 2/public/favicon.png b/src/templates/Vue InstantSearch 2/public/favicon.png new file mode 100644 index 000000000..f1db2815c Binary files /dev/null and b/src/templates/Vue InstantSearch 2/public/favicon.png differ diff --git a/src/templates/Vue InstantSearch 2/public/index.html b/src/templates/Vue InstantSearch 2/public/index.html new file mode 100644 index 000000000..ec6630c54 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/public/index.html @@ -0,0 +1,22 @@ + + + + + + + + + + {{name}} + + + +
+ + + diff --git a/src/templates/Vue InstantSearch 2/src/App.vue b/src/templates/Vue InstantSearch 2/src/App.vue new file mode 100644 index 000000000..51af51100 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/src/App.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/src/templates/Vue InstantSearch 2/src/main.js b/src/templates/Vue InstantSearch 2/src/main.js new file mode 100644 index 000000000..d395c9de9 --- /dev/null +++ b/src/templates/Vue InstantSearch 2/src/main.js @@ -0,0 +1,11 @@ +import Vue from 'vue'; +import InstantSearch from 'vue-instantsearch'; +import App from './App.vue'; + +Vue.config.productionTip = false; + +Vue.use(InstantSearch); + +new Vue({ + render: h => h(App), +}).$mount('#app'); diff --git a/src/templates/Vue InstantSearch/.template.js b/src/templates/Vue InstantSearch/.template.js index 0aa014f3b..3a9bd6ed8 100644 --- a/src/templates/Vue InstantSearch/.template.js +++ b/src/templates/Vue InstantSearch/.template.js @@ -5,7 +5,7 @@ module.exports = { category: 'Web', libraryName: 'vue-instantsearch', templateName: 'vue-instantsearch', - supportedVersion: '>= 2.0.0 < 3.0.0', + supportedVersion: '>= 3.0.0 < 4.0.0', appName: 'vue-instantsearch-app', keywords: ['algolia', 'InstantSearch', 'Vue', 'vue-instantsearch'], tasks: { diff --git a/src/templates/Vue InstantSearch/package.json b/src/templates/Vue InstantSearch/package.json index 9a43fb875..371e4abf0 100644 --- a/src/templates/Vue InstantSearch/package.json +++ b/src/templates/Vue InstantSearch/package.json @@ -9,7 +9,7 @@ "lint:fix": "npm run lint -- --fix" }, "dependencies": { - "algoliasearch": "3.32.0", + "algoliasearch": "4.6.0", "core-js": "2.6.9", "vue": "2.6.10", "vue-instantsearch": "{{libraryVersion}}"