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

Commit c174ca5

Browse files
Merge pull request #3 from literallycanvas/chore/webpack
Just doing some build work @irskep
2 parents a8a64b3 + 71c9eab commit c174ca5

File tree

15 files changed

+5276
-250
lines changed

15 files changed

+5276
-250
lines changed

.circleci/config.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
version: 2
2+
3+
refs:
4+
container: &container
5+
docker:
6+
- image: node:8.11
7+
working_directory: ~/repo
8+
9+
jobs:
10+
all:
11+
<<: *container
12+
steps:
13+
- checkout
14+
- restore_cache:
15+
keys:
16+
- v1-dependencies-{{ checksum "yarn.lock" }}
17+
- v1-dependencies-
18+
- run:
19+
name: Versions
20+
command: node -v && npm -v && yarn -v
21+
- run:
22+
name: Install dependencies
23+
command: yarn install
24+
- save_cache:
25+
paths:
26+
- node_modules
27+
key: v1-dependencies-{{ checksum "yarn.lock" }}
28+
- run:
29+
name: Build
30+
command: yarn build
31+
- run:
32+
name: Test
33+
command: yarn test
34+
35+
master:
36+
<<: *container
37+
steps:
38+
- checkout
39+
- restore_cache:
40+
keys:
41+
- v1-dependencies-{{ checksum "yarn.lock" }}
42+
- v1-dependencies-
43+
- run:
44+
name: Versions
45+
command: node -v && npm -v && yarn -v
46+
- run:
47+
name: Install dependencies
48+
command: yarn install
49+
- save_cache:
50+
paths:
51+
- node_modules
52+
key: v1-dependencies-{{ checksum "yarn.lock" }}
53+
- run:
54+
name: Build
55+
command: yarn build
56+
- run:
57+
name: Test
58+
command: yarn test
59+
- run:
60+
name: Post status to GitHub
61+
command: |
62+
npx cross-ci :run \
63+
npx commit-status success Version "'\${BUILD_VERSION}'"
64+
- run:
65+
name: Release
66+
command: yarn release
67+
68+
workflows:
69+
version: 2
70+
all:
71+
jobs:
72+
- all:
73+
filters:
74+
branches:
75+
ignore:
76+
- master
77+
master:
78+
jobs:
79+
- master:
80+
filters:
81+
branches:
82+
only: master

.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: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
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+
"release": "semantic-release",
18+
"lint": "eslint src"
1719
},
1820
"husky": {
1921
"hooks": {
20-
"pre-commit": "lint-staged"
22+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
23+
"pre-commit": "yarn test && lint-staged"
2124
}
2225
},
2326
"lint-staged": {
@@ -40,21 +43,52 @@
4043
"bugs": {
4144
"url": "https://github.com/literallycanvas/literallycanvas-core/issues"
4245
},
46+
"jest": {
47+
"moduleFileExtensions": [
48+
"js"
49+
],
50+
"testRegex": ".*/__tests__/.*\\.(test|spec)\\.js$",
51+
"collectCoverageFrom": [
52+
"src/**/*.js"
53+
]
54+
},
4355
"devDependencies": {
56+
"@commitlint/cli": "^7.2.1",
57+
"@commitlint/config-conventional": "^7.1.2",
58+
"@semantic-release/changelog": "^3.0.1",
59+
"@semantic-release/git": "^7.0.5",
60+
"@semantic-release/npm": "^5.0.5",
4461
"babel-eslint": "^10.0.1",
4562
"babel-preset-es2015": "^6.3.13",
4663
"babelify": "^7.2.0",
4764
"browserify": "~13.0.0",
65+
"commit-status": "^4.3.0",
4866
"envify": "~3.4.0",
4967
"eslint": "^5.7.0",
5068
"gulp": "~3.9.0",
5169
"gulp-rename": "~1.2.2",
5270
"gulp-uglify": "~1.5.1",
5371
"husky": "^1.1.2",
72+
"jest": "^23.6.0",
5473
"lint-staged": "^7.3.0",
5574
"prettier": "1.14.3",
75+
"semantic-release": "^15.10.5",
5676
"uglify-js": "~2.6.1",
5777
"vinyl-source-stream": "~1.1.0",
58-
"watchify": "~3.7.0"
78+
"watchify": "~3.7.0",
79+
"webpack": "^4.20.2",
80+
"webpack-cli": "^3.1.2"
81+
},
82+
"release": {
83+
"verifyConditions": [
84+
"@semantic-release/changelog",
85+
"@semantic-release/npm",
86+
"@semantic-release/git"
87+
],
88+
"prepare": [
89+
"@semantic-release/changelog",
90+
"@semantic-release/npm",
91+
"@semantic-release/git"
92+
]
5993
}
6094
}

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";

0 commit comments

Comments
 (0)