Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 04d485f

Browse files
committed
chore: build stuff
1 parent a8a64b3 commit 04d485f

File tree

14 files changed

+3221
-212
lines changed

14 files changed

+3221
-212
lines changed

.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"env": {
33
"browser": true,
4-
"es6": true
4+
"es6": true,
5+
"node": true,
6+
"jest": true
57
},
68
"extends": [
79
"eslint:recommended"

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ node_modules/
55
*.log
66
package-lock.json
77
.DS_Store
8-
lib/
8+
lib/
9+
dist/
10+
coverage/

Makefile

Lines changed: 0 additions & 34 deletions
This file was deleted.

commitlint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"subject-case": [1, "always", "lower-case"],
5+
},
6+
};

demo/simple.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323

2424
<body>
2525
<div class="literally"></div>
26-
<script src="../lib/index.js"></script>
26+
<script src="../dist/bundle.js"></script>
2727

2828
<script type="text/javascript">
29-
const LiterallyCanvas = LC.default;
29+
const LiterallyCanvas = LC.LiterallyCanvas;
3030
const mainDiv = document.querySelector('.literally');
3131
const lc = new LiterallyCanvas(mainDiv, {
32-
...LiterallyCanvas.defaultOptions,
32+
...LC.defaultOptions,
3333
defaultStrokeWidth: 10,
3434
backgroundColor: '#FFF',
3535
});

gulpfile.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

literallycanvas.sublime-project

Lines changed: 0 additions & 18 deletions
This file was deleted.

package.json

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22
"name": "literallycanvas-core",
33
"version": "0.6.0",
44
"description": "HTML5 drawing widget - core lib",
5-
"main": "lib/index.js",
5+
"main": "dist/bundle.js",
66
"files": [
77
"lib/*",
8-
"src/*"
8+
"src/*",
9+
"dist/*"
910
],
1011
"scripts": {
11-
"test": "echo \"Error: no test specified\" && exit 1",
12-
"bundle": "gulp bundle",
13-
"dev": "gulp dev",
12+
"test": "jest --no-cache",
13+
"test:coverage": "jest --no-cache --coverage",
14+
"test:watch": "jest --no-cache --watch",
15+
"build": "webpack -d --watch",
1416
"prettier": "prettier --write \"src/**/*.js\"",
15-
"lint": "eslint src",
16-
"gulp": "gulp"
17+
"lint": "eslint src"
1718
},
1819
"husky": {
1920
"hooks": {
20-
"pre-commit": "lint-staged"
21+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
22+
"pre-commit": "yarn test && lint-staged"
2123
}
2224
},
2325
"lint-staged": {
@@ -40,21 +42,36 @@
4042
"bugs": {
4143
"url": "https://github.com/literallycanvas/literallycanvas-core/issues"
4244
},
45+
"jest": {
46+
"moduleFileExtensions": [
47+
"js"
48+
],
49+
"testRegex": ".*/__tests__/.*\\.(test|spec)\\.js$",
50+
"collectCoverageFrom": [
51+
"src/**/*.js"
52+
]
53+
},
4354
"devDependencies": {
55+
"@commitlint/cli": "^7.2.1",
56+
"@commitlint/config-conventional": "^7.1.2",
4457
"babel-eslint": "^10.0.1",
4558
"babel-preset-es2015": "^6.3.13",
4659
"babelify": "^7.2.0",
4760
"browserify": "~13.0.0",
61+
"commit-status": "^4.3.0",
4862
"envify": "~3.4.0",
4963
"eslint": "^5.7.0",
5064
"gulp": "~3.9.0",
5165
"gulp-rename": "~1.2.2",
5266
"gulp-uglify": "~1.5.1",
5367
"husky": "^1.1.2",
68+
"jest": "^23.6.0",
5469
"lint-staged": "^7.3.0",
5570
"prettier": "1.14.3",
5671
"uglify-js": "~2.6.1",
5772
"vinyl-source-stream": "~1.1.0",
58-
"watchify": "~3.7.0"
73+
"watchify": "~3.7.0",
74+
"webpack": "^4.20.2",
75+
"webpack-cli": "^3.1.2"
5976
}
6077
}

src/LiterallyCanvas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import actions from "./actions";
1+
import * as actions from "./actions";
22
import bindEvents from "./bindEvents";
33
import {JSONToShape, shapeToJSON} from "./shapes";
44
import {renderShapeToContext} from "./canvasRenderer";

src/__tests__/math.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import math from "../math";
2+
3+
describe("math", () => {
4+
it("should define length function", () => {
5+
expect(math.len({x: 3, y: 4})).toBe(5);
6+
});
7+
});

0 commit comments

Comments
 (0)