diff --git a/deploy.ts b/deploy.ts index 1844f00..3c8f1d0 100644 --- a/deploy.ts +++ b/deploy.ts @@ -1,16 +1,44 @@ import { publish } from "gh-pages" +import { exec } from "child_process" + +const args = process.argv.splice(2) console.log("Deploying..."); -(async () => { - await new Promise((res, rej) => { - console.log("Updating github pages") - publish("dist", (err) => { - if (err) +const run = (command: string): Promise => { + return new Promise((res, rej) => { + console.log(`🏃 Running: '${command}'`) + exec(command, (err, stdout, stderr) => { + if (err != null) rej(err) - - console.log(`😄 Succesfully published to github pages`) - res(true) + else if (typeof (stderr) != "string") + rej(new Error(stderr)) + else + res(stdout) }) }) +} + + +(async () => { + try { + if (!args.includes("--skipBuild") && !args.includes("-sb")) + await run("npm run build") + await run("git add .") + await run('git commit -m "automated update"') + await run("git push origin master") + await new Promise((res, rej) => { + console.log("Updating github pages") + publish("dist", (err) => { + if (err) + rej(err) + + console.log(`😄 Succesfully published to github pages`) + res(true) + }) + }) + } + catch (err) { + console.log(`😭 Something went wrong: ${err}`) + } })() \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8f40f38..7cfe881 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1120,18 +1120,6 @@ "wrap-ansi": "^2.0.0" } }, - "clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", - "dev": true - }, - "clone-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", - "dev": true - }, "clone-deep": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-2.0.2.tgz", @@ -1144,87 +1132,6 @@ "shallow-clone": "^1.0.0" } }, - "clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", - "dev": true - }, - "cloneable-readable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.3.tgz", - "integrity": "sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "closure-webpack-plugin": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/closure-webpack-plugin/-/closure-webpack-plugin-2.0.1.tgz", - "integrity": "sha512-ZQz24BstWdqOwyo3ttOOqS2V/CxZ9AXEO5P3W3oIO3e0ZtnL2KefFEJ+NtVwNcuvtp64ZiQf0zWs0Jur/QLtfA==", - "dev": true, - "requires": { - "acorn": "^5.0.0", - "acorn-dynamic-import": "^2.0.0", - "schema-utils": "1.x", - "unquoted-property-validator": "^1.0.2", - "webpack-sources": "1.x" - }, - "dependencies": { - "acorn": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", - "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", - "dev": true - }, - "acorn-dynamic-import": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz", - "integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=", - "dev": true, - "requires": { - "acorn": "^4.0.3" - }, - "dependencies": { - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - } - } - } - } - }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -3409,75 +3316,6 @@ "minimatch": "~3.0.2" } }, - "google-closure-compiler": { - "version": "20190513.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20190513.0.0.tgz", - "integrity": "sha512-86B1C1yR+Fvd60QFiI/AtMIJb55QCBHzEMEmxOhbzFfdAQ9TpTk3ZFI5NHOwjq2wKlj6tmvHSl5H/5UrdV24Vg==", - "dev": true, - "requires": { - "chalk": "^1.0.0", - "google-closure-compiler-java": "^20190513.0.0", - "google-closure-compiler-js": "^20190513.0.0", - "google-closure-compiler-linux": "^20190513.0.0", - "google-closure-compiler-osx": "^20190513.0.0", - "minimist": "^1.2.0", - "vinyl": "^2.0.1", - "vinyl-sourcemaps-apply": "^0.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "google-closure-compiler-java": { - "version": "20190513.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20190513.0.0.tgz", - "integrity": "sha512-0dFZwAREck9W780tVW4AW1c4ztrigLXGJ+dLCXFCwVJZS0pmhmZx3YEByl/aFSU9etIjLwYkYo73xjPyZ/AbtA==", - "dev": true - }, - "google-closure-compiler-js": { - "version": "20190513.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-js/-/google-closure-compiler-js-20190513.0.0.tgz", - "integrity": "sha512-BoKdVwowSKUUMGCWVBO9pngeep7B4ngLz5Qjm3VG7KVYZScybworgUjQKi4y8t1vPR8YbhdxQCvNaAqoyh+3ng==", - "dev": true - }, - "google-closure-compiler-linux": { - "version": "20190513.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20190513.0.0.tgz", - "integrity": "sha512-YI1EnD3v86g6IrkAQndrdlvHvH1/ACvbH9q33CKVMUpAnzOYh8dZF2J5i4AK2GUALnun8wL/MIk5SKTQBCSbjg==", - "dev": true, - "optional": true - }, - "google-closure-compiler-osx": { - "version": "20190513.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20190513.0.0.tgz", - "integrity": "sha512-q4/e9eGNrl16oSTqgcDR+GK4GBDp27kn+cxICDYKgK/rLV8XmAW5HpI3kJty3mlWhO3SIbP5j4RMQuxqwjtZ2w==", - "dev": true, - "optional": true - }, "graceful-fs": { "version": "4.1.15", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", @@ -5963,12 +5801,6 @@ "is-finite": "^1.0.0" } }, - "replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=", - "dev": true - }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", @@ -7358,12 +7190,6 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", "dev": true }, - "unquoted-property-validator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unquoted-property-validator/-/unquoted-property-validator-1.1.0.tgz", - "integrity": "sha512-ZWeQoYZ7HN8DCLeaowNv2GvZIXqJptKB1uUWd08ZYc1qAmJt8tXh9nck26aoYmhJtE3jCjDqdqEfUTqcJ0R7bw==", - "dev": true - }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -7541,37 +7367,6 @@ "extsprintf": "^1.2.0" } }, - "vinyl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz", - "integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - } - }, - "vinyl-sourcemaps-apply": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", - "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", - "dev": true, - "requires": { - "source-map": "^0.5.1" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", diff --git a/package.json b/package.json index 29e9946..8b663af 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "webpack-dev-server --open --mode development", "build": "webpack --mode production", - "deploy": "nvmw use 12.2.0 && npm run build && ts-node deploy" + "deploy": "#needs node 12.2.0 && npm run build && ts-node deploy" }, "sideEffects": [ "*.scss" @@ -25,12 +25,10 @@ "@types/file-saver": "^2.0.1", "@types/gh-pages": "^2.0.0", "@types/toastr": "^2.1.37", - "closure-webpack-plugin": "^2.0.1", "css-loader": "^2.1.0", "extract-text-webpack-plugin": "^4.0.0-beta.0", "file-loader": "^3.0.1", "gh-pages": "^2.0.1", - "google-closure-compiler": "^20190513.0.0", "html-loader": "^0.5.5", "html-webpack-plugin": "^3.2.0", "node-sass": "^4.11.0", diff --git a/webpack.config.js b/webpack.config.js index c52035d..a3eb178 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,5 @@ const HtmlWebPackPlugin = require("html-webpack-plugin"); const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const ClosurePlugin = require('closure-webpack-plugin'); module.exports = { devtool: 'inline-source-map',