Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(monorepo): Add contributing guide #1588

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHROME_PATH=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ node_modules/
/lerna-debug.log

.nx/cache

# environment variables
.env
87 changes: 87 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# OpenSCD Contributing Guide

Hi! We're really excited that you're interested in contributing to OpenSCD! Before submitting your contribution, please read through the following guide.

The easiest way to get in touch is to join us on the [↗ Zulip Chat](https://openscd.zulipchat.com/join/k3cyur3wx526tvafkjwubhjn/).
If you say "hi" there we will be more than happy to help you find your way around this project.

## Repo Setup

To develop locally, fork the Vite repository and clone it in your local machine. The Vite repo is a [↗ monorepo](https://en.wikipedia.org/wiki/Monorepo) using pnpm workspaces. The package manager used to install and link dependencies must be [↗ npm](https://docs.npmjs.com/cli/using-npm/workspaces).
michelguerin marked this conversation as resolved.
Show resolved Hide resolved

To find out more about the development of each packages, such as the base distribution or the plugins, please refer to their respective READMEs:
- [open-scd](packages/openscd/README.md): provides the base distribution available on [openscd.github.io](https://openscd.github.io)
- [core](packages/core/README.md): provides the agreed api of OpenSCD Core


To develop, follow these steps :

1. Install [↗ Node.js](https://nodejs.org/en/download/package-manager)

> [!IMPORTANT]
> `Node.js` version should be set to `20.x.x` as there are incompatibilities with higher version

2. Run `npm ci` in OpenSCD's root folder.

3. Run `npm run build` in OpenSCD's root folder.

4. Run `npm start` in OpenSCD's root folder.

> [!NOTE]
> If you run in the following error :
> `Lerna (powered by Nx) Daemon process terminated and closed the connection`
> Rerun `npm start` and it should work as expected

To test, follow these steps :

1. Install a compatible compatible [↗ playright](https://playwright.dev/docs/browsers#introduction) browser
2. Run `npx playwright install` in OpenSCD's root folder, to install a compatible `playright` browser libraries

> [!NOTE]
> If you are using `chromium`, you might need to add :
> `CHROME_PATH=path-to-your-chromium-app` in your .env file in OpenSCD's root folder, see `.env.example`.

## Pull Request Guidelines

- Checkout a topic branch from a base branch (e.g. `main`), and merge back against that branch.

- If adding a new feature:

- Add accompanying test case.
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first, and have it approved before working on it.

- If fixing a bug:

- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log (e.g. `fix: update entities encoding/decoding (fix #3899)`).
- Provide a detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable.

- It's OK to have multiple small commits as you work on the PR. GitHub can automatically squash them before merging.

- Make sure tests pass!

## Maintenance Guidelines

> The following section is mostly for maintainers who have commit access, but it's helpful to go through if you intend to make non-trivial contributions to the codebase.

## Notes on Dependencies

OpenSCD aims to be lightweight, and this includes being aware of the number of npm dependencies and their size.

### Think Before Adding a Dependency

Most deps should be added to `devDependencies` even if they are needed at runtime. Some exceptions are:

- Type packages. Example: `@types/*`.
- Deps that cannot be properly bundled due to binary files. Example: `esbuild`.
- Deps that ship their own types that are used in Vite's own public types. Example: `rollup`.

Avoid deps with large transitive dependencies that result in bloated size compared to the functionality it provides. For example, `http-proxy` itself plus `@types/http-proxy` is a little over 1MB in size, but `http-proxy-middleware` pulls in a ton of dependencies that make it 7MB(!) when a minimal custom middleware on top of `http-proxy` only requires a couple of lines of code.
michelguerin marked this conversation as resolved.
Show resolved Hide resolved

### Ensure Type Support

OpenSCD `core` aims to be fully usable as a dependency in a TypeScript project. This means technically a dependency whose types are exposed needs to be part of `dependencies` instead of `devDependencies`. However, this also means we won't be able to bundle it.

## License

This contributing guide is derived from the one used by the [↗ ViteJS](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md) project, which is under the MIT License.
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

Open Substation Communication Designer is an editor for SCL files as described in `IEC 61850-6`.

> Try it out at [openscd.github.io](https://openscd.github.io)!
> Try it out at [openscd.github.io](https://openscd.github.io)!
trusz marked this conversation as resolved.
Show resolved Hide resolved

Make sure your web browser has enough free memory! If needed, disable plug-ins and close unused browser tabs.

## Installation

In order to install OpenSCD on your local device (only for you), simply visit [openscd.github.io](https://openscd.github.io), click the "Install OpenSCD" button in your address bar (Chrome or Edge on desktop) or click the "Add OpenSCD to home screen" notification in any mobile browser.
In order to install OpenSCD on your local device (only for you), simply visit [openscd.github.io](https://openscd.github.io), click the "Install OpenSCD" button in your address bar (Chrome or Edge on desktop) or click the "Add OpenSCD to home screen" notification in any mobile browser.

In order to install your own instance of OpenSCD on your own webserver (e.g. on your company intranet), simply download [our latest release](https://github.com/openscd/open-scd/releases/latest) (`open-scd.zip` or `open-scd.tar.gz`) and extract the archive contents into the "webroot" directory of your web server.

Expand All @@ -24,17 +24,9 @@ If you don't have your own webserver but still want your own version of OpenSCD
We gather the available plug-ins from the community in the [plug-ins](docs/plug-ins.md) file.
If you would like to list your plug-in here, please open a pull request.

## Development

This repository is a [↗ monorepo](https://en.wikipedia.org/wiki/Monorepo), made up of several packages.
To find out more about the development of each packages, such as the base distribution or the plugins, please refer to their respective READMEs:
- [open-scd](packages/openscd/README.md): provides the base distribution available on [openscd.github.io](https://openscd.github.io)
- [core](packages/core/README.md): provides the agreed api of OpenSCD Core

## Contributing

The easiest way to get in touch is to join us on the [Zulip Chat](https://openscd.zulipchat.com/join/k3cyur3wx526tvafkjwubhjn/).
If you say "hi" there we will be more than happy to help you find your way around this project.
See [Contributing Guide](CONTRIBUTING.md)

## Documentation

Expand Down
Loading