create-houdini 1.2.27 → 1.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.js +13 -6
- package/package.json +1 -1
- package/templates/react/.meta.gitignore +31 -0
- package/templates/react/package.json +6 -3
- package/templates/react/src/routes/+page.jsx +0 -3
- package/templates/react/vite.config.ts +2 -1
- package/templates/react-typescript/.meta.gitignore +30 -0
- package/templates/react-typescript/package.json +6 -3
- package/templates/react-typescript/src/+index.tsx +39 -39
- package/templates/react-typescript/src/routes/+page.tsx +2 -3
- package/templates/react-typescript/vite.config.ts +2 -1
- package/templates/sveltekit-demo/.meta.gitignore +11 -0
- package/templates/sveltekit-demo/package.json +2 -2
package/bin.js
CHANGED
|
@@ -62,7 +62,7 @@ if (!projectDir) {
|
|
|
62
62
|
|
|
63
63
|
if (dir) {
|
|
64
64
|
projectDir = dir
|
|
65
|
-
projectName =
|
|
65
|
+
projectName = dir
|
|
66
66
|
} else {
|
|
67
67
|
projectDir = '.'
|
|
68
68
|
}
|
|
@@ -175,6 +175,7 @@ copy(
|
|
|
175
175
|
["'CLIENT_CONFIG'"]: clientConfig,
|
|
176
176
|
["'CONFIG_FILE'"]: configFile,
|
|
177
177
|
},
|
|
178
|
+
{ '.meta.gitignore': '.gitignore' },
|
|
178
179
|
['.meta.json']
|
|
179
180
|
)
|
|
180
181
|
|
|
@@ -213,6 +214,7 @@ function copy(
|
|
|
213
214
|
/** @type {string} */ sourceDir,
|
|
214
215
|
/** @type {string} */ destDir = projectDir,
|
|
215
216
|
/** @type {Record<string, string>} */ transformMap = {},
|
|
217
|
+
/** @type {Record<string, string>} */ transformFileMap = {},
|
|
216
218
|
/** @type {string[]} */ ignoreList = []
|
|
217
219
|
) {
|
|
218
220
|
if (!fs.existsSync(destDir)) {
|
|
@@ -220,12 +222,16 @@ function copy(
|
|
|
220
222
|
}
|
|
221
223
|
|
|
222
224
|
const files = fs.readdirSync(sourceDir)
|
|
223
|
-
for (const
|
|
224
|
-
const
|
|
225
|
+
for (const fileSource of files) {
|
|
226
|
+
const fileDest = Object.entries(transformFileMap).reduce((acc, [key, value]) => {
|
|
227
|
+
return acc.replace(key, value)
|
|
228
|
+
}, fileSource)
|
|
229
|
+
// const file = fileSource.replace(".meta.gitignore", ".gitignore")
|
|
230
|
+
const sourceFilePath = path.join(sourceDir, fileSource)
|
|
225
231
|
const sourceRelative = path.relative(templateDir, sourceFilePath)
|
|
226
232
|
// skip the ignore list
|
|
227
233
|
if (!ignoreList.includes(sourceRelative)) {
|
|
228
|
-
const destFilePath = path.join(destDir,
|
|
234
|
+
const destFilePath = path.join(destDir, fileDest)
|
|
229
235
|
|
|
230
236
|
const stats = fs.statSync(sourceFilePath)
|
|
231
237
|
|
|
@@ -247,7 +253,7 @@ function copy(
|
|
|
247
253
|
}
|
|
248
254
|
// if we run into a directory then we should keep going
|
|
249
255
|
else if (stats.isDirectory()) {
|
|
250
|
-
copy(sourceFilePath, destFilePath, transformMap, ignoreList)
|
|
256
|
+
copy(sourceFilePath, destFilePath, transformMap, transformFileMap, ignoreList)
|
|
251
257
|
}
|
|
252
258
|
}
|
|
253
259
|
}
|
|
@@ -295,7 +301,8 @@ async function pullSchemaCli() {
|
|
|
295
301
|
|
|
296
302
|
url_and_headers = answer.url_and_headers
|
|
297
303
|
const value_splited = url_and_headers.split(' ')
|
|
298
|
-
|
|
304
|
+
|
|
305
|
+
apiUrl = value_splited[0]
|
|
299
306
|
|
|
300
307
|
const local_headers =
|
|
301
308
|
value_splited.length > 1
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
.env.local
|
|
11
|
+
.env.production.local
|
|
12
|
+
.env.*.local
|
|
13
|
+
|
|
14
|
+
node_modules
|
|
15
|
+
dist
|
|
16
|
+
dist-ssr
|
|
17
|
+
*.local
|
|
18
|
+
|
|
19
|
+
./$houdini
|
|
20
|
+
./dist
|
|
21
|
+
|
|
22
|
+
# Editor directories and files
|
|
23
|
+
.vscode/*
|
|
24
|
+
!.vscode/extensions.json
|
|
25
|
+
.idea
|
|
26
|
+
.DS_Store
|
|
27
|
+
*.suo
|
|
28
|
+
*.ntvs*
|
|
29
|
+
*.njsproj
|
|
30
|
+
*.sln
|
|
31
|
+
*.sw?
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"houdini": "^HOUDINI_VERSION",
|
|
13
13
|
"houdini-react": "^HOUDINI_VERSION",
|
|
14
|
-
"
|
|
15
|
-
"react
|
|
14
|
+
"houdini-adapter-auto": "^HOUDINI_VERSION",
|
|
15
|
+
"react": "^18.3.0-canary-09fbee89d-20231013",
|
|
16
|
+
"react-dom": "^18.3.0-canary-09fbee89d-20231013",
|
|
16
17
|
"graphql-yoga": "4.0.4",
|
|
17
18
|
"graphql": "15.8.0",
|
|
18
19
|
"@whatwg-node/server": "^0.9.14"
|
|
@@ -22,6 +23,8 @@
|
|
|
22
23
|
"vite": "^4.1.0"
|
|
23
24
|
},
|
|
24
25
|
"resolutions": {
|
|
25
|
-
"graphql": "15.8.0"
|
|
26
|
+
"graphql": "15.8.0",
|
|
27
|
+
"react": "18.3.0-canary-09fbee89d-20231013",
|
|
28
|
+
"react-dom": "18.3.0-canary-09fbee89d-20231013"
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react'
|
|
2
|
+
import adapter from 'houdini-adapter-auto'
|
|
2
3
|
import houdini from 'houdini/vite'
|
|
3
4
|
import { defineConfig } from 'vite'
|
|
4
5
|
|
|
5
6
|
// https://vitejs.dev/config/
|
|
6
7
|
export default defineConfig({
|
|
7
|
-
plugins: [houdini(), react({ fastRefresh: false })],
|
|
8
|
+
plugins: [houdini({ adapter }), react({ fastRefresh: false })],
|
|
8
9
|
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
.env.local
|
|
11
|
+
.env.production.local
|
|
12
|
+
.env.*.local
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
node_modules
|
|
16
|
+
dist
|
|
17
|
+
dist-ssr
|
|
18
|
+
*.local
|
|
19
|
+
$houdini
|
|
20
|
+
|
|
21
|
+
# Editor directories and files
|
|
22
|
+
.vscode/*
|
|
23
|
+
!.vscode/extensions.json
|
|
24
|
+
.idea
|
|
25
|
+
.DS_Store
|
|
26
|
+
*.suo
|
|
27
|
+
*.ntvs*
|
|
28
|
+
*.njsproj
|
|
29
|
+
*.sln
|
|
30
|
+
*.sw?
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"houdini": "^HOUDINI_VERSION",
|
|
13
13
|
"houdini-react": "^HOUDINI_VERSION",
|
|
14
|
-
"
|
|
15
|
-
"react
|
|
14
|
+
"houdini-adapter-auto": "^HOUDINI_VERSION",
|
|
15
|
+
"react": "^18.3.0-canary-09fbee89d-20231013",
|
|
16
|
+
"react-dom": "^18.3.0-canary-09fbee89d-20231013",
|
|
16
17
|
"graphql-yoga": "4.0.4",
|
|
17
18
|
"graphql": "15.8.0",
|
|
18
19
|
"@whatwg-node/server": "^0.9.14"
|
|
@@ -25,6 +26,8 @@
|
|
|
25
26
|
"vite": "^4.1.0"
|
|
26
27
|
},
|
|
27
28
|
"resolutions": {
|
|
28
|
-
"graphql": "15.8.0"
|
|
29
|
+
"graphql": "15.8.0",
|
|
30
|
+
"react": "18.3.0-canary-09fbee89d-20231013",
|
|
31
|
+
"react-dom": "18.3.0-canary-09fbee89d-20231013"
|
|
29
32
|
}
|
|
30
33
|
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react'
|
|
2
2
|
|
|
3
3
|
export default function App({ children }) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
return (
|
|
5
|
+
<html>
|
|
6
|
+
<head>
|
|
7
|
+
<meta charSet="utf-8" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<link
|
|
10
|
+
rel="icon"
|
|
11
|
+
type="image/png"
|
|
12
|
+
href="https://houdinigraphql.com/images/logo.png"
|
|
13
|
+
/>
|
|
14
|
+
<link
|
|
15
|
+
rel="stylesheet"
|
|
16
|
+
href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css"
|
|
17
|
+
/>
|
|
18
|
+
<title>Houdini • React</title>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<ErrorBoundary>{children}</ErrorBoundary>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
|
24
|
+
)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
class ErrorBoundary extends React.Component {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
class ErrorBoundary extends React.Component<{ children: React.ReactNode }, { hasError: boolean }> {
|
|
28
|
+
constructor(props: { children: React.ReactNode }) {
|
|
29
|
+
super(props)
|
|
30
|
+
this.state = { hasError: false }
|
|
31
|
+
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
static getDerivedStateFromError(error: Error) {
|
|
34
|
+
return { hasError: true }
|
|
35
|
+
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
componentDidCatch(error: Error, info: {}) {
|
|
38
|
+
console.error('ErrorBoundary caught an error:', error, info)
|
|
39
|
+
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
render() {
|
|
42
|
+
if (this.state.hasError) {
|
|
43
|
+
return <h1>Something went wrong.</h1>
|
|
44
|
+
}
|
|
45
|
+
return this.props.children
|
|
46
|
+
}
|
|
47
47
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react'
|
|
2
|
+
import adapter from 'houdini-adapter-auto'
|
|
2
3
|
import houdini from 'houdini/vite'
|
|
3
4
|
import { defineConfig } from 'vite'
|
|
4
5
|
|
|
5
6
|
// https://vitejs.dev/config/
|
|
6
7
|
export default defineConfig({
|
|
7
|
-
plugins: [houdini(), react({ fastRefresh: false })],
|
|
8
|
+
plugins: [houdini({ adapter }), react({ fastRefresh: false })],
|
|
8
9
|
})
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"eslint": "^8.28.0",
|
|
24
24
|
"eslint-config-prettier": "^8.5.0",
|
|
25
25
|
"eslint-plugin-svelte": "^2.30.0",
|
|
26
|
-
"houdini": "
|
|
27
|
-
"houdini-svelte": "
|
|
26
|
+
"houdini": "HOUDINI_VERSION",
|
|
27
|
+
"houdini-svelte": "HOUDINI_VERSION",
|
|
28
28
|
"prettier": "^2.8.0",
|
|
29
29
|
"prettier-plugin-svelte": "^2.10.1",
|
|
30
30
|
"svelte": "^4.0.5",
|