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

Simplify the build pipeline #1385

Merged
merged 28 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fed5932
make all packages modules, and build with `pkgroll` to local dist
sndrs Apr 26, 2024
873970c
`github-pages` depends on `libs`
sndrs Apr 26, 2024
32bef56
sotrybook needs design-tokens
sndrs Apr 26, 2024
052e09b
build tokens to `vendor`
sndrs Apr 29, 2024
fb54c6b
order exports from most to least specific
sndrs Apr 29, 2024
ebfed70
make `@types/react` an optional peerDep
sndrs Apr 29, 2024
18cb5d2
add note about fixing cypress failing in CI
sndrs Apr 29, 2024
53ab4d0
remove unessary config
sndrs Apr 29, 2024
d43394e
not incremetnal anyway
sndrs Apr 29, 2024
194b51f
make `@types/eslint` an option peerdep
sndrs Apr 29, 2024
40c0522
remove ref to `prepare-for-changesets`
sndrs Apr 29, 2024
36f1e1b
use rollup directly
sndrs May 2, 2024
37367f2
add `preserveModulesRoot` and restrtucture config
sndrs May 2, 2024
a7b0e54
correct react compoennts entry files
sndrs May 2, 2024
73588c3
use object for rollup entry
sndrs May 2, 2024
f3a3957
ignore `configs` in changesets
sndrs May 2, 2024
23fe437
`configs` is private
sndrs May 2, 2024
4d7ed4a
ignore ts paths buidling storybooks
sndrs May 3, 2024
2b24d04
use relative path
sndrs May 3, 2024
95db9db
bump `source-react-components` in dev kithcen
sndrs May 3, 2024
fc57b0f
these use the version in node_modules right now, no need to build
sndrs May 3, 2024
d8bce73
pin deps
sndrs May 3, 2024
642fe5f
move generated code to `src` dirs
sndrs May 7, 2024
1699514
remove wierd line fo code
sndrs May 7, 2024
950d22e
fix chromatic pin version
oliverabrahams May 7, 2024
614e4e8
chromatic pin version reverted
oliverabrahams May 7, 2024
b259d55
fix inmport paths
sndrs May 7, 2024
9275d89
lint fixes
sndrs May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"bumpVersionsWithWorkspaceProtocolOnly": true,
"ignore": ["@csnx/*"],
"ignore": ["github-pages", "configs"],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
Expand Down
23 changes: 23 additions & 0 deletions .changeset/lovely-moose-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@guardian/source-react-components-development-kitchen': patch
'@guardian/eslint-plugin-source-react-components': patch
'@guardian/eslint-plugin-source-foundations': patch
'@guardian/eslint-config-typescript': patch
'@guardian/source-react-components': patch
'@guardian/identity-auth-frontend': patch
'@guardian/browserslist-config': patch
'@guardian/source-foundations': patch
'@guardian/cobalt-plugin-ts': patch
'@guardian/newsletter-types': patch
'@guardian/core-web-vitals': patch
'@guardian/design-tokens': patch
'@guardian/eslint-config': patch
'@guardian/identity-auth': patch
'@guardian/ab-react': patch
'@guardian/prettier': patch
'@guardian/tsconfig': patch
'@guardian/ab-core': patch
'@guardian/libs': patch
---

