Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Replace wmnds by tfwm. #861

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .typo-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ excluded_files:
# Any typos we should ignore?
excluded_words:
- typoci
- wmnds
- tfwmds
- wmnetwork
- nwm
- wmn
Expand Down
12 changes: 6 additions & 6 deletions .zeplin/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"styleguides": ["5d95b0aaad77af16c796a476"],
"components": [
{
"path": "src/wmnds/components/phase-indicator/_phase-indicator.njk",
"path": "src/tfwmds/components/phase-indicator/_phase-indicator.njk",
"zeplinNames": ["Phase indicator / Mobile", "Phase indicator / Desktop"],
"wmnds": {
"tfwmds": {
"urlPath": "components/phase-indicator/"
}
},
{
"path": "src/wmnds/components/disruption-indicator/small/_small.njk",
"path": "src/tfwmds/components/disruption-indicator/small/_small.njk",
"zeplinNames": []
},
{
"path": "src/wmnds/components/disruption-indicator/large/_large.njk",
"wmnds": {
"path": "src/tfwmds/components/disruption-indicator/large/_large.njk",
"tfwmds": {
"urlPath": "components/disruption-indicators/"
},
"zeplinNames": [
Expand All @@ -38,7 +38,7 @@
"links": [
{
"name": "Transport for West Midlands Design System",
"type": "wmnds",
"type": "tfwmds",
"url": "https://wmnetwork.netlify.com/"
}
]
Expand Down
6 changes: 3 additions & 3 deletions doc/contributing/application-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Source files. See [README.md](../../src/README.md) in the src directory for details.

- `wmnds/`
- `tfwmds/`

This is where the core library of all components/patterns are built using nunjucks for the WMN Design System. These are then referenced by the Design System Website to show examples to other collaborators.

Expand All @@ -18,7 +18,7 @@

- `sass/`

Any core SASS/SCSS that is used for styling components/patterns etc. should be placed in here and then referenced in `src/wmnds/assets/sass/wmnds.scss`. Note: Anything referenced will appear in the live build.
Any core SASS/SCSS that is used for styling components/patterns etc. should be placed in here and then referenced in `src/tfwmds/assets/sass/tfwmds.scss`. Note: Anything referenced will appear in the live build.

- `components/`

Expand All @@ -42,7 +42,7 @@

- `js/`

Any javascript files located in here will be concatenated and compiled into `build/js/wmnds-vendor.min.js` via the [javascript build task](tasks.md#markdown-header-141-scripts-javascript).
Any javascript files located in here will be concatenated and compiled into `build/js/tfwmds-vendor.min.js` via the [javascript build task](tasks.md#markdown-header-141-scripts-javascript).

- `build/` **contains auto-generated files**

Expand Down
6 changes: 3 additions & 3 deletions doc/contributing/coding-standards.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Components

Find components in `src/wmnds/components`.
Find components in `src/tfwmds/components`.

Components must use the `.wmnds-` namespace.
Components must use the `.tfwmds-` namespace.

For example, `.wmnds-button`.
For example, `.tfwmds-button`.

## Writing CSS for components

Expand Down
44 changes: 22 additions & 22 deletions doc/contributing/css.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Class naming convention

## `wmnds` namespacing
## `tfwmds` namespacing

All class names start with a `.wmnds-` namespace to reduce the likelihood of
All class names start with a `.tfwmds-` namespace to reduce the likelihood of
conflicting with existing classes in your application. It also helps to identify
where the styling for a particular element is coming from.

Expand All @@ -24,9 +24,9 @@ The naming convention follows this pattern:
.block__element {}
.block--modifier {}

.wmnds-card // Block - the root of a component
.wmnds-card__body // Element - a part of the block
.wmnds-card--active // Modifier - a variant of the block
.tfwmds-card // Block - the root of a component
.tfwmds-card__body // Element - a part of the block
.tfwmds-card--active // Modifier - a variant of the block
```

It uses double hyphens (`--`) and underscores (`__`) so that the block, element
Expand All @@ -35,9 +35,9 @@ or modifiers themselves can be hyphen delimited without causing ambiguity.
For example:

```scss
.wmnds-phase-banner
.wmnds-phase-banner__phase-tag
.wmnds-phase-banner__phase-tag--light-blue
.tfwmds-phase-banner
.tfwmds-phase-banner__phase-tag
.tfwmds-phase-banner__phase-tag--light-blue
```

### Further reading:
Expand All @@ -57,7 +57,7 @@ given class name. It also discourages excessive nesting.
Bad:

```
.wmnds-breadcrumb {
.tfwmds-breadcrumb {
...
&__item {
...
Expand All @@ -68,11 +68,11 @@ Bad:
Good:

```
.wmnds-breadcrumb {
.tfwmds-breadcrumb {
...
}

.wmnds-breadcrumb__item {
.tfwmds-breadcrumb__item {
...
}
```
Expand All @@ -98,11 +98,11 @@ other components.

Keep all of the variants of a component in the same place.

`.wmnds-error-summary` modifies the `.wmnds-list` component.
`.tfwmds-error-summary` modifies the `.tfwmds-list` component.

Component modifiers use an extra class, scoped to the component:

`.wmnds-error-summary__list`
`.tfwmds-error-summary__list`

This class is part of the component, rather than a parent of a component.

Expand Down Expand Up @@ -165,7 +165,7 @@ Good:

```
.selector {
color: $wmnds-blue;
color: $tfwmds-blue;
}
```

Expand Down Expand Up @@ -214,7 +214,7 @@ Bad:
Good:

```
.wmnds-wrapper {
.tfwmds-wrapper {
...
}
```
Expand Down Expand Up @@ -256,7 +256,7 @@ a {
Bad:

```
.wmnds-breadcrumb {
.tfwmds-breadcrumb {
...
&__item {
...
Expand All @@ -267,11 +267,11 @@ Bad:
Good:

```
.wmnds-breadcrumb {
.tfwmds-breadcrumb {
...
}

.wmnds-breadcrumb__item {
.tfwmds-breadcrumb__item {
...
}
```
Expand Down Expand Up @@ -420,15 +420,15 @@ Bad:

```
@mixin FONT_STACK() {
font-family: $wmnds-font-stack;
font-family: $tfwmds-font-stack;
}
```

Good:

```
@mixin font-stack() {
font-family: $wmnds-font-stack;
font-family: $tfwmds-font-stack;
}
```

Expand Down Expand Up @@ -498,6 +498,6 @@ More write up on [supported rules](https://github.com/sasstools/sass-lint/tree/m

We document SCSS using [SassDoc](http://sassdoc.com/file-level-annotations/). This includes most of the settings, helpers and tools layers, with variables, functions and mixins being marked as private or public.

The syntax is used to generate a [SassDoc application](http://wmnds-frontend-review.herokuapp.com/doc/) that documents SCSS in a readable format.
The syntax is used to generate a [SassDoc application](http://tfwmds-frontend-review.herokuapp.com/doc/) that documents SCSS in a readable format.

See [colour.scss](../../../src/wmnds/helpers/_colour.scss) for an example of SassDoc syntax.
See [colour.scss](../../../src/tfwmds/helpers/_colour.scss) for an example of SassDoc syntax.
8 changes: 4 additions & 4 deletions doc/contributing/js.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Checkboxes($module) {
// code goes here
}

Checkboxes.prototype.init = function() {
Checkboxes.prototype.init = function () {
// code goes here
};

Expand Down Expand Up @@ -67,13 +67,13 @@ Assign methods to the prototype object. Do not overwrite the prototype with a ne
```js
// bad
Checkboxes.prototype = {
init: function() {
init: function () {
// code goes here
}
};

// good
Checkboxes.prototype.init = function() {
Checkboxes.prototype.init = function () {
// code goes here
};
```
Expand Down Expand Up @@ -104,7 +104,7 @@ Use default export over named export.

## Polyfilling

If you need to support older browsers, import the necessary [polyfills](/src/wmnds/vendor/polyfills) and they will be added to the environment when the feature is not supported.
If you need to support older browsers, import the necessary [polyfills](/src/tfwmds/vendor/polyfills) and they will be added to the environment when the feature is not supported.

For example, if you want to polyfill `addEventListener` for IE8, import the Event polyfills.

Expand Down
14 changes: 7 additions & 7 deletions doc/contributing/tasks/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Build commands are used for when code is to be compiled to an output that is sui
- Uses [autoprefixer](https://www.npmjs.com/package/gulp-autoprefixer) to parse CSS and add vendor prefixes
- Minifies CSS
- Creates two files in `{root}/build/css/`
- `wmnds-website.css`
- `tfwmds-website.css`
- For styleguide specific styling
- `wmn.css`
- For any styling related to WMN components
- `tfwm.css`
- For any styling related to TfWM components
- Creates sourcemaps in `{route}/_sourcemaps/`

## 1.3. Templates (HTML)
Expand Down Expand Up @@ -74,14 +74,14 @@ Build commands are used for when code is to be compiled to an output that is sui
- Concatenates all smaller javascript files together into one file
- Mangles and minifies the file
- Creates three files in `{root}/build/js/`
- `wmnds-website.min.js`
- Created from any javascript files found in `{root}/src/wmnds-website/**/*.js`
- `tfwmds-website.min.js`
- Created from any javascript files found in `{root}/src/tfwmds-website/**/*.js`
- For styleguide specific items only
- `vendor.min.js`
- Created from any javascript files found in `{root}/src/assets/js/vendor/**/*.js`
- For any vendor/third-party scripts that are required for components
- `wmn.min.js`
- Created from any javascript files found in `['src/assets/js/wmn.js', 'src/components/**/*.js']`
- `tfwm.min.js`
- Created from any javascript files found in `['src/assets/js/tfwm.js', 'src/components/**/*.js']`
- For any custom javascript associated with a component
- Creates sourcemaps in `{route}/_sourcemaps/`

Expand Down
2 changes: 1 addition & 1 deletion doc/contributing/tasks/linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The config files are located at:

### 1.4.3. File(s) that are linted

- `{root}/src/assets/js/wmn.js`
- `{root}/src/assets/js/tfwm.js`
- `{root}/src/**/*.js`

`**/*.min.js` are ignored for linting as these files are presumed to have already been linted, mangled and minified.
Expand Down
8 changes: 4 additions & 4 deletions doc/contributing/testing-and-linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@ See [JavaScript Coding Standards](coding-standards/js.md#formatting-and-linting)

We use [Jest](https://jestjs.io/), an automated testing platform with an assertion library, and [Puppeteer](https://pptr.dev/) that is used to control [headless Chrome](https://developers.google.com/web/updates/2017/04/headless-chrome).

We test individual components and for instance global Sass files. See [all.test.js](../../src/wmnds/all.test.js). for examples of global tests we run, and [checkboxes.test.js](../../src/wmnds/components/checkboxes/checkboxes.test.js) for an example of component tests.
We test individual components and for instance global Sass files. See [all.test.js](../../src/tfwmds/all.test.js). for examples of global tests we run, and [checkboxes.test.js](../../src/tfwmds/components/checkboxes/checkboxes.test.js) for an example of component tests.

We aim to write the description of our tests in as "natural language" as possible, for instance "back-link component fails to render if the required fields are not included".

### Running individual tests

You can run a subset of the test suite that only tests components by running:

`npm test -- src/wmnds/components/button`
`npm test -- src/tfwmds/components/button`

Note: There's a watch mode that keeps a testing session open waiting for changes that can be used with:

`npm test -- --watch src/wmnds/components/button`
`npm test -- --watch src/tfwmds/components/button`

### Updating component snapshots

[Snapshot tests](https://facebook.github.io/jest/doc/en/snapshot-testing.html) are used for preventing unintended changes - when the snapshot test runs, it compares the previously captured snapshot to the current markup. For components, the snapshots are stored in `[component-name directory]/_snapshots_`.

If a snapshot test fails, review the difference in the console. If the change is the correct change to make, run:

`npm test -- -u src/wmnds/components/button`
`npm test -- -u src/tfwmds/components/button`

This will update the snapshot file. Commit this file separately with a commit message that explains you're updating the snapshot file and an explanation of what caused the change.
2 changes: 1 addition & 1 deletion gulp-tasks/build-nunjucks.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const buildingTemplates = () => {
const buildingComponentsForLive = () => {
return src(paths.nunjucks.componentSrc)
.pipe(plugins.flatten({ includeParents: [4, 4] }))
.pipe(plugins.replace('from "wmnds/', 'from "'))
.pipe(plugins.replace('from "tfwmds/', 'from "'))
.pipe(dest(paths.nunjucks.componentOutput));
};

Expand Down
6 changes: 3 additions & 3 deletions gulp-tasks/move-old-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ const { src, dest } = require('gulp');
const paths = require('./paths.js');

const movingOldCSS = () => {
return src('src/wmnds/assets/old/css/wmnds-components.min.css').pipe(dest(paths.styles.output));
return src('src/tfwmds/assets/old/css/tfwmds-components.min.css').pipe(dest(paths.styles.output));
};

const movingOldReactNativeStyles = () => {
return src('src/wmnds/assets/old/css/react-native/wmnds-components.min.js').pipe(
return src('src/tfwmds/assets/old/css/react-native/tfwmds-components.min.js').pipe(
dest(`${paths.styles.output}react-native/`)
);
};

const movingOldIcons = () => {
return src('src/wmnds/assets/old/img/wmnds-sprite.min.svg').pipe(dest(paths.svgs.dest)); // move config files to build
return src('src/tfwmds/assets/old/img/tfwmds-sprite.min.svg').pipe(dest(paths.svgs.dest)); // move config files to build
};

module.exports.moveOldCSS = movingOldCSS;
Expand Down
Loading