Skip to content

Commit e3c588a

Browse files
authored
Merge branch 'main' into add-hritvik-bhatia
2 parents 77e1a07 + 19b0ec8 commit e3c588a

23 files changed

+997
-32
lines changed

.all-contributorsrc

+9
Original file line numberDiff line numberDiff line change
@@ -6795,6 +6795,15 @@
67956795
"bug",
67966796
"translation"
67976797
]
6798+
},
6799+
{
6800+
"login": "Darrenhqf",
6801+
"name": "Qingfeng Huang",
6802+
"avatar_url": "https://avatars.githubusercontent.com/u/92257843?v=4",
6803+
"profile": "https://git.arts.ac.uk/pages/21034426/My_Portfolio_Website/",
6804+
"contributions": [
6805+
"translation"
6806+
]
67986807
}
67996808
],
68006809
"repoType": "github",

.github/first-timers.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# You can create the issue in a different repo than where the problem is. Just make sure you installed the bot on the configured repository.
1+
# You can create the issue in a different repo than where the problem is. Just make sure you have installed the bot on the configured repository.
22
# The issue will link back to the original repository where the contribution will be made.
33
repository: p5.js
44

@@ -11,4 +11,4 @@ labels:
1111
- hacktoberfest
1212

1313
# If you would like to add your own template for the issue, add an .md file to your .github folder
14-
# template: .github/first-timers-issue-template.md
14+
# template: .github/first-timers-issue-template.md
+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: New p5.js 2.x release
2+
# Requires secrets `NPM_TOKEN` and `ACCESS_TOKEN` to be set
3+
4+
permissions:
5+
contents: write
6+
7+
on:
8+
push:
9+
tags:
10+
- 'v2.*.*' # Push events to matching v*.*.*, i.e. v20.15.10
11+
- 'v2.*.*-*' # Push events to matching v*.*.*-*, i.e. v20.15.10-0
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
name: Release
17+
env:
18+
INPUT_TOKEN: ${{ secrets.NPM_TOKEN }}
19+
steps:
20+
# 1. Setup
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: 20
25+
- name: Get semver info
26+
id: semver
27+
uses: akshens/semver-tag@v4
28+
with:
29+
version: ${{ github.ref_name }}
30+
31+
- name: Get version number
32+
id: version-number
33+
run: |
34+
version=$(echo ${{ github.ref_name }} | cut -c 2-)
35+
echo "version=$version" >> $GITHUB_OUTPUT
36+
37+
- name: Get current date
38+
id: date
39+
run: echo "date=$(date +"%B %Oe, %Y")" >> $GITHUB_OUTPUT
40+
- name: Install dependencies
41+
run: npm ci
42+
env:
43+
CI: true
44+
- name: Run test
45+
run: npm test
46+
env:
47+
CI: true
48+
- name: Run build
49+
run: npm run build
50+
51+
# 2. Prepare release files
52+
- run: mkdir release && mkdir p5 && cp -r ./lib/* p5/
53+
- name: Create release zip file
54+
uses: TheDoctor0/zip-release@0.6.2
55+
with:
56+
type: zip
57+
filename: release/p5.zip
58+
path: ./p5/*
59+
60+
- name: Copy release files
61+
run: cp lib/p5.js lib/p5.min.js lib/p5.esm.js release/
62+
63+
# 3. Release p5.js
64+
- name: Create GitHub release
65+
uses: softprops/action-gh-release@v0.1.15
66+
with:
67+
draft: true
68+
prerelease: ${{ steps.semver.outputs.is-prerelease == 'true' }}
69+
files: release/*
70+
generate_release_notes: true
71+
token: ${{ secrets.ACCESS_TOKEN }}
72+
- name: Publish to NPM
73+
uses: JS-DevTools/npm-publish@v1
74+
with:
75+
token: ${{ secrets.NPM_TOKEN }}
76+
tag: ${{ steps.semver.outputs.is-prerelease != 'true' && 'latest' || 'beta' }}
77+
78+
# 4. Update p5.js website
79+
- name: Clone p5.js website
80+
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
81+
uses: actions/checkout@v3
82+
with:
83+
repository: processing/p5.js-website
84+
ref: '2.0'
85+
path: website
86+
fetch-depth: 0
87+
token: ${{ secrets.ACCESS_TOKEN }}
88+
- name: Updated website files
89+
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
90+
run: |
91+
cd website
92+
npm install
93+
npm run build:contributor-docs
94+
npm run build:contributors
95+
npm run build:reference
96+
npm run build:search
97+
npm run build:p5-version
98+
- name: Commit updated website files
99+
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
100+
run: |
101+
cd website
102+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
103+
git config --local user.name "github-actions[bot]"
104+
git add .
105+
git commit -m "Update p5.js to ${{ github.ref_name }}"
106+
- name: Push updated website repo
107+
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
108+
uses: ad-m/github-push-action@v0.6.0
109+
with:
110+
github_token: ${{ secrets.ACCESS_TOKEN }}
111+
branch: '2.0'
112+
directory: website/
113+
repository: processing/p5.js-website

.github/workflows/release-workflow.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ permissions:
77
on:
88
push:
99
tags:
10-
- 'v*.*.*' # Push events to matching v*.*.*, i.e. v20.15.10
11-
- 'v*.*.*-*' # Push events to matching v*.*.*-*, i.e. v20.15.10-0
10+
- 'v1.*.*' # Push events to matching v*.*.*, i.e. v20.15.10
11+
- 'v1.*.*-*' # Push events to matching v*.*.*-*, i.e. v20.15.10-0
1212

1313
jobs:
1414
release:

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@ We recognize all types of contributions. This project follows the [all-contribut
11241124
<td align="center" valign="top" width="16.66%"><a href="https://github.com/mxramsey"><img src="https://avatars.githubusercontent.com/u/161327383?v=4?s=120" width="120px;" alt="Mx. Ramsey"/><br /><sub><b>Mx. Ramsey</b></sub></a><br /><a href="#ideas-mxramsey" title="Ideas, Planning, & Feedback">🤔</a></td>
11251125
<td align="center" valign="top" width="16.66%"><a href="https://github.com/franolichdesign"><img src="https://avatars.githubusercontent.com/u/74784668?v=4?s=120" width="120px;" alt="Franolich Design"/><br /><sub><b>Franolich Design</b></sub></a><br /><a href="https://github.com/processing/p5.js/issues?q=author%3Afranolichdesign" title="Bug reports">🐛</a> <a href="https://github.com/processing/p5.js/commits?author=franolichdesign" title="Code">💻</a></td>
11261126
<td align="center" valign="top" width="16.66%"><a href="https://github.com/HritvikBhatia"><img src="https://avatars.githubusercontent.com/u/149999573?v=4?s=120" width="120px;" alt="Vik"/><br /><sub><b>Vik</b></sub></a><br /><a href="https://github.com/processing/p5.js/commits?author=HritvikBhatia" title="Code">💻</a> <a href="https://github.com/processing/p5.js/issues?q=author%3AHritvikBhatia" title="Bug reports">🐛</a> <a href="#translation-HritvikBhatia" title="Translation">🌍</a></td>
1127+
<td align="center" valign="top" width="16.66%"><a href="https://git.arts.ac.uk/pages/21034426/My_Portfolio_Website/"><img src="https://avatars.githubusercontent.com/u/92257843?v=4?s=120" width="120px;" alt="Qingfeng Huang"/><br /><sub><b>Qingfeng Huang</b></sub></a><br /><a href="#translation-Darrenhqf" title="Translation">🌍</a></td>
11271128
</tr>
11281129
</tbody>
11291130
</table>

contributor_docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Head over to [this link](./contributor_guidelines.md) where you will be guided o
3636

3737
Most of the time we will stick with this workflow quite strictly and, especially if you have contributed to other projects before, it may feel like there are too many hoops to jump through for what may be a simple contribution. However, the steps above are aimed to make it easy for you as a contributor and for stewards/maintainers to contribute meaningfully, while also making sure that you won't be spending time working on things that may not be accepted for various reasons. The steps above will help ensure that any proposals or fixes are adequately discussed and considered before any work begin, and often this will actually save you (and the steward/maintainer) time because the PR that would need additional fixing after review, or outright not accepted, would happen less often as a result.
3838

39-
**We see contributing to p5.js as a learning opportunity** and we don't measure sucess by only looking at the volume of contributions we received. There is no time limit on how long it takes you to complete a contribution, so take your time and work at your own pace (we may check in after a long period of inactivity). Ask for help from any of the stewards or maintainers if you need them and we'll try our best to support you. For information related to area stewards or general maintenance of p5.js GitHub repository, please check out the [steward guidelines](./steward_guidelines.md).
39+
**We see contributing to p5.js as a learning opportunity** and we don't measure success by only looking at the volume of contributions we received. There is no time limit on how long it takes you to complete a contribution, so take your time and work at your own pace (we may check in after a long period of inactivity). Ask for help from any of the stewards or maintainers if you need them and we'll try our best to support you. For information related to area stewards or general maintenance of p5.js GitHub repository, please check out the [steward guidelines](./steward_guidelines.md).
4040

4141
## Non-source code contribution
4242
There are many more ways to contribute to p5.js through non-source code contribution than can be exhaustively listed here. Some of the ways may also involve working with some of the p5.js repositories (such as adding examples, writing tutorials for the website, etc.). Depending on what the planned contribution is, we may be able to support you in different ways so do reach out to us via any channel available to you (email, social media, [Discourse forum](https://discourse.processing.org/c/p5js/10), Discord, etc). Here are just some ways you can contribute:

contributor_docs/archive/es6-adoption.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## ES6 Adoption
22
p5.js has recently adopted the ECMAScript 2015 (ES6) language specifications in order to reduce the complexity of the codebase, increase readability, and utilize features that facilitate elegant and effective coding practices for both newcomers and seasoned contributors.
33

4-
The transition process was initially [discussed](https://github.com/processing/p5.js/issues/3758) with the aim of migrating p5 to ES6, which later lead to a series of widespread syntactical changes in the codebase aligned with ES6 specifications. More info on the initial transition can be found [here](https://github.com/processing/p5.js/pull/3874). These changes consisted of minor modifications to the build system to facilitate processing, linting and testing the library based on ES6 standards, as well as major and ubiquitous syntactical modification in line with ES6 features.
4+
The transition process was initially [discussed](https://github.com/processing/p5.js/issues/3758) with the aim of migrating p5 to ES6, which later led to a series of widespread syntactical changes in the codebase aligned with ES6 specifications. More info on the initial transition can be found [here](https://github.com/processing/p5.js/pull/3874). These changes consisted of minor modifications to the build system to facilitate processing, linting and testing the library based on ES6 standards, as well as major and ubiquitous syntactical modification in line with ES6 features.
55

66
It is worthy to note that as of writing this, these transformations are by no means complete, and do not reflect nor implement every possible feature of ES6. They are intended to facilitate a smoother transition to properly and efficiently utilize ES6 features if and when aligned with the community interests and standards. And serve to motivate contributors to gradually conform to the new style and features.
77

contributor_docs/contributing_to_the_p5js_reference.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ If the parameter is optional, add square brackets around the name:
117117

118118
### Additional info: Constants
119119

120-
If the parameter takes one or more values defined in [`constants.js`](https://github.com/processing/p5.js/blob/main/src/core/constants.js) , then the type should be specified as `{Constant}` and the valid values should be enumerated in the comment following the `either` keyword, e.g.:
120+
If the parameter takes one or more values defined in [`constants.js`](https://github.com/processing/p5.js/blob/main/src/core/constants.js), then the type should be specified as `{Constant}` and the valid values should be enumerated in the comment following the `either` keyword, e.g.:
121121

122122
```
123123
@param {Constant} horizAlign horizontal alignment, either LEFT, CENTER, or RIGHT
@@ -227,7 +227,7 @@ The relevant `@example` tag to create the above is as follows:
227227

228228
After the `@example` tag, you should start an HTML `<div>` tag followed by a `<code>` tag. In between the opening and closing `<code>` tag, you will insert the relevant example code. The basic principle of writing good example code for the reference is to keep things simple and minimal. The example should be meaningful and explain how the feature works without being too complicated. The example’s canvas should be 100x100 pixels and if the `setup()` function is not included, such as in the example above, the code will be automatically wrapped in a `setup()` function with a default 100x100 pixels gray background canvas created. We won’t go through the details about best practices and code style for the example code here; please see the reference style guide instead.
229229

230-
You can have multiple examples for one feature.To do so, add an additional `<div>` and `<code>` HTML block right after the first closed, separated by a blank line.
230+
You can have multiple examples for one feature. To do so, add an additional `<div>` and `<code>` HTML block right after the first closed, separated by a blank line.
231231

232232
```
233233
* @example

contributor_docs/contributor_guidelines.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ p5.js' code standard or code style is enforced by [ESLlint](https://eslint.org/)
422422

423423
While working on any features of p5.js, it is important to keep in mind the design principles of p5.js. Our priorities may differ from the priorities of other projects, so if you are coming from a different project, we recommend that you familiarize yourself with p5.js' design principles.
424424

425-
- **Access** We prioritize accessibility first and foremost, and decisions we make must take into account how it increases access to historically marginalized groups. Read more about this in our access statement.
425+
- **Access** We prioritize accessibility first and foremost, and decisions we make must take into account how they increase access to historically marginalized groups. Read more about this in our access statement.
426426
- **Beginner Friendly** The p5.js API aims to be friendly to beginner coders, offering a low barrier to creating interactive and visual web content with cutting-edge HTML5/Canvas/DOM APIs.
427427
- **Educational** p5.js is focused on an API and curriculum that supports educational use, including a complete reference to the API with supporting examples, as well as tutorials and sample class curricula that introduce core creative coding principles in a clear and engaging order.
428428
- **JavaScript and its community** p5.js aims to make web development practices more accessible to beginners by modeling proper JavaScript design patterns and usage while abstracting them where necessary. As an open-source library, p5.js also includes the wider JavaScript community in its creation, documentation, and dissemination.

contributor_docs/creating_libraries.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ Your addon library may not extend p5 or p5 classes at all, but instead just offe
279279

280280
**p5.js has two modes, global mode and instance mode.** In global mode, all p5 properties and methods are bound to the `window` object, allowing users to call methods like `background()` without having to prefix them with anything. However, this means you need to be careful not to overwrite native JavaScript functionality. For example “`Math`” and “`console`” are both native Javascript functionalities so you shouldn’t have methods named “`Math`” or “`console`”.
281281

282-
**Class names should use** `PascalCase`**, while methods and properties should use** `camelCase`**.** Classes in p5 are prefixed with p5. We would like to keep this namespace for p5 core classes only, so when you create your own namespace, **do not include the** `p5.` **prefix for class names**. You are welcomed to create your own prefix, or just give them non-prefixed names.
282+
**Class names should use** `PascalCase`**, while methods and properties should use** `camelCase`**.** Classes in p5 are prefixed with p5. We would like to keep this namespace for p5 core classes only, so when you create your own namespace, **do not include the** `p5.` **prefix for class names**. You are welcome to create your own prefix, or just give them non-prefixed names.
283283

284284
```js
285285
// Do not do this
@@ -307,4 +307,4 @@ p5.prototype.myMethod = function(){
307307

308308
**Examples are great, too!** They show people what your library can do. Because this is all JavaScript, people can see them running online before they download anything.[ ](http://jsfiddle.net/) You can create a collection of examples on the p5.js web editor to showcase how your library works.
309309

310-
**Submit your library!** Once your library is ready for distribution and you’d like it included on the [p5js.org/libraries](https://p5js.org/libraries) page, please submit a pull request on the p5.js website GitHub repository following [this intruction](https://github.com/processing/p5.js-website/blob/main/docs/contributing_libraries.md)!
310+
**Submit your library!** Once your library is ready for distribution and you’d like it included on the [p5js.org/libraries](https://p5js.org/libraries) page, please submit a pull request on the p5.js website GitHub repository following [this intruction](https://github.com/processing/p5.js-website/blob/main/docs/contributing_libraries.md)!

contributor_docs/documentation_style_guide.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Always use `let` to declare variables.
140140

141141
**Accessibility terminology**
142142

143-
The following terminiology is adapted from the WordPress documentation guidelines for [Writing inclusive documentation](https://make.wordpress.org/docs/style-guide/general-guidelines/inclusivity/#accessibility-terminology). For more background on people-first language, see the CDC's guide on [Communicating With and About People with Disabilities](https://www.cdc.gov/ncbddd/disabilityandhealth/materials/factsheets/fs-communicating-with-people.html).
143+
The following terminology is adapted from the WordPress documentation guidelines for [Writing inclusive documentation](https://make.wordpress.org/docs/style-guide/general-guidelines/inclusivity/#accessibility-terminology). For more background on people-first language, see the CDC's guide on [Communicating With and About People with Disabilities](https://www.cdc.gov/ncbddd/disabilityandhealth/materials/factsheets/fs-communicating-with-people.html).
144144

145145
| Recommended | Not Recommended |
146146
| -- | -- |
@@ -713,7 +713,7 @@ if (
713713

714714
## Iteration
715715

716-
- Don’t use a `while` or `do-while` loops unless it's necessary. Use `for` loops to iterate a fixed number of times.
716+
- Don’t use `while` or `do-while` loops unless it's necessary. Use `for` loops to iterate a fixed number of times.
717717

718718
```javascript
719719
let numPetals = 7;
@@ -896,7 +896,7 @@ for (let i = 0; i < numbers.length; i += 1) {
896896
let numbersCopy = numbers.slice();
897897
```
898898

899-
- Write arrays on multiple lines when it improves readibility. Use line breaks after the opening bracket and before the closing bracket. Add a trailing comma.
899+
- Write arrays on multiple lines when it improves readability. Use line breaks after the opening bracket and before the closing bracket. Add a trailing comma.
900900

901901
```javascript
902902
// Bad.

contributor_docs/friendly_error_system.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The basic format of a translation file's item has a key and a value (message) in
7474
```json
7575
{ "key": "value" }
7676
```
77-
For example, we have a ASCII logo saved in this format:
77+
For example, we have an ASCII logo saved in this format:
7878
```json
7979
"logo": " _ \n /\\| |/\\ \n \\ ` ' / \n / , . \\ \n \\/|_|\\/ \n\n"
8080
```

0 commit comments

Comments
 (0)