Skip to content

Commit

Permalink
Upgrade ember-cli-uglify to latest for sourcemap issue ember-cli/embe…
Browse files Browse the repository at this point in the history
…r-cli-terser#29 and add inline content for zxcvbn
  • Loading branch information
binoculars committed Mar 15, 2018
1 parent 671ab58 commit 2cb9f9a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 21 deletions.
1 change: 1 addition & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<script src="{{rootURL}}ember_osf_web/assets/ember-osf-web.js"></script>

{{content-for "raven"}}
{{content-for "zxcvbn"}}
{{content-for "body-footer"}}
</body>
</html>
32 changes: 28 additions & 4 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,27 @@
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const Funnel = require('broccoli-funnel');

const nonCdnEnvironments = ['development', 'test'];
const { EMBER_ENV } = process.env;
const useCdn = EMBER_ENV === 'production';

function postProcess(content) {
return content.trim().replace(/^\s{20}/mg, '');
}

module.exports = function(defaults) {
const useCdn = (nonCdnEnvironments.indexOf(process.env.EMBER_ENV) === -1);
const app = new EmberApp(defaults, {
'ember-bootstrap': {
bootstrapVersion: 3,
importBootstrapFont: true,
importBootstrapCSS: false,
},
'ember-cli-password-strength': {
bundleZxcvbn: false,
bundleZxcvbn: !useCdn,
},
fingerprint: {
exclude: [
'zxcvbn.js',
],
},
sassOptions: {
includePaths: [
Expand All @@ -37,7 +46,22 @@ module.exports = function(defaults) {
Raven.config(config.sentryDSN, config.sentryOptions || {}).install();
}
</script>
`.trim(),
`,
postProcess,
},
zxcvbn: {
enabled: useCdn,
/* eslint-disable max-len */
content: `
<script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"
integrity="sha256-Znf8FdJF85f1LV0JmPOob5qudSrns8pLPZ6qkd/+F0o=
sha384-jhGcGHNZytnBnH1wbEM3KxJYyRDy9Q0QLKjE65xk+aMqXFCdvFuYIjzMWAAWBBtR
sha512-TZlMGFY9xKj38t/5m2FzJ+RM/aD5alMHDe26p0mYUMoCF5G7ibfHUQILq0qQPV3wlsnCwL+TPRNK4vIWGLOkUQ=="
crossorigin="anonymous">
</script>
`,
postProcess,
/* eslint-enable max-len */
},
},
'ember-cli-babel': {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"ember-cli-test-loader": "^1.1.0",
"ember-cli-tslint": "^0.1.3",
"ember-cli-typescript": "^1.2.0",
"ember-cli-uglify": "^1.2.0",
"ember-cli-uglify": "^2.0.2",
"ember-click-outside": "^0.1.12",
"ember-collapsible-panel": "^2.1.1",
"ember-component-attributes": "^0.1.1",
Expand Down
44 changes: 28 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1915,19 +1915,19 @@ broccoli-tslinter@^3.0.0:
chalk "^2.0.1"
exists-sync "0.0.4"

broccoli-uglify-sourcemap@^1.0.0:
version "1.5.2"
resolved "https://registry.yarnpkg.com/broccoli-uglify-sourcemap/-/broccoli-uglify-sourcemap-1.5.2.tgz#04f84ab0db539031fa868ccfa563c9932d50cedb"
broccoli-uglify-sourcemap@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/broccoli-uglify-sourcemap/-/broccoli-uglify-sourcemap-2.0.2.tgz#f4a73112f1f56b46043e2e89cba5ce7762cddeb3"
dependencies:
broccoli-plugin "^1.2.1"
debug "^2.2.0"
lodash.merge "^4.5.1"
matcher-collection "^1.0.0"
debug "^3.1.0"
lodash.defaultsdeep "^4.6.0"
matcher-collection "^1.0.5"
mkdirp "^0.5.0"
source-map-url "^0.3.0"
source-map-url "^0.4.0"
symlink-or-copy "^1.0.1"
uglify-js "^2.7.0"
walk-sync "^0.1.3"
uglify-es "^3.1.3"
walk-sync "^0.3.2"

broccoli-writer@^0.1.1, broccoli-writer@~0.1.1:
version "0.1.1"
Expand Down Expand Up @@ -2538,6 +2538,10 @@ commander@^2.11.0, commander@^2.12.1, commander@^2.5.0, commander@^2.6.0, comman
version "2.14.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa"

commander@~2.13.0:
version "2.13.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"

common-tags@^1.4.0:
version "1.7.2"
resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.7.2.tgz#24d9768c63d253a56ecff93845b44b4df1d52771"
Expand Down Expand Up @@ -3739,11 +3743,12 @@ ember-cli-typescript@^1.2.0:
symlink-or-copy "^1.1.8"
walk-sync "^0.3.2"

ember-cli-uglify@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ember-cli-uglify/-/ember-cli-uglify-1.2.0.tgz#3208c32b54bc2783056e8bb0d5cfe9bbaf17ffb2"
ember-cli-uglify@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/ember-cli-uglify/-/ember-cli-uglify-2.0.2.tgz#12becdaf1a2e6f0cdbd386b1d5f5a2d0540347d3"
dependencies:
broccoli-uglify-sourcemap "^1.0.0"
broccoli-uglify-sourcemap "^2.0.1"
lodash.defaultsdeep "^4.6.0"

ember-cli-valid-component-name@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -7151,7 +7156,7 @@ lodash.memoize@~3.0.3:
version "3.0.4"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f"

lodash.merge@^4.3.0, lodash.merge@^4.4.0, lodash.merge@^4.5.1, lodash.merge@^4.6.0:
lodash.merge@^4.3.0, lodash.merge@^4.4.0, lodash.merge@^4.6.0:
version "4.6.1"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.1.tgz#adc25d9cb99b9391c59624f379fbba60d7111d54"

Expand Down Expand Up @@ -7385,7 +7390,7 @@ markdown-table@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.1.tgz#4b3dd3a133d1518b8ef0dbc709bf2a1b4824bc8c"

matcher-collection@^1.0.0:
matcher-collection@^1.0.0, matcher-collection@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/matcher-collection/-/matcher-collection-1.0.5.tgz#2ee095438372cb8884f058234138c05c644ec339"
dependencies:
Expand Down Expand Up @@ -10384,11 +10389,18 @@ uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376"

uglify-es@^3.1.3:
version "3.3.9"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"
dependencies:
commander "~2.13.0"
source-map "~0.6.1"

uglify-js@1.x:
version "1.3.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-1.3.5.tgz#4b5bfff9186effbaa888e4c9e94bd9fc4c94929d"

uglify-js@^2.6, uglify-js@^2.7.0:
uglify-js@^2.6:
version "2.8.29"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
dependencies:
Expand Down

0 comments on commit 2cb9f9a

Please sign in to comment.