Skip to content

Commit

Permalink
docs(PPDSC-2670): merge branch main into docs/PPDSC-2670-title
Browse files Browse the repository at this point in the history
  • Loading branch information
mstuartf committed Mar 2, 2023
2 parents 57c4d75 + 2e19098 commit 765ac2d
Show file tree
Hide file tree
Showing 387 changed files with 14,411 additions and 10,782 deletions.
57 changes: 39 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ orbs:
slack: circleci/[email protected]
aws-cli: circleci/[email protected]
github-cli: circleci/[email protected]
node: circleci/[email protected]

slack_notify: &slack_notify
event: 'fail'
Expand Down Expand Up @@ -1060,11 +1061,12 @@ jobs:
at: ~/project
- aws-cli/setup:
role-arn: << parameters.aws_assume_role_arn >>
profile-name: "NEWSKIT-OIDC-PROFILE"
role-session-name: "${CIRCLE_WORKFLOW_ID}-s3-push"
profile-name: 'NEWSKIT-OIDC-PROFILE'
role-session-name: '${CIRCLE_WORKFLOW_ID}-s3-push'
- run:
name: Upload sites to given S3 paths
command: | # output current date time to a HTML file to allow a in-browser that check CDN does not return old files
command:
| # output current date time to a HTML file to allow a in-browser that check CDN does not return old files
export AWS_DEFAULT_REGION=<< parameters.aws_region >>
export s3Path_docs=<< parameters.s3Path_docs >>
export s3Path_storybook=<< parameters.s3Path_storybook >>
Expand All @@ -1076,22 +1078,40 @@ jobs:
- slack/notify:
<<: *slack_notify

# Deprecated by push_s3_general_oidc
push_s3_pr:
executor: aws-cli/default #TODO: refactor other steps to use this orb it's much cleaner, install and setup can then be moved into the shared aws step
push_s3_pr_oidc:
parameters:
aws_region:
description: AWS Region
type: string
default: '${AWS_DEFAULT_REGION}'
aws_assume_role_arn:
description: AWS ARN For Assume Role
type: string
default: '${S3_AWS_ASSUME_ROLE_ARN}'
executor: aws-cli-and-terraform
steps:
- checkout
- attach_workspace:
at: ~/project
- aws-cli/install
- aws-cli/setup
- aws-cli/setup:
role-arn: << parameters.aws_assume_role_arn >>
profile-name: 'NEWSKIT-OIDC-PROFILE'
role-session-name: '${CIRCLE_WORKFLOW_ID}-s3-push'
- node/install:
install-yarn: false
node-version: '16.13'
- run:
name: Upload PR sites to S3 subfolders
command: |
export s3Path_docs=$(node scripts/s3-pr-branch-naming.js ${CIRCLE_BRANCH} 's3://ncu-newskit-docs/')
export AWS_DEFAULT_REGION=<< parameters.aws_region >>
export s3Path_docs=$(node scripts/s3-pr-branch-naming.js ${CIRCLE_BRANCH} 's3://ncu-newskit-docs-pr/')
echo "${SITE_ENV} $(date)" > timestamp.html
aws s3 cp public $s3Path_docs --recursive
export s3Path_storybook=$(node scripts/s3-pr-branch-naming.js ${CIRCLE_BRANCH} 's3://ncu-newskit-docs/' 'storybook')
aws s3 cp timestamp.html $s3Path_docs
export s3Path_storybook=$(node scripts/s3-pr-branch-naming.js ${CIRCLE_BRANCH} 's3://ncu-newskit-docs-pr/' 'storybook/')
echo $s3Path_storybook
aws s3 cp dist-storybook $s3Path_storybook --recursive
aws s3 cp timestamp.html $s3Path_storybook
- slack/notify:
<<: *slack_notify

