Skip to content

Commit 9dca49d

Browse files
authored
Make notifications not depend on common (codesandbox#2380)
* Make notifications not depend on common This greatly simplifies our build setup, recursive dependencies can go wrong very fast * Fix topology of dependencies * Simplify dependency graph * Deduplicate yarn.lock * Fix params for tests * Checkout git with cache * Remove duplicate checkout
1 parent 5fa3cb4 commit 9dca49d

File tree

17 files changed

+1571
-603
lines changed

17 files changed

+1571
-603
lines changed

.circleci/config.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,21 @@ executors:
129129
################################
130130

131131
commands:
132+
checkout_with_cache:
133+
description: 'Checkout git with a cache'
134+
steps:
135+
- restore_cache:
136+
keys:
137+
- v27-source-cache-{{ .Branch }}-{{ .Revision }}
138+
- v27-source-cache-{{ .Branch }}-
139+
- v27-source-cache-
140+
141+
- checkout
142+
143+
- save_cache:
144+
key: v27-source-cache-{{ .Branch }}-{{ .Revision }}
145+
paths:
146+
- '.git'
132147
build_deps:
133148
description: 'Install Dependencies with `yarn install`'
134149
steps:
@@ -146,7 +161,6 @@ commands:
146161
build_prod:
147162
description: 'Build the Application with `yarn build:prod`'
148163
steps:
149-
- checkout
150164
- restore_cache: *restore_deps_cache
151165
- attach_workspace: *attach_deps_workspace
152166
- restore_cache: *restore_prod_homepage_cache
@@ -173,7 +187,6 @@ commands:
173187
description:
174188
"Test Integrations with `yarn start:test` & 'yarn test:integrations'"
175189
steps:
176-
- checkout
177190
- restore_cache: *restore_deps_cache
178191
- attach_workspace: *attach_deps_workspace
179192
- run:
@@ -199,18 +212,16 @@ commands:
199212
test_jest:
200213
description: 'Test with `yarn test`'
201214
steps:
202-
- checkout
203215
- restore_cache: *restore_deps_cache
204216
- attach_workspace: *attach_deps_workspace
205217
- run:
206218
name: Test
207-
command: yarn test --ci --testResultsProcessor="jest-junit"
219+
command: yarn test:ci
208220
environment:
209221
JEST_JUNIT_OUTPUT: 'reports/junit/js-tests-results.xml'
210222
yarn_lint:
211223
description: 'Lint with `yarn lint`'
212224
steps:
213-
- checkout
214225
- restore_cache: *restore_deps_cache
215226
- attach_workspace: *attach_deps_workspace
216227
- run:
@@ -219,7 +230,6 @@ commands:
219230
yarn_typecheck:
220231
description: 'Lint with `yarn typecheck`'
221232
steps:
222-
- checkout
223233
- restore_cache: *restore_deps_cache
224234
- attach_workspace: *attach_deps_workspace
225235
- run:
@@ -260,32 +270,32 @@ jobs:
260270
build-deps:
261271
executor: node
262272
steps:
263-
- checkout
273+
- checkout_with_cache
264274
- build_deps
265275
build-prod:
266276
executor: node
267277
steps:
268-
- checkout
278+
- checkout_with_cache
269279
- build_prod
270280
test-integrations:
271281
executor: node-with-puppeteer
272282
steps:
273-
- checkout
283+
- checkout_with_cache
274284
- test_integrations
275285
test-jest:
276286
executor: node
277287
steps:
278-
- checkout
288+
- checkout_with_cache
279289
- test_jest
280290
lint:
281291
executor: node
282292
steps:
283-
- checkout
293+
- checkout_with_cache
284294
- yarn_lint
285295
typecheck:
286296
executor: node
287297
steps:
288-
- checkout
298+
- checkout_with_cache
289299
- yarn_typecheck
290300
create-docker-image:
291301
executor: docker_machine

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@
9393
{ "args": "none", "ignoreRestSiblings": true }
9494
],
9595
"no-useless-constructor": "off",
96-
"@typescript-eslint/no-useless-constructor": "warn"
96+
"@typescript-eslint/no-useless-constructor": "warn",
97+
"import/extensions": 0,
98+
"import/no-unresolved": 0
9799
}
98100
}
99101
]

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build:prod": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" lerna run build --scope homepage --stream && lerna run build --scope app --stream && lerna run copy-assets --scope app --stream",
1313
"build:embed": "lerna run build:embed --scope app --stream && gulp",
1414
"build:clean": "lerna run build:clean --scope app --scope homepage && rimraf www",
15-
"build:deps": "lerna run build:dev --scope codesandbox-api --scope @codesandbox/notifications --scope @codesandbox/executors && 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 && lerna run build --scope codesandbox-deps",
15+
"build:deps": "lerna run build:dev",
1616
"build:common": "lerna run build:dev --scope @codesandbox/common --stream",
1717
"build:dynamic": "lerna run build --scope dynamic-pages --stream",
1818
"start": "yarn build:deps && lerna run start --scope @codesandbox/common --scope app --parallel",
@@ -27,6 +27,7 @@
2727
"start:storybook": "lerna run start:storybook --scope=@codesandbox/common --stream",
2828
"start:dev_api": "lerna run start:dev_api --scope app --stream",
2929
"test": "lerna run test --ignore codesandbox-browserfs",
30+
"test:ci": "lerna run test --ignore codesandbox-browserfs -- --ci --testResultsProcessor=\"jest-junit\" ",
3031
"test:integrations": "lerna exec --scope app --stream -- yarn test:integrations",
3132
"test:jest-lite": "lerna exec --scope app --stream -- yarn run test jest-lite --watch --coverage",
3233
"now-build": "yarn build:deps && lerna run build:storybook --scope @codesandbox/common",
@@ -59,11 +60,7 @@
5960
"codesandbox-deps/tern"
6061
]
6162
},
62-
"resolutions": {
63-
"react-split-pane/react-dom": "^16.8.6"
64-
},
6563
"devDependencies": {
66-
"@types/react": "^16.8.12",
6764
"all-contributors-cli": "^5.4.0",
6865
"babel-eslint": "^10.0.2",
6966
"concurrently": "^4.1.0",
@@ -77,10 +74,9 @@
7774
"eslint-plugin-jsx-a11y": "^6.2.3",
7875
"eslint-plugin-react": "~7.4.0",
7976
"eslint-plugin-react-hooks": "^1.6.0",
80-
"flow-bin": "^0.72.0",
8177
"gulp": "^3.9.1",
8278
"husky": "^2.2.0",
83-
"lerna": "^2.5.1",
79+
"lerna": "^3.16.4",
8480
"prettier": "1.17.0",
8581
"pretty-quick": "^1.10.0",
8682
"typescript": "3.5.3"

packages/app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
"express": "^4.15.3",
8080
"file-loader": "^1.1.11",
8181
"filesize": "^3.5.6",
82-
"flow-bin": "^0.57.3",
8382
"fs-extra": "^8.0.1",
8483
"gulp-replace": "^0.5.4",
8584
"gzip-size": "3.0.0",

packages/app/src/app/pages/index.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import React, { useEffect } from 'react';
22
import { Route, Switch, Redirect, withRouter } from 'react-router-dom';
33
import { DragDropContext } from 'react-dnd';
44
import _debug from '@codesandbox/common/lib/utils/debug';
5-
import { Toasts } from '@codesandbox/notifications';
5+
import { Toasts, NotificationStatus } from '@codesandbox/notifications';
66
import { notificationState } from '@codesandbox/common/lib/utils/notifications';
77
import send, { DNT } from '@codesandbox/common/lib/utils/analytics';
8+
import theme from '@codesandbox/common/lib/theme';
9+
import { Button } from '@codesandbox/common/lib/components/Button';
810
import Loadable from 'app/utils/Loadable';
911
import { inject, hooksObserver } from 'app/componentConnectors';
1012
import { ErrorBoundary } from './common/ErrorBoundary';
@@ -78,7 +80,16 @@ const RoutesComponent = ({ signals: { appUnmounted } }) => {
7880
return null;
7981
}}
8082
/>
81-
<Toasts state={notificationState} />
83+
<Toasts
84+
colors={{
85+
[NotificationStatus.ERROR]: theme.dangerBackground(),
86+
[NotificationStatus.SUCCESS]: theme.green(),
87+
[NotificationStatus.NOTICE]: theme.secondary(),
88+
[NotificationStatus.WARNING]: theme.primary(),
89+
}}
90+
state={notificationState}
91+
Button={Button}
92+
/>
8293
<Boundary>
8394
<Content>
8495
<Switch>

packages/common/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codesandbox/common",
3-
"version": "1.0.6",
3+
"version": "1.0.8",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/codesandbox/codesandbox-client",
@@ -17,15 +17,15 @@
1717
"start:storybook": "start-storybook",
1818
"build:storybook": "build-storybook -c .storybook -o public",
1919
"build:lib": "yarn clean && yarn tsc && yarn babel src --out-dir lib && yarn cpx \"src/**/*.{css,svg,png,jpg}\" lib",
20-
"build": "yarn build:lib && yarn build:storybook",
20+
"build": "yarn build:lib",
2121
"build:dev": "yarn build",
2222
"prepublish": "yarn build",
2323
"lint": "eslint --ext .js,.ts,.tsx src"
2424
},
2525
"dependencies": {
2626
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
2727
"@babel/polyfill": "^7.4.4",
28-
"@codesandbox/notifications": "^1.0.3",
28+
"@codesandbox/notifications": "^1.0.6",
2929
"@codesandbox/template-icons": "^0.7.1",
3030
"@sentry/browser": "^5.6.2",
3131
"@tippy.js/react": "^2.1.1",
@@ -61,7 +61,6 @@
6161
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
6262
"@babel/plugin-transform-async-to-generator": "^7.5.0",
6363
"@babel/plugin-transform-runtime": "^7.5.5",
64-
"@codesandbox/template-icons": "^0.7.0",
6564
"@storybook/addon-a11y": "^5.1.11",
6665
"@storybook/addon-actions": "^5.1.9",
6766
"@storybook/addon-knobs": "^5.1.9",

packages/deps/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"main": "dist/index.js",
1212
"scripts": {
1313
"build": "yarn build:clean && yarn build:rollup",
14+
"build:dev": "yarn build",
1415
"build:clean": "rimraf dist",
1516
"build:rollup": "rollup -c"
1617
},

packages/dynamic-pages/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint": "eslint ."
1616
},
1717
"dependencies": {
18-
"@codesandbox/common": "^1.0.6",
18+
"@codesandbox/common": "^1.0.8",
1919
"@zeit/next-css": "^1.0.1",
2020
"airtable": "^0.5.9",
2121
"date-fns": "^1.30.1",

packages/executors/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"typescript": "^3.5.1"
4242
},
4343
"dependencies": {
44-
"@codesandbox/common": "^1.0.6",
44+
"@codesandbox/common": "^1.0.8",
4545
"codesandbox-api": "^0.0.22",
4646
"debug": "^4.1.1",
4747
"socket.io-client": "^2.2.0"

packages/homepage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@babel/preset-flow": "^7.0.0",
14-
"@codesandbox/common": "^1.0.6",
14+
"@codesandbox/common": "^1.0.8",
1515
"algoliasearch": "^3.24.5",
1616
"babel-plugin-macros": "^2.4.2",
1717
"babel-preset-gatsby": "^0.2.8",

0 commit comments

Comments
 (0)