Skip to content

Commit

Permalink
Upgrade inertia to 1.0.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ycs77 committed Jan 12, 2023
1 parent dc5bb12 commit bd38b5d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README-zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ createInertiaApp({

createInertiaApp({
...
setup({ el, app, props, plugin }) {
createApp({ render: () => h(app, props) })
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
+ .use(InertiaTitle)
.mount(el)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ Use in Vue 3 in `resources/js/app.js`:

createInertiaApp({
...
setup({ el, app, props, plugin }) {
createApp({ render: () => h(app, props) })
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
+ .use(InertiaTitle)
.mount(el)
Expand Down
30 changes: 18 additions & 12 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "inertia-title",
"version": "1.1.1",
"version": "1.2.0-beta.1",
"description": "Simple auto update title plugin for Inertia.js client adapters",
"main": "dist/index.js",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"./vue2": {
"require": "./dist/vue2.js",
"require": "./dist/vue2.cjs",
"import": "./dist/vue2.mjs"
},
"./vue3": {
"require": "./dist/vue3.js",
"require": "./dist/vue3.cjs",
"import": "./dist/vue3.mjs"
}
},
Expand All @@ -30,20 +30,26 @@
"bugs": {
"url": "https://github.com/ycs77/inertia-laravel-ssr-head/issues"
},
"keywords": ["inertia", "inertiajs", "head", "seo"],
"keywords": [
"inertia",
"inertiajs",
"head",
"seo"
],
"scripts": {
"build": "npm run clean && npm run build:ts && npm run copy-dts-files",
"build:ts": "tsup src/index.ts src/vue2.ts src/vue3.ts --external @inertiajs/inertia --dts --format cjs,esm -d dist",
"build:ts": "tsup",
"clean": "rm -rf dist vue2.d.ts vue3.d.ts",
"copy-dts-files": "esno scripts/copy-dts-files.ts"
},
"devDependencies": {
"@inertiajs/inertia": ">=0.10.0",
"esno": "^0.10.1",
"tsup": "^5.4.1",
"typescript": "^4.4.4"
"@inertiajs/core": "^1.0.0-beta",
"@types/node": "^18.11.18",
"tsup": "^6.5.0",
"tsx": "^3.0.0",
"typescript": "^4.9.0"
},
"peerDependencies": {
"@inertiajs/inertia": ">=0.9.0"
"@inertiajs/core": "^1.0.0-beta"
}
}
4 changes: 2 additions & 2 deletions client/src/title.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Inertia } from '@inertiajs/inertia'
import { router } from '@inertiajs/core'

export function useInertiaTitle(): void {
function setTitle(value: string) {
setTimeout(() => document.title = value, 1)
}

Inertia.on('navigate', event => {
router.on('navigate', event => {
const title = event.detail.page.props.title as string
setTitle(title)
})
Expand Down
11 changes: 11 additions & 0 deletions client/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Options } from 'tsup'

export default <Options>{
entry: ['src/index.ts', 'src/vue2.ts', 'src/vue3.ts'],
format: ['cjs', 'esm'],
outExtension: ({ format }) => ({
js: format === 'esm' ? '.mjs' : '.cjs',
}),
external: ['@inertiajs/core'],
dts: true,
}

0 comments on commit bd38b5d

Please sign in to comment.