diff --git a/.github/workflows/consumer_test.yml b/.github/workflows/consumer_test.yml deleted file mode 100644 index f9bccebd6ce..00000000000 --- a/.github/workflows/consumer_test.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Consumer test -on: - push: {branches: main} - pull_request: - workflow_dispatch: - -jobs: - consumer-test: - name: Consumer test - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - - run: npm i -g npm@^10.5.1 - - name: Remove "prepare" script - run: npm pkg delete scripts.prepare - - name: Install dependencies - run: npm ci - - name: Build @primer/react - run: npm run build -w rollup-plugin-import-css -w @primer/react - # Output the artifact as a tarball in `consumer-test`. Write the - # information for this package in `consumer-test/pack.json` so we can read - # from it later to install the package - - name: Create a tarball for the package - run: npm pack --pack-destination ../../examples/consumer-test --json > ../../examples/consumer-test/pack.json - working-directory: packages/react - - name: Clean package directory - run: npm run clean:all - - name: Test - id: test - working-directory: examples/consumer-test - run: | - # Read the filename for the tarball from `pack.json` - npm install $(jq -r '.[0].filename' pack.json) - npm install - npm run check - - name: Add annotation - if: failure() && steps.test.conclusion == 'failure' - run: | - echo "::error file=tsconfig.build.json::Test package could not build. See https://github.com/primer/react/blob/main/examples/consumer-test" diff --git a/examples/consumer-test/App.tsx b/examples/consumer-test/App.tsx deleted file mode 100644 index 0d947c6888d..00000000000 --- a/examples/consumer-test/App.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react' -import {Box} from '@primer/react' - -export default function App() { - return -} diff --git a/examples/consumer-test/README.md b/examples/consumer-test/README.md deleted file mode 100644 index 6e7ac65e3ba..00000000000 --- a/examples/consumer-test/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Primer React Consumer Test - -This directory is used to run a simple test that asserts that a consumer of -Primer React can build their own project with strict TypeScript options enabled, -including `"skipLibCheck": false`. - -During Primer React's build process, we run the TypeScript compiler and output -`.d.ts` declaration files for consumers of Primer React that are using -TypeScript. If the build script runs with a TypeScript configuration that has -any files in its `types` or `typeRoots` that import any of our development -dependencies, it's possible for our build output to be polluted by interface -augmentations in those dependencies, or in transitive dependencies. - -The best way to avoid this is to ensure that any files that import development -dependencies are excluded in our `tsconfig.build.json` file we use to build -Primer React. - -If a mistake is made and a file is omitted, we will catch those when we attempt -to build this consumer library, which has `"skipLibCheck": false` in its -TypeScript configuration. - -For historical context, see these issues: - -- [v27.0.0 breaks TypeScript typings](https://github.com/primer/react/issues/1163) -- [Storybook dependency changes types in build output](https://github.com/primer/react/issues/1849) diff --git a/examples/consumer-test/package.json b/examples/consumer-test/package.json deleted file mode 100644 index aad3a55c548..00000000000 --- a/examples/consumer-test/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "example-consumer-test", - "version": "0.0.0", - "private": true, - "scripts": { - "check": "tsc --noEmit" - }, - "dependencies": { - "@types/react": "^18.3.11", - "@types/react-dom": "^18.2.19", - "@types/styled-components": "^5.1.11", - "@primer/react": "37.6.0", - "react": "^18.0.0", - "react-dom": "^18.0.0", - "styled-components": "^5.3.11", - "typescript": "~4.7.2" - } -} diff --git a/examples/consumer-test/tsconfig.json b/examples/consumer-test/tsconfig.json deleted file mode 100644 index 1a898abb1a0..00000000000 --- a/examples/consumer-test/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "skipLibCheck": false, // IMPORTANT: Validates our type outputs - "target": "esnext", - "module": "commonjs", - "allowJs": true, - "checkJs": false, - "jsx": "preserve", - "declaration": true, - "noEmit": true, - "strict": true, - "moduleResolution": "node", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["./*.tsx"] -} diff --git a/package-lock.json b/package-lock.json index 086b673380e..261d7032649 100644 --- a/package-lock.json +++ b/package-lock.json @@ -98,6 +98,7 @@ "examples/consumer-test": { "name": "example-consumer-test", "version": "0.0.0", + "extraneous": true, "dependencies": { "@primer/react": "37.6.0", "@types/react": "^18.3.11", @@ -109,17 +110,6 @@ "typescript": "~4.7.2" } }, - "examples/consumer-test/node_modules/typescript": { - "version": "4.7.4", - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "examples/theming": { "name": "example-theming", "version": "0.0.0", @@ -8425,6 +8415,7 @@ }, "node_modules/@types/hoist-non-react-statics": { "version": "3.3.5", + "dev": true, "license": "MIT", "dependencies": { "@types/react": "*", @@ -8657,6 +8648,7 @@ }, "node_modules/@types/react-dom": { "version": "18.3.0", + "dev": true, "license": "MIT", "dependencies": { "@types/react": "*" @@ -8713,6 +8705,7 @@ }, "node_modules/@types/styled-components": { "version": "5.1.34", + "dev": true, "license": "MIT", "dependencies": { "@types/hoist-non-react-statics": "*", @@ -14609,10 +14602,6 @@ "resolved": "examples/app-router", "link": true }, - "node_modules/example-consumer-test": { - "resolved": "examples/consumer-test", - "link": true - }, "node_modules/example-theming": { "resolved": "examples/theming", "link": true