Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
- name: Lint
run: npm run lint

- name: Build
run: npm run build
- name: Type check
run: npm run typecheck

- name: Test
run: npm run test

- name: Build
run: npm run build
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"test": "jest",
"test:update": "npm run test -- --updateSnapshot",
"release": "npm run build && changeset publish",
"size": "size-limit"
"size": "size-limit",
"typecheck": "npx tsc --project tsconfig.json"
},
"repository": "primer/react",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion script/build
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ npx cross-env NODE_ENV=production rollup -c
npx cross-env BABEL_MODULE=commonjs babel src --out-dir lib --extensions ".js,.ts,.jsx,.tsx"
npx babel src --out-dir lib-esm --extensions ".js,.ts,.jsx,.tsx"

# Type check
# Build type declarations
npx tsc --project tsconfig.build.json

# Copy type declarations
Expand Down
20 changes: 20 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"allowJs": true,
"checkJs": false,
"jsx": "preserve",
"declaration": true,
"outDir": "./lib",
"emitDeclarationOnly": false,
"strict": true,
"moduleResolution": "node",
"rootDirs": ["src"],
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": ["./node_modules/@types", "./@types"]
},
"include": ["@types/**/*.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.tsx"]
}
4 changes: 2 additions & 2 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"extends": "./tsconfig.base.json",
// NOTE: We exclude Storybook stories — in part because we don't want their type definitions
// included in our build, but also because _something_ in Storybook mucks with the type definitions
// of Primer components. See also https://github.com/primer/react/issues/1163.
"exclude": ["**/*.stories.tsx"]
"exclude": ["**/*.stories.tsx"],
}
21 changes: 4 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"allowJs": true,
"checkJs": false,
"jsx": "preserve",
"declaration": true,
"outDir": "./lib",
"emitDeclarationOnly": true,
"strict": true,
"moduleResolution": "node",
"rootDirs": ["src"],
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": ["./node_modules/@types", "./@types"]
"noEmit": true,
"emitDeclarationOnly": false
},
"include": ["@types/**/*.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.tsx"]
}
}