Skip to content

Commit

Permalink
Merge pull request #175 from hubblecommerce/rc2.7
Browse files Browse the repository at this point in the history
Release Candidate 2.7
  • Loading branch information
dm-heinze authored Jun 27, 2024
2 parents 703953d + 7709f83 commit cad4747
Show file tree
Hide file tree
Showing 8 changed files with 13,774 additions and 12,739 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
node_modules
__tests__
40 changes: 0 additions & 40 deletions __tests__/module/fixture/components/misc/MiscError.vue

This file was deleted.

17 changes: 17 additions & 0 deletions __tests__/module/fixture/error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<div>
<div>Override Custom Error Page</div>
<h2>{{ error?.statusCode }}</h2>
<button @click="handleError">Clear errors</button>
</div>
</template>

<script setup lang="ts">
import type { NuxtError } from '#app'
const props = defineProps({
error: Object as () => NuxtError
})
const handleError = () => clearError({ redirect: '/' })
</script>
2 changes: 1 addition & 1 deletion cypress/e2e/module.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('TailwindCSS and DaisyUI integration', () => {
.should('equal', 'rgb(0, 0, 0)')
})

it('is possible to override MiscError.vue to create a custom error page', () => {
it('is possible to override ~/error.vue to create a custom error page', () => {
cy.request({ url: '/this-route-not-exists', failOnStatusCode: false }).its('status').should('equal', 404)
cy.visit('/this-route-not-exists', { failOnStatusCode: false })
cy.get('html').contains('Override Custom Error Page')
Expand Down
26,393 changes: 13,741 additions & 12,652 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hubblecommerce/hubble",
"version": "2.6.0",
"version": "2.7.0",
"description": "PWA for eCommerce frameworks based on NuxtJs",
"author": "hubble commerce",
"license": "MIT",
Expand Down Expand Up @@ -84,16 +84,18 @@
},
"devDependencies": {
"@faker-js/faker": "^8.0.2",
"@nuxt/module-builder": "^0.5.5",
"@nuxt/module-builder": "^0.8.0",
"@nuxt/schema": "^3.2.3",
"@nuxt/test-utils": "^3.5.3",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"cypress": "^13.6.2",
"eslint": "^8.44.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-vue": "^9.9.0",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"nuxt": "^3.11.2",
"nuxt": "^3.12.2",
"openapi-typescript-codegen": "^0.26.0",
"rollup-plugin-copy": "^3.4.0",
"start-server-and-test": "^2.0.0",
Expand Down
13 changes: 9 additions & 4 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ export default defineNuxtModule<ModuleOptions>({
await copy(resolve(join(nuxt.options.rootDir, 'tailwind.config.ts')), resolve(join(targetDir, 'tailwind.config.ts')))
}

const customErrorExist = await pathExists(resolve(join(nuxt.options.rootDir, 'error.vue')))
if (customErrorExist) {
await copy(resolve(join(nuxt.options.rootDir, 'error.vue')), resolve(join(targetDir, 'error.vue')))
}

// Set srcDir of nuxt base layer
for (const layer of nuxt.options._layers) {
if (layer.configFile === 'nuxt.config') {
Expand Down Expand Up @@ -261,9 +266,9 @@ export default defineNuxtModule<ModuleOptions>({
}

// Add custom error page
nuxt.hook('app:resolve', (app) => {
app.errorComponent = resolve(join(targetDir, 'components/misc/MiscError.vue'))
})
// nuxt.hook('app:resolve', (app) => {
// app.errorComponent = resolve(join(targetDir, 'components/misc/MiscError.vue'))
// })

// Performance: Remove dynamic import prefetching
nuxt.hook('build:manifest', (manifest) => {
Expand Down Expand Up @@ -298,7 +303,7 @@ export default defineNuxtModule<ModuleOptions>({
const excludedDirectories = [...options.dirBlacklist.map(__blacklistedDir => `${nuxt.options.rootDir}/${__blacklistedDir}/**`)]

const toTargetPath = (oldPath: string) => {
return resolve(oldPath.replace(nuxt.options.rootDir, targetDir))
return resolve(oldPath.replace(path.normalize(nuxt.options.rootDir), targetDir))
}

// TODO: Write generic function for watchers
Expand Down
39 changes: 0 additions & 39 deletions src/theme/components/misc/MiscError.vue

This file was deleted.

0 comments on commit cad4747

Please sign in to comment.