Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support modern node, amongst other things #20

Open
wants to merge 66 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e51ac9f
fix(build): `lwip` -> `@randy.tarampi/lwip`.
randytarampi Mar 10, 2019
a724c13
feat(travis): `ios-splash-generate` -> `@randy.tarampi/ios-splash-gen…
randytarampi Mar 10, 2019
0952729
chore(package): update dependencies
greenkeeper[bot] Mar 10, 2019
7b2caa7
docs(readme): add Greenkeeper badge
greenkeeper[bot] Mar 10, 2019
f3bc8aa
chore(package): update lockfile package-lock.json
greenkeeper[bot] Mar 10, 2019
6762df9
chore(package): update dependencies (#1)
randytarampi Mar 11, 2019
596ea43
chore(package): Run `ncu -u && npm install`;
randytarampi Mar 11, 2019
a61f03c
feat: Switch from `Q` to native `Promise`s.
randytarampi Mar 11, 2019
bed1683
fix(standard): Fix `'q' is not defined`.
randytarampi Mar 11, 2019
f90f713
feat: Switch to `sharp`.
randytarampi Mar 11, 2019
12aa902
feat(package): Blindly upgrade our dependencies for the new year and …
randytarampi Jan 6, 2020
0bf2f97
docs(readme): Fix badge links.
randytarampi Jan 6, 2020
b4375b0
chore(package): update semantic-release to version 16.0.0
greenkeeper[bot] Jan 9, 2020
8982f1d
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 9, 2020
832a7bf
chore(travis): Release code off node@10.
randytarampi Jan 10, 2020
666cf87
chore(greenkeeper): Update semantic-release
randytarampi Jan 10, 2020
02b0d13
chore(package): Configure `greenkeeper` as I do for all my other pack…
randytarampi Jan 10, 2020
71724fd
chore(travis): Use `bionic` images for builds.
randytarampi Jan 26, 2020
c9e379a
chore(travis): `travis.yml` lint.
randytarampi Jan 26, 2020
548ca44
chore(greenkeeper): [email protected].
greenkeeper[bot] Jan 27, 2020
f3675ac
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 27, 2020
cf101e1
chore(greenkeeper): @semantic-release/[email protected].
greenkeeper[bot] Jan 27, 2020
298d522
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 27, 2020
7692999
chore(greenkeeper): @semantic-release/[email protected].
greenkeeper[bot] Jan 27, 2020
5e5fb0c
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 27, 2020
3025c15
chore(greenkeeper): Update semantic-release
randytarampi Feb 16, 2020
ecddaa1
chore(greenkeeper): Update @semantic-release/changelog
randytarampi Feb 16, 2020
2b070f2
Merge branch 'master' into greenkeeper/@semantic-release/git-9.0.0
randytarampi Feb 16, 2020
b4b9a74
chore(greenkeeper): Update @semantic-release/git
randytarampi Feb 16, 2020
e9d822f
fix: package.json & package-lock.json to reduce vulnerabilities
snyk-bot Mar 11, 2020
6400404
chore(greenkeeper): [email protected].
greenkeeper[bot] Apr 3, 2020
13767cc
chore(package): update lockfile package-lock.json
greenkeeper[bot] Apr 3, 2020
ab788ab
Merge pull request #17 from randytarampi/snyk-fix-94bae832f7248f6bed4…
randytarampi Apr 19, 2020
166d03c
chore(greenkeeper): [email protected].
greenkeeper[bot] Apr 24, 2020
95ec0c0
chore(package): update lockfile package-lock.json
greenkeeper[bot] Apr 24, 2020
3c7cf2b
Merge pull request #19 from randytarampi/greenkeeper/tape-5.0.0
randytarampi Apr 25, 2020
8210846
chore(package): Fix tests for [email protected].
randytarampi Apr 25, 2020
4fa04af
Merge branch 'master' into greenkeeper/mkdirp-1.0.4
randytarampi Apr 25, 2020
b6effd7
Merge pull request #18 from randytarampi/greenkeeper/mkdirp-1.0.4
randytarampi Apr 25, 2020
d162644
chore(greenkeeper): @randy.tarampi/[email protected].
greenkeeper[bot] Apr 25, 2020
17c25b1
chore(package): update lockfile package-lock.json
greenkeeper[bot] Apr 25, 2020
60b2292
Merge pull request #20 from randytarampi/greenkeeper/@randy.tarampi/g…
randytarampi Apr 25, 2020
dac4ef2
chore(readme): remove Greenkeeper badge
greenkeeper[bot] Apr 28, 2020
d28bb6e
chore(package): remove Greenkeeper section
greenkeeper[bot] Apr 28, 2020
e4cf7a5
fix: upgrade semantic-release from 17.0.0 to 17.0.7
snyk-bot Apr 29, 2020
14498e2
fix: upgrade semantic-release from 17.0.0 to 17.0.7
snyk-bot Apr 29, 2020
47a20de
fix: upgrade rimraf from 3.0.0 to 3.0.2
snyk-bot Apr 29, 2020
9b0f9c7
fix: upgrade rimraf from 3.0.0 to 3.0.2
snyk-bot Apr 29, 2020
74bfdb7
fix: upgrade standard from 14.3.1 to 14.3.3
snyk-bot Apr 29, 2020
04998c4
fix: upgrade standard from 14.3.1 to 14.3.3
snyk-bot Apr 29, 2020
91f8dc6
fix: upgrade @randy.tarampi/ios-splash from 3.1.0 to 3.1.1
snyk-bot Apr 29, 2020
a785392
fix: upgrade @randy.tarampi/ios-splash from 3.1.0 to 3.1.1
snyk-bot Apr 29, 2020
08d143d
fix: upgrade @semantic-release/changelog from 5.0.0 to 5.0.1
snyk-bot Apr 29, 2020
04a78bd
fix: upgrade @semantic-release/changelog from 5.0.0 to 5.0.1
snyk-bot Apr 29, 2020
207408e
Merge pull request #21 from randytarampi/goodbye-greenkeeper
randytarampi Apr 29, 2020
2112902
Merge pull request #26 from randytarampi/snyk-upgrade-1e7774e5a5f084b…
randytarampi Apr 29, 2020
d8c12bc
Merge pull request #23 from randytarampi/snyk-upgrade-9b39f2105797470…
randytarampi Apr 29, 2020
c750035
Merge pull request #24 from randytarampi/snyk-upgrade-bbeffa6d6f0e0a2…
randytarampi Apr 29, 2020
fe13fe3
Merge branch 'master' into snyk-upgrade-489e06e2dd27bbb2bfaa2221e0ad75bd
randytarampi Apr 29, 2020
98a9187
Merge pull request #22 from randytarampi/snyk-upgrade-489e06e2dd27bbb…
randytarampi Apr 29, 2020
106ab49
Merge branch 'master' into snyk-upgrade-9dccd8c5e9f83e6cce95e7356dc98876
randytarampi Apr 29, 2020
f2401f2
Merge pull request #25 from randytarampi/snyk-upgrade-9dccd8c5e9f83e6…
randytarampi Apr 29, 2020
59cb239
fix: package.json, package-lock.json & .snyk to reduce vulnerabilities
snyk-bot May 1, 2020
12fb1bf
fix: package.json, package-lock.json & .snyk to reduce vulnerabilities
snyk-bot May 1, 2020
f7824f2
fix: package.json, package-lock.json & .snyk to reduce vulnerabilities
snyk-bot May 1, 2020
6e09bab
Merge pull request #27 from randytarampi/snyk-fix-404aa6c85339da05a4f…
randytarampi May 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.14.1
ignore: {}
# patches apply the minimum changes required to fix a vulnerability
patch:
SNYK-JS-LODASH-567746:
- '@semantic-release/git > lodash':
patched: '2020-05-01T01:09:19.960Z'
- semantic-release > lodash:
patched: '2020-05-01T01:09:19.960Z'
- semantic-release > @semantic-release/release-notes-generator > lodash:
patched: '2020-05-01T01:09:19.960Z'
- standard > eslint > lodash:
patched: '2020-05-01T01:09:19.960Z'
- semantic-release > @semantic-release/release-notes-generator > conventional-commits-parser > lodash:
patched: '2020-05-01T01:09:19.960Z'
- semantic-release > @semantic-release/release-notes-generator > conventional-changelog-writer > lodash:
patched: '2020-05-01T01:09:19.960Z'
- standard > eslint > inquirer > lodash:
patched: '2020-05-01T01:09:19.960Z'
- standard > eslint > table > lodash:
patched: '2020-05-01T01:09:19.960Z'
45 changes: 27 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
os: linux
dist: bionic
matrix:
fast_finish: true
allow_failures:
- node_js: node
- node_js: lts/*
node_js:
- 'node'
- '6'
- '4'
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -qq update
- sudo apt-get -qq install g++-4.8
- 8
- 10
- 12
- lts/*
- node
before_deploy:
- git config --local user.name "$TRAVIS_AUTHOR_NAME"
- git config --local user.email "$TRAVIS_AUTHOR_EMAIL"
deploy:
provider: script
script: npx semantic-release
skip_cleanup: true
on:
branch: master
node: 10
os: linux
sudo: false
env:
- CXX=g++-4.8
before_script:
- npm prune
after_success:
- npm run semantic-release
branches:
except:
- /^v\d+\.\d+\.\d+$/
global:
- secure: CXHoPURiGr5miynF5rq1S2tru3XUCPTU4S0IzuWfgtauIOP1NxX1jLTRETyqB9biqmZd4MJ2hZtUk8nLkzeJCbLVIgNwr3AbEaH7eUCegrwcxsd6GirIW8VGsup7tQ1l8pX3LGBL6QWZtcP1iQJw3Oa6GlMHmmYfLJzWU9cOwn/Nwsi46MrrJrwskpV62lF/hgT1Cg8RQQeb2O4Pnt/DNA8o9CB0mmTjq1/N7KUHwdqux0t64aiOKQCoKtMDXGxeA2cXTxIlh0nNyunN8hU8T39zg00jwYLN9weUqtb2jzPRDXtrC8sgj1o3Wgg8ifgEV5aKwtxYqjucFVds75j7davpvyB1fVIDiMVfzu4FgyrkqZm9B1aTMU5VyZzithbf5AjZIk7VvWZReSxyrKq7i6nsfd7cPRx9zNtl+rSkrDnT59mA/5ZKGh0E+a5PYLZuXEj9Cjo1urqMjck8EbL8sQyowDs5NDGD8QoX219aZGvP25OuuFhw+vME+kBVoTzuuvAUG9tBi1q9GWZSnOAkELCyfFs9zW9w+73WUQe22ghEoUDo3edKpkHPE1gVWX/2hgfG04GH1X92AW4182Rm6P83lejX/CixhAQ9PQ4oLsf4zWe4iYjQPqmQUTPIV0KkgOalYoR8hbrh22F7N5l0Mn1DIBfelPuqDNlPKp90IoM=
- secure: Q3NOaQvf4g91dHxOsrGU/K7mLUgE70/A9kQZsR3EujWc29cONaKsoEGOPt7J8j+MlneEn1pdLjfVV433dH1rKM1Jxm7zGYjWxcQteYwn+FOogn9meO09khFCh7wTJwciGwnxU1eg79sIEne+p72Q2ILfQVQ9/xozstMbYAmniCPfCw3dF2jOtw8yttU2SbB9WnjbiLc1IjTDERvSPnAcb9vo5IqYhFOAiyNX28O1zFHmRlhhfpnacTCHrSa/wHuMvOOiF9H0uG7XqotlDMP6PlKVmAPG3hOyiyeLKOxhat9aKugD6ke4URKkrHV51oSCjzVqQpvBKd4FFwgstOWgHe9qNXyfl6BQ9PmLs+jC0LEtObRn2EyMsRx8q1qkzcGOOyegH4S9PP6RAEfUZQNAN3gEYVo0kahLUtoUADucP+cGIoHhAd9s0OyzoQnqLZPanQ7/Vb7EOFi+dYIepuwyWM8GrA5R3pfMJIC55LLmeenAxG7hEiax9YgCgMas9i7PBW+Vlx4MR3Tf77YB4eYYktg+tnvGtLZt4gW7qNzM7iroohxFJFbI8PE2LsdzRbqJTdT/gDDVlhxqXjj8OyELyOPGSI5ufAVL+5yk7O5ml6bn1vDsc5rfmUSPTMK+icTsHdVytlcs4Qgjim4/RvyEpkwWVSpfdGFYW1qW0zYGhDE=
88 changes: 4 additions & 84 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,89 +1,9 @@
'use strict'
var splash = require('ios-splash')
var lwip = require('lwip')
var Q = require('q')
var path = require('path')
var colors = require('colors')
const splash = require('@randy.tarampi/ios-splash')
const { errorMessage, splashScreensGenerator: generator } = require('@randy.tarampi/generic-icon-splash-generate')

function openImage (path) {
var q = Q.defer()
lwip.open(path, function (err, image) {
if (err) {
q.reject(err)
}
q.resolve(image)
})
return q.promise
}

function clone (image) {
var q = Q.defer()
image.clone(function (err, clone) {
if (err) {
q.reject(err)
}
q.resolve(clone)
})
return q.promise
}

function scale (splash, image) {
var q = Q.defer()
var ratio = splash.height < splash.width ? splash.width / image.width() : splash.height / image.height()
image.scale(ratio, ratio, function (err, scaled) {
if (err) return q.reject(err)
q.resolve(scaled)
})
return q.promise
}

function crop (splash, image) {
var q = Q.defer()
image.crop(splash.width, splash.height, function (err, cropped) {
if (err) return q.reject(err)
q.resolve(cropped)
})
return q.promise
}

function writeFile (path, image) {
var q = Q.defer()
image.writeFile(path, function (err) {
if (err) return q.reject(err)
q.resolve(path)
})
return q.promise
}

function successMessage (splash, output, path) {
return console.info(colors.green('OK'), 'Image scaled and cropped to', splash.width, 'x', splash.height, 'and written to', path)
}

function errorMessage (e) {
var message = typeof e === 'string' ? e : (e.msg || e.message)
console.error(colors.red('ERROR.'), message)
}

function transformAll (splash, output, image) {
return Q.all(splash
.map(transform.bind(null, image, output))
)
}

function transform (image, output, splash) {
var out = output ? path.join(output, splash.name) : false
return clone(image)
.then(scale.bind(null, splash))
.then(crop.bind(null, splash))
.then(writeFile.bind(null, out))
.then(successMessage.bind(null, splash, output))
.catch(errorMessage)
}

module.exports = function (input, output) {
module.exports = (input, output = process.cwd()) => {
if (!input) {
errorMessage(new Error('`input` parameter is required.'))
}
output = output || process.cwd()
return openImage(input).then(transformAll.bind(null, splash(), output))
return generator(splash(), input, output)
}
Loading