From fd1435d94d3ec2f007ad2a173e3869af91b24b9c Mon Sep 17 00:00:00 2001 From: DD Date: Mon, 4 Dec 2017 18:34:59 -0500 Subject: [PATCH 1/3] Fix tests and make Travis deploy scratch paperjs --- .travis.yml | 14 +++++++++++--- dist/paper-core.js | 31 ++++++++++++++++++------------- dist/paper-full.js | 31 ++++++++++++++++++------------- gulp/utils/options.js | 7 ++++--- package.json | 4 ++-- src/init.js | 2 +- 6 files changed, 54 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2518b82..250b82e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,7 @@ language: node_js # Follow https://github.com/nodejs/LTS to decide when to remove a version node_js: -- stable -- '7' - '6' -- '4' sudo: false env: matrix: @@ -42,3 +39,14 @@ script: - gulp test - gulp zip - '[ "${TRAVIS_BRANCH}" = "develop" ] && [ "${TRAVIS_NODE_VERSION}" = "stable" ] && travis/deploy-prebuilt.sh || true' +before_deploy: +- npm --no-git-tag-version version 0.11.$(date +%Y%m%d%H%M%S) +- git config --global user.email $(git log --pretty=format:"%ae" -n1) +- git config --global user.name $(git log --pretty=format:"%an" -n1) +deploy: +- provider: npm + on: + branch: develop + skip_cleanup: true + email: $NPM_EMAIL + api_key: $NPM_TOKEN diff --git a/dist/paper-core.js b/dist/paper-core.js index 61497ac6..60d7078c 100644 --- a/dist/paper-core.js +++ b/dist/paper-core.js @@ -9,7 +9,7 @@ * * All rights reserved. * - * Date: Thu Oct 5 16:16:29 2017 +0200 + * Date: Mon Dec 4 16:36:52 2017 -0500 * *** * @@ -33,7 +33,7 @@ var paper = function(self, undefined) { self = self || require('./node/self.js'); -var window = self.window, +var window = self.window ? self.window : self, document = self.document; var Base = new function() { @@ -4525,6 +4525,7 @@ new function() { half = size / 2; ctx.strokeStyle = ctx.fillStyle = color ? color.toCanvasStyle(ctx) : '#009dec'; + ctx.lineWidth=2.5; if (itemSelected) this._drawSelected(ctx, mx, selectionItems); if (positionSelected) { @@ -8888,7 +8889,7 @@ var Path = PathItem.extend({ }), new function() { - function drawHandles(ctx, segments, matrix, size) { + function drawHandles(ctx, segments, matrix, size, isFullySelected) { var half = size / 2, coords = new Array(6), pX, pY; @@ -8900,10 +8901,12 @@ new function() { ctx.beginPath(); ctx.moveTo(pX, pY); ctx.lineTo(hX, hY); + ctx.moveTo(hX - half, hY); + ctx.lineTo(hX, hY + half); + ctx.lineTo(hX + half, hY); + ctx.lineTo(hX, hY - half); + ctx.closePath(); ctx.stroke(); - ctx.beginPath(); - ctx.arc(hX, hY, half, 0, Math.PI * 2, true); - ctx.fill(); } } @@ -8913,17 +8916,19 @@ new function() { segment._transformCoordinates(matrix, coords); pX = coords[0]; pY = coords[1]; - if (selection & 2) + if (selection & 2 && !isFullySelected) drawHandle(2); - if (selection & 4) + if (selection & 4 && !isFullySelected) drawHandle(4); - ctx.fillRect(pX - half, pY - half, size, size); + ctx.beginPath(); + ctx.arc(pX, pY, half, 0, Math.PI * 2, true); + ctx.stroke(); + var fillStyle = ctx.fillStyle; if (!(selection & 1)) { - var fillStyle = ctx.fillStyle; - ctx.fillStyle = '#ffffff'; - ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2); - ctx.fillStyle = fillStyle; + ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; } + ctx.fill(); + ctx.fillStyle = fillStyle; } } diff --git a/dist/paper-full.js b/dist/paper-full.js index ca645b17..295377b6 100644 --- a/dist/paper-full.js +++ b/dist/paper-full.js @@ -9,7 +9,7 @@ * * All rights reserved. * - * Date: Thu Oct 5 16:16:29 2017 +0200 + * Date: Mon Dec 4 16:36:52 2017 -0500 * *** * @@ -33,7 +33,7 @@ var paper = function(self, undefined) { self = self || require('./node/self.js'); -var window = self.window, +var window = self.window ? self.window : self, document = self.document; var Base = new function() { @@ -4525,6 +4525,7 @@ new function() { half = size / 2; ctx.strokeStyle = ctx.fillStyle = color ? color.toCanvasStyle(ctx) : '#009dec'; + ctx.lineWidth=2.5; if (itemSelected) this._drawSelected(ctx, mx, selectionItems); if (positionSelected) { @@ -8888,7 +8889,7 @@ var Path = PathItem.extend({ }), new function() { - function drawHandles(ctx, segments, matrix, size) { + function drawHandles(ctx, segments, matrix, size, isFullySelected) { var half = size / 2, coords = new Array(6), pX, pY; @@ -8900,10 +8901,12 @@ new function() { ctx.beginPath(); ctx.moveTo(pX, pY); ctx.lineTo(hX, hY); + ctx.moveTo(hX - half, hY); + ctx.lineTo(hX, hY + half); + ctx.lineTo(hX + half, hY); + ctx.lineTo(hX, hY - half); + ctx.closePath(); ctx.stroke(); - ctx.beginPath(); - ctx.arc(hX, hY, half, 0, Math.PI * 2, true); - ctx.fill(); } } @@ -8913,17 +8916,19 @@ new function() { segment._transformCoordinates(matrix, coords); pX = coords[0]; pY = coords[1]; - if (selection & 2) + if (selection & 2 && !isFullySelected) drawHandle(2); - if (selection & 4) + if (selection & 4 && !isFullySelected) drawHandle(4); - ctx.fillRect(pX - half, pY - half, size, size); + ctx.beginPath(); + ctx.arc(pX, pY, half, 0, Math.PI * 2, true); + ctx.stroke(); + var fillStyle = ctx.fillStyle; if (!(selection & 1)) { - var fillStyle = ctx.fillStyle; - ctx.fillStyle = '#ffffff'; - ctx.fillRect(pX - half + 1, pY - half + 1, size - 2, size - 2); - ctx.fillStyle = fillStyle; + ctx.fillStyle = 'rgba(255, 255, 255, 0.5)'; } + ctx.fill(); + ctx.fillStyle = fillStyle; } } diff --git a/gulp/utils/options.js b/gulp/utils/options.js index 013efde9..b9e4a414 100644 --- a/gulp/utils/options.js +++ b/gulp/utils/options.js @@ -34,9 +34,10 @@ if (argv.branch && argv.branch !== options.branch) { var version = options.version, branch = options.branch; -// If we're not on the master branch, use the branch name as a suffix: -if (branch !== 'master') - options.version += '-' + branch; +// Take this out for now to reduce changes every build +// // If we're not on the master branch, use the branch name as a suffix: +// if (branch !== 'master') +// options.version += '-' + branch; // Allow the removal of the suffix again, as needed by the publish task. options.resetVersion = function() { diff --git a/package.json b/package.json index 44add035..75bf1d01 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "paper", + "name": "@scratch/paper", "version": "0.11.5", "description": "The Swiss Army Knife of Vector Graphics Scripting", "license": "MIT", @@ -38,7 +38,7 @@ }, "devDependencies": { "acorn": "~0.5.0", - "canvas": "^1.3.5", + "canvas-prebuilt": "^1.6.5-prerelease.1", "del": "^2.2.1", "gulp": "^3.9.1", "gulp-cached": "^1.1.0", diff --git a/src/init.js b/src/init.js index 55ae313b..9c9c7312 100644 --- a/src/init.js +++ b/src/init.js @@ -31,5 +31,5 @@ // NOTE: We're not modifying the global `self` here. We receive its value passed // to the paper.js function scope, and this is the one that is modified here. self = self || require('./node/self.js'); -var window = self.window, +var window = self.window ? self.window : self, document = self.document; From 13b1287a305d74895e724e1b04b670e9754aecba Mon Sep 17 00:00:00 2001 From: DD Date: Wed, 6 Dec 2017 16:27:19 -0500 Subject: [PATCH 2/3] Change git ignore to relative paths --- .gitignore | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 71575f4c..b214f24c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -/.nvmrc -/node_modules/ -/dist/*/ -/dist/*.min.js -/dist/paperjs.zip +.nvmrc +node_modules/ +dist/*/ +dist/*.min.js +dist/paperjs.zip From 6b1421eb4d3dff5b4aa3ef62d9cf5e3041d4c4cc Mon Sep 17 00:00:00 2001 From: DD Date: Wed, 6 Dec 2017 17:07:59 -0500 Subject: [PATCH 3/3] Build before testing so we dont have to track the dist files --- .gitignore | 4 +--- gulp/tasks/test.js | 10 +++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b214f24c..23155791 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ .nvmrc node_modules/ -dist/*/ -dist/*.min.js -dist/paperjs.zip +dist/* diff --git a/gulp/tasks/test.js b/gulp/tasks/test.js index 79f1adbb..ff4265bd 100644 --- a/gulp/tasks/test.js +++ b/gulp/tasks/test.js @@ -13,9 +13,17 @@ var gulp = require('gulp'), gutil = require('gulp-util'), qunits = require('gulp-qunits'), + runSequence = require('run-sequence'); webserver = require('gulp-webserver'); -gulp.task('test', ['test:phantom', 'test:node']); +gulp.task('test', function(callback) { + runSequence( + 'build', + 'test:postbuild' + ); +}); + +gulp.task('test:postbuild', ['test:phantom', 'test:node']); gulp.task('test:phantom', ['minify:acorn'], function() { return gulp.src('index.html', { cwd: 'test' })