Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,18 +407,18 @@ workflows:
filters:
branches:
only:
- master
- main
- deploy-staging-approval:
type: approval
filters:
branches:
ignore:
- master
- main
- deploy-to-staging:
requires:
- deploy-staging-approval
- create-docker-image
filters:
branches:
ignore:
- master
- main
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ Your best chance of getting this bug looked at quickly is to provide an example.
| Operating System | |

<!-- prettier-ignore-start -->
[code_of_conduct]: https://github.com/codesandbox/codesandbox-client/blob/master/CODE_OF_CONDUCT.md
[contributing]: https://github.com/codesandbox/codesandbox-client/blob/master/CONTRIBUTING.md
[code_of_conduct]: https://github.com/codesandbox/codesandbox-client/blob/main/CODE_OF_CONDUCT.md
[contributing]: https://github.com/codesandbox/codesandbox-client/blob/main/CONTRIBUTING.md
<!-- prettier-ignore-end -->
22 changes: 12 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ share dependencies between these parts.
backends. Forked from
[https://github.com/jvilk/BrowserFS](https://github.com/jvilk/BrowserFS), with
an additional
[CodeSandbox backend](https://github.com/codesandbox/codesandbox-client/blob/master/standalone-packages/codesandbox-browserfs/src/backend/CodeSandboxFS.ts).
[CodeSandbox backend](https://github.com/codesandbox/codesandbox-client/blob/main/standalone-packages/codesandbox-browserfs/src/backend/CodeSandboxFS.ts).

This version of CodeSandbox is using the production server as source of truth,
this is specified by the environment variable `LOCAL_SERVER`. If you're working
Expand Down Expand Up @@ -71,22 +71,24 @@ To install the project you need to have `yarn` and `node`
- on subsequent runs you can also bypass dependencies building and use
`yarn start:fast`

> Tip: Keep your `master` branch pointing at the original repository and make
> pull requests from branches on your fork. To do this, run:
> Tip: Keep your `main` branch pointing at the original repository and make pull
> requests from branches on your fork. To do this, run:
>
> ```sh
> git remote add upstream https://github.com/codesandbox/codesandbox-client.git
> git fetch upstream
> git branch --set-upstream-to=upstream/master master
> git branch --set-upstream-to=upstream/main main
> ```
>
> This will add the original repository as a "remote" called "upstream," then
> fetch the git information from that remote, then set your local `master`
> branch to use the upstream master branch whenever you run `git pull`. Then you
> can make all of your pull request branches based on this `master` branch.
> Whenever you want to update your version of `master`, do a regular `git pull`.

5. If you want to debug the state of the app, use `npx overmind-devtools` and make sure that the app is running. Learn more [here](https://overmindjs.org/core/devtools).
> fetch the git information from that remote, then set your local `main` branch
> to use the upstream main branch whenever you run `git pull`. Then you can make
> all of your pull request branches based on this `main` branch. Whenever you
> want to update your version of `main`, do a regular `git pull`.

5. If you want to debug the state of the app, use `npx overmind-devtools` and
make sure that the app is running. Learn more
[here](https://overmindjs.org/core/devtools).

## Submitting a Pull Request

Expand Down
30 changes: 15 additions & 15 deletions contributor-docs/adding-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ add (**sandbox** vs. **container**).

To get started, you should first follow the steps in our contribution guidelines
in order to
[set up CodeSandbox locally](https://github.com/codesandbox/codesandbox-client/blob/master/CONTRIBUTING.md#setting-up-the-project-locally).
[set up CodeSandbox locally](https://github.com/codesandbox/codesandbox-client/blob/main/CONTRIBUTING.md#setting-up-the-project-locally).

### 1. Add template logo

Add the logo for your template in the
[templates repo](https://github.com/codesandbox/codesandbox-client/tree/master/packages/template-icons/src)
[templates repo](https://github.com/codesandbox/codesandbox-client/tree/main/packages/template-icons/src)
(`codesandbox-templates/packages/template-icons/src`).

#### SVG logos
Expand All @@ -102,24 +102,24 @@ content. If your template's name is "Banana", name your logo file "BananaIcon".

Examples:

- [Vue logo](https://github.com/codesandbox/codesandbox-client/tree/master/packages/template-icons/src/VueIcon.tsx)
- [React logo](https://github.com/codesandbox/codesandbox-client/tree/master/packages/template-icons/src/ReactIcon.tsx)
- [Vue logo](https://github.com/codesandbox/codesandbox-client/tree/main/packages/template-icons/src/VueIcon.tsx)
- [React logo](https://github.com/codesandbox/codesandbox-client/tree/main/packages/template-icons/src/ReactIcon.tsx)

### 2. Add template definition

In order for CodeSandbox to recognise your template, you need to add a new
definition of it in the `codesandbox-client/packages/common/src/templates`
[directory](https://github.com/codesandbox/codesandbox-client/tree/master/packages/common/src/templates).
[directory](https://github.com/codesandbox/codesandbox-client/tree/main/packages/common/src/templates).
You do this by creating a new `.ts` file with the name of your template.

Examples:

- [Parcel](https://github.com/codesandbox/codesandbox-client/blob/master/packages/common/src/templates/parcel.ts)
- [Gatsby](https://github.com/codesandbox/codesandbox-client/blob/master/packages/common/src/templates/gatsby.ts)
- [Parcel](https://github.com/codesandbox/codesandbox-client/blob/main/packages/common/src/templates/parcel.ts)
- [Gatsby](https://github.com/codesandbox/codesandbox-client/blob/main/packages/common/src/templates/gatsby.ts)

The template definition can have various options, which you can find more
information about in
[template.ts](https://github.com/codesandbox/codesandbox-client/blob/master/packages/common/src/templates/template.ts).
[template.ts](https://github.com/codesandbox/codesandbox-client/blob/main/packages/common/src/templates/template.ts).

We encourage you to improve the user experience of your templates by taking
advantage of the options you have available while writing your template
Expand All @@ -133,7 +133,7 @@ Examples:
<!-- TODO: Add more examples -->

After writing your template definition, you also need to add it to the
[index.js](https://github.com/codesandbox/codesandbox-client/blob/master/packages/common/src/templates/index.ts)
[index.js](https://github.com/codesandbox/codesandbox-client/blob/main/packages/common/src/templates/index.ts)
file in the same directory (`codesandbox-client/packages/common/src/templates`)
in order for CodeSandbox to be able to retrieve your template.

Expand All @@ -148,18 +148,18 @@ preset.

We call a template configuration for the bundler in CodeSandbox a 'Preset'. All
currently installed presets are defined in the
[index.ts](https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/sandbox/eval/index.ts)
[index.ts](https://github.com/codesandbox/codesandbox-client/blob/main/packages/app/src/sandbox/eval/index.ts)
file under `codesandbox-client/packages/app/src/sandbox/eval/presets`.

In order to understand how this configuration works, we recommend you to take a
look at templates that have already been implemented and their presets.

Examples:

- [create-react-app-typescript](https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/sandbox/eval/presets/create-react-app-typescript/index.js)
- [create-react-app-typescript](https://github.com/codesandbox/codesandbox-client/blob/main/packages/app/src/sandbox/eval/presets/create-react-app-typescript/index.js)
(most basic one)
- [CxJS](https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/sandbox/eval/presets/cxjs/index.js)
- [vue-cli](https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/sandbox/eval/presets/vue-cli/index.js)
- [CxJS](https://github.com/codesandbox/codesandbox-client/blob/main/packages/app/src/sandbox/eval/presets/cxjs/index.js)
- [vue-cli](https://github.com/codesandbox/codesandbox-client/blob/main/packages/app/src/sandbox/eval/presets/vue-cli/index.js)

### 4. Add the importer

Expand All @@ -169,7 +169,7 @@ template for every template. This logic is **not** found in `codesanbox-client`.

This means you that you also have to add your template in another file in the
`codesandbox-importers` repository called
[templates.ts](https://github.com/codesandbox/codesandbox-importers/blob/master/packages/import-utils/src/create-sandbox/templates.ts).
[templates.ts](https://github.com/codesandbox/codesandbox-importers/blob/main/packages/import-utils/src/create-sandbox/templates.ts).

When you create your Pull Request in `codesanbox-client`, you also need to
create a Pull Request in `codesandbox-importer` and reference it in your Pull
Expand All @@ -190,7 +190,7 @@ functionality of templates using containers.

To test your new template, you need to create a mock response from the API and
force the new template specification. To do this, you uncomment
[this line](https://github.com/codesandbox/codesandbox-client/blob/master/packages/app/src/app/store/actions.js#L17)
[this line](https://github.com/codesandbox/codesandbox-client/blob/main/packages/app/src/app/store/actions.js#L17)
and change `'custom'` to the id/name of your template:

```diff
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/app/overmind/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const withLoadApp = <I>(
const response = await effects.http.get<{
contributors: Contributor[];
}>(
'https://raw.githubusercontent.com/codesandbox/codesandbox-client/master/.all-contributorsrc'
'https://raw.githubusercontent.com/codesandbox/codesandbox-client/main/.all-contributorsrc'
);

state.contributors = response.data.contributors.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export const SyncedSandboxListItem = ({ name, path, url, ...props }) => {
<Stack justify="space-between" align="center">
<Text size={3} weight="medium" css={{ color: '#E5E5E5' }}>
{name}
{props.branch !== 'master' ? `:${props.branch}` : ''}
{['main', 'master'].includes(props.branch)
? ''
: `:${props.branch}`}
</Text>
</Stack>
</Stack>
Expand Down
4 changes: 2 additions & 2 deletions testpr-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function test(prId) {
const branchName = `pr-${username.sync()}-${prId}`;

Promise.resolve()
.then(() => spawnPromise('git', ['checkout', 'master']))
.then(() => spawnPromise('git', ['checkout', 'main']))
.then(() => spawnPromise('git', ['branch', '-D', branchName]))
.catch(() => {
/* Do not care if this fails */
Expand All @@ -45,7 +45,7 @@ async function test(prId) {
])
)
.then(() => spawnPromise('git', ['checkout', branchName]))
.then(() => spawnPromise('git', ['merge', 'master']))
.then(() => spawnPromise('git', ['merge', 'main']))
.then(() => spawnPromise('yarn', ['install']))
.then(() => spawnPromise('yarn', ['build:deps']))
.then(() => spawnPromise('yarn', ['typecheck']))
Expand Down
Loading