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

Function getCodeSandboxFiles

packages/dev/s2-docs/src/CodeSandbox.tsx:70–202  ·  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

68};
69
70export function getCodeSandboxFiles(
71 files: DownloadFiles['files'],
72 deps: DownloadFiles['deps'],
73 type: 'vanilla' | 'tailwind' | 's2' = 'vanilla',
74 entry: string = 'Example'
75) {
76 let entryName = entry.split('/').pop()!.split('.')[0];
77 return {
78 '.codesandbox/tasks.json': {
79 content:
80 JSON.stringify(
81 {
82 setupTasks: [
83 {
84 name: 'Installing Dependencies',
85 command: 'pnpm install'
86 }
87 ],
88 tasks: {
89 start: {
90 name: 'start',
91 command: 'pnpm start',
92 runAtStart: true,
93 preview: {
94 port: 5173
95 }
96 },
97 build: {
98 name: 'build',
99 command: 'pnpm build',
100 runAtStart: false
101 }
102 }
103 },
104 null,
105 2
106 ) + '\n'
107 },
108 '.devcontainer/devcontainer.json': {
109 content:
110 JSON.stringify(
111 {
112 name: 'Devcontainer',
113 image: 'ghcr.io/codesandbox/devcontainers/typescript-node:latest'
114 },
115 null,
116 2
117 ) + '\n'
118 },
119 'package.json': {
120 content:
121 JSON.stringify(
122 {
123 name: type === 's2' ? 's2-starter' : 'react-aria-starter',
124 private: true,
125 version: '0.0.0',
126 source: 'src/index.html',
127 scripts: {

Callers 2

CodePlatterFunction · 0.90
createCodeSandboxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected