Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/cc/banner-size-tweaks' into cc/b…
Browse files Browse the repository at this point in the history
…anner-size-tweaks
  • Loading branch information
charleycampbell committed Sep 4, 2024
2 parents 85dcc72 + 469ef98 commit 4fae147
Show file tree
Hide file tree
Showing 73 changed files with 2,327 additions and 1,610 deletions.
3 changes: 1 addition & 2 deletions .github/actions/setup-node-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ runs:
cache: 'pnpm'

# Set up GitHub Actions caching for Wireit.
# disable cross-run caching for now
# - uses: google/wireit@setup-github-actions-caching/v1
- uses: google/wireit@setup-github-actions-caching/v2

- run: pnpm install --frozen-lockfile
shell: bash
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# but not on CI:
# https://typicode.github.io/husky/#/?id=with-env-variables
if [ "$CI" != "true" ]; then
. ./tools/scripts/check-node-version
. ./scripts/check-node-version
fi

# keep docs up to date
node tools/scripts/maintain-readme/index.mjs
node scripts/maintain-readme/index.mjs
git add README.md

# keep makefile up to date
node tools/scripts/maintain-makefile/index.mjs
node scripts/maintain-makefile/index.mjs
git add Makefile

corepack pnpm lint-staged
24 changes: 4 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export SHELL := /usr/bin/env bash
# lists available `make` targets
.PHONY: ls
ls:
@node tools/scripts/list-make-targets.mjs
@node scripts/list-make-targets.mjs


###################################### DEV #####################################
Expand Down Expand Up @@ -56,7 +56,7 @@ lint: env
$(call log,"Linting projects")
@corepack pnpm -r lint
@corepack pnpm lint:packages
@node ./tools/scripts/check-packages-for-tslib.mjs
@node ./scripts/check-packages-for-tslib.mjs

# check repo for formatting errors
.PHONY: formatting\:check
Expand Down Expand Up @@ -135,7 +135,7 @@ env: check-node-version install
.PHONY: check-node-version # PRIVATE
check-node-version:
$(call log,"Checking Node")
@./tools/scripts/check-node-version
@./scripts/check-node-version

# Install dependencies. If deps are up to date this is almost instant, so we can
# run before every other target with very little DX cost.
Expand All @@ -149,7 +149,7 @@ install: check-node-version

# This is a set of all possible project-specific tasks.
#
# IT IS AUTOGENERATED BY tools/scripts/maintain-makefile/index.mjs
# IT IS AUTOGENERATED BY scripts/maintain-makefile/index.mjs
#
# It enables running the relevant npm-scripts wrapped in the
# standardised Makefile prerequisites.
Expand Down Expand Up @@ -265,22 +265,6 @@ install: check-node-version
@guardian/eslint-config\:lint: env
@corepack pnpm --filter @guardian/eslint-config lint

.PHONY: @guardian/eslint-config\:tsc
@guardian/eslint-config\:tsc: env
@corepack pnpm --filter @guardian/eslint-config tsc

.PHONY: @guardian/eslint-config-typescript\:fix
@guardian/eslint-config-typescript\:fix: env
@corepack pnpm --filter @guardian/eslint-config-typescript fix

.PHONY: @guardian/eslint-config-typescript\:lint
@guardian/eslint-config-typescript\:lint: env
@corepack pnpm --filter @guardian/eslint-config-typescript lint

.PHONY: @guardian/eslint-config-typescript\:tsc
@guardian/eslint-config-typescript\:tsc: env
@corepack pnpm --filter @guardian/eslint-config-typescript tsc

.PHONY: @guardian/identity-auth\:build
@guardian/identity-auth\:build: env
@corepack pnpm --filter @guardian/identity-auth build
Expand Down
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
The following packages live in `libs/@guardian/*` and are published to NPM:

<!-- START PUBLISHED_PACKAGES -->
<!-- THIS CONTENT IS AUTOGENERATED BY tools/scripts/maintain-readme/index.mjs -->
<!-- THIS CONTENT IS AUTOGENERATED BY scripts/maintain-readme/index.mjs -->

- [@guardian/ab-core](libs/@guardian/ab-core)
- [@guardian/ab-react](libs/@guardian/ab-react)
- [@guardian/browserslist-config](libs/@guardian/browserslist-config)
- [@guardian/core-web-vitals](libs/@guardian/core-web-vitals)
- [@guardian/eslint-config](libs/@guardian/eslint-config)
- [@guardian/eslint-config-typescript](libs/@guardian/eslint-config-typescript)
- [@guardian/identity-auth](libs/@guardian/identity-auth)
- [@guardian/identity-auth-frontend](libs/@guardian/identity-auth-frontend)
- [@guardian/libs](libs/@guardian/libs)
Expand Down Expand Up @@ -49,7 +48,7 @@ _You'll be prompted to install any missing requirements if they are needed..._
Tasks that apply to all projects are defined in the [`Makefile`](./Makefile):

<!-- START TASKS -->
<!-- THIS CONTENT IS AUTOGENERATED BY tools/scripts/maintain-readme/index.mjs -->
<!-- THIS CONTENT IS AUTOGENERATED BY scripts/maintain-readme/index.mjs -->

- `make build` _builds all projects_
- `make build-storybook` _builds all storybooks_
Expand Down Expand Up @@ -114,13 +113,6 @@ Project-specific tasks are defined as `scripts` in their `package.json`, and can

- `make @guardian/eslint-config:fix`
- `make @guardian/eslint-config:lint`
- `make @guardian/eslint-config:tsc`

#### @guardian/eslint-config-typescript

- `make @guardian/eslint-config-typescript:fix`
- `make @guardian/eslint-config-typescript:lint`
- `make @guardian/eslint-config-typescript:tsc`

#### @guardian/identity-auth

Expand Down
4 changes: 2 additions & 2 deletions apps/github-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"@astrojs/svelte": "5.7.0",
"@guardian/libs": "workspace:*",
"astro": "4.14.2",
"svelte": "4.2.12",
"svelte": "4.2.19",
"typescript": "5.5.2",
"wireit": "0.14.4"
"wireit": "0.14.8"
},
"wireit": {
"build": {
Expand Down
4 changes: 2 additions & 2 deletions apps/storybooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"dev": "wireit"
},
"devDependencies": {
"storybook": "8.2.7",
"wireit": "0.14.4"
"storybook": "8.2.9",
"wireit": "0.14.8"
},
"wireit": {
"dev": {
Expand Down
41 changes: 29 additions & 12 deletions configs/storybook/main.js → configs/storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
const fs = require('node:fs');
import { readFileSync } from 'node:fs';
import { isObject } from '@guardian/libs';
import type { StorybookConfig } from '@storybook/react-webpack5';

export type { StorybookConfig };

const nodeModulesExclude = {
and: [/node_modules/],
not: [/@guardian\//],
};

module.exports = {
const config: StorybookConfig = {
stories: [],
addons: [
'@storybook/addon-a11y',
'@storybook/addon-essentials',
'@storybook/addon-links',
],
features: {
// used in composition
buildStoriesJson: true,
},
webpackFinal: async (config, { configType }) => {
webpackFinal: async (config /*, { configType } */) => {
config.module ??= { rules: [] };
config.module.rules ??= [];

config.module.rules.push({
test: /\.(ts|tsx)$/,
exclude: nodeModulesExclude,
Expand Down Expand Up @@ -45,11 +48,23 @@ module.exports = {
});

// update storybook webpack config to transpile *all* JS
config.module.rules.find(
(rule) => String(rule.test) === String(/\.(cjs|mjs|tsx?|jsx?)$/),
).exclude = nodeModulesExclude;
for (const rule of config.module.rules) {
if (isObject(rule) && rule.test instanceof RegExp) {
if (
rule.test.test('file.js') ||
rule.test.test('file.cjs') ||
rule.test.test('file.mjs') ||
rule.test.test('file.jsx') ||
rule.test.test('file.ts') ||
rule.test.test('file.cts') ||
rule.test.test('file.mts') ||
rule.test.test('file.tsx')
) {
rule.exclude = nodeModulesExclude;
}
}
}

config.resolve.plugins ||= [];
return config;
},
framework: {
Expand All @@ -60,5 +75,7 @@ module.exports = {
autodocs: true,
},
previewHead: (head) =>
head + fs.readFileSync(require.resolve('./preview-head.html'), 'utf8'),
head + readFileSync(require.resolve('./preview-head.html'), 'utf8'),
};

export default config;
28 changes: 14 additions & 14 deletions configs/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
"name": "@configs/storybook",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@babel/core": "7.25.2",
"@babel/plugin-transform-typescript": "7.25.0",
"@babel/preset-env": "7.25.0",
"@babel/preset-react": "7.24.1",
"@babel/preset-typescript": "7.24.1",
"@babel/plugin-transform-typescript": "7.25.2",
"@babel/preset-env": "7.25.4",
"@babel/preset-react": "7.24.7",
"@babel/preset-typescript": "7.24.7",
"@emotion/babel-plugin": "11.12.0",
"@emotion/react": "11.11.3",
"@guardian/libs": "workspace:*",
"@guardian/source": "workspace:*",
"@storybook/addon-a11y": "8.2.7",
"@storybook/addon-docs": "8.2.7",
"@storybook/addon-essentials": "8.2.7",
"@storybook/addon-links": "8.2.7",
"@storybook/addon-viewport": "8.2.7",
"@storybook/manager-api": "8.2.7",
"@storybook/react": "8.2.7",
"@storybook/react-webpack5": "8.2.7",
"@storybook/theming": "8.2.7",
"@storybook/addon-a11y": "8.2.9",
"@storybook/addon-docs": "8.2.9",
"@storybook/addon-essentials": "8.2.9",
"@storybook/addon-links": "8.2.9",
"@storybook/addon-viewport": "8.2.9",
"@storybook/manager-api": "8.2.9",
"@storybook/react": "8.2.9",
"@storybook/react-webpack5": "8.2.9",
"@storybook/theming": "8.2.9",
"@types/babel__core": "7.20.5",
"@types/react": "18.2.11",
"babel-loader": "9.1.3",
Expand Down
4 changes: 2 additions & 2 deletions configs/storybook/preview/FocusManagerDecorator.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Decorator } from '@storybook/react';
import { useEffect } from 'react';
import { FocusStyleManager } from '@guardian/source/foundations';
import { useEffect } from 'react';
import type { Decorator } from '@storybook/react';

export const FocusManagerDecorator: Decorator = (storyFn) => {
useEffect(() => {
Expand Down
2 changes: 0 additions & 2 deletions configs/storybook/preview/ThemeProviderDecorator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment -- storybook type contains `any`s */

import { ThemeProvider } from '@emotion/react';
import type { Decorator } from '@storybook/react';

Expand Down
4 changes: 2 additions & 2 deletions configs/storybook/preview/viewport.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Breakpoint } from '@guardian/source/foundations';
import { breakpoints } from '@guardian/source/foundations';
import type { Breakpoint } from '@guardian/source/foundations';

type ViewportMeta = {
[key in Breakpoint]: {
Expand Down Expand Up @@ -66,7 +66,7 @@ const viewportEntries = Object.entries(breakpoints).map(([name, width]) => {
];
});

const viewportEntriesObject = Object.fromEntries(viewportEntries) as Viewports;
const viewportEntriesObject: Viewports = Object.fromEntries(viewportEntries);

export const viewport = {
viewports: {
Expand Down
4 changes: 4 additions & 0 deletions configs/storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"include": ["**/*"]
}
2 changes: 1 addition & 1 deletion libs/@guardian/ab-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"ts-jest": "29.2.3",
"tslib": "2.6.2",
"typescript": "5.5.2",
"wireit": "0.14.4"
"wireit": "0.14.8"
},
"peerDependencies": {
"tslib": "^2.6.2",
Expand Down
2 changes: 1 addition & 1 deletion libs/@guardian/ab-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"ts-jest": "29.2.3",
"tslib": "2.6.2",
"typescript": "5.5.2",
"wireit": "0.14.4"
"wireit": "0.14.8"
},
"peerDependencies": {
"@guardian/ab-core": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion libs/@guardian/browserslist-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@guardian/browserslist-config": "workspace:*",
"browserslist": "4.23.0",
"tslib": "2.6.2",
"wireit": "0.14.4"
"wireit": "0.14.8"
},
"peerDependencies": {
"browserslist": "^4.22.2",
Expand Down
2 changes: 1 addition & 1 deletion libs/@guardian/core-web-vitals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"tslib": "2.6.2",
"typescript": "5.5.2",
"web-vitals": "4.2.1",
"wireit": "0.14.4"
"wireit": "0.14.8"
},
"peerDependencies": {
"@guardian/libs": "^18.0.0",
Expand Down
24 changes: 0 additions & 24 deletions libs/@guardian/eslint-config-typescript/.eslintrc.cjs

This file was deleted.

Loading

0 comments on commit 4fae147

Please sign in to comment.