Skip to content

Commit 24b2863

Browse files
authored
Merge pull request #1 from processing/master
p5 changes
2 parents 6e5146c + 3010ac4 commit 24b2863

File tree

328 files changed

+7223
-117150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

328 files changed

+7223
-117150
lines changed

.all-contributorsrc

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,10 +1200,10 @@
12001200
"contributions": []
12011201
},
12021202
{
1203-
"login": "max-devjs",
1204-
"name": "max_devjs",
1203+
"login": "maxdevjs",
1204+
"name": "maxdevjs",
12051205
"avatar_url": "https://avatars2.githubusercontent.com/u/22229196?v=4",
1206-
"profile": "http://twitter.com/max_devjs",
1206+
"profile": "http://twitter.com/maxdevjs",
12071207
"contributions": []
12081208
},
12091209
{
@@ -1524,6 +1524,26 @@
15241524
"doc",
15251525
"example"
15261526
]
1527+
},
1528+
{
1529+
"login":"singhvisha",
1530+
"name":"Vishal Singh",
1531+
"avatar_url":"https://avatars0.githubusercontent.com/u/38842688?s=460&v=4",
1532+
"profile":"https://github.com/singhvisha",
1533+
"contributions": [
1534+
"doc"
1535+
]
1536+
},
1537+
{
1538+
"login": "coreygo",
1539+
"name": "Corey Gouker",
1540+
"avatar_url": "https://avatars1.githubusercontent.com/u/649879?v=4",
1541+
"profile": "https://www.coreygo.com",
1542+
"contributions": [
1543+
"code",
1544+
"doc",
1545+
"bug"
1546+
]
15271547
}
15281548
],
15291549
"repoType": "github"

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
language: node_js
22
node_js:
3-
- "8"
4-
- "10"
5-
install: for i in {1..3}; do travis_wait 5 npm install && break; rm -rf node_modules; done
6-
script: npm run grunt
7-
services: docker
3+
- '8'
4+
- '10'
5+
install: for i in {1..3}; do travis_wait 5 npm install && npm install codecov -g && break; rm -rf node_modules; done
6+
script:
7+
- npm run grunt
8+
- npx nyc report --reporter=json
9+
after_success: bash <(curl -s https://codecov.io/bash)

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In the future:
3333
* Offensive comments related to gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, ability, class, religion, culture, subculture, political opinion, age, skill level, occupation, or background
3434
* Threats of violence
3535
* Deliberate intimidation
36-
* Sexually explicit or violent material
36+
* Sexually explicit or violent material that is not contextualized and preceded by a considerate warning
3737
* Unwelcome sexual attention
3838
* Stalking or following
3939
* Or any other kinds of harassment

Gruntfile.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@
5959
* all-contributors generate - Generates new contributors list for README
6060
*/
6161

62+
// these requires allow us to use es6 features such as
63+
// `import`/`export` and `async`/`await` in the Grunt tasks
64+
// we load from other files (`tasks/`)
65+
require('regenerator-runtime/runtime');
66+
require('@babel/register');
67+
6268
function getYuidocOptions() {
6369
const BASE_YUIDOC_OPTIONS = {
6470
name: '<%= pkg.name %>',
@@ -163,7 +169,7 @@ module.exports = grunt => {
163169
ecmaVersion: 5
164170
}
165171
},
166-
src: ['src/**/*.js', 'lib/addons/p5.dom.js']
172+
src: ['src/**/*.js']
167173
},
168174
test: {
169175
src: ['bench/**/*.js', 'test/**/*.js', '!test/js/*.js']
@@ -178,7 +184,7 @@ module.exports = grunt => {
178184
format: 'unix'
179185
},
180186
source: {
181-
src: ['src/**/*.js', 'lib/addons/p5.dom.js']
187+
src: ['src/**/*.js']
182188
},
183189
fix: {
184190
options: {
@@ -285,7 +291,7 @@ module.exports = grunt => {
285291
dist: {
286292
files: {
287293
'lib/p5.min.js': 'lib/p5.pre-min.js',
288-
'lib/addons/p5.dom.min.js': 'lib/addons/p5.dom.js'
294+
'lib/modules/p5Custom.min.js': 'lib/modules/p5Custom.pre-min.js'
289295
}
290296
}
291297
},
@@ -328,7 +334,7 @@ module.exports = grunt => {
328334
middlewares.unshift(
329335
require('connect-modrewrite')([
330336
'^/assets/js/p5(\\.min)?\\.js(.*) /lib/p5$1.js$2 [L]',
331-
'^/assets/js/p5\\.(dom|sound)(\\.min)?\\.js(.*) /lib/addons/p5.$1$2.js$3 [L]'
337+
'^/assets/js/p5\\.(sound)(\\.min)?\\.js(.*) /lib/addons/p5.$1$2.js$3 [L]'
332338
]),
333339
function(req, res, next) {
334340
res.setHeader('Access-Control-Allow-Origin', '*');
@@ -355,7 +361,7 @@ module.exports = grunt => {
355361
middlewares.unshift(
356362
require('connect-modrewrite')([
357363
'^/assets/js/p5(\\.min)?\\.js(.*) /lib/p5$1.js$2 [L]',
358-
'^/assets/js/p5\\.(dom|sound)(\\.min)?\\.js(.*) /lib/addons/p5.$1$2.js$3 [L]'
364+
'^/assets/js/p5\\.(sound)(\\.min)?\\.js(.*) /lib/addons/p5.$1$2.js$3 [L]'
359365
]),
360366
function(req, res, next) {
361367
res.setHeader('Access-Control-Allow-Origin', '*');
@@ -382,7 +388,7 @@ module.exports = grunt => {
382388
middlewares.unshift(
383389
require('connect-modrewrite')([
384390
'^/assets/js/p5(\\.min)?\\.js(.*) /lib/p5$1.js$2 [L]',
385-
'^/assets/js/p5\\.(dom|sound)(\\.min)?\\.js(.*) /lib/addons/p5.$1$2.js$3 [L]'
391+
'^/assets/js/p5\\.(sound)(\\.min)?\\.js(.*) /lib/addons/p5.$1$2.js$3 [L]'
386392
]),
387393
function(req, res, next) {
388394
res.setHeader('Access-Control-Allow-Origin', '*');

README.md

Lines changed: 3 additions & 2 deletions
Large diffs are not rendered by default.

developer_docs/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ A complete guide to unit testing is beyond the scope of the p5.js documentation,
117117

118118
If you're continuously changing files in the library, you may want to run `npm run dev` to automatically rebuild the library for you whenever any of its source files change without you having to first type the command manually.
119119

120-
6. Make some changes to the codebase and [commit](https://help.github.com/articles/github-glossary/#commit) them with Git.
120+
6. Make some changes locally to the codebase and [commit](https://help.github.com/articles/github-glossary/#commit) them with Git.
121+
122+
```
123+
$ git add -u
124+
$ git commit -m "YOUR COMMIT MESSAGE"
125+
```
121126

122127
7. Run `npm run grunt` again to make sure there are no syntax errors, test failures, or other problems.
123128

@@ -142,7 +147,7 @@ $ npm run docs:dev
142147

143148
The overarching p5.js project includes repositories other than this one.
144149

145-
- [p5.js](https://github.com/processing/p5.js): This repository contains the source code for the p5.js library, as well as the p5.dom.js addon library. The [user-facing p5.js reference manual](https://p5js.org/reference/) is also generated from the [JSDoc](http://usejsdoc.org/) comments included in this source code. It is maintained by [Lauren McCarthy](https://github.com/lmccart).
150+
- [p5.js](https://github.com/processing/p5.js): This repository contains the source code for the p5.js library. The [user-facing p5.js reference manual](https://p5js.org/reference/) is also generated from the [JSDoc](http://usejsdoc.org/) comments included in this source code. It is maintained by [Lauren McCarthy](https://github.com/lmccart).
146151
- [website](https://github.com/processing/p5.js-website) This repository contains most of the code for the [p5.js website](http://p5js.org), with the exception of the reference manual. It is maintained by [Lauren McCarthy](https://github.com/lmccart).
147152
- [sound](https://github.com/processing/p5.js-sound) This repository contains the p5.sound.js library. It is maintained by [Jason Sigal](https://github.com/therewasaguy).
148153
- [web editor](https://github.com/processing/p5.js-web-editor): This repository contains the source code for the [p5.js web editor](https://editor.p5js.org). It is maintained by [Cassie Tarakajian](https://github.com/catarak). Note that the older [p5.js editor](https://github.com/processing/p5.js-editor) is now deprecated.

developer_docs/custom_p5_build.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,43 @@
22

33
## Overview
44

5-
An excellent new [feature](https://github.com/processing/p5.js/pull/2051) of p5.js allows user to build p5.js as a custom combination of its modules. This greatly helps in reducing the production version size of the library, as well as improves overall performance.
5+
An excellent new [feature](https://github.com/processing/p5.js/pull/2051) of p5.js allows user to build p5.js as a custom combination of its modules. This greatly helps in reducing the production version size of the library, as well as improves overall performance.
66

77
This feature was suggested as a part of a proposal for Google Summer of Code 2017.
88

9-
## Usage
9+
## Usage
1010

11-
Currently, the usage is through invoking a Grunt task manually from the command line.
11+
Currently, the usage is through invoking a Grunt task manually from the command line:
1212

13-
```
13+
```sh
1414
git clone https://github.com/processing/p5.js.git
1515
cd p5.js
1616
npm install
1717
npm run grunt
1818
npm run grunt combineModules:module_x:module_y
1919
```
2020

21-
Here, `module_n` refers to the name of the module which you want to select. Multiple modules must be passed as shown above. Also, these modules must have the same name as their folders in `/src` directory to work correctly. While `core` is included by default, `core/shape` needs to be included for shapes like line() and other core features to work.
21+
Here, `module_n` refers to the name of the modules which you want to select. Multiple modules must be passed as shown above. Also, these modules must have the same name as their folders in `/src` directory to work correctly. While `core` is included by default, `core/shape` needs to be included for shapes like line() and other core features to work.
22+
23+
The above usage example will likely output a `p5Custom.js` larger than the complete `p5.min.js` as the output is not minified using the `uglify` task.
24+
25+
The recommended steps to reduce bundle size as much as possible are:
26+
27+
```sh
28+
git clone https://github.com/processing/p5.js.git
29+
cd p5.js
30+
npm install
31+
npm run grunt
32+
npm run grunt combineModules:min:module_x:module_y uglify
33+
```
34+
35+
## Examples
2236

23-
## Example
37+
- `npm run grunt combineModules:min:core/shape:color:math:image uglify`
38+
Generates a `p5Custom.min.js` bundle in the `lib/modules` directory with the combineModules and uglify tasks. Note that modules should be listed after `combineModules:min` and the `uglify` task should have a space after the modules list.
2439

25-
`npm run grunt combineModules:core/shape:color:math:image`
40+
- `npm run grunt combineModules:core/shape:color:math:image`
41+
Generates a non-minified `p5Custom.js` bundle in the `lib/modules` directory.
2642

27-
This will generate your `p5Custom.js` bundle in the `lib/modules` directory.
43+
- `npm run grunt combineModules:min:core/shape:color:math:image`
44+
Generates a `p5Custom.pre-min.js` in the `lib/modules` directory with the `combineModules:min` task. Note that in this example `npm run grunt uglify` can be run separately after running the `combineModules:min` task.

0 commit comments

Comments
 (0)