Now bundled using [`pkgroll`](https://www.npmjs.com/package/pkgroll).
33 changes: 13 additions & 20 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,19 @@ module.exports = {
// disable eslint on all files by default, for perf reasons
// re-enabled in each projects own eslint config (ignorePatterns: ['!**/*'])
ignorePatterns: ['**/*'],
plugins: ['@nx'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
},
overrides: [
{
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
},
},
{
files: ['*.js', '*.jsx', '*.mjs', '*.cjs'],
extends: ['plugin:@nx/javascript', '@guardian/eslint-config'],
extends: ['@guardian/eslint-config'],
},
{
files: ['*.ts', '*.tsx', '*.mts', '*.cts', '*.d.ts'],
extends: ['plugin:@nx/typescript', '@guardian/eslint-config-typescript'],
extends: ['@guardian/eslint-config-typescript'],
settings: {
'import/resolver': {
typescript: {
Expand All @@ -46,6 +33,12 @@ module.exports = {
'import/no-default-export': 'off',
},
},
{
files: ['rollup.config.js'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['*.stories.*'],
rules: {
Expand Down
31 changes: 0 additions & 31 deletions .github/actions/prepare-for-changesets/action.yml

This file was deleted.

9 changes: 8 additions & 1 deletion .github/actions/setup-node-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ runs:
- run: pnpm install --frozen-lockfile
shell: bash

# if cypress tests fail _and_ you have an update to the lockfile, you may
# need to do a single run with this uncommented...
# don't forget to check the version.
# i hate cypress.
# - run: pnpm dlx [email protected] install --force
# shell: bash

# Restores cypress binary cache. If the binary is missing, it will be
# downloaded and cached for next time.
# https://docs.cypress.io/guides/continuous-integration/introduction#Caching
- name: Cache Cypress binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ updates:
dependencies:
dependency-type: 'production'
update-types: ['minor', 'patch']
exclude-patterns:
- '@csnx*' # don't treat csnx packages as public
devDependencies:
dependency-type: 'development'
update-types: ['minor', 'patch']
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/canaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ jobs:
- name: Version
run: pnpm changeset version --snapshot canary

- run: pnpm nx run-many --target=build --all=true

- name: Prepare Nx project for changesets
uses: ./.github/actions/prepare-for-changesets
- run: make build

- name: Release
uses: changesets/action@v1
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ jobs:

- run: pnpm nx run-many --target=build --all=true

- name: Prepare Nx project for changesets
uses: ./.github/actions/prepare-for-changesets

# down to business...
- name: Use GitHub App Token
uses: actions/create-github-app-token@v1
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
'*': 'prettier --ignore-unknown --write --cache',
'package.json': 'sort-package-json',
};
8 changes: 0 additions & 8 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const nodeModulesExclude = {
and: [/node_modules/],
not: [/@guardian\//],
Expand Down Expand Up @@ -49,13 +48,6 @@ module.exports = {
).exclude = nodeModulesExclude;

config.resolve.plugins ||= [];
config.resolve.plugins.push(
new TsconfigPathsPlugin({
configFile: path.resolve(__dirname, '..', 'tsconfig.base.json'),
extensions: config.resolve.extensions,
mainFields: config.resolve.mainFields,
}),
);
return config;
},
framework: {
Expand Down
48 changes: 0 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,6 @@ install: check-node-version
@guardian/ab-react\:verify-dist: env
@corepack pnpm nx run @guardian/ab-react:verify-dist --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/browserslist-config\:build
@guardian/browserslist-config\:build: env
@corepack pnpm nx run @guardian/browserslist-config:build --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/browserslist-config\:fix
@guardian/browserslist-config\:fix: env
@corepack pnpm nx run @guardian/browserslist-config:fix --skip-nx-cache=$(SKIP_NX_CACHE)
Expand All @@ -198,14 +194,6 @@ install: check-node-version
@guardian/browserslist-config\:update-readme: env
@corepack pnpm nx run @guardian/browserslist-config:update-readme --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/browserslist-config\:verify-dist
@guardian/browserslist-config\:verify-dist: env
@corepack pnpm nx run @guardian/browserslist-config:verify-dist --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/cobalt-plugin-ts\:build
@guardian/cobalt-plugin-ts\:build: env
@corepack pnpm nx run @guardian/cobalt-plugin-ts:build --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/cobalt-plugin-ts\:fix
@guardian/cobalt-plugin-ts\:fix: env
@corepack pnpm nx run @guardian/cobalt-plugin-ts:fix --skip-nx-cache=$(SKIP_NX_CACHE)
Expand Down Expand Up @@ -246,18 +234,10 @@ install: check-node-version
@guardian/design-tokens\:fix: env
@corepack pnpm nx run @guardian/design-tokens:fix --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/design-tokens\:generate-tokens
@guardian/design-tokens\:generate-tokens: env
@corepack pnpm nx run @guardian/design-tokens:generate-tokens --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/design-tokens\:lint
@guardian/design-tokens\:lint: env
@corepack pnpm nx run @guardian/design-tokens:lint --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/eslint-config\:build
@guardian/eslint-config\:build: env
@corepack pnpm nx run @guardian/eslint-config:build --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/eslint-config\:fix
@guardian/eslint-config\:fix: env
@corepack pnpm nx run @guardian/eslint-config:fix --skip-nx-cache=$(SKIP_NX_CACHE)
Expand All @@ -266,14 +246,6 @@ install: check-node-version
@guardian/eslint-config\:lint: env
@corepack pnpm nx run @guardian/eslint-config:lint --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/eslint-config\:verify-dist
@guardian/eslint-config\:verify-dist: env
@corepack pnpm nx run @guardian/eslint-config:verify-dist --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/eslint-config-typescript\:build
@guardian/eslint-config-typescript\:build: env
@corepack pnpm nx run @guardian/eslint-config-typescript:build --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/eslint-config-typescript\:fix
@guardian/eslint-config-typescript\:fix: env
@corepack pnpm nx run @guardian/eslint-config-typescript:fix --skip-nx-cache=$(SKIP_NX_CACHE)
Expand All @@ -282,10 +254,6 @@ install: check-node-version
@guardian/eslint-config-typescript\:lint: env
@corepack pnpm nx run @guardian/eslint-config-typescript:lint --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/eslint-config-typescript\:verify-dist
@guardian/eslint-config-typescript\:verify-dist: env
@corepack pnpm nx run @guardian/eslint-config-typescript:verify-dist --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/eslint-plugin-source-foundations\:build
@guardian/eslint-plugin-source-foundations\:build: env
@corepack pnpm nx run @guardian/eslint-plugin-source-foundations:build --skip-nx-cache=$(SKIP_NX_CACHE)
Expand Down Expand Up @@ -426,10 +394,6 @@ install: check-node-version
@guardian/newsletter-types\:lint: env
@corepack pnpm nx run @guardian/newsletter-types:lint --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/prettier\:build
@guardian/prettier\:build: env
@corepack pnpm nx run @guardian/prettier:build --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/prettier\:fix
@guardian/prettier\:fix: env
@corepack pnpm nx run @guardian/prettier:fix --skip-nx-cache=$(SKIP_NX_CACHE)
Expand All @@ -438,10 +402,6 @@ install: check-node-version
@guardian/prettier\:lint: env
@corepack pnpm nx run @guardian/prettier:lint --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/prettier\:verify-dist
@guardian/prettier\:verify-dist: env
@corepack pnpm nx run @guardian/prettier:verify-dist --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/source-foundations\:build
@guardian/source-foundations\:build: env
@corepack pnpm nx run @guardian/source-foundations:build --skip-nx-cache=$(SKIP_NX_CACHE)
Expand Down Expand Up @@ -546,10 +506,6 @@ install: check-node-version
@guardian/source-react-components-development-kitchen\:verify-dist: env
@corepack pnpm nx run @guardian/source-react-components-development-kitchen:verify-dist --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/tsconfig\:build
@guardian/tsconfig\:build: env
@corepack pnpm nx run @guardian/tsconfig:build --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/tsconfig\:fix
@guardian/tsconfig\:fix: env
@corepack pnpm nx run @guardian/tsconfig:fix --skip-nx-cache=$(SKIP_NX_CACHE)
Expand All @@ -558,10 +514,6 @@ install: check-node-version
@guardian/tsconfig\:lint: env
@corepack pnpm nx run @guardian/tsconfig:lint --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: @guardian/tsconfig\:verify-dist
@guardian/tsconfig\:verify-dist: env
@corepack pnpm nx run @guardian/tsconfig:verify-dist --skip-nx-cache=$(SKIP_NX_CACHE)

.PHONY: github-pages\:build
github-pages\:build: env
@corepack pnpm nx run github-pages:build --skip-nx-cache=$(SKIP_NX_CACHE)
Expand Down
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,12 @@ Project-specific tasks are defined as `scripts` in a `package.json` or `targets`

#### @guardian/browserslist-config

- `make @guardian/browserslist-config:build`
- `make @guardian/browserslist-config:fix`
- `make @guardian/browserslist-config:lint`
- `make @guardian/browserslist-config:update-readme`
- `make @guardian/browserslist-config:verify-dist`

#### @guardian/cobalt-plugin-ts

- `make @guardian/cobalt-plugin-ts:build`
- `make @guardian/cobalt-plugin-ts:fix`
- `make @guardian/cobalt-plugin-ts:lint`

Expand All @@ -118,22 +115,17 @@ Project-specific tasks are defined as `scripts` in a `package.json` or `targets`

- `make @guardian/design-tokens:build`
- `make @guardian/design-tokens:fix`
- `make @guardian/design-tokens:generate-tokens`
- `make @guardian/design-tokens:lint`

#### @guardian/eslint-config

- `make @guardian/eslint-config:build`
- `make @guardian/eslint-config:fix`
- `make @guardian/eslint-config:lint`
- `make @guardian/eslint-config:verify-dist`

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

- `make @guardian/eslint-config-typescript:build`
- `make @guardian/eslint-config-typescript:fix`
- `make @guardian/eslint-config-typescript:lint`
- `make @guardian/eslint-config-typescript:verify-dist`

#### @guardian/eslint-plugin-source-foundations

Expand Down Expand Up @@ -190,10 +182,8 @@ Project-specific tasks are defined as `scripts` in a `package.json` or `targets`

#### @guardian/prettier

- `make @guardian/prettier:build`
- `make @guardian/prettier:fix`
- `make @guardian/prettier:lint`
- `make @guardian/prettier:verify-dist`

#### @guardian/source-foundations

Expand Down Expand Up @@ -232,10 +222,8 @@ Project-specific tasks are defined as `scripts` in a `package.json` or `targets`

#### @guardian/tsconfig

- `make @guardian/tsconfig:build`
- `make @guardian/tsconfig:fix`
- `make @guardian/tsconfig:lint`
- `make @guardian/tsconfig:verify-dist`

#### github-pages

Expand Down
15 changes: 0 additions & 15 deletions apps/github-pages/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
import { defineConfig } from 'astro/config';
import tsConfig from '../../tsconfig.base.json';
import path from 'node:path';

import svelte from '@astrojs/svelte';

// duplicate the aliases defined in tsconfig.base.json
let alias = {};
for (const [module, modulePath] of Object.entries(
tsConfig.compilerOptions.paths,
)) {
alias[module] = path.resolve('../../' + modulePath[0] + '.ts');
}

// https://astro.build/config
export default defineConfig({
site: 'https://guardian.github.io',
base: '/csnx',
integrations: [svelte()],
vite: {
resolve: {
alias,
},
},
});
Loading