Skip to content

Commit 0623685

Browse files
committed
Merge branch 'master' into vscodeeffect
2 parents 4e04d8e + def3779 commit 0623685

File tree

38 files changed

+1992
-214
lines changed

38 files changed

+1992
-214
lines changed

.circleci/config.yml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,6 @@ commands:
168168
- run:
169169
name: Build Application
170170
command: yarn build:prod
171-
- run:
172-
name: Mark Sentry release
173-
command: |
174-
if [ "${CIRCLE_BRANCH}" == "master" ]; then
175-
node packages/app/scripts/sentry-create-release.js
176-
fi
177171
- save_cache: *save_prod_build_cache
178172
- save_cache: *save_prod_result
179173
- run:
@@ -302,6 +296,34 @@ jobs:
302296
executor: docker_machine
303297
steps:
304298
- docker_cache
299+
deploy-to-production:
300+
executor: node
301+
environment:
302+
ENVIRONMENT: production
303+
steps:
304+
- checkout_with_cache
305+
- restore_cache: *restore_deps_cache
306+
- attach_workspace: *attach_deps_workspace
307+
- run:
308+
name: Mark Sentry release
309+
command: node packages/app/scripts/sentry-create-release.js
310+
- run:
311+
name: Deploy Image
312+
command: node packages/app/scripts/deploy.js
313+
- run:
314+
name: Deploy Sentry release
315+
command: node packages/app/scripts/sentry-deploy-release.js
316+
deploy-to-staging:
317+
executor: node
318+
environment:
319+
ENVIRONMENT: staging
320+
steps:
321+
- checkout_with_cache
322+
- restore_cache: *restore_deps_cache
323+
- attach_workspace: *attach_deps_workspace
324+
- run:
325+
name: Deploy Image
326+
command: node packages/app/scripts/deploy.js
305327

