Skip to content

Commit 189ffb6

Browse files
committed
Fix formatting
1 parent 6cff2e8 commit 189ffb6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+158
-137
lines changed

bin/generate_scaffold_example

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ npm_cache = File.join(working_dir, 'npm_cache')
4949
FileUtils.mkdir_p(dir) unless File.directory?(dir)
5050
end
5151

52-
# Clean working directory
53-
FileUtils.rm_r(working_dir) if File.directory?(working_dir)
54-
FileUtils.mkdir_p(working_dir)
52+
app_name = "scaffold_example_#{options[:framework]}"
53+
app_dir = File.join(working_dir, app_name)
54+
55+
# Clean app directory
56+
FileUtils.rm_r(app_dir) if File.directory?(app_dir)
57+
FileUtils.mkdir_p(app_dir)
5558

5659
# Generate a new Rails app
57-
app_name = 'scaffold_example'
58-
app_dir = File.join(working_dir, app_name)
5960
system("rails new #{app_dir} -J")
6061

6162
# Install and configure with caching

lib/generators/inertia/install/templates/react/InertiaExample.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Head } from '@inertiajs/react'
22
import { useState } from 'react'
33

4-
import reactSvg from '/assets/react.svg'
54
import inertiaSvg from '/assets/inertia.svg'
5+
import reactSvg from '/assets/react.svg'
66
import viteRubySvg from '/assets/vite_ruby.svg'
77

88
import cs from './InertiaExample.module.css'

lib/generators/inertia/install/templates/react/InertiaExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Head } from '@inertiajs/react'
22
import { useState } from 'react'
33

4-
import reactSvg from '/assets/react.svg'
54
import inertiaSvg from '/assets/inertia.svg'
5+
import reactSvg from '/assets/react.svg'
66
import viteRubySvg from '/assets/vite_ruby.svg'
77

88
import cs from './InertiaExample.module.css'

