Skip to content

Commit 2a3121e

Browse files
authored
Merge pull request #7 from ml5js/dev-server
add dev server
2 parents e78c371 + 57894ed commit 2a3121e

File tree

6 files changed

+2503
-35
lines changed

6 files changed

+2503
-35
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,26 @@ nvm install 18.15
88
nvm use 18
99
```
1010

11-
To build the library, run the following commands:
11+
To start the development server, run the following commands:
1212

1313
```
1414
npm install
15-
npm run build
15+
npm start
1616
```
1717

18-
This will create the build in the dist folder.
18+
You should see something similar to this in the terminal:
19+
20+
```
21+
[webpack-dev-server] Project is running at:
22+
[webpack-dev-server] Loopback: http://localhost:8080/
23+
...
24+
...
25+
webpack 5.76.1 compiled successfully in 8360 ms
26+
```
1927

20-
Open `examples/NeuralNetwork/index.html` in the browser to see the build running an example from the ml5 website.
28+
A local server have been started and hosts a built version of the ml5 library at http://localhost:8080/ml5.js. While the server is running, Webpack will automatically rebuild the library if you change and save any file in the `/src` folder.
29+
30+
Open `examples/NeuralNetwork/index.html` in the browser to see the live build of `ml5.js` working in some example code.
2131

2232
## Code Formatting
2333

@@ -47,6 +57,17 @@ npx prettier --write path/to/file
4757

4858
For more options with the command line, refer to the [Prettier Documentation](https://prettier.io/docs/en/cli.html)
4959

60+
## Building the Library
61+
62+
To build the ml5 library for production, run the following commands
63+
64+
```
65+
npm install
66+
npm run build
67+
```
68+
69+
This will create a production version of the library in `/dist` directory.
70+
5071
## Process
5172

5273
_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._

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ml5-neuralnetwork-test-build
1+
# ml5-next-gen
22

33
Welcome to the next-generation repo for the ml5.js project! Due to the complexities inherent in updating all the dependencies in [the original repo](https://github.com/ml5js/ml5-library), we're exploring rebuilding from the ground up. This fresh repository allows us to migrate over classes and functions one at a time. This is very much a work in progress and is currently in its early, experimental stage. We appreciate your patience as we work towards refining this next evolution of the ml5.js project. Stay tuned!
44

@@ -12,13 +12,23 @@ nvm install 18.15
1212
nvm use 18
1313
```
1414

15-
To build the library, run the following commands:
15+
To start the development server, run the following commands:
1616

1717
```
1818
npm install
19-
npm run build
19+
npm start
2020
```
2121

22-
This will create the build in the dist folder.
22+
You should see something similar to this in the terminal:
2323

24-
Open `examples/NeuralNetwork/index.html` in the browser to see the build running an example from the ml5 website.
24+
```
25+
[webpack-dev-server] Project is running at:
26+
[webpack-dev-server] Loopback: http://localhost:8080/
27+
...
28+
...
29+
webpack 5.76.1 compiled successfully in 8360 ms
30+
```
31+
32+
A local server have been started and hosts a built version of the ml5 library at http://localhost:8080/ml5.js. While the server is running, Webpack will automatically rebuild the library if you change and save any file in the `/src` folder.
33+
34+
Open `examples/NeuralNetwork/index.html` in the browser to see the live build of `ml5.js` working in some example code.

examples/NeuralNetwork/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Document</title>
8-
<script src="../../dist/ml5.js"></script>
8+
<script src="http://localhost:8080/ml5.js"></script>
99
</head>
1010
<body>
1111
<script src="script.js"></script>

0 commit comments

Comments
 (0)