@tanstack/create 0.68.1 → 0.68.3
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/CHANGELOG.md +12 -0
- package/dist/create-app.js +22 -0
- package/dist/edge-add-ons.js +106 -0
- package/dist/edge-config-file.js +15 -0
- package/dist/edge-create-app.js +438 -0
- package/dist/edge-environment.js +141 -0
- package/dist/edge-file-helpers.js +88 -0
- package/dist/edge-frameworks.js +33 -0
- package/dist/edge-package-json.js +146 -0
- package/dist/edge-path.js +62 -0
- package/dist/edge-render.js +31 -0
- package/dist/edge-template-file.js +141 -0
- package/dist/edge.js +7 -0
- package/dist/frameworks/react/add-ons/storybook/info.json +5 -10
- package/dist/frameworks/react/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/react/project/base/package.json +1 -0
- package/dist/frameworks/react/project/base/tsr.config.json +3 -0
- package/dist/frameworks/react/project/packages.json +3 -0
- package/dist/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/dist/frameworks/solid/project/base/package.json +1 -0
- package/dist/frameworks/solid/project/base/tsr.config.json +3 -0
- package/dist/frameworks/solid/project/packages.json +3 -0
- package/dist/generated/create-manifest.js +4683 -0
- package/dist/manifest-types.js +1 -0
- package/dist/manifest.js +1 -0
- package/dist/types/custom-add-ons/add-on.d.ts +5 -3
- package/dist/types/edge-add-ons.d.ts +5 -0
- package/dist/types/edge-config-file.d.ts +8 -0
- package/dist/types/edge-create-app.d.ts +2 -0
- package/dist/types/edge-environment.d.ts +19 -0
- package/dist/types/edge-file-helpers.d.ts +7 -0
- package/dist/types/edge-frameworks.d.ts +7 -0
- package/dist/types/edge-package-json.d.ts +3 -0
- package/dist/types/edge-path.d.ts +5 -0
- package/dist/types/edge-render.d.ts +1 -0
- package/dist/types/edge-template-file.d.ts +2 -0
- package/dist/types/edge.d.ts +9 -0
- package/dist/types/generated/create-manifest.d.ts +36 -0
- package/dist/types/manifest-types.d.ts +4 -0
- package/dist/types/manifest.d.ts +1 -0
- package/dist/types/types.d.ts +96 -56
- package/dist/types.js +5 -3
- package/package.json +25 -5
- package/scripts/generate-manifest.mjs +407 -0
- package/src/create-app.ts +32 -1
- package/src/edge-add-ons.ts +138 -0
- package/src/edge-config-file.ts +35 -0
- package/src/edge-create-app.ts +594 -0
- package/src/edge-environment.ts +175 -0
- package/src/edge-file-helpers.ts +112 -0
- package/src/edge-frameworks.ts +54 -0
- package/src/edge-package-json.ts +212 -0
- package/src/edge-path.ts +77 -0
- package/src/edge-render.ts +32 -0
- package/src/edge-template-file.ts +204 -0
- package/src/edge.ts +43 -0
- package/src/frameworks/react/add-ons/storybook/info.json +5 -10
- package/src/frameworks/react/project/base/_dot_gitignore +0 -1
- package/src/frameworks/react/project/base/package.json +1 -0
- package/src/frameworks/react/project/base/tsr.config.json +3 -0
- package/src/frameworks/react/project/packages.json +3 -0
- package/src/frameworks/solid/project/base/_dot_gitignore +0 -1
- package/src/frameworks/solid/project/base/package.json +1 -0
- package/src/frameworks/solid/project/base/tsr.config.json +3 -0
- package/src/frameworks/solid/project/packages.json +3 -0
- package/src/generated/create-manifest.ts +6490 -0
- package/src/manifest-types.ts +8 -0
- package/src/manifest.ts +1 -0
- package/src/types.ts +5 -3
- package/tests/create-app.test.ts +39 -3
- package/tests/edge-import.test.ts +31 -0
- package/tests/edge-manifest.test.ts +168 -0
- package/tests/framework-template.test.ts +21 -2
- package/dist/frameworks/react/add-ons/storybook/assets/_dot_storybook/main.ts +0 -17
- package/dist/frameworks/react/add-ons/storybook/assets/_dot_storybook/preview.ts +0 -15
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.stories.ts +0 -67
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.tsx +0 -47
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.stories.tsx +0 -92
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.tsx +0 -29
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/index.ts +0 -14
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.stories.ts +0 -43
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.tsx +0 -39
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.stories.ts +0 -53
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.tsx +0 -52
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.stories.ts +0 -55
- package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.tsx +0 -57
- package/dist/frameworks/react/add-ons/storybook/assets/src/routes/demo/storybook.tsx +0 -93
- package/dist/frameworks/react/add-ons/storybook/package.json +0 -10
- package/src/frameworks/react/add-ons/storybook/assets/_dot_storybook/main.ts +0 -17
- package/src/frameworks/react/add-ons/storybook/assets/_dot_storybook/preview.ts +0 -15
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.stories.ts +0 -67
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.tsx +0 -47
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.stories.tsx +0 -92
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.tsx +0 -29
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/index.ts +0 -14
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.stories.ts +0 -43
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.tsx +0 -39
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.stories.ts +0 -53
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/radio-group.tsx +0 -52
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.stories.ts +0 -55
- package/src/frameworks/react/add-ons/storybook/assets/src/components/storybook/slider.tsx +0 -57
- package/src/frameworks/react/add-ons/storybook/assets/src/routes/demo/storybook.tsx +0 -93
- package/src/frameworks/react/add-ons/storybook/package.json +0 -10
package/src/manifest.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './edge.js'
|
package/src/types.ts
CHANGED
|
@@ -72,8 +72,9 @@ export const AddOnBaseSchema = z.object({
|
|
|
72
72
|
z.object({
|
|
73
73
|
url: z.string().optional(),
|
|
74
74
|
name: z.string().optional(),
|
|
75
|
-
path: z.string(),
|
|
76
|
-
jsName: z.string(),
|
|
75
|
+
path: z.string().optional(),
|
|
76
|
+
jsName: z.string().optional(),
|
|
77
|
+
icon: z.string().optional(),
|
|
77
78
|
}),
|
|
78
79
|
)
|
|
79
80
|
.optional(),
|
|
@@ -84,6 +85,7 @@ export const AddOnBaseSchema = z.object({
|
|
|
84
85
|
scripts: z.record(z.string(), z.string()).optional(),
|
|
85
86
|
})
|
|
86
87
|
.optional(),
|
|
88
|
+
variables: z.array(z.unknown()).optional(),
|
|
87
89
|
shadcnComponents: z.array(z.string()).optional(),
|
|
88
90
|
dependsOn: z.array(z.string()).optional(),
|
|
89
91
|
smallLogo: z.string().optional(),
|
|
@@ -130,7 +132,7 @@ export const IntegrationSchema = z.object({
|
|
|
130
132
|
export const AddOnInfoSchema = AddOnBaseSchema.extend({
|
|
131
133
|
modes: z.array(z.string()),
|
|
132
134
|
integrations: z.array(IntegrationSchema).optional(),
|
|
133
|
-
phase: z.enum(['setup', 'add-on']),
|
|
135
|
+
phase: z.enum(['setup', 'add-on', 'example']),
|
|
134
136
|
readme: z.string().optional(),
|
|
135
137
|
readmeIsEjs: z.boolean().optional(),
|
|
136
138
|
})
|
package/tests/create-app.test.ts
CHANGED
|
@@ -4,8 +4,7 @@ import { resolve } from 'node:path'
|
|
|
4
4
|
import { createApp } from '../src/create-app.js'
|
|
5
5
|
|
|
6
6
|
import { createMemoryEnvironment } from '../src/environment.js'
|
|
7
|
-
import {
|
|
8
|
-
import { AddOn, Options } from '../src/types.js'
|
|
7
|
+
import type { AddOn, Options } from '../src/types.js'
|
|
9
8
|
|
|
10
9
|
const simpleOptions = {
|
|
11
10
|
projectName: 'test',
|
|
@@ -43,7 +42,7 @@ const simpleOptions = {
|
|
|
43
42
|
packageManager: 'pnpm',
|
|
44
43
|
typescript: true,
|
|
45
44
|
tailwind: true,
|
|
46
|
-
mode:
|
|
45
|
+
mode: 'file-router',
|
|
47
46
|
variableValues: {},
|
|
48
47
|
} as unknown as Options
|
|
49
48
|
|
|
@@ -88,6 +87,43 @@ describe('createApp', () => {
|
|
|
88
87
|
expect(output.commands.some(({ command }) => command === 'echo')).toBe(true)
|
|
89
88
|
})
|
|
90
89
|
|
|
90
|
+
it.each(['react', 'solid'])(
|
|
91
|
+
'generates routes for %s file-router apps after install',
|
|
92
|
+
async (frameworkId) => {
|
|
93
|
+
const { environment, output } = createMemoryEnvironment()
|
|
94
|
+
await createApp(environment, {
|
|
95
|
+
...simpleOptions,
|
|
96
|
+
framework: {
|
|
97
|
+
...simpleOptions.framework,
|
|
98
|
+
id: frameworkId,
|
|
99
|
+
},
|
|
100
|
+
install: true,
|
|
101
|
+
} as Options)
|
|
102
|
+
|
|
103
|
+
expect(output.commands).toContainEqual({
|
|
104
|
+
command: 'pnpm',
|
|
105
|
+
args: ['generate-routes'],
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
it('skips route generation when dependency install is skipped', async () => {
|
|
111
|
+
const { environment, output } = createMemoryEnvironment()
|
|
112
|
+
await createApp(environment, {
|
|
113
|
+
...simpleOptions,
|
|
114
|
+
framework: {
|
|
115
|
+
...simpleOptions.framework,
|
|
116
|
+
id: 'react',
|
|
117
|
+
},
|
|
118
|
+
install: false,
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
expect(output.commands).not.toContainEqual({
|
|
122
|
+
command: 'pnpm',
|
|
123
|
+
args: ['generate-routes'],
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
|
|
91
127
|
it('should create an app - with a add-on', async () => {
|
|
92
128
|
const { environment, output } = createMemoryEnvironment()
|
|
93
129
|
await createApp(environment, {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
|
|
3
|
+
const blockedModules = [
|
|
4
|
+
'node:fs',
|
|
5
|
+
'node:fs/promises',
|
|
6
|
+
'node:path',
|
|
7
|
+
'node:url',
|
|
8
|
+
'execa',
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
describe('@tanstack/create/edge import', () => {
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
for (const moduleName of blockedModules) {
|
|
14
|
+
vi.doUnmock(moduleName)
|
|
15
|
+
}
|
|
16
|
+
vi.resetModules()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('does not import Node-only modules', async () => {
|
|
20
|
+
vi.resetModules()
|
|
21
|
+
for (const moduleName of blockedModules) {
|
|
22
|
+
vi.doMock(moduleName, () => {
|
|
23
|
+
throw new Error(`${moduleName} is unavailable`)
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const edge = await import('../src/edge.js')
|
|
28
|
+
|
|
29
|
+
expect(edge.getFrameworkById('react')?.id).toBe('react')
|
|
30
|
+
})
|
|
31
|
+
})
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createApp,
|
|
5
|
+
createMemoryEnvironment,
|
|
6
|
+
finalizeAddOns,
|
|
7
|
+
getAllAddOns,
|
|
8
|
+
getFrameworkById,
|
|
9
|
+
populateAddOnOptionsDefaults,
|
|
10
|
+
} from '../src/edge.js'
|
|
11
|
+
import { getAllAddOns as getAllNodeAddOns } from '../src/add-ons.js'
|
|
12
|
+
import { createFrameworkDefinition as createReactFrameworkDefinition } from '../src/frameworks/react/index.js'
|
|
13
|
+
import { createFrameworkDefinition as createSolidFrameworkDefinition } from '../src/frameworks/solid/index.js'
|
|
14
|
+
|
|
15
|
+
import type {
|
|
16
|
+
AddOn,
|
|
17
|
+
Framework,
|
|
18
|
+
FrameworkDefinition,
|
|
19
|
+
Options,
|
|
20
|
+
} from '../src/types.js'
|
|
21
|
+
|
|
22
|
+
function frameworkFromDefinition(definition: FrameworkDefinition): Framework {
|
|
23
|
+
const { addOns, base, ...rest } = definition
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
...rest,
|
|
27
|
+
getFiles: () => Promise.resolve(Object.keys(base)),
|
|
28
|
+
getFileContents: (path: string) => Promise.resolve(base[path]),
|
|
29
|
+
getDeletedFiles: () => Promise.resolve([]),
|
|
30
|
+
getAddOns: () => addOns,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function materializeFiles(bundle: {
|
|
35
|
+
getFiles: () => Promise<Array<string>>
|
|
36
|
+
getFileContents: (path: string) => Promise<string>
|
|
37
|
+
}) {
|
|
38
|
+
const files: Record<string, string> = {}
|
|
39
|
+
for (const file of (await bundle.getFiles()).sort()) {
|
|
40
|
+
files[file] = await bundle.getFileContents(file)
|
|
41
|
+
}
|
|
42
|
+
return files
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function materializeAddOn(addOn: AddOn) {
|
|
46
|
+
const {
|
|
47
|
+
getFiles: _getFiles,
|
|
48
|
+
getFileContents: _getFileContents,
|
|
49
|
+
getDeletedFiles: _getDeletedFiles,
|
|
50
|
+
files: _files,
|
|
51
|
+
deletedFiles: _deletedFiles,
|
|
52
|
+
...metadata
|
|
53
|
+
} = addOn
|
|
54
|
+
|
|
55
|
+
return JSON.parse(
|
|
56
|
+
JSON.stringify({
|
|
57
|
+
...metadata,
|
|
58
|
+
files: await materializeFiles(addOn),
|
|
59
|
+
deletedFiles: (await addOn.getDeletedFiles()).sort(),
|
|
60
|
+
}),
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function materializeAddOns(addOns: Array<AddOn>) {
|
|
65
|
+
const materialized = await Promise.all(addOns.map(materializeAddOn))
|
|
66
|
+
return materialized.sort((a, b) => a.id.localeCompare(b.id))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
describe('@tanstack/create/edge manifest', () => {
|
|
70
|
+
it.each([
|
|
71
|
+
['react', createReactFrameworkDefinition],
|
|
72
|
+
['solid', createSolidFrameworkDefinition],
|
|
73
|
+
])('matches the Node-scanned %s framework catalog', async (frameworkId, scan) => {
|
|
74
|
+
const nodeDefinition = scan()
|
|
75
|
+
const nodeFramework = frameworkFromDefinition(nodeDefinition)
|
|
76
|
+
const edgeFramework = getFrameworkById(frameworkId)
|
|
77
|
+
|
|
78
|
+
expect(edgeFramework).toBeDefined()
|
|
79
|
+
expect(edgeFramework?.id).toBe(nodeDefinition.id)
|
|
80
|
+
expect(edgeFramework?.name).toBe(nodeDefinition.name)
|
|
81
|
+
expect(edgeFramework?.description).toBe(nodeDefinition.description)
|
|
82
|
+
expect(edgeFramework?.version).toBe(nodeDefinition.version)
|
|
83
|
+
expect(edgeFramework?.supportedModes).toEqual(nodeDefinition.supportedModes)
|
|
84
|
+
expect(edgeFramework?.basePackageJSON).toEqual(
|
|
85
|
+
nodeDefinition.basePackageJSON,
|
|
86
|
+
)
|
|
87
|
+
expect(edgeFramework?.optionalPackages).toEqual(
|
|
88
|
+
nodeDefinition.optionalPackages,
|
|
89
|
+
)
|
|
90
|
+
expect(await materializeFiles(edgeFramework!)).toEqual(nodeDefinition.base)
|
|
91
|
+
expect(await materializeAddOns(edgeFramework!.getAddOns())).toEqual(
|
|
92
|
+
await materializeAddOns(nodeFramework.getAddOns()),
|
|
93
|
+
)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('returns the same React add-ons as the Node filesystem-backed path', () => {
|
|
97
|
+
const nodeFramework = frameworkFromDefinition(createReactFrameworkDefinition())
|
|
98
|
+
const edgeFramework = getFrameworkById('react')
|
|
99
|
+
|
|
100
|
+
expect(edgeFramework).toBeDefined()
|
|
101
|
+
expect(getAllAddOns(edgeFramework!, 'file-router').map((addOn) => addOn.id))
|
|
102
|
+
.toEqual(
|
|
103
|
+
getAllNodeAddOns(nodeFramework, 'file-router').map((addOn) => addOn.id),
|
|
104
|
+
)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('generates a React app from the manifest-backed catalog', async () => {
|
|
108
|
+
vi.stubGlobal(
|
|
109
|
+
'fetch',
|
|
110
|
+
vi.fn(async () => {
|
|
111
|
+
return new Response(JSON.stringify({ version: '1.0.0' }), {
|
|
112
|
+
status: 200,
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
const framework = getFrameworkById('react')
|
|
118
|
+
expect(framework).toBeDefined()
|
|
119
|
+
|
|
120
|
+
const featureIds = getAllAddOns(framework!, 'file-router').map(
|
|
121
|
+
(addOn) => addOn.id,
|
|
122
|
+
)
|
|
123
|
+
expect(featureIds).toContain('tanstack-query')
|
|
124
|
+
expect(featureIds).toContain('clerk')
|
|
125
|
+
expect(featureIds).toContain('cloudflare')
|
|
126
|
+
|
|
127
|
+
const chosenAddOns = await finalizeAddOns(framework!, 'file-router', [
|
|
128
|
+
'tanstack-query',
|
|
129
|
+
'clerk',
|
|
130
|
+
'cloudflare',
|
|
131
|
+
'biome',
|
|
132
|
+
])
|
|
133
|
+
const addOnOptions = populateAddOnOptionsDefaults(chosenAddOns)
|
|
134
|
+
const { environment, output } = createMemoryEnvironment('/worker-app')
|
|
135
|
+
|
|
136
|
+
await createApp(environment, {
|
|
137
|
+
projectName: 'worker-app',
|
|
138
|
+
targetDir: '/worker-app',
|
|
139
|
+
framework: framework!,
|
|
140
|
+
mode: 'file-router',
|
|
141
|
+
typescript: true,
|
|
142
|
+
tailwind: true,
|
|
143
|
+
packageManager: 'pnpm',
|
|
144
|
+
git: false,
|
|
145
|
+
install: false,
|
|
146
|
+
intent: false,
|
|
147
|
+
chosenAddOns,
|
|
148
|
+
addOnOptions,
|
|
149
|
+
includeExamples: false,
|
|
150
|
+
} satisfies Options)
|
|
151
|
+
|
|
152
|
+
const packageJSON = JSON.parse(output.files['package.json'])
|
|
153
|
+
|
|
154
|
+
expect(packageJSON.scripts.dev).toBe('vite dev --port 3000')
|
|
155
|
+
expect(packageJSON.scripts.deploy).toBe(
|
|
156
|
+
'pnpm run build && wrangler deploy',
|
|
157
|
+
)
|
|
158
|
+
expect(packageJSON.dependencies).toHaveProperty('@tanstack/react-start')
|
|
159
|
+
expect(packageJSON.dependencies).toHaveProperty('@tanstack/react-query')
|
|
160
|
+
expect(packageJSON.dependencies).toHaveProperty('@clerk/clerk-react')
|
|
161
|
+
expect(packageJSON.devDependencies).toHaveProperty('wrangler')
|
|
162
|
+
expect(output.files['wrangler.jsonc']).toContain('tanstack-start-app')
|
|
163
|
+
expect(output.files['.env.example']).toContain(
|
|
164
|
+
'VITE_CLERK_PUBLISHABLE_KEY=',
|
|
165
|
+
)
|
|
166
|
+
expect(output.files['src/routes/index.tsx']).toContain('createFileRoute')
|
|
167
|
+
})
|
|
168
|
+
})
|
|
@@ -7,9 +7,28 @@ describe('framework templates', () => {
|
|
|
7
7
|
it.each([
|
|
8
8
|
['React', createReactFrameworkDefinition],
|
|
9
9
|
['Solid', createSolidFrameworkDefinition],
|
|
10
|
-
])(
|
|
10
|
+
])(
|
|
11
|
+
'%s gitignore does not exclude the generated route tree',
|
|
12
|
+
(_, createDefinition) => {
|
|
13
|
+
const framework = createDefinition()
|
|
14
|
+
|
|
15
|
+
expect(framework.base._dot_gitignore).not.toContain(
|
|
16
|
+
'src/routeTree.gen.ts',
|
|
17
|
+
)
|
|
18
|
+
},
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
it.each([
|
|
22
|
+
['React', createReactFrameworkDefinition],
|
|
23
|
+
['Solid', createSolidFrameworkDefinition],
|
|
24
|
+
])('%s includes route generation tooling', (_, createDefinition) => {
|
|
11
25
|
const framework = createDefinition()
|
|
12
26
|
|
|
13
|
-
expect(framework.base.
|
|
27
|
+
expect(framework.base['package.json']).toContain(
|
|
28
|
+
'"generate-routes": "tsr generate"',
|
|
29
|
+
)
|
|
30
|
+
expect(
|
|
31
|
+
framework.optionalPackages['file-router'].devDependencies,
|
|
32
|
+
).toHaveProperty('@tanstack/router-cli')
|
|
14
33
|
})
|
|
15
34
|
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
5
|
-
addons: [],
|
|
6
|
-
framework: {
|
|
7
|
-
name: "@storybook/react-vite",
|
|
8
|
-
options: {},
|
|
9
|
-
},
|
|
10
|
-
async viteFinal(config) {
|
|
11
|
-
const { default: tailwindcss } = await import("@tailwindcss/vite");
|
|
12
|
-
config.plugins = config.plugins || [];
|
|
13
|
-
config.plugins.push(tailwindcss());
|
|
14
|
-
return config;
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
export default config;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Preview } from "@storybook/react-vite";
|
|
2
|
-
import "../src/styles.css";
|
|
3
|
-
|
|
4
|
-
const preview: Preview = {
|
|
5
|
-
parameters: {
|
|
6
|
-
controls: {
|
|
7
|
-
matchers: {
|
|
8
|
-
color: /(background|color)$/i,
|
|
9
|
-
date: /Date$/i,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default preview;
|
package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/button.stories.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn } from "storybook/test";
|
|
3
|
-
|
|
4
|
-
import { Button } from "./button";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/Button",
|
|
8
|
-
component: Button,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
args: { onClick: fn() },
|
|
14
|
-
} satisfies Meta<typeof Button>;
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
export const Primary: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
variant: "primary",
|
|
22
|
-
children: "Primary Button",
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Secondary: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
variant: "secondary",
|
|
29
|
-
children: "Secondary Button",
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Danger: Story = {
|
|
34
|
-
args: {
|
|
35
|
-
variant: "danger",
|
|
36
|
-
children: "Delete Account",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Small: Story = {
|
|
41
|
-
args: {
|
|
42
|
-
size: "small",
|
|
43
|
-
children: "Small Button",
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const Medium: Story = {
|
|
48
|
-
args: {
|
|
49
|
-
size: "medium",
|
|
50
|
-
children: "Medium Button",
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Large: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
size: "large",
|
|
57
|
-
children: "Large Button",
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Disabled: Story = {
|
|
62
|
-
args: {
|
|
63
|
-
variant: "primary",
|
|
64
|
-
children: "Disabled Button",
|
|
65
|
-
disabled: true,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface ButtonProps {
|
|
4
|
-
variant?: 'primary' | 'secondary' | 'danger'
|
|
5
|
-
size?: 'small' | 'medium' | 'large'
|
|
6
|
-
children: React.ReactNode
|
|
7
|
-
onClick?: () => void
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
type?: 'button' | 'submit' | 'reset'
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Button: React.FC<ButtonProps> = ({
|
|
14
|
-
variant = 'primary',
|
|
15
|
-
size = 'medium',
|
|
16
|
-
children,
|
|
17
|
-
onClick,
|
|
18
|
-
disabled = false,
|
|
19
|
-
type = 'button',
|
|
20
|
-
className = '',
|
|
21
|
-
}) => {
|
|
22
|
-
const baseStyles =
|
|
23
|
-
'demo-button disabled:opacity-50 disabled:cursor-not-allowed'
|
|
24
|
-
|
|
25
|
-
const variantStyles = {
|
|
26
|
-
primary: '',
|
|
27
|
-
secondary: 'demo-button-secondary',
|
|
28
|
-
danger: 'demo-button-danger',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const sizeStyles = {
|
|
32
|
-
small: 'px-3 py-1.5 text-sm',
|
|
33
|
-
medium: 'px-4 py-2 text-base',
|
|
34
|
-
large: 'px-6 py-3 text-lg',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<button
|
|
39
|
-
type={type}
|
|
40
|
-
onClick={onClick}
|
|
41
|
-
disabled={disabled}
|
|
42
|
-
className={`${baseStyles} ${variantStyles[variant]} ${sizeStyles[size]} ${className}`}
|
|
43
|
-
>
|
|
44
|
-
{children}
|
|
45
|
-
</button>
|
|
46
|
-
)
|
|
47
|
-
}
|
package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/dialog.stories.tsx
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
|
|
3
|
-
import { Dialog } from "./dialog";
|
|
4
|
-
import { Button } from "./button";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/Dialog",
|
|
8
|
-
component: Dialog,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
} satisfies Meta<typeof Dialog>;
|
|
14
|
-
|
|
15
|
-
export default meta;
|
|
16
|
-
type Story = StoryObj<typeof meta>;
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
args: {
|
|
20
|
-
title: "User Profile",
|
|
21
|
-
children: (
|
|
22
|
-
<div className="space-y-4">
|
|
23
|
-
<p className="text-gray-700 dark:text-gray-300">
|
|
24
|
-
This is a simple dialog component with a title and content area.
|
|
25
|
-
</p>
|
|
26
|
-
</div>
|
|
27
|
-
),
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const WithFooter: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
title: "Confirm Action",
|
|
34
|
-
children: (
|
|
35
|
-
<div className="space-y-4">
|
|
36
|
-
<p className="text-gray-700 dark:text-gray-300">
|
|
37
|
-
Are you sure you want to proceed with this action?
|
|
38
|
-
</p>
|
|
39
|
-
</div>
|
|
40
|
-
),
|
|
41
|
-
footer: (
|
|
42
|
-
<div className="flex gap-3 justify-end">
|
|
43
|
-
<Button variant="secondary" size="medium">
|
|
44
|
-
Cancel
|
|
45
|
-
</Button>
|
|
46
|
-
<Button variant="primary" size="medium">
|
|
47
|
-
Confirm
|
|
48
|
-
</Button>
|
|
49
|
-
</div>
|
|
50
|
-
),
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Form: Story = {
|
|
55
|
-
args: {
|
|
56
|
-
title: "Create Account",
|
|
57
|
-
children: (
|
|
58
|
-
<div className="space-y-4 min-w-80">
|
|
59
|
-
<div className="flex flex-col gap-2">
|
|
60
|
-
<label className="text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
61
|
-
Email
|
|
62
|
-
</label>
|
|
63
|
-
<input
|
|
64
|
-
type="email"
|
|
65
|
-
placeholder="you@example.com"
|
|
66
|
-
className="px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
<div className="flex flex-col gap-2">
|
|
70
|
-
<label className="text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
71
|
-
Password
|
|
72
|
-
</label>
|
|
73
|
-
<input
|
|
74
|
-
type="password"
|
|
75
|
-
placeholder="••••••••"
|
|
76
|
-
className="px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100"
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
),
|
|
81
|
-
footer: (
|
|
82
|
-
<div className="flex gap-3 justify-end">
|
|
83
|
-
<Button variant="secondary" size="medium">
|
|
84
|
-
Cancel
|
|
85
|
-
</Button>
|
|
86
|
-
<Button variant="primary" size="medium">
|
|
87
|
-
Create Account
|
|
88
|
-
</Button>
|
|
89
|
-
</div>
|
|
90
|
-
),
|
|
91
|
-
},
|
|
92
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface DialogProps {
|
|
4
|
-
title: string
|
|
5
|
-
children: React.ReactNode
|
|
6
|
-
footer?: React.ReactNode
|
|
7
|
-
className?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const Dialog: React.FC<DialogProps> = ({
|
|
11
|
-
title,
|
|
12
|
-
children,
|
|
13
|
-
footer,
|
|
14
|
-
className = '',
|
|
15
|
-
}) => {
|
|
16
|
-
return (
|
|
17
|
-
<div className={`demo-panel overflow-hidden p-0 ${className}`}>
|
|
18
|
-
<div className="border-b border-[var(--line)] px-6 py-4">
|
|
19
|
-
<h2 className="demo-section-title">{title}</h2>
|
|
20
|
-
</div>
|
|
21
|
-
<div className="px-6 py-6">{children}</div>
|
|
22
|
-
{footer && (
|
|
23
|
-
<div className="border-t border-[var(--line)] bg-[var(--chip-bg)] px-6 py-4">
|
|
24
|
-
{footer}
|
|
25
|
-
</div>
|
|
26
|
-
)}
|
|
27
|
-
</div>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { Input } from "./input";
|
|
2
|
-
export type { InputProps } from "./input";
|
|
3
|
-
|
|
4
|
-
export { RadioGroup } from "./radio-group";
|
|
5
|
-
export type { RadioGroupProps, RadioOption } from "./radio-group";
|
|
6
|
-
|
|
7
|
-
export { Slider } from "./slider";
|
|
8
|
-
export type { SliderProps } from "./slider";
|
|
9
|
-
|
|
10
|
-
export { Dialog } from "./dialog";
|
|
11
|
-
export type { DialogProps } from "./dialog";
|
|
12
|
-
|
|
13
|
-
export { Button } from "./button";
|
|
14
|
-
export type { ButtonProps } from "./button";
|
package/dist/frameworks/react/add-ons/storybook/assets/src/components/storybook/input.stories.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { fn } from "storybook/test";
|
|
3
|
-
|
|
4
|
-
import { Input } from "./input";
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Form/Input",
|
|
8
|
-
component: Input,
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: "centered",
|
|
11
|
-
},
|
|
12
|
-
tags: ["autodocs"],
|
|
13
|
-
args: { onChange: fn() },
|
|
14
|
-
} satisfies Meta<typeof Input>;
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
export const Default: Story = {
|
|
20
|
-
args: {
|
|
21
|
-
label: "Email Address",
|
|
22
|
-
id: "email",
|
|
23
|
-
placeholder: "Enter your email",
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Required: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
label: "First Name",
|
|
30
|
-
id: "firstName",
|
|
31
|
-
placeholder: "John",
|
|
32
|
-
required: true,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const WithValue: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
label: "Last Name",
|
|
39
|
-
id: "lastName",
|
|
40
|
-
value: "Doe",
|
|
41
|
-
placeholder: "Enter last name",
|
|
42
|
-
},
|
|
43
|
-
};
|