Skip to content

Commit

Permalink
make all packages modules, and build with pkgroll to local dist
Browse files Browse the repository at this point in the history
  • Loading branch information
sndrs committed Apr 26, 2024
1 parent d3af7ef commit 0e1858d
Show file tree
Hide file tree
Showing 135 changed files with 971 additions and 6,659 deletions.
1 change: 0 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"bumpVersionsWithWorkspaceProtocolOnly": true,
"ignore": ["@csnx/*"],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
Expand Down
24 changes: 24 additions & 0 deletions .changeset/lovely-moose-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@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
'github-pages': patch
---

Now bundled using [`pkgroll`](https://www.npmjs.com/package/pkgroll).
27 changes: 7 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 Down
31 changes: 0 additions & 31 deletions .github/actions/prepare-for-changesets/action.yml

This file was deleted.

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
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',
};
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,
},
},
});
1 change: 1 addition & 0 deletions apps/github-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"devDependencies": {
"@astrojs/check": "0.5.6",
"@astrojs/svelte": "5.3.0",
"@guardian/libs": "workspace:*",
"astro": "4.5.16",
"svelte": "4.2.12",
"typescript": "5.3.3",
Expand Down
5 changes: 2 additions & 3 deletions configs/jest.config.ts → configs/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Config } from 'jest';

export const config: Config = {
/** @typedef {import("jest").Config} Config */
export const config = {
clearMocks: true,
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],

Expand Down
7 changes: 6 additions & 1 deletion libs/@guardian/ab-core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {
extends: ['../../../.eslintrc.cjs'],
ignorePatterns: ['!**/*', 'node_modules'],
ignorePatterns: [
'!**/*',
'node_modules',
'jest.dist.*', // depends on build output, so don't lint it
'dist',
],
overrides: [
{
files: ['*.ts', '*.tsx'],
Expand Down
11 changes: 11 additions & 0 deletions libs/@guardian/ab-core/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { config as baseConfig } from '../../../configs/jest.config.js';

/** @typedef {import("jest").Config} Config */
const config = {
...baseConfig,
displayName: '@guardian/ab-core',
testEnvironment: 'jest-environment-jsdom',
};

// eslint-disable-next-line import/no-default-export -- that's what jest likes
export default config;
13 changes: 0 additions & 13 deletions libs/@guardian/ab-core/jest.config.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable -- this file will break unless the project is built, so let's not worry about it */

// Mock `./src/index` with whatever `package.json` points at in dist.
// This means we can run the unit tests against `dist` instead.

import * as dist from '../../../dist/libs/@guardian/libs';
import * as dist from '.';

jest.mock('./src/index', () => dist);
Loading

0 comments on commit 0e1858d

Please sign in to comment.