lib/generators/inertia/install/templates/react/inertia.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ createInertiaApp({
1414
// progress: false,
1515

1616
resolve: (name) => {
17-
const pages = import.meta.glob('../pages/**/*.jsx', { eager: true })
17+
const pages = import.meta.glob('../pages/**/*.jsx', {
18+
eager: true,
19+
})
1820
const page = pages[`../pages/${name}.jsx`]
1921
if (!page) {
2022
console.error(`Missing Inertia page component: '${name}.jsx'`)
@@ -35,8 +37,8 @@ createInertiaApp({
3537
} else {
3638
console.error(
3739
'Missing root element.\n\n' +
38-
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
39-
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.'
40+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
41+
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.',
4042
)
4143
}
4244
},

lib/generators/inertia/install/templates/react/inertia.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { createInertiaApp } from '@inertiajs/react'
22
import { createElement, ReactNode } from 'react'
33
import { createRoot } from 'react-dom/client'
44

5-
type ResolvedComponent = { default: ReactNode, layout?: (page: ReactNode) => ReactNode }
5+
// Temporary type definition, until @inertiajs/react provides one
6+
type ResolvedComponent = {
7+
default: ReactNode
8+
layout?: (page: ReactNode) => ReactNode
9+
}
610

711
createInertiaApp({
812
// Set default page title
@@ -16,7 +20,9 @@ createInertiaApp({
1620
// progress: false,
1721

1822
resolve: (name) => {
19-
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.tsx', {eager: true})
23+
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.tsx', {
24+
eager: true,
25+
})
2026
const page = pages[`../pages/${name}.tsx`]
2127
if (!page) {
2228
console.error(`Missing Inertia page component: '${name}.tsx'`)
@@ -31,14 +37,14 @@ createInertiaApp({
3137
return page
3238
},
3339

34-
setup({el, App, props}) {
40+
setup({ el, App, props }) {
3541
if (el) {
3642
createRoot(el).render(createElement(App, props))
3743
} else {
3844
console.error(
3945
'Missing root element.\n\n' +
40-
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
41-
'Consider moving <%%= vite_typescript_tag "inertia" %> to the Inertia-specific layout instead.'
46+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
47+
'Consider moving <%%= vite_typescript_tag "inertia" %> to the Inertia-specific layout instead.',
4248
)
4349
}
4450
},

lib/generators/inertia/install/templates/svelte/inertia.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ createInertiaApp({
1313
// progress: false,
1414

1515
resolve: (name) => {
16-
const pages = import.meta.glob('../pages/**/*.svelte', { eager: true })
16+
const pages = import.meta.glob('../pages/**/*.svelte', {
17+
eager: true,
18+
})
1719
const page = pages[`../pages/${name}.svelte`]
1820
if (!page) {
1921
console.error(`Missing Inertia page component: '${name}.svelte'`)
@@ -34,8 +36,8 @@ createInertiaApp({
3436
} else {
3537
console.error(
3638
'Missing root element.\n\n' +
37-
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
38-
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.'
39+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
40+
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.',
3941
)
4042
}
4143
},

lib/generators/inertia/install/templates/svelte/inertia.ts.tt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ createInertiaApp({
1313
// progress: false,
1414

1515
resolve: (name) => {
16-
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.svelte', { eager: true })
16+
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.svelte', {
17+
eager: true,
18+
})
1719
const page = pages[`../pages/${name}.svelte`]
1820
if (!page) {
1921
console.error(`Missing Inertia page component: '${name}.svelte'`)
@@ -30,13 +32,13 @@ createInertiaApp({
3032

3133
setup({ el, App, props }) {
3234
if (el) {
33-
<%= "// @ts-expect-error 1.3.0 beta contains types mismatch\n" if inertia_resolved_version == Gem::Version.new('1.3.0-beta.2') -%>
35+
<%= " // @ts-expect-error 1.3.0 beta contains types mismatch\n" if inertia_resolved_version == Gem::Version.new('1.3.0-beta.2') -%>
3436
mount(App, { target: el, props })
3537
} else {
3638
console.error(
3739
'Missing root element.\n\n' +
38-
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
39-
'Consider moving <%%= vite_typescript_tag "inertia" %> to the Inertia-specific layout instead.'
40+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
41+
'Consider moving <%%= vite_typescript_tag "inertia" %> to the Inertia-specific layout instead.',
4042
)
4143
}
4244
},

lib/generators/inertia/install/templates/svelte4/inertia.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ createInertiaApp({
1212
// progress: false,
1313

1414
resolve: (name) => {
15-
const pages = import.meta.glob('../pages/**/*.svelte', { eager: true })
15+
const pages = import.meta.glob('../pages/**/*.svelte', {
16+
eager: true,
17+
})
1618
const page = pages[`../pages/${name}.svelte`]
1719
if (!page) {
1820
console.error(`Missing Inertia page component: '${name}.svelte'`)
@@ -33,8 +35,8 @@ createInertiaApp({
3335
} else {
3436
console.error(
3537
'Missing root element.\n\n' +
36-
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
37-
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.'
38+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
39+
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.',
3840
)
3941
}
4042
},

lib/generators/inertia/install/templates/svelte4/inertia.ts.tt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ createInertiaApp({
1212
// progress: false,
1313

1414
resolve: (name) => {
15-
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.svelte', { eager: true })
15+
const pages = import.meta.glob<ResolvedComponent>('../pages/**/*.svelte', {
16+
eager: true,
17+
})
1618
const page = pages[`../pages/${name}.svelte`]
1719
if (!page) {
1820
console.error(`Missing Inertia page component: '${name}.svelte'`)
@@ -34,8 +36,8 @@ createInertiaApp({
3436
} else {
3537
console.error(
3638
'Missing root element.\n\n' +
37-
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
38-
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.'
39+
'If you see this error, it probably means you load Inertia.js on non-Inertia pages.\n' +
40+
'Consider moving <%%= vite_javascript_tag "inertia" %> to the Inertia-specific layout instead.',
3941
)
4042
}
4143
},

lib/generators/inertia/install/templates/vue/InertiaExample.ts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
import { Head } from '@inertiajs/vue3'
3838
import { ref } from 'vue'
3939
40-
import vueSvg from '/assets/vue.svg'
4140
import inertiaSvg from '/assets/inertia.svg'
4241
import viteRubySvg from '/assets/vite_ruby.svg'
42+
import vueSvg from '/assets/vue.svg'
4343
4444
defineProps({
4545
name: String,

0 commit comments

Comments
 (0)