Expand All @@ -1108,8 +1128,8 @@ jobs:
circleci-agent step halt
else
gh pr comment --body "You can preview these changes on:
Documentation Site: $(node scripts/pr_comment_link.js ${CIRCLE_BRANCH} 'http://ncu-newskit-docs.s3-website-eu-west-1.amazonaws.com/' 'docs')
Storybook: $(node scripts/pr_comment_link.js ${CIRCLE_BRANCH} 'http://ncu-newskit-docs.s3-website-eu-west-1.amazonaws.com/' 'storybook')"
Documentation Site: $(node scripts/pr_comment_link.js ${CIRCLE_BRANCH} 'http://ncu-newskit-docs-pr.s3-website-eu-west-1.amazonaws.com/' 'docs')
Storybook: $(node scripts/pr_comment_link.js ${CIRCLE_BRANCH} 'http://ncu-newskit-docs-pr.s3-website-eu-west-1.amazonaws.com/' 'storybook')"
fi
- slack/notify:
<<: *slack_notify
Expand Down Expand Up @@ -1463,11 +1483,11 @@ workflows:
tf_env: false
requires:
- init_aws
- deploy_terraform:
- deploy_terraform_oidc:
name: deploy_terraform_s3_pr
package: s3
context: ncu-product-platforms-context
apply: false
package: s3/dev-newskit
context: ncu-newskit-site-pr
apply: true
tf_env: false
environment: pr
requires:
Expand Down Expand Up @@ -1504,9 +1524,9 @@ workflows:
context: ncu-newskit-site-pr
requires:
- build_icons
- push_s3_pr:
- push_s3_pr_oidc:
name: deploy_to_s3_pr
context: ncu-product-platforms-context
context: ncu-newskit-site-pr
requires:
- deploy_terraform_s3_pr
- build_docs_pr
Expand All @@ -1519,6 +1539,7 @@ workflows:
- validate_terraform:
name: validate_terraform
requires:
- deploy_terraform_s3_pr
- validate_deploy_terraform_s3_dev
- validate_deploy_terraform_s3_staging
- validate_deploy_terraform_s3_prod
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
.env
.DS_STORE
.eslintcache
.env.local
build
*.log
dist
Expand Down
1 change: 1 addition & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {

const unlimitedScenarios = [
'Accordion',
'Paragraph',
'grid',
'stack',
'card',
Expand Down
2 changes: 1 addition & 1 deletion cypress/components/scroll.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('scroll', () => {
});

it('vertical flow', () => {
const defaultStepDistance = 160;
const defaultStepDistance = 114;
cy.visit('?name=scroll');

cy.get('[data-testid="vertical-scroll-component"]').within(() => {
Expand Down
6 changes: 6 additions & 0 deletions docs/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ Scripts should be named using the following naming convention:

* `e2e:docs:ci` -> starts serve:docs and runs the cypress docs tests headlessly.

Run Percy from main branch if you want to force the baseline images to be updated. The two commands to yarn run, after you have switched to main branch and done a git pull, are shown below:

* `test:visual:comps:local:percy` -> sets required env variables and runs the percy component tests locally.

* `e2e:visual:docs:local:percy` -> sets required env variables and runs the percy doc site tests locally.

Image updating normally happens whenever a PR is merged to main, but occasionally it can get out of sync. NB Do *not* set PERCY_PARTIAL_BUILD=1 on main branch, as that is not supported (only on feature branches). We use it on the pull_request workflow to bypass a full visual regression (just one dummy test is run).

Percy support issues can be raised by emailing [email protected].

## Storybook

* `dev:storybook` -> locally starts storybook at port 6006.
Expand Down
52 changes: 46 additions & 6 deletions lib/codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ run to see all codemods and flags
npx @newskit/codemod --help
```



## Included scripts
The list includes these transformers
## v6.0.0
The following transformers are available when upgrading to v6:

- [`emotion-icons`](#emotion-icons)
- [`remove-redundant-marker-ul`](#remove-redundant-marker-ul)
- [`update-list-item-marker-ul-value`](#update-list-item-marker-ul-value)
- [`enum-to-union`](#enum-to-union)
- [`update-linkinline`](#update-linkinline)
- [`update-linkstandalone`](#update-linkstandalone)


#### `emotion-icons`
Expand All @@ -42,7 +42,7 @@ Imports and transform `newskit` icons to `emotion-icons`;
```sh
npx @newskit/codemod v6.0.0/emotion-icons [path]
// example
npx @newskit/codemod v6.0.0/emotion-icons 'components/**/*.+(ts|tsx|js|jsx)'
npx @newskit/codemod v6.0.0/emotion-icons 'components/**/*.+(ts|tsx|js|jsx)'
```

#### `remove-redundant-marker-ul`
Expand All @@ -62,6 +62,7 @@ Unordered List has now a default marker, the script passes `listItemMarker` with
- <UnorderedList></UnorderedList>
+ <UnorderedList listItemMarker={null}></UnorderedList>
```

#### `enum-to-union`

Some of NewsKit components support enum as the prop type, the script remove the imports of enum and replace enum type with union type.
Expand All @@ -86,7 +87,7 @@ LinkInline is used within paragraphs or sentences to link to different content o

#### `update-linkstandalone`

Updates deprecated Link component to LinkStandalone.
Updates deprecated Link component to LinkStandalone.
LinkStandalone is used outside of body content, for example within navigational components such as menus, headers and footers.

```diff
Expand All @@ -97,7 +98,46 @@ LinkStandalone is used outside of body content, for example within navigational
+ <LinkStandalone href={'www.google.com'}>Click on me</LinkStandalone>;
```

## v7.0.0
The following transformers are available when upgrading to v7:

- [`audio-player-play-pause-button`](#audio-player-play-pause-button)
- [`all-default`](#all-default)
- [`replace-space-inset-props-and-overrides`](#replace-space-inset-props-and-overrides)

#### `audio-player-play-pause-button`

There are changes to the default styling of the AudioPlayer component in v7.

Run this codemod if you would like to apply manual overrides to keep the old default styling.

```diff
- <AudioPlayerPlayPauseButton />

+ <AudioPlayerPlayPauseButton size="large" />
```

#### `all-default`

Run this codemod if you would like to apply manual overrides to the keep the old default for all components listed above.

#### `replace-space-inset-props-and-overrides`

spaceInset prop was marked as deprecated and has now been removed in V7.

Run this codemod if you would like to apply logical props instead.

```diff
- <Flag overrides={{spaceInset: "space060"}}>Flag</Flag>

+ <Flag overrides={{paddingBlock: "space060", paddingInline: "space060"}}>Flag</Flag>
```

```diff
- <Block spaceInset="space020" stylePreset="inkContrast">Block</Block>

+ <Block stylePreset="inkContrast" paddingBlock="space020" paddingInline="space020">Block</Block>
```

## Development

Expand Down
1 change: 1 addition & 0 deletions lib/codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"author": "newskit",
"dependencies": {
"chalk": "4.1.2",
"dedent-js": "^1.0.1",
"glob": "^8.0.3",
"jscodeshift": "^0.13.1",
"jscodeshift-add-imports": "^1.0.10",
Expand Down
Loading

0 comments on commit 765ac2d

Please sign in to comment.