From a349dc705bf87ac978a3a58dd27d70ddae408454 Mon Sep 17 00:00:00 2001 From: Lukas Oppermann Date: Thu, 29 Aug 2024 22:43:32 +0200 Subject: [PATCH] convert build config to js (#1032) --- .changeset/wicked-yaks-hear.md | 5 +++++ buildConfig.tsconfig.jsonc | 27 +++++++++++++++++++++++++++ package.json | 7 +++---- tsconfig.json | 2 +- 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .changeset/wicked-yaks-hear.md create mode 100644 buildConfig.tsconfig.jsonc diff --git a/.changeset/wicked-yaks-hear.md b/.changeset/wicked-yaks-hear.md new file mode 100644 index 000000000..a168b650a --- /dev/null +++ b/.changeset/wicked-yaks-hear.md @@ -0,0 +1,5 @@ +--- +'@primer/primitives': minor +--- + +Move build files from src to dist/build and add complied version diff --git a/buildConfig.tsconfig.jsonc b/buildConfig.tsconfig.jsonc new file mode 100644 index 000000000..de1de0951 --- /dev/null +++ b/buildConfig.tsconfig.jsonc @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "jsx": "react", + "target": "ES2016", + "module": "commonjs", + "lib": ["ESNext", "dom"], + "moduleResolution": "node", + "esModuleInterop": true, + "strict": true, + "noImplicitAny": true, + "skipLibCheck": false, + "typeRoots": ["./src/@types", "./node_modules/", "./node_modules/@types", "types"], + "types": ["vitest/globals"], + "rootDir": "./src", + "outDir": "./dist/build", + "declaration": true, + "resolveJsonModule": true, + "baseUrl": ".", + "paths": { + "~/*": ["*"], + // workaround for: https://github.com/vitest-dev/vitest/issues/4567 + "rollup/parseAst": ["./node_modules/rollup/dist/parseAst"] + } + }, + "include": ["src/**/*.ts"], + "exclude": ["./src/@types", "**/*.test.ts", "src/test-utilities/*.ts", "vitest.config.ts"] +} diff --git a/package.json b/package.json index 43498c57e..633a4b88b 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,7 @@ "node": ">=18.18.0 <18.19.0" }, "files": [ - "dist", - "src/**/*", - "!src/**/*.test.ts" + "dist" ], "repository": "https://github.com/primer/primitives", "keywords": [ @@ -26,11 +24,12 @@ }, "homepage": "https://github.com/primer/primitives#readme", "scripts": { - "build": "npm run build:v8 && npm run build:fallbacks && npm run build:figma", + "build": "npm run build:v8 && npm run build:fallbacks && npm run build:figma && npm run build:config", "build:next": "echo '\\033[31m 🛑 Use npm run build instead of npm run build:next\\033[0m'", "build:v8": "tsx ./scripts/buildTokens.ts", "build:fallbacks": "tsx ./scripts/buildFallbacks.ts", "build:figma": "tsx scripts/buildFigma.ts", + "build:config": "tsc -p buildConfig.tsconfig.jsonc", "tokenJson:check": "tsx scripts/diffThemes.ts && tsx scripts/diffTokenProps.ts", "contrast:check": "tsx scripts/color-contrast.ts", "format": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,css}'", diff --git a/tsconfig.json b/tsconfig.json index ca66471b9..4f5973a81 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,7 @@ "esModuleInterop": true, "strict": true, "noImplicitAny": true, - "typeRoots": ["./src/@types", "./node_modules/", "./node_modules/@types", "types", "config/types/"], + "typeRoots": ["./src/@types", "./node_modules/", "./node_modules/@types", "types"], "types": ["vitest/globals"], "rootDir": "./", "declaration": true,