Skip to content

Commit c6758b2

Browse files
authored
Extract common to a lib (#1653)
Allows homepage and dynamic-pages to work standalone
1 parent 8f067eb commit c6758b2

File tree

326 files changed

+770
-639
lines changed

Some content is hidden

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

326 files changed

+770
-639
lines changed

.yarnrc

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

package.json

Lines changed: 1 addition & 1 deletion
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 && lerna run build:dev --scope common && lerna run build:dev --scope vscode-textmate --scope codesandbox-browserfs --scope node-services && lerna run build:dev --scope sse-hooks",
11+
"build:deps": "lerna run build:dev --scope codesandbox-api && lerna run build:dev --scope @codesandbox/common && lerna run build:dev --scope vscode-textmate --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",

packages/app/config/webpack.common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
77
const CopyWebpackPlugin = require('copy-webpack-plugin');
88
const HappyPack = require('happypack');
99
const WatchMissingNodeModulesPlugin = require('../scripts/utils/WatchMissingNodeModulesPlugin');
10-
const env = require('common/lib/config/env');
11-
const getHost = require('common/lib/utils/host');
10+
const env = require('@codesandbox/common/lib/config/env');
11+
const getHost = require('@codesandbox/common/lib/utils/host');
1212

1313
const babelDev = require('./babel.dev');
1414
const babelProd = require('./babel.prod');

packages/app/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
"cerebral": "^4.0.0",
160160
"circular-json": "^0.4.0",
161161
"codemirror": "^5.27.4",
162-
"codesandbox-api": "^0.0.20",
162+
"codesandbox-api": "^0.0.22",
163163
"codesandbox-import-utils": "2.1.1",
164164
"color": "^0.11.4",
165165
"compare-versions": "^3.1.0",
@@ -247,7 +247,6 @@
247247
"sha1": "^1.1.1",
248248
"shelljs": "^0.7.8",
249249
"shortid": "^2.2.8",
250-
"socket.io-client": "^2.1.1",
251250
"store": "^2.0.12",
252251
"string-replace-loader": "^2.1.1",
253252
"styled-components": "^4.1.2",

packages/app/src/app/components/Alert/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { Button } from 'common/lib/components/Button';
3+
import { Button } from '@codesandbox/common/lib/components/Button';
44
import { Container, Title, Text, Buttons } from './elements';
55

66
function Alert({ title, body, onCancel, onDelete }) {

packages/app/src/app/components/CodeEditor/CodeMirror/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled, { css, keyframes } from 'styled-components';
2-
import theme from 'common/lib/theme';
2+
import theme from '@codesandbox/common/lib/theme';
33

44
const fadeInAnimation = keyframes`
55
0% { background-color: #374140; }

packages/app/src/app/components/CodeEditor/CodeMirror/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as React from 'react';
44
import CodeMirror from 'codemirror';
55
import { withTheme } from 'styled-components';
66

7-
import type { ModuleError, Module } from 'common/lib/types';
7+
import type { ModuleError, Module } from '@codesandbox/common/lib/types';
88
import { getCodeMirror } from 'app/utils/codemirror';
99

1010
import 'codemirror/addon/dialog/dialog';

packages/app/src/app/components/CodeEditor/Configuration/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import { TextOperation } from 'ot';
3-
import { Module } from 'common/lib/types';
4-
import getUI from 'common/lib/templates/configuration/ui';
3+
import { Module } from '@codesandbox/common/lib/types';
4+
import getUI from '@codesandbox/common/lib/templates/configuration/ui';
55
import getType from 'app/utils/get-type';
66
import EntryIcons from 'app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons';
7-
import Tooltip from 'common/lib/components/Tooltip';
8-
import { ConfigurationFile } from 'common/lib/templates/configuration/types';
7+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
8+
import { ConfigurationFile } from '@codesandbox/common/lib/templates/configuration/types';
99

1010
import CodeIcon from 'react-icons/lib/md/code';
1111

packages/app/src/app/components/CodeEditor/FilePath/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components';
22
import ChevronLeft from 'react-icons/lib/md/chevron-left';
33
import ExitZen from 'react-icons/lib/md/fullscreen-exit';
4-
import { withTooltip } from 'common/lib/components/Tooltip';
4+
import { withTooltip } from '@codesandbox/common/lib/components/Tooltip';
55

66
export const Container = styled.div`
77
background-color: rgba(0, 0, 0, 0.3);

packages/app/src/app/components/CodeEditor/FilePath/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { getModulePath } from 'common/lib/sandbox/modules';
2+
import { getModulePath } from '@codesandbox/common/lib/sandbox/modules';
33
import EntryIcons from 'app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons';
44
import getType from 'app/utils/get-type';
55

packages/app/src/app/components/CodeEditor/FuzzySearch/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import * as React from 'react';
22
import { sortBy, groupBy, flatten } from 'lodash-es';
33
import Downshift from 'downshift';
44
import matchSorter from 'match-sorter';
5-
import { getModulePath } from 'common/lib/sandbox/modules';
6-
import Input from 'common/lib/components/Input';
5+
import { getModulePath } from '@codesandbox/common/lib/sandbox/modules';
6+
import Input from '@codesandbox/common/lib/components/Input';
77
import EntryIcons from 'app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons';
88
import getType from 'app/utils/get-type';
9-
import { ESC } from 'common/lib/utils/keycodes';
9+
import { ESC } from '@codesandbox/common/lib/utils/keycodes';
1010
import {
1111
Container,
1212
InputContainer,

packages/app/src/app/components/CodeEditor/ImageViewer/elements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components';
2-
import Centered from 'common/lib/components/flex/Centered';
2+
import Centered from '@codesandbox/common/lib/components/flex/Centered';
33

44
export const Container = styled(Centered)`
55
height: 100%;

packages/app/src/app/components/CodeEditor/ImageViewer/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22
import React from 'react';
3-
import Input from 'common/lib/components/Input';
4-
import { Button } from 'common/lib/components/Button';
3+
import Input from '@codesandbox/common/lib/components/Input';
4+
import { Button } from '@codesandbox/common/lib/components/Button';
55
import { Container, Title, SubTitle, Image, MaxWidth } from './elements';
66

77
import { Props } from '../types';

packages/app/src/app/components/CodeEditor/Monaco/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components';
2-
import theme from 'common/lib/theme';
2+
import theme from '@codesandbox/common/lib/theme';
33

44
export const Container = styled.div`
55
width: 100%;

packages/app/src/app/components/CodeEditor/Monaco/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import { TextOperation } from 'ot';
44
import { debounce } from 'lodash-es';
55
import { join, dirname } from 'path';
66
import { withTheme } from 'styled-components';
7-
import { getModulePath } from 'common/lib/sandbox/modules';
7+
import { getModulePath } from '@codesandbox/common/lib/sandbox/modules';
88
import { listen } from 'codesandbox-api';
99

10-
import getTemplate from 'common/lib/templates';
10+
import getTemplate from '@codesandbox/common/lib/templates';
1111
import type {
1212
Module,
1313
Sandbox,
1414
ModuleError,
1515
ModuleCorrection,
1616
Directory,
17-
} from 'common/lib/types';
18-
import { getTextOperation } from 'common/lib/utils/diff';
17+
} from '@codesandbox/common/lib/types';
18+
import { getTextOperation } from '@codesandbox/common/lib/utils/diff';
1919

20-
import delay from 'common/lib/utils/delay';
20+
import delay from '@codesandbox/common/lib/utils/delay';
2121

2222
/* eslint-disable import/no-webpack-loader-syntax */
2323
import LinterWorker from 'worker-loader?publicPath=/&name=monaco-linter.[hash:8].worker.js!./workers/linter';

packages/app/src/app/components/CodeEditor/VSCode/Configuration/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// @flow
22
import React from 'react';
33
import { TextOperation } from 'ot';
4-
import { Module } from 'common/lib/types';
5-
import getUI from 'common/lib/templates/configuration/ui';
4+
import { Module } from '@codesandbox/common/lib/types';
5+
import getUI from '@codesandbox/common/lib/templates/configuration/ui';
66
import getType from 'app/utils/get-type';
77
import EntryIcons from 'app/pages/Sandbox/Editor/Workspace/Files/DirectoryEntry/Entry/EntryIcons';
8-
import theme from 'common/lib/theme';
8+
import theme from '@codesandbox/common/lib/theme';
99

1010
import { Props as EditorProps, Editor } from '../../types';
1111
import { Container, Title, Description } from './elements';
12-
import { ConfigurationFile } from 'common/lib/templates/configuration/types';
12+
import { ConfigurationFile } from '@codesandbox/common/lib/templates/configuration/types';
1313

1414
type Disposable = {
1515
dispose: () => void;

packages/app/src/app/components/CodeEditor/VSCode/elements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled, { createGlobalStyle } from 'styled-components';
2-
import theme from 'common/lib/theme';
2+
import theme from '@codesandbox/common/lib/theme';
33

44
export const Container = styled.div`
55
width: 100%;

packages/app/src/app/components/CodeEditor/VSCode/index.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ import { render } from 'react-dom';
44
import { ThemeProvider } from 'styled-components';
55
import { TextOperation } from 'ot';
66
import { debounce } from 'lodash-es';
7-
import { getModulePath, resolveModule } from 'common/lib/sandbox/modules';
7+
import { getModulePath, resolveModule } from '@codesandbox/common/lib/sandbox/modules';
88
import { listen } from 'codesandbox-api';
99

1010
import prettify from 'app/src/app/utils/prettify';
11-
import DEFAULT_PRETTIER_CONFIG from 'common/lib/prettify-default-config';
12-
import getUI from 'common/lib/templates/configuration/ui';
11+
import DEFAULT_PRETTIER_CONFIG from '@codesandbox/common/lib/prettify-default-config';
12+
import getUI from '@codesandbox/common/lib/templates/configuration/ui';
1313

14-
import getTemplate from 'common/lib/templates';
15-
import theme from 'common/lib/theme';
14+
import getTemplate from '@codesandbox/common/lib/templates';
15+
import theme from '@codesandbox/common/lib/theme';
1616
import {
1717
Module,
1818
Sandbox,
1919
ModuleError,
2020
ModuleCorrection,
21-
} from 'common/lib/types';
22-
import { getTextOperation } from 'common/lib/utils/diff';
21+
} from '@codesandbox/common/lib/types';
22+
import { getTextOperation } from '@codesandbox/common/lib/utils/diff';
2323

2424
/* eslint-disable import/no-webpack-loader-syntax */
2525
// @ts-ignore

packages/app/src/app/components/CodeEditor/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React from 'react';
22
import Title from 'app/components/Title';
33
import SubTitle from 'app/components/SubTitle';
44
import Loadable from 'app/utils/Loadable';
5-
import getUI from 'common/lib/templates/configuration/ui';
6-
import Centered from 'common/lib/components/flex/Centered';
7-
import Margin from 'common/lib/components/spacing/Margin';
8-
import isImage from 'common/lib/utils/is-image';
9-
import getDefinition from 'common/lib/templates';
10-
import { Sandbox } from 'common/lib/types';
11-
import { getModulePath } from 'common/lib/sandbox/modules';
12-
import Tooltip from 'common/lib/components/Tooltip';
5+
import getUI from '@codesandbox/common/lib/templates/configuration/ui';
6+
import Centered from '@codesandbox/common/lib/components/flex/Centered';
7+
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
8+
import isImage from '@codesandbox/common/lib/utils/is-image';
9+
import getDefinition from '@codesandbox/common/lib/templates';
10+
import { Sandbox } from '@codesandbox/common/lib/types';
11+
import { getModulePath } from '@codesandbox/common/lib/sandbox/modules';
12+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
1313
import UIIcon from 'react-icons/lib/md/dvr';
1414
import QuestionIcon from 'react-icons/lib/go/question';
1515

packages/app/src/app/components/CodeEditor/types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
Sandbox,
66
ModuleError,
77
ModuleCorrection,
8-
} from 'common/lib/types';
8+
} from '@codesandbox/common/lib/types';
99

1010
export type Settings = {
1111
autoCompleteEnabled: boolean,

packages/app/src/app/components/CodeEditor/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Sandbox,
66
ModuleError,
77
ModuleCorrection,
8-
} from 'common/lib/types';
8+
} from '@codesandbox/common/lib/types';
99

1010
export type Settings = {
1111
autoCompleteEnabled: boolean;

packages/app/src/app/components/ContextMenu/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components';
22

33
import { animated } from 'react-spring/renderprops';
4-
import theme from 'common/lib/theme';
4+
import theme from '@codesandbox/common/lib/theme';
55

66
export const Container = styled(animated.div)`
77
position: fixed;

packages/app/src/app/components/ContextMenu/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { Spring } from 'react-spring/renderprops';
3-
import Portal from 'common/lib/components/Portal';
3+
import Portal from '@codesandbox/common/lib/components/Portal';
44

55
import { Container, Item, ItemContainer } from './elements';
66

packages/app/src/app/components/DelayedAnimation/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import styled from 'styled-components';
2-
import delayEffect from 'common/lib/utils/animation/delay-effect';
2+
import delayEffect from '@codesandbox/common/lib/utils/animation/delay-effect';
33

44
export default styled.div`
55
${props => delayEffect(props.delay || 0)};

packages/app/src/app/components/DeleteSandboxButton/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styled from 'styled-components';
33
import DeleteIcon from 'react-icons/lib/md/delete';
4-
import Tooltip from 'common/lib/components/Tooltip';
4+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
55

66
export const DeleteSandboxButton = styled(props => (
77
<Tooltip title="Delete Sandbox">

packages/app/src/app/components/DeploymentIntegration/DetailInfo/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import Margin from 'common/lib/components/spacing/Margin';
3-
import { Button } from 'common/lib/components/Button';
2+
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
3+
import { Button } from '@codesandbox/common/lib/components/Button';
44

55
import { Details, Info } from './elements';
66

packages/app/src/app/components/GitProgress/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled, { keyframes } from 'styled-components';
22

3-
import delayInEffect from 'common/lib/utils/animation/delay-effect';
3+
import delayInEffect from '@codesandbox/common/lib/utils/animation/delay-effect';
44
import OpaqueLogo from 'app/components/OpaqueLogo';
55
import GitHubLogo from 'app/components/GitHubLogo';
66
import Cube from './Cube';

packages/app/src/app/components/HeaderSearchBar/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components';
22
import SearchIcon from 'react-icons/lib/go/search';
3-
import Relative from 'common/lib/components/Relative';
3+
import Relative from '@codesandbox/common/lib/components/Relative';
44

55
export const Container = styled(Relative)`
66
display: flex;

packages/app/src/app/components/HeaderSearchBar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import history from 'app/utils/history';
3-
import { searchUrl } from 'common/lib/utils/url-generator';
3+
import { searchUrl } from '@codesandbox/common/lib/utils/url-generator';
44

55
import {
66
Container,

packages/app/src/app/components/Integration/DetailInfo/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import CrossIcon from 'react-icons/lib/md/clear';
3-
import Margin from 'common/lib/components/spacing/Margin';
4-
import Tooltip from 'common/lib/components/Tooltip';
5-
import { Button } from 'common/lib/components/Button';
3+
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
4+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
5+
import { Button } from '@codesandbox/common/lib/components/Button';
66

77
import { Details, Heading, Info, Action } from './elements';
88

packages/app/src/app/components/IntegrationModal/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22

3-
import Centered from 'common/lib/components/flex/Centered';
4-
import Margin from 'common/lib/components/spacing/Margin';
5-
import Relative from 'common/lib/components/Relative';
3+
import Centered from '@codesandbox/common/lib/components/flex/Centered';
4+
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
5+
import Relative from '@codesandbox/common/lib/components/Relative';
66

77
import {
88
Container,

packages/app/src/app/components/Loading/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import Logo from 'common/lib/components/Logo';
3-
import Centered from 'common/lib/components/flex/Centered';
2+
import Logo from '@codesandbox/common/lib/components/Logo';
3+
import Centered from '@codesandbox/common/lib/components/flex/Centered';
44

55
import { LogoContainer } from './elements';
66

packages/app/src/app/components/Overlay/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { observer } from 'mobx-react';
33

44
import { Transition, animated, config } from 'react-spring/renderprops';
5-
import track from 'common/lib/utils/analytics';
5+
import track from '@codesandbox/common/lib/utils/analytics';
66

77
class OverlayComponent extends React.Component {
88
state = {

packages/app/src/app/components/Preview/DevTools/Console/Input/index.monaco.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import React from 'react';
33
import styled from 'styled-components';
44

55
import ChevronRight from 'react-icons/lib/md/chevron-right';
6-
import theme from 'common/lib/theme';
6+
import theme from '@codesandbox/common/lib/theme';
77

88
import MonacoEditor from 'app/components/CodeEditor/Monaco/MonacoReactComponent';
99
import defineTheme from 'app/components/CodeEditor/Monaco/define-theme';
1010

11-
import { ARROW_UP, ARROW_DOWN, ENTER } from 'common/lib/utils/keycodes';
11+
import {
12+
ARROW_UP,
13+
ARROW_DOWN,
14+
ENTER,
15+
} from '@codesandbox/common/lib/utils/keycodes';
1216

1317
import { IconContainer } from './elements';
1418

packages/app/src/app/components/Preview/DevTools/Console/Input/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import CodeMirror from 'codemirror';
44
import styled from 'styled-components';
55

66
import ChevronRight from 'react-icons/lib/md/chevron-right';
7-
import theme from 'common/lib/theme';
7+
import theme from '@codesandbox/common/lib/theme';
88

99
import { getCodeMirror } from 'app/utils/codemirror';
1010

11-
import { ARROW_UP, ARROW_DOWN, ENTER } from 'common/lib/utils/keycodes';
11+
import { ARROW_UP, ARROW_DOWN, ENTER } from '@codesandbox/common/lib/utils/keycodes';
1212

1313
import { IconContainer, CodeMirrorContainer } from './elements';
1414

0 commit comments

Comments
 (0)