-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced tsup with Rollup in the AIO to bundle TS and CSS with a single tool + Experimental Icon replacement
- Loading branch information
Showing
51 changed files
with
1,511 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16.13.1 | ||
16.19.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* eslint-disable no-console */ | ||
import { JestConfigWithTsJest } from "ts-jest" | ||
import sharedConfig from "../../jest.config.js" | ||
|
||
const jestConfig: JestConfigWithTsJest = { | ||
...sharedConfig, | ||
roots: ["<rootDir>"], | ||
modulePathIgnorePatterns: [], | ||
moduleNameMapper: { | ||
...sharedConfig.moduleNameMapper, | ||
"~types/(.*)$": "<rootDir>/src/types/$1", | ||
"~utils/(.*)$": "<rootDir>/src/utils/$1", | ||
"~components/(.*)$": "<rootDir>/src/$1", | ||
"~icons/(.*)$": "<rootDir>/src/SVG/icons/$1", | ||
}, | ||
} | ||
|
||
export default jestConfig | ||
|
||
process.env.TZ = "UTC" | ||
|
||
if (process.env.USE_REACT_16 === "true") { | ||
console.log("=== React 16 tests ===") | ||
module.exports.cacheDirectory = ".cache/jest-cache-react-16" | ||
module.exports.moduleNameMapper = { | ||
...module.exports.moduleNameMapper, | ||
"^react-dom((\\/.*)?)$": "react-dom-16$1", | ||
"^react((\\/.*)?)$": "react-16$1", | ||
"^@testing-library/react((\\/.*)?)$": "@testing-library/react-12$1", | ||
"^react-test-renderer((\\/.*)?)$": "react-test-renderer-17$1", | ||
} | ||
} else if (process.env.USE_REACT_17 === "true") { | ||
console.log("=== React 17 tests ===") | ||
module.exports.cacheDirectory = ".cache/jest-cache-react-17" | ||
module.exports.moduleNameMapper = { | ||
...module.exports.moduleNameMapper, | ||
"^react-dom((\\/.*)?)$": "react-dom-17$1", | ||
"^react((\\/.*)?)$": "react-17$1", | ||
"^@testing-library/react((\\/.*)?)$": "@testing-library/react-12$1", | ||
"^react-test-renderer((\\/.*)?)$": "react-test-renderer-17$1", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
module.exports = { | ||
plugins: [require("tailwindcss"), require("autoprefixer")], | ||
plugins: { | ||
"postcss-import": {}, | ||
"tailwindcss/nesting": "postcss-nesting", | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
cssnano: {}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import alias from "@rollup/plugin-alias"; | ||
import commonjs from "@rollup/plugin-commonjs" | ||
import image from "@rollup/plugin-image" | ||
import resolve from "@rollup/plugin-node-resolve" | ||
import typescript from "@rollup/plugin-typescript" | ||
import dts from "rollup-plugin-dts" | ||
import esbuild from "rollup-plugin-esbuild" | ||
import peerDepsExternal from "rollup-plugin-peer-deps-external" | ||
import postcss from "rollup-plugin-postcss" | ||
import ttypescript from "ttypescript" | ||
|
||
const TYPES_TEMP_DIR = "dts" | ||
const OUTPUT_DIR = "dist" | ||
|
||
const getCompiledConfigByModuleType = format => ({ | ||
input: { index: "./src/index.ts", future: "./src/__future__/index.ts" }, | ||
plugins: [ | ||
peerDepsExternal(), | ||
// Has to be the same as packages/components/tsconfig.json -> compilerOptions -> paths | ||
alias({ | ||
entries: [ | ||
{ find: "~types", replacement: "src/types" }, | ||
{ find: "~utils", replacement: "src/utils" }, | ||
{ find: "~icons", replacement: "src/SVG/icons" }, | ||
{ find: "~components", replacement: "src" }, | ||
] | ||
}), | ||
resolve({ | ||
preferBuiltins: true, | ||
extensions: [".js", ".jsx", ".ts", ".tsx"], | ||
}), | ||
postcss({ | ||
extract: true, | ||
extensions: [".scss", ".css"], | ||
}), | ||
typescript({ | ||
declaration: true, | ||
declarationDir: `${OUTPUT_DIR}/${format}/${TYPES_TEMP_DIR}`, | ||
exclude: ["node_modules", "**/*.spec.ts", "**/*.spec.tsx", "**/*.stories.tsx"], | ||
// We use ttypescript instead of typescript to allow transformer to convert alias into actual paths/dependencies | ||
typescript: ttypescript | ||
}), | ||
commonjs({ | ||
include: /node_modules/, | ||
requireReturnsDefault: "auto", | ||
}), | ||
esbuild(), | ||
image(), | ||
], | ||
output: [ | ||
{ | ||
dir: `${OUTPUT_DIR}/${format}`, | ||
format, | ||
sourcemap: true, | ||
}, | ||
], | ||
}) | ||
|
||
export default [ | ||
getCompiledConfigByModuleType("cjs"), | ||
getCompiledConfigByModuleType("esm"), | ||
// This step doesn't matter if it's cjs or esm, the output will be the same (esm is faster) | ||
{ | ||
input: `./${OUTPUT_DIR}/esm/dts/index.d.ts`, | ||
output: [{ file: `${OUTPUT_DIR}/index.d.ts`, format: "esm" }], | ||
external: [/\.scss$/], | ||
plugins: [dts()], | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require("../../setupTests.ts") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/components/src/ButtonGroup/docs/ButtonGroup.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.