Skip to content

Commit

Permalink
fix audit
Browse files Browse the repository at this point in the history
  • Loading branch information
doriclaudino committed Apr 19, 2020
1 parent 14e9396 commit b474811
Show file tree
Hide file tree
Showing 13 changed files with 726 additions and 7,574 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gruntfile.js
test/test.js
test/testDeps
test/**/*.js
webpack.config.js
lib/
examples/
dist/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ examples/__test
p5soundnotes
*.DS_Store
.vscode
coverage
coverage
yarn-error.log
debug.log
58 changes: 29 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
const webpackConfig = require('./webpack.config.js');

module.exports = function (grunt) {
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
decomment: {
any: {
// remove comments added by webpack from the build
files: {
'./dist/p5.drawer.js': './dist/p5.drawer.js',
'./dist/p5.drawer.js': './dist/p5.drawer.js'
},
options: {
ignore: [
// keep JSDoc comments (p5.js repo's YUIDoc task parses those for documentation)
/\/\*\*\s*\n([^\*]|(\*(?!\/)))*\*\//g,
// keep the version number
/.*Version.*/,
],
},
},
/.*Version.*/
]
}
}
},
// Configure style consistency
eslint: {
source: {
options: { configFile: './.eslintrc' },
src: ['src/**/*.js', 'test/**/*test*.js'],
},
src: ['src/**/*.js']
}
},
watch: {
options: {
livereload: true,
livereload: true
},
exampleDir: {
files: ['examples/**/*.*'],
files: ['examples/**/*.*']
},
distDir: {
files: ['src/**/*.js'],
tasks: ['devBuild'],
options: {
reload: true,
},
reload: true
}
},
testDir: {
files: ['test/bdd/*test*.js', 'test/index.html'],
files: ['test/**/*test*.js', 'test/index.html']
},
configFiles: {
files: ['Gruntfile.js', 'webpack.config.js'],
options: {
reload: true,
},
},
reload: true
}
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true,
},
singleRun: true
}
},
webpack: {
prod: webpackConfig.prod,
dev: webpackConfig.dev,
test: webpackConfig.test,
test: webpackConfig.test
},
clean: {
coverage: ['coverage'],
dist: ['dist'],
dist: ['dist']
},
open: {
testChrome: {
path: 'http://localhost:8000/test',
app: 'Chrome',
app: 'Chrome'
},
testFirefox: {
path: 'http://localhost:8000/test',
app: 'Firefox',
app: 'Firefox'
},
testSafari: {
path: 'http://localhost:8000/test',
app: 'Safari',
},
app: 'Safari'
}
},
connect: {
server: {
options: {
port: 8000,
livereload: 35729,
hostname: 'localhost',
},
},
},
hostname: 'localhost'
}
}
}
});

grunt.loadNpmTasks('grunt-webpack');
Expand All @@ -107,7 +107,7 @@ module.exports = function (grunt) {
'connect',
'devBuild',
'open:testChrome',
'watch',
'watch'
]);
grunt.registerTask('serve', 'connect:server:keepalive');
grunt.registerTask('run-tests', ['clean:coverage', 'karma']);
Expand Down
130 changes: 91 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,85 @@
[![codecov](https://codecov.io/gh/doriclaudino/p5.drawer/branch/master/graph/badge.svg)](https://codecov.io/gh/doriclaudino/p5.drawer)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/doriclaudino/p5.drawer/issues)
<img alt="npm bundle size" src="https://img.shields.io/bundlephobia/min/p5.drawer">

### Install (CDN)

<br>
<br>
Create a drawer animation emulating Scribit, AxiDraw extremely easy.
<br>
<div>
<img src="https://i.imgur.com/emokMlD.png" width="200">
<img src="https://imgur.com/AevdDH0.png" width="200">
<img src="https://imgur.com/nbt0qGb.png" width="200">
</div>
```html
<!-- option one jsdelivr-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/p5.drawer.min.js"></script>

<!-- option two githack-->
<script src="https://raw.githack.com/doriclaudino/p5.drawer/master/dist/p5.drawer.min.js"></script>

<!--
option three local source
downloading from: https://github.com/doriclaudino/p5.drawer/blob/master/dist/p5.drawer.min.js -->
<script src="../p5.drawer.min.js"></script>
```

### Install (NPM)

```bash
npm install p5.drawer
or
yarn install p5.drawer
```

### Requirements
### Requirements (CDN)

```bash
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/addons/p5.sound.js"></script>
```

### Install
### Requirements (NPM)

```bash
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/p5.drawer.min.js"></script>
or
<script src="https://raw.githack.com/doriclaudino/p5.drawer/master/dist/p5.drawer.min.js"></script>;
npm install p5
or
import 'p5.drawer'
yarn install p5
```

**Start coding!**

[p5.drawer sketch](https://editor.p5js.org/doriclaudino/sketches/5UUjoEKRx)
<br>
<br>

```bash
createDrawer(image,audio,position);
**Checkout our example on [editor.p5js.org](https://editor.p5js.org/doriclaudino/sketches/5UUjoEKRx)**

```javascript
//main function to create a drawer
createDrawer([image], [audio], [position]);
//main function to move your drawer around
myDrawer.moveTo(mouseX, mouseY, [speed]);

//on Preload
//load images on preload
let myDrawer;
function preload() {
let img = loadImage('image_path')
let sound = loadSound('sound_path')
let pos = createVector(20,20)

myDrawer = createDrawer(img,sound,pos);
let img = loadImage('image_path');
let sound = loadSound('sound_path');
let pos = createVector(20, 20);

//create the drawer
myDrawer = createDrawer(img, sound, pos);
}

function draw() {
myDrawer.moveTo(mouseX, mouseY);
}
```

### Images from our sketch

Create a drawer animation emulating Scribit, AxiDraw extremely easy.

<div>
<img src="https://i.imgur.com/emokMlD.png" width="200">
<img src="https://imgur.com/AevdDH0.png" width="200">
<img src="https://imgur.com/nbt0qGb.png" width="200">
</div>

### Gifs from our sketch

![](https://media.giphy.com/media/U3hHR6jI6XbOfdH9Ka/giphy.gif)

### Features
Expand All @@ -67,25 +99,45 @@ function preload() {
- Center images
- Save internal steps

### Importing library
##Development
[Fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) this project

You can import our library for testing purpose or to use on web:
```javascript
import 'p5' //make sure you expose p5 or import somewhere
import 'p5.drawer' //extend p5 prototype and expose our methods everywhere
```
```bash
#use yarn or npm
#install all deps
yarn

Additionally, you can use the cdn compile version [(ready-to-copy example)](https://editor.p5js.org/doriclaudino/sketches/5UUjoEKRx):
```javascript
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/p5.drawer.min.js"></script>
#auto-reload watch files src files, tests files
#serve example at http://localhost:8000/
#serve test at http://localhost:8000/test/
yarn dev

#clean and run new tests with coverage artifacts
yarn test

#final build version with optimizations
yarn build

or using githack

<script src="https://raw.githack.com/doriclaudino/p5.drawer/master/dist/p5.drawer.min.js"></script>;
### continuos integrations

#validate our ci configs
yarn ci:validate

#execute local ci using our config, it will fail on coverage
yarn ci:executeLocal
```

## Resources

## Credits
- [Grunt](https://github.com/gruntjs/grunt-cli)
- [Webpack](https://github.com/webpack/webpack)
- [p5.js](https://github.com/processing/p5.js)
- [p5.js-sound](https://github.com/processing/p5.js-sound)

## References and Inspiration

Projects started using typescript-library-starter
- p5.js-sound. Licensed under The MIT License (MIT). [github](https://github.com/processing/p5.js-sound)
- Daniel Shiffmmann @shiffmann [github](https://github.com/shiffman)
- Stefano Padoan @stefanopadoan.art [instagram](https://www.instagram.com/stefanopadoan.art/)
- Samer Dabra @spongenuity [instagram](https://www.instagram.com/spongenuity/)
2 changes: 0 additions & 2 deletions debug.log

This file was deleted.

3 changes: 1 addition & 2 deletions dist/p5.drawer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** [p5.drawer] Version: 2.0.0 - 2020-04-18 */
/** [p5.drawer] Version: 2.0.0 - 2020-04-19 */
/**
* <p>p5.drawer extends p5 with custom drawers on top of your canvas
* </p>
Expand Down Expand Up @@ -116,7 +116,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
this._saveSteps = true;
this._penTipPosition = tipPosition || p5.instance.createVector(0, 0);
this._steps = [];
if (!this._image || !this._sound) console.warn('Make sure to load the image and sound on preload(), we remove the boths from build. See the example folder.');
}

_createClass(Drawer, [{
Expand Down
Loading

0 comments on commit b474811

Please sign in to comment.