From 9fa982d6d142f84678836e0c2ec65d5981057305 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 10 Nov 2022 20:52:12 -0800 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20install=20HDS=20and=20a?= =?UTF-8?q?ssociated=20assets=20(#1436)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 🤖 install HDS and associated assets * chore: 🤖 bump HDS version * refactor: 💡 optimize hds/icon addon content build * test: 💍 fix intermittent test failure Co-authored-by: Dharini Jeeva --- .../helpers/relative-datetime-live-test.js | 2 +- addons/rose/addon/styles/addon.scss | 1 + addons/rose/index.js | 32 +++++ addons/rose/package.json | 2 +- ui/admin/ember-cli-build.js | 7 -- ui/desktop/ember-cli-build.js | 7 -- yarn.lock | 110 +++++++++++++++++- 7 files changed, 139 insertions(+), 22 deletions(-) create mode 100644 addons/rose/addon/styles/addon.scss diff --git a/addons/core/tests/integration/helpers/relative-datetime-live-test.js b/addons/core/tests/integration/helpers/relative-datetime-live-test.js index 8887e0359..037a8a552 100644 --- a/addons/core/tests/integration/helpers/relative-datetime-live-test.js +++ b/addons/core/tests/integration/helpers/relative-datetime-live-test.js @@ -35,7 +35,7 @@ module('Integration | Helper | relative-datetime-live', function (hooks) { await render(hbs`{{relative-datetime-live this.date}}`); assert.dom(this.element).hasText('23 years ago'); - this.date = now + 8 * 31 * 24 * 60 * 60 * 1000; + this.date = now + 8 * 30 * 24 * 60 * 60 * 1000; await render(hbs`{{relative-datetime-live this.date}}`); assert.dom(this.element).hasText('in 7 months'); diff --git a/addons/rose/addon/styles/addon.scss b/addons/rose/addon/styles/addon.scss new file mode 100644 index 000000000..16d19db6c --- /dev/null +++ b/addons/rose/addon/styles/addon.scss @@ -0,0 +1 @@ +@import '@hashicorp/design-system-components'; diff --git a/addons/rose/index.js b/addons/rose/index.js index 3b830156c..6cf90c285 100644 --- a/addons/rose/index.js +++ b/addons/rose/index.js @@ -12,11 +12,43 @@ module.exports = { app.import('node_modules/codemirror/lib/codemirror.css'); app.import('node_modules/codemirror/theme/monokai.css'); + this.includeHDSStyles(app); this.includeFlightIcons(app); this.includePublic(app); this.setupSVGO(app); }, + /** + * Due to a limitation in how ember treats nested addons (see https://github.com/ember-cli/ember-cli/issues/4475) + * this is neeeded to reach down into @hashicorp/ember-flight-icons' contentFor hook to run the logic + * that injects the sprite into the DOM + */ + contentFor(type, config) { + return this.findOwnAddonByName('@hashicorp/design-system-components') + .findOwnAddonByName('@hashicorp/ember-flight-icons') + .contentFor(type, config); + }, + + /** + * Finds the HDS styles folder and includes it into the running + * application's `sassOptions.includePaths`. + */ + includeHDSStyles(app) { + const tokensPath = + '../../node_modules/@hashicorp/design-system-tokens/dist/products/css'; + const hdsPath = + '../../node_modules/@hashicorp/design-system-components/app/styles'; + + // Setup default sassOptions on the running application + app.options.sassOptions = app.options.sassOptions || {}; + app.options.sassOptions.includePaths = + app.options.sassOptions.includePaths || []; + + // Include the addon styles + app.options.sassOptions.includePaths.push(tokensPath); + app.options.sassOptions.includePaths.push(hdsPath); + }, + /** * Finds the structure-icons folder and includes it into the * ember-inline-svg addon. diff --git a/addons/rose/package.json b/addons/rose/package.json index ed3ef239c..d1fe87765 100644 --- a/addons/rose/package.json +++ b/addons/rose/package.json @@ -34,6 +34,7 @@ }, "dependencies": { "@embroider/test-setup": "^0.48.1", + "@hashicorp/design-system-components": "^1.3.2", "codemirror": "5.65.7", "ember-auto-import": "^2.4.2", "ember-cli-babel": "^7.26.10", @@ -56,7 +57,6 @@ "@ember/test-helpers": "^2.8.1", "@glimmer/component": "^1.1.2", "@glimmer/tracking": "^1.1.2", - "@hashicorp/flight-icons": "^2.6.0", "@storybook/addon-a11y": "^6.3.12", "@storybook/addon-actions": "^6.3.10", "@storybook/addon-controls": "^6.5.12", diff --git a/ui/admin/ember-cli-build.js b/ui/admin/ember-cli-build.js index 953afd1d1..f97f2387f 100644 --- a/ui/admin/ember-cli-build.js +++ b/ui/admin/ember-cli-build.js @@ -18,13 +18,6 @@ module.exports = function (defaults) { enabled: true, extensions: ['js'], }, - sassOptions: { - onlyIncluded: true, - extension: 'scss', - }, - emberNotify: { - importCss: false, - }, svg: { paths: ['../../addons/core/public'], }, diff --git a/ui/desktop/ember-cli-build.js b/ui/desktop/ember-cli-build.js index 9f598497c..2d14f68e1 100644 --- a/ui/desktop/ember-cli-build.js +++ b/ui/desktop/ember-cli-build.js @@ -18,13 +18,6 @@ module.exports = function (defaults) { enabled: true, extensions: ['js'], }, - sassOptions: { - onlyIncluded: true, - extension: 'scss', - }, - emberNotify: { - importCss: false, - }, svg: { paths: ['../../addons/core/public'], }, diff --git a/yarn.lock b/yarn.lock index 9fcf7f8e7..b6b02fd80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3927,6 +3927,14 @@ ember-cli-version-checker "^5.1.2" semver "^7.3.5" +"@embroider/addon-shim@^1.5.0": + version "1.8.3" + resolved "https://registry.yarnpkg.com/@embroider/addon-shim/-/addon-shim-1.8.3.tgz#2368510b8ce42d50d02cb3289c32e260dfa34bd9" + integrity sha512-7pyHwzT6ESXc3nZsB8rfnirLkUhQWdvj6CkYH+0MUPN74mX4rslf7pnBqZE/KZkW3uBIaBYvU8fxi0hcKC/Paw== + dependencies: + "@embroider/shared-internals" "^1.8.3" + semver "^7.3.5" + "@embroider/core@0.33.0", "@embroider/core@^0.33.0": version "0.33.0" resolved "https://registry.yarnpkg.com/@embroider/core/-/core-0.33.0.tgz#0fb1752d6e34ea45368e65c42e13220a57ffae76" @@ -4059,7 +4067,7 @@ semver "^7.3.5" typescript-memoize "^1.0.1" -"@embroider/shared-internals@^1.0.0": +"@embroider/shared-internals@^1.0.0", "@embroider/shared-internals@^1.8.3": version "1.8.3" resolved "https://registry.yarnpkg.com/@embroider/shared-internals/-/shared-internals-1.8.3.tgz#52d868dc80016e9fe983552c0e516f437bf9b9f9" integrity sha512-N5Gho6Qk8z5u+mxLCcMYAoQMbN4MmH+z2jXwQHVs859bxuZTxwF6kKtsybDAASCtd2YGxEmzcc1Ja/wM28824w== @@ -4526,10 +4534,43 @@ resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== -"@hashicorp/flight-icons@^2.6.0": - version "2.6.0" - resolved "https://registry.yarnpkg.com/@hashicorp/flight-icons/-/flight-icons-2.6.0.tgz#1726bb550de4c9dd8100c3c70d826b7c9f01074c" - integrity sha512-hu6VwUw/6qI9sQqo3h+lbNTXJ//vKOf02MF6z9JqQfNm2eMwW8l6Get87gGkLdnFU6KLWUvYrZPk4laZAcOq8Q== +"@hashicorp/design-system-components@^1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@hashicorp/design-system-components/-/design-system-components-1.3.2.tgz#42d10b20bf93bdf4587012af8a4a944f3538272a" + integrity sha512-aXm5pv9LurVFpoHTgOo87H2LxcdykSPMo88W2E/sw5dEEwJPZARI/Mg3H1i3EjR8Psc1COAozP5jpOhfer1b4w== + dependencies: + "@hashicorp/design-system-tokens" "^1.2.0" + "@hashicorp/ember-flight-icons" "^3.0.1" + ember-auto-import "^2.4.2" + ember-cached-decorator-polyfill "^0.1.4" + ember-cli-babel "^7.26.11" + ember-cli-htmlbars "^6.1.0" + ember-cli-sass "^10.0.1" + ember-keyboard "^8.1.0" + ember-named-blocks-polyfill "^0.2.5" + ember-style-modifier "^0.8.0" + ember-truth-helpers "^3.0.0" + sass "^1.43.4" + +"@hashicorp/design-system-tokens@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@hashicorp/design-system-tokens/-/design-system-tokens-1.2.0.tgz#e83a69934c5c0c84de3c4572811e56543905bf39" + integrity sha512-N74hb1mLImbY1NyH7Of4UDY7HBO5A4VSdXzXyLO2ZrB/WYIfX++uKjOMknca0lAAIMC7kqaYm3OIbND/sHbu8g== + +"@hashicorp/ember-flight-icons@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@hashicorp/ember-flight-icons/-/ember-flight-icons-3.0.1.tgz#38895453a7994d7089bc058ccaa11f9c7eb9584e" + integrity sha512-1gmzv3d//YzW87vd5FsJQpgq+addDdl3xgPkT1v9uVaDh7k8AZsz9IltymhP+Q62OIGHhx7GwagIwnwf3B6bAQ== + dependencies: + "@hashicorp/flight-icons" "^2.11.1" + ember-auto-import "^2.4.2" + ember-cli-babel "^7.26.11" + ember-cli-htmlbars "^6.1.0" + +"@hashicorp/flight-icons@^2.11.1": + version "2.11.1" + resolved "https://registry.yarnpkg.com/@hashicorp/flight-icons/-/flight-icons-2.11.1.tgz#0ef70fac396699fb1987afab9570786eda57e95b" + integrity sha512-JD3/o1jtru9b2nzMeYYABcQ3TCcBx3wv0XjibdjQ18yhZ4b3zW6v0sl9eRDl+wbfVfBeXLXuGabt7ZXWNaPCCA== "@humanwhocodes/config-array@^0.5.0": version "0.5.0" @@ -12086,6 +12127,26 @@ ember-browser-services@^2.0.0: ember-cli-typescript "^4.2.1" ember-window-mock "^0.7.2" +ember-cache-primitive-polyfill@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ember-cache-primitive-polyfill/-/ember-cache-primitive-polyfill-1.0.1.tgz#a27075443bd87e5af286c1cd8a7df24e3b9f6715" + integrity sha512-hSPcvIKarA8wad2/b6jDd/eU+OtKmi6uP+iYQbzi5TQpjsqV6b4QdRqrLk7ClSRRKBAtdTuutx+m+X+WlEd2lw== + dependencies: + ember-cli-babel "^7.22.1" + ember-cli-version-checker "^5.1.1" + ember-compatibility-helpers "^1.2.1" + silent-error "^1.1.1" + +ember-cached-decorator-polyfill@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/ember-cached-decorator-polyfill/-/ember-cached-decorator-polyfill-0.1.4.tgz#f1e2c65cc78d0d9c4ac0e047e643af477eb85ace" + integrity sha512-JOK7kBCWsTVCzmCefK4nr9BACDJk0owt9oIUaVt6Q0UtQ4XeAHmoK5kQ/YtDcxQF1ZevHQFdGhsTR3JLaHNJgA== + dependencies: + "@glimmer/tracking" "^1.0.4" + ember-cache-primitive-polyfill "^1.0.1" + ember-cli-babel "^7.21.0" + ember-cli-babel-plugin-helpers "^1.1.1" + ember-can@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ember-can/-/ember-can-3.1.0.tgz#683e7e98303d7691001c6c8b7611c8152d477cf3" @@ -12371,6 +12432,16 @@ ember-cli-preprocess-registry@^3.3.0: debug "^3.0.1" process-relative-require "^1.0.0" +ember-cli-sass@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/ember-cli-sass/-/ember-cli-sass-10.0.1.tgz#afa91eb7dfe3890be0390639d66976512e7d8edc" + integrity sha512-dWVoX03O2Mot1dEB1AN3ofC8DDZb6iU4Kfkbr3WYi9S9bGVHrpR/ngsR7tuVBuTugTyG53FPtLLqYdqx7XjXdA== + dependencies: + broccoli-funnel "^2.0.1" + broccoli-merge-trees "^3.0.1" + broccoli-sass-source-maps "^4.0.0" + ember-cli-version-checker "^2.1.0" + ember-cli-sass@^11.0.1: version "11.0.1" resolved "https://registry.yarnpkg.com/ember-cli-sass/-/ember-cli-sass-11.0.1.tgz#dc565764213a76973a83c0db9583cb79ba187dc5" @@ -12940,6 +13011,16 @@ ember-intl@^6.0.0-beta.4: mkdirp "^1.0.4" silent-error "^1.1.1" +ember-keyboard@^8.1.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/ember-keyboard/-/ember-keyboard-8.2.0.tgz#d11fa7f0443606b7c1850bbd8253274a00046e11" + integrity sha512-h2kuS2irtIyvNbAMkGDlDTB4TPXwgmC6Nu9bIuGWoCjkGdgJbUg0VegfyRJ1TlxbIHlAelbqVpE8UhfgY5wEag== + dependencies: + "@embroider/addon-shim" "^1.5.0" + ember-destroyable-polyfill "^2.0.3" + ember-modifier "^2.1.2 || ^3.1.0 || ^4.0.0" + ember-modifier-manager-polyfill "^1.2.0" + ember-load-initializers@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ember-load-initializers/-/ember-load-initializers-2.1.2.tgz#8a47a656c1f64f9b10cecdb4e22a9d52ad9c7efa" @@ -12979,7 +13060,7 @@ ember-modifier-manager-polyfill@^1.2.0: ember-cli-version-checker "^2.1.2" ember-compatibility-helpers "^1.2.0" -ember-modifier@^3.2.7: +"ember-modifier@^2.1.2 || ^3.1.0 || ^4.0.0", ember-modifier@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/ember-modifier/-/ember-modifier-3.2.7.tgz#f2d35b7c867cbfc549e1acd8d8903c5ecd02ea4b" integrity sha512-ezcPQhH8jUfcJQbbHji4/ZG/h0yyj1jRDknfYue/ypQS8fM8LrGcCMo0rjDZLzL1Vd11InjNs3BD7BdxFlzGoA== @@ -13114,6 +13195,14 @@ ember-source@~3.28.8: semver "^7.3.4" silent-error "^1.1.1" +ember-style-modifier@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/ember-style-modifier/-/ember-style-modifier-0.8.0.tgz#ef46b3f288e63e3d850418ea8dc6f7b12edde721" + integrity sha512-I7M+oZ+poYYOP7n521rYv7kkYZbxotL8VbtHYxLQ3tasRZYQJ21qfu3vVjydSjwyE3w7EZRgKngBoMhKSAEZnw== + dependencies: + ember-cli-babel "^7.26.6" + ember-modifier "^3.2.7" + ember-template-imports@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/ember-template-imports/-/ember-template-imports-3.1.1.tgz#9b7a4f37c0a638b3d3d9894dade494efceb30f9a" @@ -23739,6 +23828,15 @@ sass-lint@^1.13.1: path-is-absolute "^1.0.0" util "^0.10.3" +sass@^1.43.4: + version "1.56.0" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.56.0.tgz#134032075a3223c8d49cb5c35e091e5ba1de8e0a" + integrity sha512-WFJ9XrpkcnqZcYuLRJh5qiV6ibQOR4AezleeEjTjMsCocYW59dEG19U3fwTTXxzi2Ed3yjPBp727hbbj53pHFw== + dependencies: + chokidar ">=3.0.0 <4.0.0" + immutable "^4.0.0" + source-map-js ">=0.6.2 <2.0.0" + sass@^1.55.0: version "1.55.0" resolved "https://registry.yarnpkg.com/sass/-/sass-1.55.0.tgz#0c4d3c293cfe8f8a2e8d3b666e1cf1bff8065d1c"