Skip to content

Commit 1478bc1

Browse files
committed
Add common folder for p5 versions
1 parent b9669a1 commit 1478bc1

File tree

5 files changed

+149
-145
lines changed

5 files changed

+149
-145
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COPY .babelrc index.js nodemon.json ./
1414
COPY ./webpack ./webpack
1515
COPY client ./client
1616
COPY server ./server
17+
COPY common ./common
1718
COPY translations/locales ./translations/locales
1819
COPY public ./public
1920
CMD ["npm", "start"]

client/modules/IDE/components/VersionPicker.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import PropTypes from 'prop-types';
55
import styled from 'styled-components';
66

77
import { prop } from '../../../theme';
8-
import { useP5Version, p5Versions } from '../hooks/useP5Version';
8+
import { useP5Version } from '../hooks/useP5Version';
9+
import { p5Versions } from '../../../../common/p5Versions';
910
import MenuItem from '../../../components/Dropdown/MenuItem';
1011
import DropdownMenu from '../../../components/Dropdown/DropdownMenu';
1112
import { updateFileContent } from '../actions/files';

client/modules/IDE/hooks/useP5Version.jsx

Lines changed: 2 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,8 @@
11
/* eslint-disable func-names */
2-
import React, { useContext, useMemo, useState } from 'react';
2+
import React, { useContext, useMemo } from 'react';
33
import { useSelector } from 'react-redux';
44
import PropTypes from 'prop-types';
5-
6-
// Generated from https://www.npmjs.com/package/p5?activeTab=versions
7-
// Run this in the console:
8-
// JSON.stringify([...document.querySelectorAll('._132722c7')].map(n => n.innerText), null, 2)
9-
// TODO: use their API for this to grab these at build time?
10-
export const p5Versions = [
11-
'2.0.3',
12-
'2.0.2',
13-
'2.0.1',
14-
'2.0.0',
15-
'1.11.8',
16-
'1.11.7',
17-
'1.11.6',
18-
'1.11.5',
19-
'1.11.4',
20-
'1.11.3',
21-
'1.11.2',
22-
'1.11.1',
23-
'1.11.0',
24-
'1.10.0',
25-
'1.9.4',
26-
'1.9.3',
27-
'1.9.2',
28-
'1.9.1',
29-
'1.9.0',
30-
'1.8.0',
31-
'1.7.0',
32-
'1.6.0',
33-
'1.5.0',
34-
'1.4.2',
35-
'1.4.1',
36-
'1.4.0',
37-
'1.3.1',
38-
'1.3.0',
39-
'1.2.0',
40-
'1.1.9',
41-
'1.1.8',
42-
'1.1.7',
43-
'1.1.5',
44-
'1.1.4',
45-
'1.1.3',
46-
'1.1.2',
47-
'1.1.1',
48-
'1.1.0',
49-
'1.0.0',
50-
'0.10.2',
51-
'0.10.1',
52-
'0.10.0',
53-
'0.9.0',
54-
'0.8.0',
55-
'0.7.3',
56-
'0.7.2',
57-
'0.7.1',
58-
'0.7.0',
59-
'0.6.1',
60-
'0.6.0',
61-
'0.5.16',
62-
'0.5.15',
63-
'0.5.14',
64-
'0.5.13',
65-
'0.5.12',
66-
'0.5.11',
67-
'0.5.10',
68-
'0.5.9',
69-
'0.5.8',
70-
'0.5.7',
71-
'0.5.6',
72-
'0.5.5',
73-
'0.5.4',
74-
'0.5.3',
75-
'0.5.2',
76-
'0.5.1',
77-
'0.5.0',
78-
'0.4.24',
79-
'0.4.23',
80-
'0.4.22',
81-
'0.4.21',
82-
'0.4.20',
83-
'0.4.19',
84-
'0.4.18',
85-
'0.4.17',
86-
'0.4.16',
87-
'0.4.15',
88-
'0.4.14',
89-
'0.4.13',
90-
'0.4.12',
91-
'0.4.11',
92-
'0.4.10',
93-
'0.4.9',
94-
'0.4.8',
95-
'0.4.7',
96-
'0.4.6',
97-
'0.4.5',
98-
'0.4.4',
99-
'0.4.3',
100-
'0.4.2',
101-
'0.4.1',
102-
'0.4.0',
103-
'0.3.16',
104-
'0.3.15',
105-
'0.3.14',
106-
'0.3.13',
107-
'0.3.12',
108-
'0.3.11',
109-
'0.3.10',
110-
'0.3.9',
111-
'0.3.8',
112-
'0.3.7',
113-
'0.3.6',
114-
'0.3.5',
115-
'0.3.4',
116-
'0.3.3',
117-
'0.3.2',
118-
'0.3.1',
119-
'0.3.0',
120-
'0.2.23',
121-
'0.2.22',
122-
'0.2.21',
123-
'0.2.20',
124-
'0.2.19',
125-
'0.2.18',
126-
'0.2.17',
127-
'0.2.16',
128-
'0.2.15',
129-
'0.2.14',
130-
'0.2.13',
131-
'0.2.12',
132-
'0.2.11',
133-
'0.2.10',
134-
'0.2.9',
135-
'0.2.8',
136-
'0.2.7',
137-
'0.2.6',
138-
'0.2.5',
139-
'0.2.4',
140-
'0.2.3',
141-
'0.2.2',
142-
'0.2.1'
143-
];
144-
145-
export const currentP5Version = '1.11.8'; // Don't update to 2.x until 2026
5+
import { currentP5Version, p5Versions } from '../../../../common/p5Versions';
1466

