Skip to content

Commit 984e746

Browse files
committed
Move info for prettier to CONTRIBUTING.md
1 parent f77ecda commit 984e746

File tree

2 files changed

+48
-28
lines changed

2 files changed

+48
-28
lines changed

CONTRIBUTING.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## Setup
2+
3+
This build uses node version 18.15.0 and npm version.
4+
Install nvm and run the following commands:
5+
6+
```
7+
nvm install 18.15
8+
nvm use 18
9+
```
10+
11+
To build the library, run the following commands:
12+
13+
```
14+
npm install
15+
npm run build
16+
```
17+
18+
This will create the build in the dist folder.
19+
20+
Open `examples/NeuralNetwork/index.html` in the browser to see the build running an example from the ml5 website.
21+
22+
## Code Formatting
23+
24+
To keep the coding style consistent, we will be using the Prettier formatter.
25+
26+
### Visual Studio Code
27+
28+
If you are using Visual Studio Code, you can install the Prettier extension by going to the **Extensions** tab and search for "Prettier". Click on **Prettier - Code formatter** and click **Install**.
29+
30+
Go to **File > Preferences > Settings**, search for "default formatter" and make sure **Prettier - Code formatter** is selected for **Editor: Default Formatter**.
31+
32+
To automatically format a document when saving it, search for "format on save" in the settings and make sure **Editor: Format On Save** is checked. Otherwise, you can use the VS Code keyboard shortcut to format an opened document, which is <kbd>shift</kbd> + <kbd>alt</kbd> + <kbd>f</kbd> for Windows or <kbd>shift</kbd> + <kbd>option</kbd> + <kbd>f</kbd> for Mac by default.
33+
34+
### Command Line
35+
36+
You can also format a document via the command line. To format all JavaScript documents in the repo, use:
37+
38+
```
39+
npm run format
40+
```
41+
42+
To format a specific document, use
43+
44+
```
45+
npx prettier --write path/to/file
46+
```
47+
48+
For more options with the command line, refer to the [Prettier Documentation](https://prettier.io/docs/en/cli.html)

README.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,6 @@ This will create the build in the dist folder.
2323

2424
Open `examples/NeuralNetwork/index.html` in the browser to see the build running an example from the ml5 website.
2525

26-
## Code Formatting
27-
28-
To keep the coding style consistent, we will be using the Prettier formatter.
29-
30-
### Visual Studio Code
31-
32-
If you are using Visual Studio Code, you can install the Prettier extension by going to the **Extensions** tab and search for "Prettier". Click on **Prettier - Code formatter** and click **Install**.
33-
34-
Go to **File > Preferences > Settings**, search for "default formatter" and make sure **Prettier - Code formatter** is selected for **Editor: Default Formatter**.
35-
36-
To automatically format a document when saving it, search for "format on save" in the settings and make sure **Editor: Format On Save** is checked. Otherwise, you can use the VS Code keyboard shortcut to format an opened document, which is <kbd>shift</kbd> + <kbd>alt</kbd> + <kbd>f</kbd> for Windows or <kbd>shift</kbd> + <kbd>option</kbd> + <kbd>f</kbd> for Mac.
37-
38-
### Command Line
39-
40-
You can also format a document via the command line. To format all JavaScript documents in the repo, use:
41-
42-
```
43-
npm run format
44-
```
45-
46-
To format a specific document, use
47-
48-
```
49-
npx prettier --write path/to/file
50-
```
51-
52-
For more options with the command line, refer to the [Prettier Documentation](https://prettier.io/docs/en/cli.html)
53-
5426
## Process
5527

5628
_This section explains how this repository was creates and is for reference purposes only. The steps outlines in this section do not need to be followed by contributors._

0 commit comments

Comments
 (0)