Created
September 4, 2021 06:29
-
-
Save artze/2eed45c7de131c2158b4b4a4ca35a2b1 to your computer and use it in GitHub Desktop.
canvas-sketch project init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Init prettier config | |
cat <<EOF > ./.prettierrc.js | |
module.exports = { | |
arrowParens: "always", | |
printWidth: 100, | |
semi: true, | |
singleQuote: false, | |
tabWidth: 2, | |
trailingComma: "none" | |
}; | |
EOF | |
# Init eslint config | |
cat <<EOF > ./.eslintrc.js | |
module.exports = { | |
env: { | |
browser: true, | |
commonjs: true, | |
es2021: true, | |
node: true | |
}, | |
extends: ["eslint:recommended", "plugin:prettier/recommended"], | |
parserOptions: { | |
ecmaVersion: 12 | |
}, | |
rules: {} | |
}; | |
EOF | |
# Init sketch.js | |
cat <<EOF > ./sketch.js | |
const canvasSketch = require("canvas-sketch"); | |
const P5 = require("p5"); | |
const settings = { | |
dimensions: [2048, 2048], | |
p5: P5, | |
animate: false | |
}; | |
const sketch = ({ p5 }) => { | |
/** | |
* p5 setup() | |
*/ | |
return () => { | |
/** | |
* p5 draw() | |
*/ | |
}; | |
}; | |
canvasSketch(sketch, settings); | |
EOF | |
# Install npm dependencies | |
npm install -S p5 | |
npm install -D eslint prettier eslint-config-prettier eslint-plugin-prettier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment