Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz committed Feb 17, 2022
2 parents 1f05358 + da6ede9 commit 0a5a9ef
Show file tree
Hide file tree
Showing 128 changed files with 10,806 additions and 4,871 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dist/
esm/
sandpack/
file-resolver-protocol.ts
file-resolver-protocol.ts
examples/
cypress/
2 changes: 1 addition & 1 deletion .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Setup | Authenticate with Registry
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Setup | Install dependencies
run: yarn install --frozen-lockfile
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Install dependencies and cache
uses: bahmutov/npm-install@v1
Expand All @@ -60,7 +60,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Install dependencies and cache
uses: bahmutov/npm-install@v1
Expand All @@ -81,7 +81,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Install dependencies and cache
uses: bahmutov/npm-install@v1
Expand All @@ -102,7 +102,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Install dependencies and cache
uses: bahmutov/npm-install@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Install dependencies and cache
uses: bahmutov/npm-install@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Setup | Authenticate with Registry
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sizebot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup | Node.js
uses: actions/setup-node@v2
with:
node-version: "14.16.1"
node-version: "14.17.0"

- name: Install dependencies and cache
uses: bahmutov/npm-install@v1
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
v14.17.0
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ React components that give you the power of editable sandboxes that run in the b

```jsx
import { Sandpack } from "@codesandbox/sandpack-react";
import "@codesandbox/sandpack-react/dist/index.css";

<Sandpack template="react" />;
```
Expand All @@ -34,7 +33,7 @@ Start with the [Sandpack introduction](https://sandpack.codesandbox.io/docs) pag

The documentation is divided into following sections:

- [Getting Started](https://sandpack.codesandbox.io/docs/getting-started/install)
- [Advanced Guides](https://sandpack.codesandbox.io/docs/advanced-usage/provider)
- [API reference](https://sandpack.codesandbox.io/docs/api/client)
- [Releases](https://sandpack.codesandbox.io/docs/releases)
- [Getting Started](https://sandpack.codesandbox.io/docs/getting-started/install)
- [Advanced Guides](https://sandpack.codesandbox.io/docs/advanced-usage/provider)
- [API reference](https://sandpack.codesandbox.io/docs/api/client)
- [Releases](https://sandpack.codesandbox.io/docs/releases)
6 changes: 3 additions & 3 deletions cypress/integration/CodeMirror.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe("CodeMirror", () => {
const languages = ["html", "javascript", "jsx", "css", "less", "vue"];
import * as mocks from "../../sandpack-react/src/components/CodeEditor/languages-mocks";

languages.forEach((lang, index) => {
describe("CodeMirror", () => {
Object.keys(mocks).forEach((lang, index) => {
it(`Should render a "${lang}" component with a proper syntax-highlight`, () => {
cy.viewport(600, 1000).visit(
`/iframe.html?id=components-codemirror--${lang}`
Expand Down
36 changes: 18 additions & 18 deletions cypress/snapshots.js

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions examples/cra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions examples/cra/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "cra",
"version": "0.1.0",
"private": true,
"dependencies": {
"@codesandbox/sandpack-react": "*",
"@codesandbox/sandpack-themes": "*",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.17",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0",
"typescript": "^4.5.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added examples/cra/public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions examples/cra/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added examples/cra/public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/cra/public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions examples/cra/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
15 changes: 15 additions & 0 deletions examples/cra/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Sandpack } from "@codesandbox/sandpack-react";
import { githubLightTheme, sandpackDark } from "@codesandbox/sandpack-themes";

const Home = () => {
return (
<div>
<Sandpack />
<Sandpack theme="dark" />
<Sandpack theme={githubLightTheme} />
<Sandpack options={{ readOnly: true }} theme={sandpackDark} />
</div>
);
};

export default Home;
10 changes: 10 additions & 0 deletions examples/cra/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
26 changes: 26 additions & 0 deletions examples/cra/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
3 changes: 3 additions & 0 deletions examples/gatsby/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
.cache/
public
7 changes: 7 additions & 0 deletions examples/gatsby/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
siteMetadata: {
siteUrl: "https://www.yourdomain.tld",
title: "gatsby",
},
plugins: [],
};
13 changes: 13 additions & 0 deletions examples/gatsby/gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from "react";
import { getSandpackCssText } from "@codesandbox/sandpack-react";

export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<style
id="sandpack"
dangerouslySetInnerHTML={{
__html: getSandpackCssText(),
}}
/>,
]);
};
24 changes: 24 additions & 0 deletions examples/gatsby/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "gatsby",
"version": "1.0.0",
"private": true,
"description": "gatsby",
"author": "Danilo Woznica",
"keywords": [
"gatsby"
],
"scripts": {
"develop": "gatsby develop",
"start": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
"clean": "gatsby clean"
},
"dependencies": {
"@codesandbox/sandpack-react": "*",
"@codesandbox/sandpack-themes": "*",
"gatsby": "^4.4.0",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
}
15 changes: 15 additions & 0 deletions examples/gatsby/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Sandpack } from "@codesandbox/sandpack-react";
import { githubLightTheme, sandpackDark } from "@codesandbox/sandpack-themes";

const Home = () => {
return (
<div>
<Sandpack />
<Sandpack theme="dark" />
<Sandpack theme={githubLightTheme} />
<Sandpack options={{ readOnly: true }} theme={sandpackDark} />
</div>
);
};

export default Home;
6 changes: 6 additions & 0 deletions examples/nextjs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
Loading

0 comments on commit 0a5a9ef

Please sign in to comment.