Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-dev-site] Terra dev site v7 #255

Merged
merged 50 commits into from
Aug 31, 2021
Merged

[terra-dev-site] Terra dev site v7 #255

merged 50 commits into from
Aug 31, 2021

Conversation

mjhenkes
Copy link
Contributor

@mjhenkes mjhenkes commented Aug 5, 2021

Summary

This is a big one approximately 70% of terra-dev-site has been rewritten. Pretty much everything except some of the loader components:

Highlights are:

  • New cleaner pages look
  • Supports webpack 5
  • Uses less memory
  • Props table does a better job describing objects and defaults
  • Dev site will watch folders and refresh if files are added or removed instead of requiring the site to be manually rebuilt.
  • Pure webpack plugin
    • No more dev-site config folder
    • No more temporary files written to disk before webpack compile
    • All config controlled by the webpack plugin
  • Supports multiple dev sites per webpack config

Closes #

Deployment Link

https://terra-applic-.herokuapp.com/

Testing

Additional Details

Validation PRs:
terra-ui: cerner/terra-ui#319
terra-core: cerner/terra-core#3271
terra-framework: cerner/terra-framework#1359
terra-clinical: cerner/terra-clinical#740
terra-graphs: cerner/terra-graphs#220
terra-toolkit: n/a. We cant upgrade this one until terra-application supports react-intl v5

Thank you for contributing to Terra.
@cerner/terra

@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--ghsjqa August 5, 2021 22:28 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--juczwk August 9, 2021 20:21 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 9, 2021 20:52 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 10, 2021 18:47 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 10, 2021 20:44 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 10, 2021 21:42 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 10, 2021 21:43 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 10, 2021 22:22 Inactive
@mjhenkes mjhenkes self-assigned this Aug 11, 2021
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 11, 2021 13:15 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 11, 2021 14:26 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 11, 2021 14:39 Inactive
In addition the `TerraDevSiteEntrypoints` have been removed as well. Webpack 4 requires an entry point, but that requirement is generally satisfied by our reusable webpack configs. Webpack 5 will allow plugins to define entrypoints without being specified in the config.


Below is an example webpack config setting up the `terra-dev-site` plugin.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for v7 correct? Would a diff of v6 to v7 be helpful for migration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the diff would just end up looking messy. See https://github.com/cerner/terra-core/pull/3271/files for an example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh it is a bit messy. Might be worth linking to that commit for teams to reference that?


<Notice variant="important" ariaLevel="3">

Note in the example where `env.defaultLocale` is passed to the `TerraDevSite` plugin. The `defaultLocale` env is set as a part of our WDIO test service and must be passed into the `TerraDevSite` plugin to ensure locale tests are run appropriately.
Copy link
Contributor

@emilyrohrbough emilyrohrbough Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be helpful to add a commetn in the example to call it out there:'

    new TerraDevSite({
+     // env.defaultLocale is set by the WDIO test service to enable local testing
      defaultLocale: env.defaultLocale,
    }),

also I don't remember, if env.defaultLocale is not provided, does it fallback to english in the TerraDevSite plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The locale will default to en if no locale is provided: documented here https://github.com/cerner/terra-application/blob/terra-dev-site-v7/packages/terra-application-docs/src/terra-dev-site/tool/terra-dev-site/configPropsTable.jsx#L173
(that gets turned into a props table)

|`navConfig.navigation.index`|**removed**|The site index page is now assumed to be the first `primaryNavigationItem` in the list.|
|`navConfig.navigation.primaryNavigationItems`|`primaryNavigationItems`| PrimaryNavigationItems are no longer nested under the navigation object.|
|`navConfig.navigation.primaryNavigationItems.path`|`primaryNavigationItems.path`|unchanged.|
|`navConfig.navigation.primaryNavigationItems.text`|`primaryNavigationItems.label`|Changed to label to align with terra-application api naming.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you link the terra-application api you are referencing?

|`appConfig.favicon`|`faviconFilePath`|No longer nested under appConfig. The name now includes 'filePaths' to better describe the expected input.|
|`appConfig.themes`|**removed**|The available themes are now pulled from the terra-theme.config file via the webpack global variable `TERRA_THEME_CONFIG`.|
|`appConfig.defaultTheme`|`defaultTheme`|No longer nested under appConfig.|
|`appConfig.locales`|**removed**|Deprecated as of terra-dev-site 6.23, now removed.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one locale per site or will all terra locales be provided by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all will be provided, en will be default unless otherwise specified.

|`appConfig.defaultTheme`|`defaultTheme`|No longer nested under appConfig.|
|`appConfig.locales`|**removed**|Deprecated as of terra-dev-site 6.23, now removed.|
|`appConfig.defaultLocale`|`defaultLocale`|No longer nested under appConfig.|
|`appConfig.defaultDirection`|`defaultDirection`|No longer nested under appConfig.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway to remove this configuration and rely on the default local's expected directionality? <-- is this available via the locale's meta-data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There doesn't seem to be a way to get rtl/ltr data from the locale, I could use a third part (rtl-detect) but i'm pleased enough with the current implementation

|`appConfig.themes`|**removed**|The available themes are now pulled from the terra-theme.config file via the webpack global variable `TERRA_THEME_CONFIG`.|
|`appConfig.defaultTheme`|`defaultTheme`|No longer nested under appConfig.|
|`appConfig.locales`|**removed**|Deprecated as of terra-dev-site 6.23, now removed.|
|`appConfig.defaultLocale`|`defaultLocale`|No longer nested under appConfig.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above comment, is there a default used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults to en, This is documented on the config page, but not here because it hasn't changed from v6 to v7

|`appConfig.extensions.componentPath`|`extensionItems.modalFilePath`| Renamed to prepare for application v2 modals.|
|`appConfig.extensions.size`|**removed**|One size fits all.|
|`appConfig.headHtml`|`headHtml`|No longer nested under appConfig.|
|`includeTestEvidence`|**removed**|Removed the ability to include test evidence, this should be covered now by a separate site report.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a terra-toolkit report that teams need to enable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's automatically enabled for all 'orion' builds internally.


### Resulting Test changes

The page introduces a new tab stop. Any tests using tabstops will have to be updated to include an additional tab stop.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example of what you mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I don't think this is still true, I'll remove it.

<ApplicationStatusOverlay buttonAttrs={StatusViewButtons} message="Status View with all props" variant="no-data" />
</ApplicationStatusOverlayProvider>
// eslint-disable-next-line react/forbid-dom-props
<div style={{ height: '500px' }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should terra-dev-site provide a demo style?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be impossible for us to guess what hight is appropriate for the example, So i think it's up to the creator of the example.

const [loadingFailed, setLoadingFailed] = React.useState();

if (!pageContentConfig || !ContentComponent) {
return <Image src={kaiju404} width="100%" alt="404" />;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bringing back Kaiju?! 🎉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, just reusing the 404 image.

/**
* The PageAction elements to render for the Page.
*/
children: PropTypes.node,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these proptypes still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and still accurate too!

@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 30, 2021 18:18 Inactive
Co-authored-by: Emily Rohrbough  <emilyrohrbough@users.noreply.github.com>
@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 30, 2021 18:23 Inactive
Copy link
Contributor

@emilyrohrbough emilyrohrbough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me from a documentation perspective! 👍🏻

@mjhenkes mjhenkes temporarily deployed to terra-applic-terra-dev--iotyfw August 31, 2021 00:16 Inactive
@mjhenkes mjhenkes merged commit a454149 into main Aug 31, 2021
@mjhenkes mjhenkes deleted the terra-dev-site-v7 branch August 31, 2021 14:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants