Skip to content

Commit 3215852

Browse files
authored
Editor Redesign & Extensions (codesandbox#1593)
1 parent a6aa73d commit 3215852

File tree

6,033 files changed

+2551780
-776895
lines changed

Some content is hidden

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

6,033 files changed

+2551780
-776895
lines changed

.circleci/config.yml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,42 @@ jobs:
99
- checkout
1010
- restore_cache:
1111
keys:
12-
- v14-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13-
- v14-dependency-cache-{{ .Branch }}
14-
- v14-dependency-cache
12+
- v17-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
13+
- v17-dependency-cache-{{ .Branch }}
14+
- v17-dependency-cache
1515
- restore_cache:
1616
keys:
17-
- v14-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
18-
- v14-standalone-dependency-cache-{{ .Branch }}
19-
- v14-standalone-dependency-cache
17+
- v17-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
18+
- v17-standalone-dependency-cache-{{ .Branch }}
19+
- v17-standalone-dependency-cache
2020
- run:
2121
name: Install Dependencies
2222
command: yarn install
2323
- save_cache:
24-
key: v14-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
24+
key: v17-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
2525
paths:
2626
- node_modules
2727
- packages/app/node_modules
28+
- packages/chrome-extension/node_modules
2829
- packages/codesandbox-api/node_modules
2930
- packages/common/node_modules
31+
- packages/dynamic-pages/node_modules
3032
- packages/homepage/node_modules
33+
- packages/node-services/node_modules
34+
- packages/react-embed/node_modules
3135
- packages/react-sandpack/node_modules
36+
- packages/sandbox-hooks/node_modules
3237
- packages/sandpack/node_modules
38+
- packages/sse-hooks/node_modules
3339
- save_cache:
34-
key: v14-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
40+
key: v17-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
3541
paths:
3642
- standalone-packages/codesandbox-browserfs/node_modules
3743
- run:
3844
name: Build
3945
command: yarn build:deps
4046
- save_cache:
41-
key: v14-repo-{{ .Environment.CIRCLE_SHA1 }}
47+
key: v17-repo-{{ .Environment.CIRCLE_SHA1 }}
4248
paths:
4349
- ~/codesandbox-client
4450

@@ -48,19 +54,19 @@ jobs:
4854
working_directory: ~/codesandbox-client
4955
steps:
5056
- restore_cache:
51-
key: v14-repo-{{ .Environment.CIRCLE_SHA1 }}
57+
key: v17-repo-{{ .Environment.CIRCLE_SHA1 }}
5258
# We do this to compare sizes from these builds with master
5359
- restore_cache:
54-
key: v14-prod-app-build-cache-master
60+
key: v17-prod-app-build-cache-master
5561
- run:
5662
name: Build Application
5763
command: yarn build:prod
5864
- save_cache:
59-
key: v14-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
65+
key: v17-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
6066
paths:
6167
- ./packages/app/www
6268
- save_cache:
63-
key: v14-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
69+
key: v17-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
6470
paths:
6571
- ./www
6672

@@ -70,7 +76,7 @@ jobs:
7076
working_directory: ~/codesandbox-client
7177
steps:
7278
- restore_cache:
73-
key: v14-repo-{{ .Environment.CIRCLE_SHA1 }}
79+
key: v17-repo-{{ .Environment.CIRCLE_SHA1 }}
7480
- run:
7581
name: Start Test Server
7682
command: yarn start:test
@@ -98,7 +104,7 @@ jobs:
98104
working_directory: ~/codesandbox-client
99105
steps:
100106
- restore_cache:
101-
key: v14-repo-{{ .Environment.CIRCLE_SHA1 }}
107+
key: v17-repo-{{ .Environment.CIRCLE_SHA1 }}
102108
- run:
103109
name: Test
104110
command: yarn test --ci --testResultsProcessor="jest-junit"
@@ -111,18 +117,29 @@ jobs:
111117
working_directory: ~/codesandbox-client
112118
steps:
113119
- restore_cache:
114-
key: v14-repo-{{ .Environment.CIRCLE_SHA1 }}
120+
key: v17-repo-{{ .Environment.CIRCLE_SHA1 }}
115121
- run:
116122
name: Lint
117123
command: yarn lint
118124

125+
typecheck:
126+
docker:
127+
- image: circleci/node:10
128+
working_directory: ~/codesandbox-client
129+
steps:
130+
- restore_cache:
131+
key: v17-repo-{{ .Environment.CIRCLE_SHA1 }}
132+
- run:
133+
name: Lint
134+
command: yarn typecheck
135+
119136
create-docker-image:
120137
machine: true
121138
working_directory: ~/codesandbox-client
122139
steps:
123140
- checkout
124141
- restore_cache:
125-
key: v14-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
142+
key: v17-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
126143
- run:
127144
name: Docker Sign In
128145
command: '[ -n "$DOCKER_USER" ] && echo $DOCKER_PWD | docker login -u $DOCKER_USER --password-stdin || true'
@@ -141,6 +158,9 @@ workflows:
141158
- test-integrations:
142159
requires:
143160
- build-dependencies
161+
- typecheck:
162+
requires:
163+
- build-dependencies
144164
- test-jest:
145165
requires:
146166
- build-dependencies

.eslintrc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"Raven": true,
1212
"VERSION": true,
1313
"$PropertyType": true,
14-
"TimeoutID": true
14+
"TimeoutID": true,
15+
"object": true,
16+
"__DEV__": true
1517
},
1618
"rules": {
1719
"react/jsx-filename-extension": 0,
@@ -28,6 +30,17 @@
2830
"no-nested-ternary": "warn",
2931
"react/require-default-props": "off",
3032
"import/no-named-default": 0,
31-
"no-param-reassign": ["error", { "props": false }]
33+
"import/no-webpack-loader-syntax": 0,
34+
"import/extensions": [
35+
"error",
36+
"always",
37+
{
38+
"ts": "never",
39+
"tsx": "never",
40+
"js": "never"
41+
}
42+
],
43+
"no-param-reassign": ["error", { "props": false }],
44+
"camelcase": "error"
3245
}
3346
}

Gulpfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ gulp.task('homepage', () =>
3232
gulp.task('monaco', () =>
3333
gulp
3434
.src('standalone-packages/monaco-editor/release/min/vs/**/*')
35-
.pipe(gulp.dest('www/public/13/vs'))
35+
.pipe(gulp.dest('www/public/14/vs'))
3636
);
3737

3838
// Used for cases where HTML is cached
3939
gulp.task('old-browserfs', () =>
4040
gulp
4141
.src('standalone-packages/codesandbox-browserfs/dist/**/*')
42-
.pipe(gulp.dest('www/static/browserfs'))
42+
.pipe(gulp.dest('www/static/browserfs2'))
4343
);
4444

4545
gulp.task('old-vscode', () =>
4646
gulp
4747
.src('standalone-packages/vscode-editor/release/min/vs/**/*')
48-
.pipe(gulp.dest('public/vscode8/vs'))
48+
.pipe(gulp.dest('www/public/vscode8/vs'))
4949
);
5050

5151
gulp.task('statics', () =>

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build:prod": "lerna run build --scope homepage --stream && lerna run build --scope app --stream && gulp",
99
"build:embed": "lerna run build:embed --scope app --stream && gulp",
1010
"build:clean": "lerna run build:clean --scope app --scope homepage && rimraf www",
11-
"build:deps": "lerna run build:dev --scope codesandbox-api --scope codesandbox-browserfs --scope node-services --scope common && lerna run build:dev --scope sse-hooks",
11+
"build:deps": "lerna run build:dev --scope common && lerna run build:dev --scope vscode-textmate --scope codesandbox-api --scope codesandbox-browserfs --scope node-services && lerna run build:dev --scope sse-hooks",
1212
"build:dynamic": "lerna run build --scope dynamic-pages --stream",
1313
"start": "yarn build:deps && lerna run start --scope app --stream",
1414
"start:fast": "lerna run start --scope app --stream",
@@ -24,7 +24,8 @@
2424
"add-contributor": "all-contributors add",
2525
"generate": "all-contributors generate",
2626
"precommit": "lint-staged",
27-
"postinstall": "rimraf packages/app/node_modules/styled-components node_modules/react-split-pane/node_modules/react* && cp -R node_modules/uglify-es node_modules/terser && yarn lerna run install-dependencies --scope codesandbox-browserfs --scope sse-loading-screen --stream && opencollective postinstall"
27+
"postinstall": "rimraf node_modules/@types packages/app/node_modules/styled-components node_modules/react-split-pane/node_modules/react* && cp -R node_modules/uglify-es node_modules/terser && yarn lerna run install-dependencies --scope vscode-textmate --scope codesandbox-browserfs --scope sse-loading-screen --stream && opencollective postinstall",
28+
"typecheck": "lerna run typecheck --scope app"
2829
},
2930
"lint-staged": {
3031
"*.{js,css,json}": [
@@ -55,9 +56,10 @@
5556
},
5657
"resolutions": {
5758
"uglify-es": "npm:terser",
58-
"react-split-pane/react-dom": "16.8.1"
59+
"react-split-pane/react-dom": "^16.8.3"
5960
},
6061
"devDependencies": {
62+
"@types/react": "^16.8.6",
6163
"all-contributors-cli": "^5.4.0",
6264
"babel-eslint": "^8.2.1",
6365
"eslint": "CompuIves/eslint#add/define-parser",

packages/app/config/webpack.common.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ module.exports = {
9898
loader: 'file-loader',
9999
type: 'javascript/auto',
100100
},
101+
{
102+
test: /\.scss$/,
103+
use: [
104+
'style-loader', // creates style nodes from JS strings
105+
'css-loader', // translates CSS into CommonJS
106+
'sass-loader', // compiles Sass to CSS, using Node Sass by default
107+
],
108+
},
101109
// Transpile node dependencies, node deps are often not transpiled for IE11
102110
{
103111
test: [
@@ -155,6 +163,12 @@ module.exports = {
155163
loader: 'happypack/loader',
156164
},
157165

166+
{
167+
test: /\.tsx?$/,
168+
exclude: [/node_modules/],
169+
loader: 'happypack/loader',
170+
},
171+
158172
// `eslint-plugin-vue/lib/index.js` depends on `fs` module we cannot use in browsers, so needs shimming.
159173
{
160174
test: new RegExp(`eslint-plugin-vue${sepRe}lib${sepRe}index\\.js$`),
@@ -419,6 +433,8 @@ module.exports = {
419433
// Makes some environment variables available to the JS code, for example:
420434
// if (process.env.NODE_ENV === 'development') { ... }. See `env.js`.
421435
new webpack.DefinePlugin(env.default),
436+
437+
new webpack.DefinePlugin({ __DEV__ }),
422438
// Watcher doesn't work well if you mistype casing in a path so we use
423439
// a plugin that prints an error when you attempt to do this.
424440
// See https://github.com/facebookincubator/create-react-app/issues/240
@@ -449,16 +465,30 @@ module.exports = {
449465
[
450466
{
451467
from: '../../standalone-packages/vscode-editor/release/min/vs',
452-
to: 'public/vscode9/vs',
468+
to: 'public/vscode11/vs',
469+
force: true,
470+
},
471+
{
472+
from: '../../standalone-packages/vscode-extensions/out',
473+
to: 'public/vscode-extensions/v1',
453474
force: true,
454475
},
455476
{
456477
from: '../../node_modules/onigasm/lib/onigasm.wasm',
457478
to: 'public/onigasm/2.2.1/onigasm.wasm',
458479
},
480+
{
481+
from:
482+
'../../standalone-packages/vscode-textmate/node_modules/onigasm/lib/onigasm.wasm',
483+
to: 'public/onigasm/2.1.0/onigasm.wasm',
484+
},
459485
{
460486
from: '../../node_modules/monaco-vue/release/min',
461-
to: 'public/13/vs/language/vue',
487+
to: 'public/14/vs/language/vue',
488+
},
489+
{
490+
from: '../../standalone-packages/monaco-editor/release/min/vs',
491+
to: 'public/14/vs',
462492
},
463493
{
464494
from: '../sse-hooks/dist',
@@ -469,8 +499,10 @@ module.exports = {
469499
to: 'static',
470500
},
471501
{
472-
from: '../../standalone-packages/codesandbox-browserfs/dist',
473-
to: 'static/browserfs2',
502+
from: __DEV__
503+
? '../../standalone-packages/codesandbox-browserfs/build'
504+
: '../../standalone-packages/codesandbox-browserfs/dist',
505+
to: 'static/browserfs3',
474506
},
475507
].filter(x => x)
476508
),

packages/app/config/webpack.dev.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const merge = require('webpack-merge');
2-
const webpack = require('webpack');
2+
// const webpack = require('webpack');
33
const commonConfig = require('./webpack.common');
44

55
const devEntries = [
@@ -28,8 +28,6 @@ module.exports = merge(
2828
removeEmptyChunks: false,
2929
splitChunks: false,
3030
},
31-
plugins: [
32-
// new webpack.HotModuleReplacementPlugin(),
33-
],
31+
// plugins: [new webpack.HotModuleReplacementPlugin()],
3432
}
3533
);

packages/app/config/webpack.prod.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,13 @@ module.exports = merge(commonConfig, {
107107
navigateFallback: publicPath + 'app.html',
108108
navigateFallbackWhitelist: [/\/s\//],
109109
// Don't precache sourcemaps (they're large) and build asset manifest:
110-
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
111-
maximumFileSizeToCacheInBytes: 5242880,
110+
staticFileGlobsIgnorePatterns: [
111+
/\.map$/,
112+
/vscode/,
113+
/\/vs/,
114+
/asset-manifest\.json$/,
115+
],
116+
maximumFileSizeToCacheInBytes: 1024 * 1024 * 20, // 20mb
112117

113118
runtimeCaching: [
114119
// Don't add this runtime cache as this causes us to give back *old*
@@ -144,6 +149,26 @@ module.exports = merge(commonConfig, {
144149
},
145150
},
146151
},
152+
{
153+
urlPattern: /\/vscode11/,
154+
handler: 'cacheFirst',
155+
options: {
156+
cache: {
157+
maximumFileSizeToCacheInBytes: 1024 * 1024 * 100, // 100mb
158+
name: 'vscode',
159+
},
160+
},
161+
},
162+
{
163+
urlPattern: /vscode-extensions\//,
164+
handler: 'cacheFirst',
165+
options: {
166+
cache: {
167+
maximumFileSizeToCacheInBytes: 1024 * 1024 * 100, // 100mb
168+
name: 'vscode-extensions',
169+
},
170+
},
171+
},
147172
],
148173
}),
149174
// Generate a service worker script that will precache, and keep up to date,
@@ -178,7 +203,7 @@ module.exports = merge(commonConfig, {
178203
navigateFallbackWhitelist: [/^(?!\/__).*/],
179204
// Don't precache sourcemaps (they're large) and build asset manifest:
180205
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
181-
maximumFileSizeToCacheInBytes: 5242880,
206+
maximumFileSizeToCacheInBytes: 1024 * 1024 * 20, // 20mb
182207
runtimeCaching: [
183208
{
184209
urlPattern: /api\/v1\/sandboxes/,

packages/app/jsconfig.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)