sharp/packaging/types.sh
Lovell Fuller e4e7384f99 Move lib/types.d.ts generation to separate script.
Fixes Promise<T>, ensures module prefix is declared.
2016-11-20 11:24:12 +00:00

15 lines
493 B
Bash
Executable File

#!/bin/sh
# Regenerates lib/types.d.ts Typescript definitions
sources="lib/constructor.js lib/input.js lib/resize.js lib/composite.js lib/operation.js lib/colour.js lib/channel.js lib/output.js lib/utility.js"
types="types.d.ts"
# Generate types via JSDoc comments
./node_modules/.bin/jsdoc -d . -t ./node_modules/tsd-jsdoc $sources
# Wrap output with module declaration
echo "declare module \"sharp\" {\n" > "lib/$types"
cat "$types" >> "lib/$types"
echo "}\n" >> "lib/$types"
rm "$types"