From 3c12109ec457609fc6c1234fed80759eb9a7eed6 Mon Sep 17 00:00:00 2001 From: Chris Wendt Date: Sun, 19 Aug 2018 01:47:24 -0700 Subject: [PATCH] build: hardsource --- .gitignore | 2 + app/app.scss | 2 +- app/extensions-client-common.scss | 6 +- package-lock.json | 171 ++++++++++++++++++++++++++---- package.json | 1 + webpack/base.config.ts | 23 +++- 6 files changed, 175 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 477a67f6..ff2e980d 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ npm-debug.log.* # Cypress testing. These will get downloaded as artifacts by buildkite. cypress/screenshots/ cypress/vidoes/ + +.cache/ diff --git a/app/app.scss b/app/app.scss index a7e592fb..38c3d8e1 100644 --- a/app/app.scss +++ b/app/app.scss @@ -89,5 +89,5 @@ $theme-colors-light: ( @import './components/symbols'; @import './components/codeIntelStatusIndicator'; @import 'node_modules/@sourcegraph/codeintellify/lib/HoverOverlay.scss'; -@import 'node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner.css'; +@import 'node_modules/@sourcegraph/react-loading-spinner/lib/LoadingSpinner'; @import './extensions-client-common'; diff --git a/app/extensions-client-common.scss b/app/extensions-client-common.scss index 7ce8af10..34b5a648 100644 --- a/app/extensions-client-common.scss +++ b/app/extensions-client-common.scss @@ -1,8 +1,8 @@ -@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/PopoverButton.css'; -@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/Toggle.css'; +@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/PopoverButton'; +@import 'node_modules/@sourcegraph/extensions-client-common/lib/ui/generic/Toggle'; @import 'node_modules/@sourcegraph/extensions-client-common/lib/app/CommandList'; @import 'node_modules/@sourcegraph/extensions-client-common/lib/app/ExtensionStatus'; -@import 'node_modules/@sourcegraph/extensions-client-common/lib/extensions/manager/ExtensionCard.css'; +@import 'node_modules/@sourcegraph/extensions-client-common/lib/extensions/manager/ExtensionCard'; $body-color-light: #2b3750; $body-color-dark: #f2f4f8; diff --git a/package-lock.json b/package-lock.json index e381bbc2..ef301a04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1712,6 +1712,12 @@ "through": ">=2.2.7 <3" } }, + "JSV": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", + "integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c=", + "dev": true + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -8086,14 +8092,12 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "optional": true + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -8108,20 +8112,17 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "optional": true + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "optional": true + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "optional": true + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "core-util-is": { "version": "1.0.2", @@ -8238,8 +8239,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "optional": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", @@ -8251,7 +8251,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -8266,7 +8265,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -8274,14 +8272,12 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "optional": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minipass": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz", "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -8300,7 +8296,6 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "optional": true, "requires": { "minimist": "0.0.8" } @@ -8387,8 +8382,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "optional": true + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "object-assign": { "version": "4.1.1", @@ -8400,7 +8394,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "optional": true, "requires": { "wrappy": "1" } @@ -8522,7 +8515,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -9465,6 +9457,90 @@ "har-schema": "^2.0.0" } }, + "hard-source-webpack-plugin": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/hard-source-webpack-plugin/-/hard-source-webpack-plugin-0.12.0.tgz", + "integrity": "sha512-xELLABhB3WtdVxDZ4iku8W5Xi0Tq5w+1fOXrSWjeML90uWikykkiQmTV6Lk0MKC5uFEKUZcSuTY5BZS+8ZXr8A==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "find-cache-dir": "^2.0.0", + "jsonlint": "^1.6.3", + "lodash": "^4.15.0", + "mkdirp": "^0.5.1", + "node-object-hash": "^1.2.0", + "pkg-dir": "^3.0.0", + "rimraf": "^2.6.2", + "tapable": "^1.0.0-beta.5", + "webpack-sources": "^1.0.1", + "write-json-file": "^2.3.0" + }, + "dependencies": { + "find-cache-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.0.0.tgz", + "integrity": "sha512-LDUY6V1Xs5eFskUVYtIwatojt6+9xC9Chnlk/jYOOvn3FAFfSaWddxahDGyNHh0b2dMXa6YW2m0tk8TdVaXHlA==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^1.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "tapable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz", + "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", + "dev": true + } + } + }, "has": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", @@ -10725,6 +10801,16 @@ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, + "jsonlint": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.3.tgz", + "integrity": "sha512-jMVTMzP+7gU/IyC6hvKyWpUU8tmTkK5b3BPNuMI9U8Sit+YAWLlZwB6Y6YrdCxfg2kNz05p3XY3Bmm4m26Nv3A==", + "dev": true, + "requires": { + "JSV": "^4.0.x", + "nomnom": "^1.5.x" + } + }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -12327,6 +12413,12 @@ } } }, + "node-object-hash": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-1.4.1.tgz", + "integrity": "sha512-JQVqSM5/mOaUoUhCYR0t1vgm8RFo7qpJtPvnoFCLeqQh1xrfmr3BCD3nGBnACzpIEF7F7EVgqGD3O4lao/BY/A==", + "dev": true + }, "node-releases": { "version": "1.0.0-alpha.10", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.0.0-alpha.10.tgz", @@ -19130,6 +19222,15 @@ } } }, + "sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + }, "source-list-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", @@ -22050,6 +22151,34 @@ "signal-exit": "^3.0.2" } }, + "write-json-file": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-json-file/-/write-json-file-2.3.0.tgz", + "integrity": "sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8=", + "dev": true, + "requires": { + "detect-indent": "^5.0.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "pify": "^3.0.0", + "sort-keys": "^2.0.0", + "write-file-atomic": "^2.0.0" + }, + "dependencies": { + "detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, "ws": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", diff --git a/package.json b/package.json index aaf2b4d8..b6e52c00 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "extract-text-webpack-plugin": "^4.0.0-beta.0", "get-graphql-schema": "^2.1.1", "gql2ts": "^1.2.1", + "hard-source-webpack-plugin": "^0.12.0", "husky": "^0.14.3", "jade": "^1.11.0", "node-sass": "^4.9.0", diff --git a/webpack/base.config.ts b/webpack/base.config.ts index f7df2ed9..6da12794 100644 --- a/webpack/base.config.ts +++ b/webpack/base.config.ts @@ -1,5 +1,5 @@ import ExtractTextPlugin from 'extract-text-webpack-plugin' -import sassImportOnce from 'node-sass-import-once' +import HardSourceWebpackPlugin from 'hard-source-webpack-plugin' import * as path from 'path' import * as webpack from 'webpack' @@ -32,6 +32,23 @@ export default { filename: '../css/[name].bundle.css', allChunks: true, }), + new HardSourceWebpackPlugin({ + cachePrune: { + // Ignore the age of cache entries. Without this, the size of + // the cache can balloon past the `sizeThreshold`. + maxAge: 0, + // The cache size needs to be large enough for the build + // artifacts, otherwise the cache will get deleted and rendered + // useless. The build artifacts total ~70MB at the time of + // writing, so 500MB of cache is plenty. + sizeThreshold: 500 * 1024 * 1024, + }, + }), + new HardSourceWebpackPlugin.ExcludeModulePlugin([ + { + test: /sass-loader/, + }, + ]), ], resolve: { extensions: ['.ts', '.tsx', '.js'], @@ -68,10 +85,6 @@ export default { loader: 'sass-loader', options: { includePaths: [__dirname + '/node_modules'], - importer: sassImportOnce, - importOnce: { - css: true, - }, }, }, ]),