Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
80443f1
fix(build): `lwip` -> `@randy.tarampi/lwip`.
randytarampi Mar 10, 2019
93f50bc
feat(travis): `android-splash-generate` -> `@randy.tarampi/android-sp…
randytarampi Mar 10, 2019
f020ca9
chore(package): update dependencies
greenkeeper[bot] Mar 10, 2019
b6af0c9
docs(readme): add Greenkeeper badge
greenkeeper[bot] Mar 10, 2019
741c9b6
chore(package): update lockfile package-lock.json
greenkeeper[bot] Mar 10, 2019
22f8683
chore(package): update dependencies (#1)
randytarampi Mar 11, 2019
96441ec
chore(standard): Fix `Unnecessary return statement`.
randytarampi Mar 11, 2019
240e56b
chore(package): Run `ncu -u && npm install`;
randytarampi Mar 11, 2019
9424a14
feat: Switch from `Q` to native `Promise`s.
randytarampi Mar 11, 2019
9cabef6
fix(standard): Fix `'q' is not defined`.
randytarampi Mar 11, 2019
02144d1
feat: Switch to `sharp`.
randytarampi Mar 11, 2019
07a1cf6
feat(package): Blindly upgrade our dependencies for the new year and …
randytarampi Jan 6, 2020
3d8f8ab
docs(readme): Fix badge links.
randytarampi Jan 6, 2020
f6ec71e
chore(package): update semantic-release to version 16.0.0
greenkeeper[bot] Jan 9, 2020
0f913a0
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 9, 2020
1c9c3c8
chore(travis): Release code off node@10.
randytarampi Jan 10, 2020
645ad7d
chore(greenkeeper): Update semantic-release
randytarampi Jan 10, 2020
e20ff0d
chore(package): Configure `greenkeeper` as I do for all my other pack…
randytarampi Jan 10, 2020
d43c9be
chore(travis): Use `bionic` images for builds.
randytarampi Jan 26, 2020
67e5b79
chore(travis): `travis.yml` lint.
randytarampi Jan 26, 2020
d61a23a
chore(greenkeeper): semantic-release@17.0.0.
greenkeeper[bot] Jan 27, 2020
655e546
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 27, 2020
f260e7b
chore(greenkeeper): @semantic-release/git@9.0.0.
greenkeeper[bot] Jan 27, 2020
89ac18a
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 27, 2020
db7b2cd
chore(greenkeeper): @semantic-release/changelog@5.0.0.
greenkeeper[bot] Jan 27, 2020
bcbdb46
chore(package): update lockfile package-lock.json
greenkeeper[bot] Jan 27, 2020
aaa5347
chore(greenkeeper): Update semantic-release
randytarampi Feb 16, 2020
945729c
chore(greenkeeper): Update @semantic-release/changelog
randytarampi Feb 16, 2020
6b60289
Merge branch 'master' into greenkeeper/@semantic-release/git-9.0.0
randytarampi Feb 16, 2020
9a20ddf
chore(greenkeeper): Update @semantic-release/git
randytarampi Feb 16, 2020
96e4ee5
fix: package.json & package-lock.json to reduce vulnerabilities
snyk-bot Mar 12, 2020
6b1413d
chore(greenkeeper): mkdirp@1.0.4.
greenkeeper[bot] Apr 3, 2020
c7202f2
chore(package): update lockfile package-lock.json
greenkeeper[bot] Apr 3, 2020
62eafa4
Merge pull request #17 from randytarampi/snyk-fix-09a2b8c7211717e1e10…
randytarampi Apr 19, 2020
e7bab50
chore(greenkeeper): tape@5.0.0.
greenkeeper[bot] Apr 24, 2020
587936a
chore(package): update lockfile package-lock.json
greenkeeper[bot] Apr 24, 2020
4330546
Merge pull request #19 from randytarampi/greenkeeper/tape-5.0.0
randytarampi Apr 25, 2020
1f0bf59
chore(package): Fix tests for mkdirp@1.0.4.
randytarampi Apr 25, 2020
829fac1
Merge branch 'master' into greenkeeper/mkdirp-1.0.4
randytarampi Apr 25, 2020
5d650f6
Merge pull request #18 from randytarampi/greenkeeper/mkdirp-1.0.4
randytarampi Apr 25, 2020
8fa849c
chore(greenkeeper): @randy.tarampi/generic-icon-splash-generate@2.0.0.
greenkeeper[bot] Apr 25, 2020
3919e62
chore(package): update lockfile package-lock.json
greenkeeper[bot] Apr 25, 2020
6a79de5
Merge pull request #20 from randytarampi/greenkeeper/@randy.tarampi/g…
randytarampi Apr 25, 2020
061ed5f
chore(readme): remove Greenkeeper badge
greenkeeper[bot] Apr 28, 2020
a1e5428
chore(package): remove Greenkeeper section
greenkeeper[bot] Apr 28, 2020
266e06f
Merge pull request #21 from randytarampi/goodbye-greenkeeper
randytarampi Apr 29, 2020
f0324c7
fix: upgrade rimraf from 3.0.0 to 3.0.2
snyk-bot Apr 30, 2020
5e9e555
fix: upgrade rimraf from 3.0.0 to 3.0.2
snyk-bot Apr 30, 2020
c0fd4f8
fix: upgrade standard from 14.3.1 to 14.3.3
snyk-bot Apr 30, 2020
ee0e31a
fix: upgrade standard from 14.3.1 to 14.3.3
snyk-bot Apr 30, 2020
cd72307
fix: upgrade @randy.tarampi/android-splash from 2.1.0 to 2.1.1
snyk-bot Apr 30, 2020
3c04fc9
fix: upgrade @randy.tarampi/android-splash from 2.1.0 to 2.1.1
snyk-bot Apr 30, 2020
1cc9b30
fix: upgrade @semantic-release/changelog from 5.0.0 to 5.0.1
snyk-bot Apr 30, 2020
1e8a081
fix: upgrade @semantic-release/changelog from 5.0.0 to 5.0.1
snyk-bot Apr 30, 2020
116d81e
fix: package.json, package-lock.json & .snyk to reduce vulnerabilities
snyk-bot May 1, 2020
536d4e5
fix: package.json, package-lock.json & .snyk to reduce vulnerabilities
snyk-bot May 1, 2020
df8a9c6
fix: package.json, package-lock.json & .snyk to reduce vulnerabilities
snyk-bot May 1, 2020
fc6e483
Merge pull request #27 from randytarampi/snyk-fix-9b1ffa0256fc6b19274…
randytarampi May 1, 2020
913cc41
Merge branch 'master' into snyk-upgrade-560df3fdb57776225199a9a9c4f07cb3
randytarampi May 1, 2020
6b5075e
Merge pull request #26 from randytarampi/snyk-upgrade-560df3fdb577762…
randytarampi May 1, 2020
b06313f
Merge branch 'master' into snyk-upgrade-462bc13c684b751e13b90746d61758a7
randytarampi May 1, 2020
ac921bb
Merge pull request #25 from randytarampi/snyk-upgrade-462bc13c684b751…
randytarampi May 1, 2020
2156243
Merge branch 'master' into snyk-upgrade-a308c4f107cd4f9babca448d23ee26f1
randytarampi May 1, 2020
ae9d81d
Merge pull request #24 from randytarampi/snyk-upgrade-a308c4f107cd4f9…
randytarampi May 1, 2020
c225be0
Merge pull request #23 from randytarampi/snyk-upgrade-8a953eca33189d7…
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-01T05:48:21.931Z'
- semantic-release > lodash:
patched: '2020-05-01T05:48:21.931Z'
- semantic-release > @semantic-release/release-notes-generator > lodash:
patched: '2020-05-01T05:48:21.931Z'
- standard > eslint > lodash:
patched: '2020-05-01T05:48:21.931Z'
- semantic-release > @semantic-release/release-notes-generator > conventional-commits-parser > lodash:
patched: '2020-05-01T05:48:21.931Z'
- semantic-release > @semantic-release/release-notes-generator > conventional-changelog-writer > lodash:
patched: '2020-05-01T05:48:21.931Z'
- standard > eslint > inquirer > lodash:
patched: '2020-05-01T05:48:21.931Z'
- standard > eslint > table > lodash:
patched: '2020-05-01T05:48:21.931Z'
56 changes: 22 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
language: node_js
node_js:
- iojs-v1
- '0.12'
- '0.10'
sudo: false
cache:
directories:
- node_modules
notifications:
email: false
slack:
secure: Ms5NpfsH+acxe2iULh+z4lQ8U+zLMNylcQCDUc1oAY+2ubjdFsyuw4fDeAN0NdquDD6GEPPD1XF1aZBjWJRNe7bmVCUnu9QAspvuIHOHrikJYunz6so5Fsh2pr96zdJRDnNk3Xu0oMMNhYdh/qpIHpu/GOEkJW+BGDCUntudc+0=
before_install:
- npm i -g npm@^2.0.0
- npm i -g pangyp
- npm prune
install:
- npm install --node-gyp=$(which pangyp)
before_script:
- curl -Lo travis_after_all.py https://raw.github.com/dmakhno/travis_after_all/master/travis_after_all.py
after_success:
- python travis_after_all.py
- export $(cat .to_export_back)
after_failure:
- python travis_after_all.py
- export $(cat .to_export_back)
os: linux
dist: bionic
matrix:
fast_finish: true
allow_failures:
- node_js: node
- node_js: lts/*
node_js:
- 8
- 10
- 12
- lts/*
- node
before_deploy:
- rm -f travis_after_all.py .to_export_back
after_script:
- echo leader=$BUILD_LEADER status=$BUILD_AGGREGATE_STATUS
- git config --local user.name "$TRAVIS_AUTHOR_NAME"
- git config --local user.email "$TRAVIS_AUTHOR_EMAIL"
deploy:
provider: npm
email: david@excellenteasy.com
provider: script
script: npx semantic-release
skip_cleanup: true
on:
branch: master
repo: excellenteasy/android-splash-generate
condition: "$BUILD_LEADER$BUILD_AGGREGATE_STATUS = YESothers_succeeded"
api_key:
secure: DcLCvKwnYudLFrbxBrPc6ahYc+Lqxoe2K0qKw9/cICllebQuQL6MLGQq+GNsfQ9ACmL1SMpsK1/AF9D+wazyuCDSKfqmuh5QYxWYurkdjyYjstzt5FQRPv8wZS+tuVG5krSNS4TGe8P8lNAne3A+fYBPcj81St9aHrhuNATtpik=
node: 10
os: linux
sudo: false
env:
global:
secure: cqfjULv++BhPCcTbB4SgnN2rRQfajryycbXxOrfTwvAk/kGhCU5UzLb84zdhaRVKXLksThjgBtd6KV5OFFluBAVCpxDUOE+IbZeFIcuPGHl4433fa1NgDzYcPtY5MsTYNIfNDVtnGSzcgewwAT8pE+AM3N2/JrFwjOC1+efR9FA=
- secure: pDk/asMOWbfTz9zZG/BC11LRweqEVM84evm37TFi5lm3vNuCOFz/L4aeXjzUv19XYhcId2BysoJBV5cuuOwNVxvCMAWQ91jGkXIedhLeavY+PB18OK6KDPlhfUL2chigZUV3u5aEglyUbl+/+5/Z4XU5PIGWoEZWqeOXykQMbqzvJR/W8/LdhhbQHqLl/qWOaJ5eHAsd+kgQEA0z6xSFtd+HqT6pHYgljTCtw/VSQpSi9hRFWGrjwPEfuEaMOl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oe1wMWjiz9U5vPvALEY96LVfGwr2MD36SaRUU=
1 change: 0 additions & 1 deletion bin/android-splash-generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function cli () {

if (input) {
generate(argv.input || argv.i, output)
return
} else {
console.error('Please specify an input icon file witht the `-i` option.')
}
Expand Down
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('android-splash')
var lwip = require('lwip')
var Q = require('q')
var path = require('path')
var colors = require('colors')
const splash = require('@randy.tarampi/android-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