306328
################################
307329
# Workflows
@@ -334,3 +356,23 @@ workflows:
334356
- typecheck
335357
# - test-integrations
336358
- test-jest
359+
- deploy-production-approval:
360+
type: approval
361+
filters:
362+
branches:
363+
only:
364+
- master
365+
- deploy-to-production:
366+
requires:
367+
- deploy-production-approval
368+
- create-docker-image
369+
filters:
370+
branches:
371+
only:
372+
- master
373+
- deploy-staging-approval:
374+
type: approval
375+
- deploy-to-staging:
376+
requires:
377+
- deploy-staging-approval
378+
- create-docker-image

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@
8585
"husky": "^2.2.0",
8686
"lerna": "^3.16.4",
8787
"lint-staged": "^9.2.5",
88-
"prettier": "1.17.0",
88+
"prettier": "1.18.2",
8989
"pretty-quick": "^1.10.0",
90-
"typescript": "3.6.3",
90+
"typescript": "3.7.1-rc",
9191
"username": "^5.1.0"
9292
},
9393
"husky": {

packages/app/integration-tests/browser-tests/browsers.test.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ const hash = require('child_process')
44
.execSync('git rev-parse --short HEAD')
55
.toString();
66

7+
const delay = ms =>
8+
new Promise(resolve => {
9+
setTimeout(() => {
10+
resolve();
11+
}, ms);
12+
});
13+
714
function getCapabilities(browserInfo) {
815
return {
916
...browserInfo,
@@ -77,8 +84,13 @@ usedDescribe('browser-tests', () => {
7784
os_version: '10',
7885
resolution: '1024x768',
7986
};
80-
81-
await testPageWitCapabilities(capabilities);
87+
try {
88+
await testPageWitCapabilities(capabilities);
89+
} catch (e) {
90+
await delay(10000);
91+
// Retry
92+
await testPageWitCapabilities(capabilities);
93+
}
8294
}, 130000);
8395

8496
test('safari', async () => {
@@ -90,8 +102,13 @@ usedDescribe('browser-tests', () => {
90102
os_version: 'High Sierra',
91103
resolution: '1024x768',
92104
};
93-
94-
await testPageWitCapabilities(capabilities);
105+
try {
106+
await testPageWitCapabilities(capabilities);
107+
} catch (e) {
108+
await delay(10000);
109+
// Retry
110+
await testPageWitCapabilities(capabilities);
111+
}
95112
}, 130000);
96113

97114
test.skip('android', async () => {

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
"terser": "^4.1.4",
312312
"terser-webpack-plugin": "^1.4.1",
313313
"thread-loader": "^2.1.2",
314-
"typescript": "3.6.3",
314+
"typescript": "3.7.1-rc",
315315
"url-loader": "1.0.1",
316316
"webpack": "^4.36.1",
317317
"webpack-bundle-analyzer": "^2.13.1",

packages/app/scripts/deploy.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const fetch = require('cross-fetch');
2+
3+
fetch('https://deployment-api.lbogdan.ro/image', {
4+
method: 'POST',
5+
headers: {
6+
'Content-Type': 'application/json',
7+
Authorization: `Bearer ${process.env.DEPLOY_TOKEN}`,
8+
},
9+
body: JSON.stringify({
10+
env: process.env.ENVIRONMENT,
11+
image: 'client',
12+
tag: process.env.CIRCLE_SHA1.substr(0, 7),
13+
deploy: true,
14+
}),
15+
})
16+
.then(x => {
17+
if (!x.ok) {
18+
throw new Error('Request failed');
19+
}
20+
21+
return x.json();
22+
})
23+
.then(res => {
24+
// eslint-disable-next-line
25+
console.log(res);
26+
process.exit(0);
27+
})
28+
.catch(e => {
29+
console.error(e);
30+
process.exit(1);
31+
});

packages/app/scripts/sentry-create-release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ try {
1212
`yarn sentry-cli releases --org=codesandbox -p frontend new "${VERSION}"`
1313
);
1414
childProcess.execSync(
15-
`yarn sentry-cli releases --org=codesandbox set-commits "${VERSION}" --commit "CompuIves/codesandbox-client@${COMMIT_HASH}"`
15+
`yarn sentry-cli releases --org=codesandbox set-commits "${VERSION}" --commit "codesandbox/codesandbox-client@${COMMIT_HASH}"`
1616
);
1717
console.log('Marked release');
1818
} catch (e) {

packages/app/src/app/index.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
notificationState,
1818
} from '@codesandbox/common/lib/utils/notifications';
1919
import { isSafari } from '@codesandbox/common/lib/utils/platform';
20-
import { NotificationStatus } from '@codesandbox/notifications';
2120
import { client } from 'app/graphql/client';
2221
import history from 'app/utils/history';
2322
import { createOvermind } from 'overmind';
@@ -98,23 +97,8 @@ overmind.initialized.then(() => {
9897
registerServiceWorker('/service-worker.js', {
9998
onUpdated: () => {
10099
debug('Updated SW');
101-
window.getSignal('setUpdateStatus')({ status: 'available' });
102100

103-
notificationState.addNotification({
104-
title: 'CodeSandbox Update Available',
105-
message:
106-
'We just installed a new version of CodeSandbox, refresh to update!',
107-
status: NotificationStatus.SUCCESS,
108-
sticky: true,
109-
actions: {
110-
primary: [
111-
{
112-
run: () => document.location.reload(),
113-
label: 'Reload Page',
114-
},
115-
],
116-
},
117-
});
101+
window.getSignal('setUpdateStatus')({ status: 'available' });
118102
},
119103
onInstalled: () => {
120104
debug('Installed SW');

packages/app/src/app/overmind/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export const signInZeitClicked: AsyncAction = async ({
157157
};
158158

159159
export const signOutZeitClicked: AsyncAction = async ({ state, effects }) => {
160-
await effects.http.delete(`/users/current_user/integrations/zeit`);
160+
await effects.api.signoutZeit();
161161
state.user.integrations.zeit = null;
162162
};
163163

packages/app/src/app/overmind/effects/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ export default {
432432
signoutGithubIntegration(): Promise<void> {
433433
return api.delete(`/users/current_user/integrations/github`);
434434
},
435+
signoutZeit(): Promise<void> {
436+
return api.delete(`/users/current_user/integrations/zeit`);
437+
},
435438
preloadTemplates() {
436439
client.query({ query: LIST_TEMPLATES, variables: { showAll: true } });
437440
},

packages/app/src/app/pages/Dashboard/Content/CreateNewSandbox/NewSandboxModal/Imports/GitHubImport.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ export const GitHubImport = () => {
5454
}
5555
}, []);
5656

57+
const handleKey = useCallback(
58+
({ key }) => {
59+
if (key === 'Enter' && !error) {
60+
window.location.href = gitHubToSandboxUrl(url);
61+
}
62+
},
63+
[error, url]
64+
);
65+
5766
return (
5867
<Section style={{ flex: 6 }}>
5968
<ImportHeader>
@@ -76,6 +85,7 @@ export const GitHubImport = () => {
7685
placeholder="GitHub Repository URL..."
7786
onChange={updateUrl}
7887
value={url}
88+
onKeyDown={handleKey}
7989
/>
8090

8191
{transformedUrl ? (

0 commit comments

Comments
 (0)