diff --git a/bin/postinstall.js b/bin/postinstall.js new file mode 100644 index 000000000..0d4548565 --- /dev/null +++ b/bin/postinstall.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node + +if (!process.env.SUPPRESS_SUPPORT) { + const ANSI_RESET = '\u001b[0m' + const ANSI_GREEN = '\u001b[32m' + const ANSI_YELLOW = '\u001b[33m' + const ANSI_BLUE = '\u001b[96m' + const ANSI_WHITE = '\u001b[37m' + const ANSI_BOLD = '\u001b[1m' + + console.log( // eslint-disable-line + ANSI_GREEN + + 'Has SweetAlert2 helped you create amazing applications?\n' + + 'You can show your' + ANSI_YELLOW + ' <3 ' + ANSI_GREEN + 'and support by making a donation:\n' + + ANSI_WHITE + ' > ' + + ANSI_BLUE + ANSI_BOLD + 'https://sweetalert2.github.io/#donations\n' + + ANSI_RESET + ) +} diff --git a/package.json b/package.json index 5b3278ef3..9483f9808 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "webpack": "^4.29.0" }, "files": [ + "bin", "dist", "src", "sweetalert2.d.ts" @@ -106,7 +107,8 @@ "check:third-party": "npm run check:unpkg && npm run check:jsdelivr && npm run check:wappalyzer", "check:wappalyzer": "curl 'https://api.wappalyzer.com/lookup-basic/v1/?url=https%3A%2F%2Fsweetalert2.github.io' 2>&1 | grep --quiet 'SweetAlert2'", "check:unpkg": "curl --location 'https://unpkg.com/sweetalert2' 2>&1 | grep --quiet 'window.Swal'", - "check:jsdelivr": "curl --location 'https://cdn.jsdelivr.net/npm/sweetalert2' 2>&1 | grep --quiet 'window.Swal'" + "check:jsdelivr": "curl --location 'https://cdn.jsdelivr.net/npm/sweetalert2' 2>&1 | grep --quiet 'window.Swal'", + "postinstall": "node bin/postinstall.js" }, "bugs": "https://github.com/sweetalert2/sweetalert2/issues", "license": "MIT"