MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getFiles

Function getFiles

packages/dev/s2-docs/src/StackBlitz.tsx:47–156  ·  view source on GitHub ↗
(
  files: DownloadFiles['files'],
  deps: DownloadFiles['deps'],
  type: 'vanilla' | 'tailwind' | 's2' = 'vanilla',
  entry: string = 'Example'
)

Source from the content-addressed store, hash-verified

45}
46
47function getFiles(
48 files: DownloadFiles['files'],
49 deps: DownloadFiles['deps'],
50 type: 'vanilla' | 'tailwind' | 's2' = 'vanilla',
51 entry: string = 'Example'
52) {
53 let entryName = entry.split('/').pop()!.split('.')[0];
54 return {
55 'package.json':
56 JSON.stringify(
57 {
58 name: 'react-aria-starter',
59 private: true,
60 version: '0.0.0',
61 type: 'module',
62 scripts: {
63 dev: 'vite',
64 build: 'vite build',
65 preview: 'vite preview'
66 },
67 dependencies: {
68 react: '^19',
69 'react-dom': '^19',
70 ...(type === 's2' ? {'@react-spectrum/s2': 'latest'} : {}),
71 ...deps
72 },
73 devDependencies: {
74 '@types/react': '^19',
75 '@types/react-dom': '^19',
76 vite: '^6',
77 '@vitejs/plugin-react': '^4',
78 ...(type === 'tailwind'
79 ? {
80 tailwindcss: '^4',
81 '@tailwindcss/vite': '^4',
82 'tailwindcss-react-aria-components': '^2',
83 'tailwindcss-animate': '^1'
84 }
85 : {}),
86 ...(type === 's2'
87 ? {
88 'unplugin-parcel-macros': '^0.2.0'
89 }
90 : {})
91 }
92 },
93 null,
94 2
95 ) + '\n',
96 'vite.config.ts': `import {defineConfig} from 'vite';
97import react from '@vitejs/plugin-react';${type === 'tailwind' ? "\nimport tailwindcss from '@tailwindcss/vite';" : ''}${type === 's2' ? "\nimport macros from 'unplugin-parcel-macros';" : ''}
98
99export default defineConfig({
100 plugins: [${type === 's2' ? 'macros.vite(), ' : ''}react()${type === 'tailwind' ? ', tailwindcss()' : ''}],
101});
102`,
103 'index.html': `<!DOCTYPE html>
104<html lang="en">

Callers 1

createStackBlitzFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected