Skip to content

Commit 4ffa3b6

Browse files
garethxCompuIves
authored andcommitted
Ci+embeds (codesandbox#3022)
* Adding draft announcement post * fix link * Delete mattgperry_tweet_1181863225756934144.png * Add files via upload * Update index.md * Update index.md * Moving docs onto /docs * fix issues * Alter docs * Tweak docs * Tweaks to blog posts * Tweaks to embed * Update packages/homepage/content/articles/codesandbox-ci-embeds/index.md Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/homepage/content/articles/codesandbox-ci-embeds/index.md Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/homepage/content/articles/codesandbox-ci-embeds/index.md Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/homepage/content/articles/codesandbox-ci-embeds/index.md Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/homepage/content/articles/codesandbox-ci-embeds/index.md Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/homepage/content/articles/codesandbox-ci-embeds/index.md Co-Authored-By: Michaël De Boey <[email protected]> * Update thank youi * Add links to thanks * Update index.md apparently we don't need the embed code, some plugin will turn this into one. * Add files via upload * Update index.md * Add docs for theme in embed * Revert "Update packages/homepage/content/articles/codesandbox-ci-embeds/index.md" This reverts commit 3a86b0d.
1 parent 66b9bde commit 4ffa3b6

File tree

14 files changed

+238
-22
lines changed

14 files changed

+238
-22
lines changed

packages/app/src/embed/components/App/elements.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ export const Moving = styled.div`
3333
position: absolute;
3434
top: 0;
3535
bottom: 0;
36-
left: 0;
36+
left: props.sidebarOpen ? 250 : 0;
3737
right: 0;
38-
transform: translateX(${props => (props.sidebarOpen ? 250 : 0)}px);
38+
width: ${props => (props.sidebarOpen ? 'calc(100% - 250px)' : '100%')};
3939
border: 1px solid;
4040
/* 8 digit hex code with last 2 for opacity */
4141
border-color: ${props => props.theme.colors.sideBar.border + '33'};

packages/app/src/embed/components/Content/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type State = {
8383
running: boolean;
8484
currentDevToolPosition: DevToolsTabPosition;
8585
};
86-
86+
// eslint-disable-next-line import/no-default-export
8787
export default class Content extends React.PureComponent<Props, State> {
8888
state: State;
8989

packages/app/src/sandbox/status-screen/run-on-click-screen.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
color: #fff;
55
font-family: 'Inter UI', sans-serif;
66
background: #151515;
7+
cursor: pointer;
78
}
89

910
.container {
191 KB
Loading
164 KB
Loading
136 KB
Loading
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
banner: ./images/banner.png
3+
slug: codesandbox-ci-embeds
4+
authors: ['Ives van Hoorne']
5+
photo: https://avatars0.githubusercontent.com/u/587016?s=460&v=4
6+
title: Announcing CodeSandbox CI and all-new Embeds
7+
description:
8+
Today we're pleased to launch CodeSandbox CI - A free continuous integration
9+
service purpose-built for open source library maintainers, along with a new
10+
look for embeds.
11+
date: 2019-11-13
12+
---
13+
14+
## CodeSandbox CI
15+
16+
Maintaining open source projects, while enormously fulfilling, can be
17+
time-consuming and stressful. After a busy Hacktober, we know from first-hand
18+
experience what it's like, and we wanted to help library maintainers make the
19+
best use of their time. Today we're pleased to launch CodeSandbox CI: A free
20+
continuous integration service purpose-built for open source library
21+
maintainers.
22+
23+
https://youtu.be/k_aR_4FeKlc
24+
25+
### Here's how it works
26+
27+
CodeSandbox CI is a GitHub app that auto-builds your library⁠ from pull
28+
requests. Whenever someone opens a new pull request, CodeSandbox CI builds a new
29+
version of your library. Those builds get posted to our registry, so you can
30+
test it in CodeSandbox or locally, and all without having to publish the build
31+
to npm⁠. Plus, if the original GitHub issue contains a link to a reproducible
32+
sandbox, then we'll automatically fork it using the new PR build. That means you
33+
can review it online with one click.
34+
35+
### Used by the biggest names in OSS
36+
37+
After a successful private beta, CodeSandbox CI is already in use by projects
38+
like React, Babel, Framer, Material UI, and others. And it's proving to be a
39+
real time-saver.
40+
41+
**Try it out for yourself by
42+
[installing the GitHub app](https://github.com/apps/codesandbox)**.
43+
44+
[![Framer tweet](./images/mattgperry_tweet_1181863225756934144.png)](https://twitter.com/mattgperry/status/1181863225756934144?s=20)
45+
46+
## A new look for Embeds
47+
48+
CodeSandbox CI is the latest way maintainers can use CodeSandbox to save time
49+
and improve experiences for users and contributors. But more than 4000 open
50+
source projects already use CodeSandbox embeds in their docs, blog posts, and
51+
websites—providing visitors with working examples that help explain how to use
52+
their creations.
53+
54+
Embeds provide the ability to view a sandbox inline in your content, whether you
55+
want to show the code, the running app, or both at the same time. Our embeds use
56+
a specially designed version of CodeSandbox that's small in size but almost as
57+
powerful as the full thing, making for a great way to explain a coding concept
58+
or show off a demo.
59+
60+
We want you to be able to use embeds anywhere you want. So based on feedback
61+
from our community, we've launched a new default look and feel for embeds that's
62+
minimal in design and looks great wherever you place it. With a subtle color
63+
palette and no branding, it doesn't take the focus away from your great content.
64+
65+
Danny Ruchtie, Head of Design here at CodeSandbox, notes that with this release,
66+
_“we've focused on building something that would better blend in with its
67+
surroundings while maintaining all its powerful features. So there's less focus
68+
on the UI and more on the content. We also wanted to give users more control and
69+
improve the embed experience on mobile.”_
70+
71+
See the difference for yourself:
72+
73+
https://codesandbox.io/s/new?fontsize=14
74+
75+
### The next big design trend?
76+
77+
Ahead of the hipster crowd and the recent dark mode trend (we've had a default
78+
dark theme since we started!), we're pleased to introduce what's sure to be the
79+
next big thing in web design: light mode!
80+
81+
Seriously though, while black's our go-to, we appreciate it doesn't always work
82+
for some site designs. So we've added a new white-based theme for embeds, which
83+
you can toggle on when creating an embed from the Share menu in the editor.
84+
85+
The new design is already live, so check it out and take a look at
86+
[our docs](https://codesandbox.io/docs/embedding) for more info.
87+
88+
### Get more done
89+
90+
With embeds, and now CodeSandbox CI, we're giving open-source project
91+
maintainers new ways to reduce their support overhead and get more done.
92+
Available now, CodeSandbox CI makes it possible to test fixes without the need
93+
to clone, install, and check things locally. There’s more info about how to
94+
configure CodeSandbox CI in [our docs](https://u2edh.csb.app/docs.html), and you
95+
can get started by
96+
[installing the GitHub app](https://github.com/apps/codesandbox).
97+
98+
## Thanks
99+
100+
Thanks goes to [Bogdan Luca](https://twitter.com/lucabogdan),
101+
[Siddharth Kshetrapal](https://twitter.com/siddharthkp), and
102+
[Danny Ruchtie](https://twitter.com/druchtie) whose hard work made these updates
103+
possible. And also to our community for your thoughtful feedback and
104+
suggestions. We can't wait to see what you will build!

packages/homepage/content/docs/2-embedding.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ find them here.
4949
| `runonclick` | Only load the preview when the user says so. | `0`/`1` | `0` |
5050
| `verticallayout` | Whether to show the editor and preview vertically. | `0`/`1` | `0` |
5151
| `view` | Which view to open by default | `editor`/`split`/`preview` | `split`, `preview` for small screens |
52+
| `theme` | Which theme to show for the embed | `dark`/`light` | `dark` |
5253

5354
## Example Embeds
5455

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: CI
3+
authors: ['Ives van Hoorne']
4+
description:
5+
Here's what CodeSandbox CI is, how it will benefit you as a library
6+
maintainer, and how to set it up for your library.
7+
---
8+
9+
## What is CodeSandbox CI?
10+
11+
CodeSandbox CI is a [GitHub app](https://github.com/apps/codesandbox) that you
12+
can install in your repository. The app is responsible for building your
13+
library. Whenever a Pull Request is opened it builds a version of the library
14+
from that PR. This is published to our registry, so you can immediately test the
15+
library in CodeSandbox or locally without publishing to nom or elsewhere.
16+
17+
## Why do I want this?
18+
19+
The goal of this app is to make it easier for you to test your library without
20+
publishing to npm yet. Since CodeSandbox is already used for bug reports we
21+
wanted to make it possible to also test the PR version of your library with the
22+
existing bug reports.
23+
24+
## How does it work?
25+
26+
A typical workflow might look like this:
27+
28+
- Someone opens an issue for a bug with a sandbox reproducible
29+
- Someone opens a fix PR mentioning the issue
30+
- We build the library from the PR, fork the sandbox repro and install the new
31+
library in that sandbox. This way you will only have to open the generated
32+
sandbox to confirm that the fix works with no need to clone, install or test
33+
locally.
34+
35+
## How do I set this up?
36+
37+
For most libraries, the only thing you need to do is install this
38+
[GitHub App](https://github.com/apps/codesandbox). In some cases you might need
39+
to do some configuration, an example of this is for monorepos. You can configure
40+
your library by creating a file called `ci.json` in a folder called
41+
`.codesandbox` (`.codesandbox/ci.json`) in the root of your repo. An example PR
42+
can be found [here](https://github.com/facebook/react/pull/17175).
43+
44+
## Configuration
45+
46+
You can configure how your projects build on CodeSandbox CI by creating a file
47+
called `ci.json` in a folder called `.codesandbox` in the root of your
48+
repository.
49+
50+
### Configuration Format
51+
52+
These are all the configuration options you can set. They are all optional.
53+
54+
```json
55+
{
56+
// which script in package.json to run to install instead of `npm ci` or `yarn install`,
57+
// can be `false` if you want to skip this step
58+
"installCommand": "install",
59+
// which script in package.json to run to build,
60+
// can be `false` if you want to skip this step
61+
"buildCommand": "build",
62+
// if you have a monorepo, put the paths of the packages here. We'll infer the package names.
63+
// globs are supported
64+
"packages": ["packages/react", "packages/react-dom"],
65+
// if you don't publish from the package directory, specify per dependency
66+
// where the contents of the built dependency are. These files will be uploaded
67+
// to our registry
68+
"publishDirectory": {
69+
"react": "build/node_modules/react"
70+
"react-dom": "build/node_modules/react-dom"
71+
},
72+
// a list of sandboxes that you want generated for a PR, if this list
73+
// is not set we will default to `vanilla`. The built library will automatically
74+
// be installed in the fork of these sandboxes in the place of the library. So if
75+
// you have a sandbox with `lodash`, and you built `lodash` and `vue`, we will only
76+
// replace `lodash` with the built version.
77+
// You can also set absolute paths to a directory in your repository. We will make sure
78+
// to generate a sandbox from the contents of that directory.
79+
"sandboxes": ["vanilla", "new", "/examples/todomvc"]
80+
}
81+
```
82+
83+
### Monorepo Example
84+
85+
Monorepos are quite common, here's an example configuration for a monorepo:
86+
87+
```json
88+
{
89+
"packages": ["./", "packages/vue-template-compiler"]
90+
}
91+
```
92+
93+
This builds two libraries: `vue`, which is in the root of the repository, and
94+
`vue-template-compiler`, which resides in the `packages` folder.
95+
96+
We automatically infer your packages from your lerna config or yarn workspaces
97+
config if `packages` is not set.
98+
99+
We handle auto linking of these dependencies, this means that we rewrite the
100+
dependencies to the newly built versions of CodeSandbox CI. In this example,
101+
`vue` uses `vue-template-compiler`, so we've updated `package.json` of `vue` to
102+
point to our built `vue-template-compiler`.

packages/homepage/gatsby-node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const getBlogNodeInfo = ({
1414
frontmatter: { authors, date, description, photo },
1515
},
1616
}) => ({
17-
author: authors[0],
17+
authors,
1818
date,
1919
description,
2020
photo,
@@ -89,7 +89,7 @@ const createNodeFieldsFromNodeInfo = ({
8989
const createBlogNodeFields = ({ createNodeField, nodeInfo }) => {
9090
createNodeFieldsFromNodeInfo({
9191
createNodeField,
92-
nodeFieldNames: ['author', 'date', 'description', 'photo'],
92+
nodeFieldNames: ['authors', 'date', 'description', 'photo'],
9393
nodeInfo,
9494
});
9595
};

0 commit comments

Comments
 (0)