From 28765d3a7f186c8406c6d081486c3decd982db9a Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 28 Feb 2023 15:38:50 +0000 Subject: [PATCH 1/3] Update index.ts and Playground.stories.tsx --- sandpack-client/src/clients/node/index.ts | 5 +++- sandpack-react/src/Playground.stories.tsx | 28 +++++++++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/sandpack-client/src/clients/node/index.ts b/sandpack-client/src/clients/node/index.ts index df9988157..a426e17a2 100644 --- a/sandpack-client/src/clients/node/index.ts +++ b/sandpack-client/src/clients/node/index.ts @@ -366,7 +366,10 @@ export class SandpackNode extends SandpackClient { */ if (this.emulatorShellProcess?.state === "running") { Object.entries(modules).forEach(([key, value]) => { - if (Buffer.compare(value, this._modulesCache.get(key)) !== 0) { + if ( + !this._modulesCache.get(key) || + Buffer.compare(value, this._modulesCache.get(key)) !== 0 + ) { this.emulator.fs.writeFile(key, value); } }); diff --git a/sandpack-react/src/Playground.stories.tsx b/sandpack-react/src/Playground.stories.tsx index 19a211578..127f57d64 100644 --- a/sandpack-react/src/Playground.stories.tsx +++ b/sandpack-react/src/Playground.stories.tsx @@ -1,31 +1,25 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import * as themes from "@codesandbox/sandpack-themes"; import React from "react"; - -import { Sandpack } from "./presets"; +import { SandpackProvider } from "."; +import { + SandpackCodeEditor, + SandpackFileExplorer, + SandpackPreview, +} from "./components"; export default { title: "Intro/Playground", }; export const Basic: React.FC = () => { - const [text, setText] = React.useState("world"); return ( <> - setText(target.value)} - /> - Hello ${text} -} -`, - }} - template="react" - theme={themes.sandpackDark} - /> + + + + + ); }; From 5a07f26d9a8aa27a1f299c8f8969a26874575ac3 Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 28 Feb 2023 15:45:13 +0000 Subject: [PATCH 2/3] Update ci.json and package.json --- .codesandbox/ci.json | 2 +- sandpack-react/package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index fabf52bc2..8678701e7 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -1,5 +1,5 @@ { "packages": ["sandpack-client", "sandpack-react"], - "sandboxes": ["sowx8r", "909l3f"], + "sandboxes": ["sowx8r"], "node": "16" } diff --git a/sandpack-react/package.json b/sandpack-react/package.json index 1b0ddfb6d..a3f206810 100644 --- a/sandpack-react/package.json +++ b/sandpack-react/package.json @@ -20,7 +20,8 @@ "prebuild": "yarn run clean", "test": "TEST_ENV=true jest . --transformIgnorePatterns \"node_modules/(?!@codemirror)/\" --modulePathIgnorePatterns \"e2e\"", "lint": "eslint '**/*.ts?(x)' --fix", - "build": "rollup -c", + "build": "rollup -c && yarn build:types", + "build:types": "tsc -p tsconfig.json", "build:publish": "yarn build", "start": "tsc -p tsconfig.esm.json --watch", "dev": "start-storybook -p 6006 --quiet", From b1ba4c48974d98059c36ef1876c6502942f04a51 Mon Sep 17 00:00:00 2001 From: Danilo Woznica Date: Tue, 28 Feb 2023 15:48:43 +0000 Subject: [PATCH 3/3] Update package.json --- sandpack-themes/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sandpack-themes/package.json b/sandpack-themes/package.json index bb724c965..9cdbd184a 100644 --- a/sandpack-themes/package.json +++ b/sandpack-themes/package.json @@ -16,7 +16,8 @@ "scripts": { "clean": "rm -rf dist", "prebuild": "yarn run clean", - "build": "rollup -c", + "build": "rollup -c && yarn build:types", + "build:types": "tsc -p tsconfig.json", "build:publish": "yarn build", "typecheck": "tsc" },