Skip to content

Commit 580729d

Browse files
authored
[WIP] Sandpack (codesandbox#626)
Sandpack Progress
1 parent c90e1d1 commit 580729d

File tree

165 files changed

+8126
-1689
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+8126
-1689
lines changed

.circleci/config.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@ jobs:
99
- checkout
1010
- restore_cache:
1111
keys:
12-
- v4-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13-
- v4-dependency-cache-{{ .Branch }}
14-
- v4-dependency-cache
12+
- v6-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13+
- v6-dependency-cache-{{ .Branch }}
14+
- v6-dependency-cache
1515
- restore_cache:
1616
keys:
17-
- v4-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
18-
- v4-standalone-dependency-cache-{{ .Branch }}
19-
- v4-standalone-dependency-cache
17+
- v6-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
18+
- v6-standalone-dependency-cache-{{ .Branch }}
19+
- v6-standalone-dependency-cache
2020
- run:
2121
name: Install Dependencies
2222
command: yarn install
2323
- save_cache:
24-
key: v4-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
24+
key: v6-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
2525
paths:
2626
- node_modules
2727
- save_cache:
28-
key: v4-standalone-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
28+
key: v6-standalone-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
2929
paths:
3030
- standalone-packages/codesandbox-browserfs/node_modules
3131
- run:
3232
name: Build
3333
command: yarn build:dependents
3434
- save_cache:
35-
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
35+
key: v6-repo-{{ .Environment.CIRCLE_SHA1 }}
3636
paths:
3737
- ~/codesandbox-client
3838

@@ -42,19 +42,19 @@ jobs:
4242
working_directory: ~/codesandbox-client
4343
steps:
4444
- restore_cache:
45-
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
45+
key: v6-repo-{{ .Environment.CIRCLE_SHA1 }}
4646
# We do this to compare sizes from these builds with master
4747
- restore_cache:
48-
key: v4-prod-app-build-cache-master
48+
key: v6-prod-app-build-cache-master
4949
- run:
5050
name: Build Application
5151
command: yarn build:prod
5252
- save_cache:
53-
key: v4-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
53+
key: v6-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
5454
paths:
5555
- ./packages/app/www
5656
- save_cache:
57-
key: v4-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
57+
key: v6-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
5858
paths:
5959
- ./www
6060
- store_artifacts:
@@ -67,7 +67,7 @@ jobs:
6767
working_directory: ~/codesandbox-client
6868
steps:
6969
- restore_cache:
70-
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
70+
key: v6-repo-{{ .Environment.CIRCLE_SHA1 }}
7171
- run:
7272
name: Start Test Server
7373
command: yarn start:test
@@ -95,7 +95,7 @@ jobs:
9595
working_directory: ~/codesandbox-client
9696
steps:
9797
- restore_cache:
98-
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
98+
key: v6-repo-{{ .Environment.CIRCLE_SHA1 }}
9999
- run:
100100
name: Test
101101
command: yarn test --ci --testResultsProcessor="jest-junit"
@@ -108,7 +108,7 @@ jobs:
108108
working_directory: ~/codesandbox-client
109109
steps:
110110
- restore_cache:
111-
key: v4-repo-{{ .Environment.CIRCLE_SHA1 }}
111+
key: v6-repo-{{ .Environment.CIRCLE_SHA1 }}
112112
- run:
113113
name: Lint
114114
command: yarn lint
@@ -118,7 +118,7 @@ jobs:
118118
working_directory: ~/codesandbox-client
119119
steps:
120120
- restore_cache:
121-
key: v4-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
121+
key: v6-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
122122
- run:
123123
name: Docker Sign In
124124
command: echo $DOCKER_PWD | docker login -u $DOCKER_USER --password-stdin
@@ -155,9 +155,6 @@ workflows:
155155
requires:
156156
- build-dependencies
157157
- create-docker-image:
158-
filters:
159-
branches:
160-
only: master
161158
requires:
162159
- build-prod
163160
- lint

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CodeSandbox. An online code editor tailored for web application development.
2-
Copyright (C) 2017 Ives van Hoorne
2+
Copyright (C) 2018 Ives van Hoorne
33

44
This program is free software: you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"build": "yarn build:dependents && yarn build:prod",
88
"build:prod": "lerna run build --scope app --scope homepage --parallel && gulp",
9-
"build:dependents": "lerna run build --ignore app --ignore homepage --parallel",
9+
"build:dependents": "lerna run build --scope codesandbox-api --scope common --scope codesandbox-browserfs --stream && lerna run build --scope smooshpack --stream && lerna run build --scope react-smooshpack --stream",
1010
"start": "lerna run build --scope codesandbox-browserfs --stream && lerna run start --parallel",
1111
"start:fast": "lerna run start --scope app --stream",
1212
"start:test": "lerna run start:test --scope app --stream",
@@ -30,7 +30,9 @@
3030
"packages/homepage",
3131
"packages/app",
3232
"packages/common",
33-
"packages/codesandbox-api"
33+
"packages/codesandbox-api",
34+
"packages/sandpack",
35+
"packages/react-sandpack"
3436
],
3537
"devDependencies": {
3638
"all-contributors-cli": "^4.3.0",

packages/app/config/env.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
22
// injected into the application via DefinePlugin in Webpack configuration.
3+
const getHost = require('./host');
34

45
const REACT_APP = /^REACT_APP_/i;
56
const NODE_ENV = JSON.stringify(process.env.NODE_ENV || 'development');
67
const LOCAL_SERVER = !!JSON.stringify(process.env.LOCAL_SERVER);
78

8-
const getHost = () => {
9-
if (LOCAL_SERVER) {
10-
return 'http://localhost:3000';
11-
}
12-
13-
if (process.env.NODE_ENV === 'development') {
14-
return 'https://codesandbox.dev';
15-
}
16-
17-
if ('STAGING_BRANCH' in process.env) {
18-
return `http://${process.env.STAGING_BRANCH}.cs.lbogdan.tk`;
19-
}
20-
21-
if ('ROOT_URL' in process.env) {
22-
return process.env.ROOT_URL;
23-
}
24-
25-
return 'https://codesandbox.io';
26-
};
27-
289
module.exports = Object.keys(process.env)
2910
.filter(key => REACT_APP.test(key))
3011
.reduce(

packages/app/config/host.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const LOCAL_SERVER = !!JSON.stringify(process.env.LOCAL_SERVER);
2+
3+
module.exports = () => {
4+
if (LOCAL_SERVER) {
5+
return 'http://localhost:3000';
6+
}
7+
8+
if (process.env.NODE_ENV === 'development') {
9+
return 'https://codesandbox.dev';
10+
}
11+
12+
if ('STAGING_BRANCH' in process.env) {
13+
return `http://${process.env.STAGING_BRANCH}.cs.lbogdan.tk`;
14+
}
15+
16+
if ('ROOT_URL' in process.env) {
17+
return process.env.ROOT_URL;
18+
}
19+
20+
return 'https://codesandbox.io';
21+
};

0 commit comments

Comments
 (0)