-
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.
Kzn 2294 bundler package + style injection (#4656)
- Loading branch information
Showing
38 changed files
with
1,532 additions
and
1,410 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@kaizen/package-bundler": major | ||
--- | ||
|
||
A package that bundles packages. | ||
|
||
Adds bundler for shared UIs with support for (S)CSS modules and Tailwind. |
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,5 @@ | ||
--- | ||
"@kaizen/components": minor | ||
--- | ||
|
||
Update build to use `@kaizen/package-bundler`. |
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,5 @@ | ||
--- | ||
"@kaizen/design-tokens": minor | ||
--- | ||
|
||
Update build to use `tsx` instead of `ts-node`. |
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,2 +1,3 @@ | ||
/packages/**/dist | ||
/packages/components/src/Icon/bin/Template.tsx | ||
storybook/public |
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
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,9 +1,6 @@ | ||
module.exports = { | ||
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 |
---|---|---|
@@ -1,99 +1,13 @@ | ||
import alias from "@rollup/plugin-alias" | ||
import { babel, getBabelOutputPlugin } from "@rollup/plugin-babel"; | ||
import commonjs from "@rollup/plugin-commonjs" | ||
import resolve from "@rollup/plugin-node-resolve" | ||
import typescript from "@rollup/plugin-typescript" | ||
import ignore from "rollup-plugin-ignore" | ||
import nodeExternals from "rollup-plugin-node-externals" | ||
import postcss from "rollup-plugin-postcss" | ||
import { pluginsSharedUi, rollupConfig } from "@kaizen/package-bundler"; | ||
|
||
|
||
const sharedConfig = { | ||
export default rollupConfig({ | ||
input: { index: "./src/index.ts", future: "./src/__future__/index.ts" }, | ||
plugins: [ | ||
nodeExternals({ | ||
devDeps: true | ||
}), | ||
// 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: "~components", replacement: "src" }, | ||
// i18n-react-intl package attempts to import locales from this path. | ||
// When rollup attempts to import from the 'find' path, it will be | ||
// redirected to import from the replacement path (same as storybook webpack config). | ||
{ | ||
find: "__@cultureamp/i18n-react-intl/locales", | ||
replacement: "locales", | ||
}, | ||
], | ||
}), | ||
resolve({ | ||
preferBuiltins: true, | ||
extensions: [".js", ".jsx", ".ts", ".tsx" | ||
// This is needed to ensure that css is compiled correctly. | ||
// Without this there is an alphabetised order in the dist CSS for subcomponents. | ||
// This can cause styles being overwritten by primitives, ie: BaseButton overwriting DropdownButton | ||
// https://cultureamp.slack.com/archives/C02NUQ27G56/p1713157055178419 | ||
plugins: pluginsSharedUi, | ||
alias: { | ||
entries: [ | ||
{ find: "~types", replacement: "src/types" }, | ||
{ find: "~utils", replacement: "src/utils" }, | ||
{ find: "~components", replacement: "src" }, | ||
], | ||
}), | ||
// These libraries aren't used in KAIO, and require polyfills to be set up | ||
// in consuming repos. Ignoring them here removes the need for extra setup in | ||
// consuming repos. | ||
ignore(["stream", "http", "https", "zlib"]), | ||
babel({ babelHelpers: "bundled" }), | ||
getBabelOutputPlugin({ | ||
plugins: [ | ||
"@babel/plugin-transform-react-pure-annotations", | ||
"babel-plugin-pure-static-props" | ||
] | ||
}), | ||
postcss({ | ||
modules: true, | ||
extract: true, | ||
extensions: [".scss", ".css"], | ||
}), | ||
] | ||
} | ||
|
||
const cjsConfig = { | ||
...sharedConfig, | ||
plugins: [ | ||
...sharedConfig.plugins, | ||
typescript({ | ||
tsconfig: "./tsconfig.dist.json", | ||
compilerOptions: { | ||
esModuleInterop: false, | ||
allowSyntheticDefaultImports: true | ||
} | ||
}), | ||
commonjs(), | ||
], | ||
output: { | ||
dir: "dist/cjs", | ||
format: "cjs", | ||
preserveModules: true, | ||
entryFileNames: "[name].cjs", | ||
interop: "auto", | ||
} | ||
} | ||
|
||
const esmConfig = { | ||
...sharedConfig, | ||
plugins: [ | ||
...sharedConfig.plugins, | ||
typescript({ tsconfig: "./tsconfig.dist.json" }) | ||
], | ||
output: { | ||
dir: "dist/esm", | ||
format: "esm", | ||
preserveModules: true, | ||
entryFileNames: "[name].mjs", | ||
} | ||
} | ||
|
||
export default [ | ||
cjsConfig, | ||
esmConfig, | ||
] | ||
}, | ||
}) |
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,12 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.dist.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "dist/types", | ||
"emitDeclarationOnly": true, | ||
"plugins": [ | ||
// Transform paths in output .d.ts files (Include this line if you output declarations files) | ||
{ "transform": "typescript-transform-paths", "afterDeclarations": true } | ||
] | ||
} | ||
"extends": [ | ||
"./tsconfig.dist.json", | ||
"@kaizen/package-bundler/tsconfig.types.json" | ||
] | ||
} |
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.