Skip to content

Commit 877222e

Browse files
authoredFeb 28, 2023
fix(nodebox): consider new files from Sandpack (#778)
1 parent 373ab43 commit 877222e

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed
 

‎.codesandbox/ci.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"packages": ["sandpack-client", "sandpack-react"],
3-
"sandboxes": ["sowx8r", "909l3f"],
3+
"sandboxes": ["sowx8r"],
44
"node": "16"
55
}

‎sandpack-client/src/clients/node/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,10 @@ export class SandpackNode extends SandpackClient {
366366
*/
367367
if (this.emulatorShellProcess?.state === "running") {
368368
Object.entries(modules).forEach(([key, value]) => {
369-
if (Buffer.compare(value, this._modulesCache.get(key)) !== 0) {
369+
if (
370+
!this._modulesCache.get(key) ||
371+
Buffer.compare(value, this._modulesCache.get(key)) !== 0
372+
) {
370373
this.emulator.fs.writeFile(key, value);
371374
}
372375
});

‎sandpack-react/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"prebuild": "yarn run clean",
2121
"test": "TEST_ENV=true jest . --transformIgnorePatterns \"node_modules/(?!@codemirror)/\" --modulePathIgnorePatterns \"e2e\"",
2222
"lint": "eslint '**/*.ts?(x)' --fix",
23-
"build": "rollup -c",
23+
"build": "rollup -c && yarn build:types",
24+
"build:types": "tsc -p tsconfig.json",
2425
"build:publish": "yarn build",
2526
"start": "tsc -p tsconfig.esm.json --watch",
2627
"dev": "start-storybook -p 6006 --quiet",
+11-17
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import * as themes from "@codesandbox/sandpack-themes";
33
import React from "react";
4-
5-
import { Sandpack } from "./presets";
4+
import { SandpackProvider } from ".";
5+
import {
6+
SandpackCodeEditor,
7+
SandpackFileExplorer,
8+
SandpackPreview,
9+
} from "./components";
610

711
export default {
812
title: "Intro/Playground",
913
};
1014

1115
export const Basic: React.FC = () => {
12-
const [text, setText] = React.useState("world");
1316
return (
1417
<>
15-
<input
16-
defaultValue={text}
17-
onChange={({ target }) => setText(target.value)}
18-
/>
19-
<Sandpack
20-
files={{
21-
"App.js": `export default function App() {
22-
return <h1>Hello ${text}</h1>
23-
}
24-
`,
25-
}}
26-
template="react"
27-
theme={themes.sandpackDark}
28-
/>
18+
<SandpackProvider template="nextjs" theme={themes.sandpackDark}>
19+
<SandpackFileExplorer />
20+
<SandpackCodeEditor />
21+
<SandpackPreview />
22+
</SandpackProvider>
2923
</>
3024
);
3125
};

‎sandpack-themes/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"scripts": {
1717
"clean": "rm -rf dist",
1818
"prebuild": "yarn run clean",
19-
"build": "rollup -c",
19+
"build": "rollup -c && yarn build:types",
20+
"build:types": "tsc -p tsconfig.json",
2021
"build:publish": "yarn build",
2122
"typecheck": "tsc"
2223
},

1 commit comments

Comments
 (1)

vercel[bot] commented on Feb 28, 2023

@vercel[bot]

Successfully deployed to the following URLs:

sandpack-docs – ./website/docs

sandpack.vercel.app
sandpack-docs-git-main-codesandbox1.vercel.app
sandpack-docs-codesandbox1.vercel.app

Please sign in to comment.