@tanstack/cta-framework-solid 0.10.0-alpha.20
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/ADD-ON-AUTHORING.md +129 -0
- package/LICENSE +21 -0
- package/add-ons/form/assets/src/routes/demo.form.tsx.ejs +352 -0
- package/add-ons/form/info.json +16 -0
- package/add-ons/form/package.json +5 -0
- package/add-ons/module-federation/assets/module-federation.config.js.ejs +27 -0
- package/add-ons/module-federation/assets/src/demo-mf-component.tsx +3 -0
- package/add-ons/module-federation/assets/src/demo-mf-self-contained.tsx +9 -0
- package/add-ons/module-federation/info.json +8 -0
- package/add-ons/module-federation/package.json +5 -0
- package/add-ons/sentry/assets/_dot_cursorrules.append +22 -0
- package/add-ons/sentry/assets/_dot_env.local.append +2 -0
- package/add-ons/sentry/assets/src/routes/demo.sentry.bad-event-handler.tsx +20 -0
- package/add-ons/sentry/info.json +16 -0
- package/add-ons/sentry/package.json +5 -0
- package/add-ons/solid-ui/README.md +9 -0
- package/add-ons/solid-ui/assets/src/lib/utils.ts +6 -0
- package/add-ons/solid-ui/assets/src/styles.css +138 -0
- package/add-ons/solid-ui/assets/ui.config.json +13 -0
- package/add-ons/solid-ui/info.json +12 -0
- package/add-ons/solid-ui/package.json +9 -0
- package/add-ons/start/assets/app.config.ts.ejs +19 -0
- package/add-ons/start/assets/src/api.ts +6 -0
- package/add-ons/start/assets/src/client.tsx +7 -0
- package/add-ons/start/assets/src/router.tsx.ejs +24 -0
- package/add-ons/start/assets/src/routes/demo.start.server-funcs.tsx +49 -0
- package/add-ons/start/assets/src/ssr.tsx +12 -0
- package/add-ons/start/info.json +17 -0
- package/add-ons/start/package.json +12 -0
- package/add-ons/store/assets/src/lib/demo-store.ts +13 -0
- package/add-ons/store/assets/src/routes/demo.store.tsx.ejs +77 -0
- package/add-ons/store/info.json +16 -0
- package/add-ons/store/package.json +6 -0
- package/add-ons/t3env/README.md +16 -0
- package/add-ons/t3env/assets/src/env.ts +39 -0
- package/add-ons/t3env/info.json +8 -0
- package/add-ons/t3env/package.json +6 -0
- package/add-ons/tanstack-query/assets/src/integrations/tanstack-query/header-user.tsx +5 -0
- package/add-ons/tanstack-query/assets/src/integrations/tanstack-query/provider.tsx +15 -0
- package/add-ons/tanstack-query/assets/src/routes/demo.tanstack-query.tsx +24 -0
- package/add-ons/tanstack-query/info.json +28 -0
- package/add-ons/tanstack-query/package.json +6 -0
- package/dist/index.js +18 -0
- package/dist/types/index.d.ts +1 -0
- package/examples/tanchat/README.md +52 -0
- package/examples/tanchat/assets/ai-streaming-server/README.md +110 -0
- package/examples/tanchat/assets/ai-streaming-server/_dot_env.example +1 -0
- package/examples/tanchat/assets/ai-streaming-server/package.json +26 -0
- package/examples/tanchat/assets/ai-streaming-server/src/index.ts +102 -0
- package/examples/tanchat/assets/ai-streaming-server/tsconfig.json +15 -0
- package/examples/tanchat/assets/src/components/demo.SettingsDialog.tsx +149 -0
- package/examples/tanchat/assets/src/demo.index.css +227 -0
- package/examples/tanchat/assets/src/lib/demo-store.ts +13 -0
- package/examples/tanchat/assets/src/routes/example.chat.tsx +435 -0
- package/examples/tanchat/assets/src/store/demo.hooks.ts +17 -0
- package/examples/tanchat/assets/src/store/demo.store.ts +133 -0
- package/examples/tanchat/info.json +15 -0
- package/examples/tanchat/package.json +7 -0
- package/package.json +33 -0
- package/project/base/README.md.ejs +215 -0
- package/project/base/_dot_cursorrules.append +35 -0
- package/project/base/_dot_gitignore +5 -0
- package/project/base/_dot_vscode/settings.json.ejs +35 -0
- package/project/base/index.html.ejs +20 -0
- package/project/base/package.json +23 -0
- package/project/base/public/favicon.ico +0 -0
- package/project/base/public/logo192.png +0 -0
- package/project/base/public/logo512.png +0 -0
- package/project/base/public/manifest.json +25 -0
- package/project/base/public/robots.txt +3 -0
- package/project/base/src/App.css.ejs +38 -0
- package/project/base/src/App.tsx.ejs +34 -0
- package/project/base/src/components/Header.tsx.ejs +26 -0
- package/project/base/src/logo.svg +120 -0
- package/project/base/src/main.tsx.ejs +126 -0
- package/project/base/src/routes/__root.tsx.ejs +38 -0
- package/project/base/src/routes/index.tsx.ejs +41 -0
- package/project/base/src/styles.css.ejs +15 -0
- package/project/base/tsconfig.json.ejs +31 -0
- package/project/base/vite.config.js.ejs +22 -0
- package/project/packages.json +18 -0
- package/src/index.ts +26 -0
- package/tests/snapshots/solid/solid-cr-js-npm.json +22 -0
- package/tests/snapshots/solid/solid-cr-ts-npm.json +23 -0
- package/tests/snapshots/solid/solid-cr-ts-start-npm.json +27 -0
- package/tests/snapshots/solid/solid-fr-ts-npm.json +24 -0
- package/tests/snapshots/solid/solid-fr-ts-tw-npm.json +23 -0
- package/tests/solid.test.ts +119 -0
- package/tests/test-utilities.ts +44 -0
- package/toolchains/biome/assets/biome.json.ejs +31 -0
- package/toolchains/biome/info.json +8 -0
- package/toolchains/biome/package.json +10 -0
- package/toolchains/eslint/assets/_dot_prettierignore +3 -0
- package/toolchains/eslint/assets/eslint.config.js +5 -0
- package/toolchains/eslint/assets/prettier.config.js +10 -0
- package/toolchains/eslint/info.json +8 -0
- package/toolchains/eslint/package.json +11 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { expect, test, beforeAll } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createApp,
|
|
5
|
+
createMemoryEnvironment,
|
|
6
|
+
finalizeAddOns,
|
|
7
|
+
getFrameworkById,
|
|
8
|
+
} from '@tanstack/cta-engine'
|
|
9
|
+
|
|
10
|
+
import type { AddOn, Mode, Options } from '@tanstack/cta-engine'
|
|
11
|
+
|
|
12
|
+
import { cleanupOutput } from './test-utilities.js'
|
|
13
|
+
|
|
14
|
+
import { register as registerSolid } from '../src/index.js'
|
|
15
|
+
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
registerSolid()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
async function createSolidOptions(
|
|
21
|
+
projectName: string,
|
|
22
|
+
addOns?: Array<string>,
|
|
23
|
+
): Promise<Options> {
|
|
24
|
+
const framework = getFrameworkById('solid')!
|
|
25
|
+
|
|
26
|
+
let chosenAddOns: Array<AddOn> = []
|
|
27
|
+
let mode = 'code-router'
|
|
28
|
+
if (addOns) {
|
|
29
|
+
mode = 'file-router'
|
|
30
|
+
chosenAddOns = await finalizeAddOns(framework, mode, addOns)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
framework,
|
|
35
|
+
addOns: !!chosenAddOns.length,
|
|
36
|
+
chosenAddOns,
|
|
37
|
+
git: true,
|
|
38
|
+
mode,
|
|
39
|
+
packageManager: 'npm',
|
|
40
|
+
projectName,
|
|
41
|
+
targetDir: `/foo/bar/baz/${projectName}`,
|
|
42
|
+
tailwind: false,
|
|
43
|
+
typescript: false,
|
|
44
|
+
variableValues: {},
|
|
45
|
+
} as Options
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
test('code router in javascript on npm', async () => {
|
|
49
|
+
const projectName = 'TEST'
|
|
50
|
+
const { environment, output } = createMemoryEnvironment()
|
|
51
|
+
const options = {
|
|
52
|
+
...(await createSolidOptions(projectName)),
|
|
53
|
+
}
|
|
54
|
+
await createApp(environment, options)
|
|
55
|
+
const cleanedOutput = cleanupOutput(options, output)
|
|
56
|
+
await expect(JSON.stringify(cleanedOutput, null, 2)).toMatchFileSnapshot(
|
|
57
|
+
'./snapshots/solid/solid-cr-js-npm.json',
|
|
58
|
+
)
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test('code router in typescript on npm', async () => {
|
|
62
|
+
const projectName = 'TEST'
|
|
63
|
+
const { environment, output } = createMemoryEnvironment()
|
|
64
|
+
const options = {
|
|
65
|
+
...(await createSolidOptions(projectName)),
|
|
66
|
+
typescript: true,
|
|
67
|
+
}
|
|
68
|
+
await createApp(environment, options)
|
|
69
|
+
const cleanedOutput = cleanupOutput(options, output)
|
|
70
|
+
await expect(JSON.stringify(cleanedOutput, null, 2)).toMatchFileSnapshot(
|
|
71
|
+
'./snapshots/solid/solid-cr-ts-npm.json',
|
|
72
|
+
)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test('file router on npm', async () => {
|
|
76
|
+
const projectName = 'TEST'
|
|
77
|
+
const { environment, output } = createMemoryEnvironment()
|
|
78
|
+
const options = {
|
|
79
|
+
...(await createSolidOptions(projectName)),
|
|
80
|
+
mode: 'file-router' as Mode,
|
|
81
|
+
typescript: true,
|
|
82
|
+
}
|
|
83
|
+
await createApp(environment, options)
|
|
84
|
+
const cleanedOutput = cleanupOutput(options, output)
|
|
85
|
+
await expect(JSON.stringify(cleanedOutput, null, 2)).toMatchFileSnapshot(
|
|
86
|
+
'./snapshots/solid/solid-fr-ts-npm.json',
|
|
87
|
+
)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('file router with tailwind on npm', async () => {
|
|
91
|
+
const projectName = 'TEST'
|
|
92
|
+
const { environment, output } = createMemoryEnvironment()
|
|
93
|
+
const options = {
|
|
94
|
+
...(await createSolidOptions(projectName)),
|
|
95
|
+
mode: 'file-router' as Mode,
|
|
96
|
+
typescript: true,
|
|
97
|
+
tailwind: true,
|
|
98
|
+
}
|
|
99
|
+
await createApp(environment, options)
|
|
100
|
+
const cleanedOutput = cleanupOutput(options, output)
|
|
101
|
+
await expect(JSON.stringify(cleanedOutput, null, 2)).toMatchFileSnapshot(
|
|
102
|
+
'./snapshots/solid/solid-fr-ts-tw-npm.json',
|
|
103
|
+
)
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
test('file router with add-on start on npm', async () => {
|
|
107
|
+
const projectName = 'TEST'
|
|
108
|
+
const { environment, output } = createMemoryEnvironment()
|
|
109
|
+
const options = {
|
|
110
|
+
...(await createSolidOptions(projectName, ['start'])),
|
|
111
|
+
tailwind: true,
|
|
112
|
+
typescript: true,
|
|
113
|
+
}
|
|
114
|
+
await createApp(environment, options)
|
|
115
|
+
const cleanedOutput = cleanupOutput(options, output)
|
|
116
|
+
await expect(JSON.stringify(cleanedOutput, null, 2)).toMatchFileSnapshot(
|
|
117
|
+
'./snapshots/solid/solid-cr-ts-start-npm.json',
|
|
118
|
+
)
|
|
119
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { dirname, join, basename, extname } from 'node:path'
|
|
2
|
+
|
|
3
|
+
import { formatCommand, Options } from '@tanstack/cta-engine'
|
|
4
|
+
|
|
5
|
+
const IGNORE_EXTENSIONS = ['.png', '.ico', '.svg']
|
|
6
|
+
|
|
7
|
+
export function cleanupOutput(
|
|
8
|
+
options: Options,
|
|
9
|
+
output: {
|
|
10
|
+
files: Record<string, string>
|
|
11
|
+
commands: Array<{
|
|
12
|
+
command: string
|
|
13
|
+
args: Array<string>
|
|
14
|
+
}>
|
|
15
|
+
},
|
|
16
|
+
) {
|
|
17
|
+
const trimProjectRelativePath = (path: string) =>
|
|
18
|
+
join(dirname(path).replace(options.targetDir, ''), basename(path))
|
|
19
|
+
|
|
20
|
+
const filteredFiles = Object.keys(output.files)
|
|
21
|
+
.filter((key) => !IGNORE_EXTENSIONS.includes(extname(key)))
|
|
22
|
+
.reduce(
|
|
23
|
+
(acc, key) => {
|
|
24
|
+
acc[trimProjectRelativePath(key)] = output.files[key]
|
|
25
|
+
return acc
|
|
26
|
+
},
|
|
27
|
+
{} as Record<string, string>,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const files = Object.keys(filteredFiles)
|
|
31
|
+
.sort()
|
|
32
|
+
.reduce(
|
|
33
|
+
(acc, key) => {
|
|
34
|
+
acc[key] = filteredFiles[key]
|
|
35
|
+
return acc
|
|
36
|
+
},
|
|
37
|
+
{} as Record<string, string>,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
files,
|
|
42
|
+
commands: output.commands.map((c) => formatCommand(c)),
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": false
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false,
|
|
10
|
+
"ignore": ["src/routeTree.gen.ts"],
|
|
11
|
+
"include": ["src/*", ".vscode/*", "index.html", "vite.config.js"]
|
|
12
|
+
},
|
|
13
|
+
"formatter": {
|
|
14
|
+
"enabled": true,
|
|
15
|
+
"indentStyle": "tab"
|
|
16
|
+
},
|
|
17
|
+
"organizeImports": {
|
|
18
|
+
"enabled": true
|
|
19
|
+
},
|
|
20
|
+
"linter": {
|
|
21
|
+
"enabled": true,
|
|
22
|
+
"rules": {
|
|
23
|
+
"recommended": true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"javascript": {
|
|
27
|
+
"formatter": {
|
|
28
|
+
"quoteStyle": "double"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ES2020",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"rootDir": "./src",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationDir": "./dist/types"
|
|
14
|
+
},
|
|
15
|
+
"include": ["./src/**/*.ts"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|