1477
export const majorVersion = (version) => version.split('.')[0];
1488

common/p5Versions.js

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
export const currentP5Version = '1.11.8'; // Don't update to 2.x until 2026
2+
3+
// Generated from https://www.npmjs.com/package/p5?activeTab=versions
4+
// Run this in the console:
5+
// JSON.stringify([...document.querySelectorAll('._132722c7')].map(n => n.innerText), null, 2)
6+
// TODO: use their API for this to grab these at build time?
7+
export const p5Versions = [
8+
'2.0.3',
9+
'2.0.2',
10+
'2.0.1',
11+
'2.0.0',
12+
'1.11.8',
13+
'1.11.7',
14+
'1.11.6',
15+
'1.11.5',
16+
'1.11.4',
17+
'1.11.3',
18+
'1.11.2',
19+
'1.11.1',
20+
'1.11.0',
21+
'1.10.0',
22+
'1.9.4',
23+
'1.9.3',
24+
'1.9.2',
25+
'1.9.1',
26+
'1.9.0',
27+
'1.8.0',
28+
'1.7.0',
29+
'1.6.0',
30+
'1.5.0',
31+
'1.4.2',
32+
'1.4.1',
33+
'1.4.0',
34+
'1.3.1',
35+
'1.3.0',
36+
'1.2.0',
37+
'1.1.9',
38+
'1.1.8',
39+
'1.1.7',
40+
'1.1.5',
41+
'1.1.4',
42+
'1.1.3',
43+
'1.1.2',
44+
'1.1.1',
45+
'1.1.0',
46+
'1.0.0',
47+
'0.10.2',
48+
'0.10.1',
49+
'0.10.0',
50+
'0.9.0',
51+
'0.8.0',
52+
'0.7.3',
53+
'0.7.2',
54+
'0.7.1',
55+
'0.7.0',
56+
'0.6.1',
57+
'0.6.0',
58+
'0.5.16',
59+
'0.5.15',
60+
'0.5.14',
61+
'0.5.13',
62+
'0.5.12',
63+
'0.5.11',
64+
'0.5.10',
65+
'0.5.9',
66+
'0.5.8',
67+
'0.5.7',
68+
'0.5.6',
69+
'0.5.5',
70+
'0.5.4',
71+
'0.5.3',
72+
'0.5.2',
73+
'0.5.1',
74+
'0.5.0',
75+
'0.4.24',
76+
'0.4.23',
77+
'0.4.22',
78+
'0.4.21',
79+
'0.4.20',
80+
'0.4.19',
81+
'0.4.18',
82+
'0.4.17',
83+
'0.4.16',
84+
'0.4.15',
85+
'0.4.14',
86+
'0.4.13',
87+
'0.4.12',
88+
'0.4.11',
89+
'0.4.10',
90+
'0.4.9',
91+
'0.4.8',
92+
'0.4.7',
93+
'0.4.6',
94+
'0.4.5',
95+
'0.4.4',
96+
'0.4.3',
97+
'0.4.2',
98+
'0.4.1',
99+
'0.4.0',
100+
'0.3.16',
101+
'0.3.15',
102+
'0.3.14',
103+
'0.3.13',
104+
'0.3.12',
105+
'0.3.11',
106+
'0.3.10',
107+
'0.3.9',
108+
'0.3.8',
109+
'0.3.7',
110+
'0.3.6',
111+
'0.3.5',
112+
'0.3.4',
113+
'0.3.3',
114+
'0.3.2',
115+
'0.3.1',
116+
'0.3.0',
117+
'0.2.23',
118+
'0.2.22',
119+
'0.2.21',
120+
'0.2.20',
121+
'0.2.19',
122+
'0.2.18',
123+
'0.2.17',
124+
'0.2.16',
125+
'0.2.15',
126+
'0.2.14',
127+
'0.2.13',
128+
'0.2.12',
129+
'0.2.11',
130+
'0.2.10',
131+
'0.2.9',
132+
'0.2.8',
133+
'0.2.7',
134+
'0.2.6',
135+
'0.2.5',
136+
'0.2.4',
137+
'0.2.3',
138+
'0.2.2',
139+
'0.2.1'
140+
];

server/domain-objects/createDefaultFiles.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { currentP5Version } from '../../common/p5Versions';
2+
13
export const defaultSketch = `function setup() {
24
createCanvas(400, 400);
35
}
@@ -9,8 +11,8 @@ function draw() {
911
export const defaultHTML = `<!DOCTYPE html>
1012
<html lang="en">
1113
<head>
12-
<script src="https://cdn.jsdelivr.net/npm/p5@1.11.8/lib/p5.js"></script>
13-
<script src="https://cdn.jsdelivr.net/npm/p5@1.11.8/lib/addons/p5.sound.min.js"></script>
14+
<script src="https://cdn.jsdelivr.net/npm/p5@${currentP5Version}/lib/p5.js"></script>
15+
<script src="https://cdn.jsdelivr.net/npm/p5@${currentP5Version}/lib/addons/p5.sound.min.js"></script>
1416
<link rel="stylesheet" type="text/css" href="style.css">
1517
<meta charset="utf-8" />
1618

0 commit comments

Comments
 (0)