Skip to content

Commit

Permalink
docs: Organize and expand contributing documentation (#253)
Browse files Browse the repository at this point in the history
* docs: Use title case consistently

The sibling headings use title case.

* docs: Relocate contributing guidelines into separate files

Reduce the size of the `README` file and begin reorganizing code
contribution guidelines to simplify navigating additional content.

* docs: Expand the contributing guidelines

* docs: Expand and improve consistency of code contribution documentation

* docs: Document CLI development tips

* docs: Fix documentation link paths

* docs: Fix code of conduct link path

* docs: Fix missing punctuation

* docs: Add links to code contribution and project setup documentation

* fix: Improve casing consistency

* docs: Improve documentation formatting

* docs: Simplify copying and pasting example commands

* docs: Describe the Calypso project

Contributors may not be familiar with the Calypso project or its purpose.

Co-authored-by: Carlos Garcia <[email protected]>

* docs: Further clarify Calypso's connection to WordPress.com

Calypso is not associated with the open-source WordPress project.

* docs: Recommend running `npm install` before building the source code

Avoid potential confusion from missing or outdated dependencies by
recommending that contributors always install the latest dependencies
before building the source code.

---------

Co-authored-by: Carlos Garcia <[email protected]>
  • Loading branch information
dcalhoun and fluiddot authored Jun 17, 2024
1 parent fefc9d2 commit f431f55
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 99 deletions.
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing Guidelines

We welcome contributions to Studio, whether they are bug reports, feature requests, or code changes. Please read the following guidelines to ensure that your contributions are accepted quickly and easily.

## Expectations

- We expect all contributors to follow our [Code of Conduct](./CODE-OF-CONDUCT.md).
- We expect all contributors to follow our [Security Policy](./SECURITY.md).
- By submitting a pull request, you agree to release your code under the project's [License](./LICENSE.md).

## How to Contribute

### Reporting Security Issues

Please see our [security policy](./SECURITY.md).

### Reporting General Issues

If you find a bug or have a feature request, please [open an issue](https://github.com/Automattic/studio/issues/new/choose).

### Code Contributions

For information on setting up your development environment for contributing code, see the [Code Contributions](./docs/code-contributions.md).

We are truly grateful for any pull requests you open, and we assure you of our welcoming and respectful approach. We will review and consider all pull requests, valuing the diverse contributions, but we don’t guarantee that all proposed changes will be merged into the core.

The most desirable pull requests are:

- Bug fixes for existing features.
- Enhancements that improve compatibility with different system versions, browsers, PHP or WP versions, WordPress plugins, or environments in general.

We recommend [adding an issue](https://github.com/Automattic/studio/issues/new/choose) for new features so we can review the plan before you start work on the pull request.
103 changes: 4 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ A desktop application for creating local WordPress environments, powered by Word

![](https://raw.githubusercontent.com/Automattic/studio/trunk/demo.png)

## Getting started
## Getting Started

Studio is open source and is available to download for free!

**Step 1: Download the App**
Expand All @@ -25,102 +26,6 @@ Our mission is for Studio to be the fastest and simplest way for developers to b

Feel free to [open an issue](https://github.com/Automattic/studio/issues/new/choose) to discuss your proposed improvement. Pull requests are welcome for bug fixes and enhancements. New features will need to go through our internal vetting process before they are accepted.

### Contributions etiquette

We are truly grateful for any PRs you open, and we assure you of our welcoming and respectful approach. We will review and consider all PRs, valuing the diverse contributions, but we don’t guarantee that all proposed changes will be merged into the core.

The most desirable PRs are:
- Bug fixes for existing features
- Enhancements that improve compatibility with different system versions, browsers, PHP or WP versions, WordPress plugins, or environments in general.

We recommend [adding an issue](https://github.com/Automattic/studio/issues/new/choose) for new features so we can review the plan before you start work on the PR.

### Start development

#### Initial setup

The project includes native dependencies which require Python and its `setuptools` module to build correctly.

If you manage packages with Homebrew you can do the following:

```bash
brew install python3 python-setuptools
```

#### Install dependencies, incrementally build, and run app

```bash
nvm use
npm install
npm start
```

The app automatically launches with the Chromium developer tools opened by default.

`src/index.ts` is the entry point for the main process.

`src/renderer.ts` is the entry point for the "renderer"—the code running in the Chromium window.

#### Code formatting

Code formatting has been set up to make merging PRs easier. It uses the same prettier/eslint mechanism as Calypso. See [JavaScript Coding Guidelines](https://github.com/Automattic/wp-calypso/blob/trunk/docs/coding-guidelines/javascript.md) for details on setting up your editor.

### Testing

#### Unit tests

You can run tests with the following command:

```bash
npm run test
```

#### E2E tests

There are also E2E tests available. To run them, clean the `out/` directory and build the fresh app binary:

```bash
npm run make
```

Then run tests:

```bash
npm run e2e
```

### Debugging

The renderer process can be debugged using the Chromium developer tools. To open the developer tools, press `Cmd+Option+I` on Mac or `Ctrl+Shift+I` on Windows.

The React tree in the renderer process can be debugged with the standalone [React Developer Tools](https://react.dev/learn/react-developer-tools#safari-and-other-browsers). To do this, start the the React Developer Tools and then start the app with the `REACT_DEV_TOOLS=true` flag set.

```bash
npx react-devtools
REACT_DEV_TOOLS=true npm start
```

The main process can be debugged using the Node.js inspector. To do this, run the app with the `--inspect-brk-electron` flag:

```bash
npm start -- --inspect-brk-electron
```

Then open `chrome://inspect` in a Chromium-based browser and click "inspect" next to the process you want to debug.

### Building Installers

Installers can currently be built on Mac (Intel or Apple Silicon) and Windows:

```bash
npm install
npm run make
```

### Localization

[See localization docs](./docs/localization.md)

### Versioning and Updates
To learn more about how to contribute, please read the [Contributing Guidelines](./CONTRIBUTING.md).

[See versioning docs](./docs/versioning-and-updates.md)
For information on setting up your development environment for contributing code, see the [Code Contributions](./docs/code-contributions.md).
135 changes: 135 additions & 0 deletions docs/code-contributions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Code Contributions

## Development

### Required Dependencies

Before you can build and run the app, you need to install the following dependencies:

- [Node.js](https://nodejs.org/) - required JavaScript runtime environment.
- [Python](https://www.python.org/) - required for building native dependencies.
- [setuptools](https://pypi.org/project/setuptools/) - required for building native dependencies.

Many project contributors rely upon [`nvm`](https://github.com/nvm-sh/nvm) and [Homebrew](https://brew.sh) to manage Node.js and Python installations respectively.

If you manage packages with Homebrew you can do the following:

```bash
brew install python3 python-setuptools
```

`nvm` commands referenced in the remaining documentation operate under the assumption that installed Node.js versions are managed with `nvm`. To use the correct Node.js version and install the project dependencies, run the following commands:

```bash
nvm use
npm install
```

### Running the App

Once all required dependencies are installed, you can run the app with the following command:

```bash
npm install
npm start
```

The app automatically launches with the Chromium developer tools opened by default. Changes to the "renderer" process code will automatically reload the app, changes to the main process code require a manual server restart or [typing `rs`](https://www.electronforge.io/cli#start) into the same terminal where the server was started.

### Project Structure

The following represents notable pieces of project structure:

- `scripts/` - scripts for building and testing the app.
- `src/` - the source code for the app.
- `src/index.ts` - the entry point for the main process.
- `src/renderer.ts` - the entry point for the "renderer," the code running in the Chromium window.
- `vendor/wp-now` - the modified `wp-now` source code.

### Code Formatting

Code formatting is set up to make merging pull requests easier. It uses the same Prettier/ESLint mechanism as Calypso, the code powering the WordPress.com dashboard. See [JavaScript Coding Guidelines](https://github.com/Automattic/wp-calypso/blob/trunk/docs/coding-guidelines/javascript.md) for guidance on setting up your editor for code formatting.

### CLI Development

The CLI relies upon a separate instance of the app to run. When developing the CLI, the CLI can be invoked with the following steps:

- Run `npm start` to launch the first instance of the app.
- Within the `forge.config.ts` file, change the `WebpackPlugin` ports used for the second instance:
- Set the development `port` to `3457`.
- Add a `loggerPort` property set to `9001`.
- Run `npm start -- -- --cli"=<CLI-COMMAND>"` in separate terminal session.

## Testing

### Unit Tests

Automated unit tests can be run with the following command:

```bash
npm run test
```

Or to run tests in "watch" mode:

```bash
npm run test:watch
```

### End-to-End Tests

Automated end-to-end (E2E) tests are also available. To run them, clean the `out/` directory and build the fresh app binary:

```bash
npm run make
```

Then run tests:

```bash
npm run e2e
```

## Debugging

The renderer process can be debugged using the Chromium developer tools. To open the developer tools, press <kbd>Cmd</kbd>+<kbd>Option</kbd>+<kbd>I</kbd> on Mac or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> on Windows.

The React tree in the renderer process can be debugged with the standalone [React Developer Tools](https://react.dev/learn/react-developer-tools#safari-and-other-browsers). To do this, start the the React Developer Tools and then start the app with the `REACT_DEV_TOOLS=true` flag set.

First, install and run the React Developer Tools:

```bash
npx react-devtools
```

Then start the app with the `REACT_DEV_TOOLS=true` flag:

```bash
REACT_DEV_TOOLS=true npm start
```

The main process can be debugged using the Node.js inspector. To do this, run the app with the `--inspect-brk-electron` flag:

```bash
npm start -- --inspect-brk-electron
```

Then open `chrome://inspect` in a Chromium-based browser and click "inspect" next to the process you want to debug.

## Building Installers

Once all required dependencies are installed, you can build installers for the app.
Installers can currently be built on Mac (Intel or Apple Silicon) and Windows with the following command:

```bash
npm install
npm run make
```

## Localization

See [Localization](./localization.md) documentation.

## Versioning and Updates

See [Versioning and Updates](./versioning-and-updates.md) documentation.

0 comments on commit f431f55

Please sign in to comment.