Skip to content

Commit 9e77c46

Browse files
authored
Move to workspaces (codesandbox#265)
* Move to workspaces * Enable experimental workspaces * Lerna * Intermediate * Nice * Intermediate * Progress * Reorganize * Updates * Almost done * Change Prettier * Fix tests * Build api before linting * Update CirleCI image * Add flag * Perf improvements * Perf improvements * IE11 support * Performance improvements * Fix scaling * Fix build script * Update config * Fix Gatsby static assets * Fix host * Wave adjustment * Fix URL of embed * Fix width artifacts for 1280px width * Update media queries * Fix false positives for low performance mode * Update footer & process feedback * Add 'New Sandbox' page * Update navigation button * Patron * Change header
1 parent 4416d08 commit 9e77c46

File tree

149 files changed

+13954
-1258
lines changed

Some content is hidden

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

149 files changed

+13954
-1258
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
build:
55
working_directory: ~/codesandbox-client
66
docker:
7-
- image: circleci/node:8.4.0
7+
- image: circleci/node:9.0
88
environment:
99
TZ: "/usr/share/zoneinfo/Europe/Amsterdam"
1010
steps:
@@ -13,7 +13,7 @@ jobs:
1313
key: dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
1414
- run:
1515
name: Install Dependency
16-
command: yarn install && yarn add puppeteer
16+
command: yarn install && yarn add puppeteer -W
1717
- save_cache:
1818
key: dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
1919
paths:

.eslintrc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@
1919
"import/prefer-default-export": 0,
2020
"class-methods-use-this": 0,
2121
"no-console": ["error", { "allow": ["error"] }],
22-
"prefer-template": "off"
22+
"prefer-template": "off",
23+
"no-plusplus": 0
2324
},
2425
"settings": {
25-
"import/resolver": {
26-
"webpack": {
27-
"config": "config/webpack.common.js"
28-
}
29-
}
26+
"import/resolver": "webpack"
3027
}
3128
}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

33
# dependencies
4-
/node_modules
4+
node_modules
55

66
/integration-tests/**/__diff_output__
77

@@ -20,3 +20,5 @@ yarn-error.log
2020
.vscode
2121
.idea
2222
jest
23+
24+
lerna-debug.log

.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
workspaces-experimental true

Gulpfile.js

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
11
const gulp = require('gulp');
2-
const postcss = require('gulp-postcss');
3-
const autoprefixer = require('autoprefixer');
4-
const cssnano = require('cssnano');
5-
const rev = require('gulp-rev');
6-
const replace = require('gulp-replace');
72
const runSequence = require('run-sequence');
83

94
const config = require('./config/paths');
105

11-
gulp.task('css', function() {
6+
gulp.task('homepage', function() {
127
return gulp
13-
.src('src/homepage/**/*.css')
14-
.pipe(postcss([autoprefixer, cssnano]))
15-
.pipe(rev())
16-
.pipe(gulp.dest(`${config.appBuild}/`))
17-
.pipe(rev.manifest())
18-
.pipe(gulp.dest(`${config.appBuild}/`));
19-
});
20-
21-
gulp.task('javascript', function() {
22-
return gulp
23-
.src('src/homepage/**/*.js')
24-
.pipe(gulp.dest(`${config.appBuild}/`));
25-
});
26-
27-
gulp.task('html', function() {
28-
const manifest = require(`${config.appBuild}/rev-manifest.json`);
29-
30-
return gulp
31-
.src('src/homepage/index.html')
32-
.pipe(replace('static/css/main.css', manifest['static/css/main.css']))
8+
.src('src/homepage/public/**/*.*')
339
.pipe(gulp.dest(`${config.appBuild}/`));
3410
});
3511

@@ -40,7 +16,7 @@ gulp.task('static', function() {
4016
});
4117

4218
gulp.task('build', function(cb) {
43-
return runSequence(['css', 'javascript', 'static'], 'html', cb);
19+
return runSequence(['homepage', 'static'], cb);
4420
});
4521

4622
gulp.task('default', ['build']);

config/webpack.common.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = {
136136

137137
resolve: {
138138
mainFields: ['browser', 'module', 'jsnext:main', 'main'],
139-
modules: ['src', 'node_modules'],
139+
modules: ['node_modules'],
140140

141141
extensions: ['.js', '.json'],
142142

@@ -250,10 +250,10 @@ module.exports = {
250250
from: 'static',
251251
to: 'static',
252252
},
253-
{
254-
from: 'src/homepage/static',
255-
to: 'static',
256-
},
253+
// {
254+
// from: 'src/homepage/static',
255+
// to: 'static',
256+
// },
257257
].filter(x => x)
258258
),
259259
// We first create a common chunk between embed and app, to share components

lerna.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"lerna": "2.4.0",
3+
"version": "independent",
4+
"npmClient": "yarn",
5+
"useWorkspaces": true
6+
}

package.json

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
"name": "react-sandbox",
33
"version": "0.1.0",
44
"license": "MIT",
5+
"private": true,
56
"devDependencies": {
67
"all-contributors-cli": "^4.3.0",
78
"autoprefixer": "^6.7.7",
89
"babel-core": "^6.25.0",
910
"babel-eslint": "^7.2.3",
10-
"babel-jest": "^20.0.3",
11-
"babel-loader": "^7.1.0",
11+
"babel-jest": "^21.2.0",
12+
"babel-loader": "7.1.1",
1213
"babel-macros": "^1.0.2",
1314
"babel-plugin-codegen": "^1.2.0",
1415
"babel-plugin-lodash": "^3.2.11",
@@ -55,10 +56,11 @@
5556
"html-webpack-plugin": "^2.24.1",
5657
"http-proxy-middleware": "^0.17.3",
5758
"husky": "^0.14.3",
58-
"jest": "^20.0.0",
59+
"jest": "^21.2.1",
5960
"jest-image-snapshot": "^1.0.1",
60-
"jest-styled-components": "^4.3.0",
61+
"jest-styled-components": "^4.9.0",
6162
"json-loader": "0.5.4",
63+
"lerna": "^2.4.0",
6264
"lint-staged": "^4.0.1",
6365
"object-assign": "^4.1.1",
6466
"opn": "4.0.2",
@@ -174,8 +176,9 @@
174176
"start:dev_api": "node scripts/start.js",
175177
"start:test":
176178
"cross-env LOCAL_SERVER=1 NODE_ENV=test node scripts/start.js",
177-
"build": "cross-env NODE_ENV=production node scripts/build.js && gulp",
178-
"test": "npm run lint && jest --env=jsdom",
179+
"build":
180+
"lerna run build && cross-env NODE_ENV=production node scripts/build.js && gulp",
181+
"test": "lerna run build --ignore app && npm run lint && jest --env=jsdom",
179182
"test:watch": "jest --watch --env=jsdom",
180183
"test:integrations":
181184
"jest --config integration-tests/jest.config.json --env=jsdom",
@@ -202,11 +205,18 @@
202205
},
203206
"jest": {
204207
"roots": ["<rootDir>/src"],
205-
"moduleDirectories": ["node_modules", "src"],
206-
"testPathIgnorePatterns": ["/node_modules/", "/create-zip\\/.*\\/files/"],
208+
"moduleDirectories": ["node_modules"],
209+
"testPathIgnorePatterns": ["/create-zip\\/.*\\/files/"],
210+
"transformIgnorePatterns": [
211+
"<rootDir>/node_modules/(?!(embed|app|common))"
212+
],
207213
"moduleNameMapper": {
208214
"\\.css$": "<rootDir>/__mocks__/styleMock.js",
209215
"\\.html$": "<rootDir>/__mocks__/styleMock.js"
216+
},
217+
"transform": {
218+
"^.+\\.js$": "babel-jest"
210219
}
211-
}
220+
},
221+
"workspaces": ["src/**"]
212222
}

src/__mocks__/styleMock.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/app/components/Loading.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import styled, { keyframes } from 'styled-components';
3-
import Logo from './Logo';
3+
import Logo from 'common/components/Logo';
4+
45
import Centered from './flex/Centered';
56

67
const animation = keyframes`

0 commit comments

Comments
 (0)