Skip to content

Commit

Permalink
feat(theme): allow recursive partial theme (opensearch-project#239)
Browse files Browse the repository at this point in the history
* build(tsconfig): update tsconfigs to extend from a base config

The main tsconfig.json is what vscode uses to parse ts files. Adding a global type would not
available in excluded test files. Extended base tsconfig to current match current build config.

* feat(theme): allow recursive partial themes

Allow recursive partial themes to be passed to the Setting component. Added RecursivePartial global
type.

Issue opensearch-project#201

* test(settings): add tests for partial theme to settings component

* refactor: global type inclusion and story config

Moved global type to be utils. Updated storybook config with custom tsconfig file.

* refactor: remove enum declaration
  • Loading branch information
nickofthyme authored Jun 20, 2019
1 parent c756217 commit 64e9451
Show file tree
Hide file tree
Showing 17 changed files with 650 additions and 460 deletions.
5 changes: 4 additions & 1 deletion packages/osd-charts/.playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"compilerOptions": {
"downlevelIteration": true,
"target": "es5"
}
},
"exclude": [
"../**/*.test.*"
]
}
2 changes: 1 addition & 1 deletion packages/osd-charts/.playground/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
loader: 'ts-loader',
exclude: /node_modules/,
options: {
configFile: './tsconfig.json',
configFile: 'tsconfig.json',
},
},
{
Expand Down
4 changes: 4 additions & 0 deletions packages/osd-charts/.storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../tsconfig",
"exclude": ["../**/*.test.*"]
}
20 changes: 11 additions & 9 deletions packages/osd-charts/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ module.exports = (baseConfig, env, config) => {
config.devtool = 'source-map';
}
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve('ts-loader'),
},
{
loader: require.resolve('react-docgen-typescript-loader'),
},
],
test: /\.tsx?$/,
loader: require.resolve('ts-loader'),
exclude: /node_modules/,
options: {
configFile: 'tsconfig.json',
},
});
config.module.rules.push({
test: /\.tsx?$/,
loader: require.resolve('react-docgen-typescript-loader'),
exclude: /node_modules/,
});
config.module.rules.push({
test: /\.tsx?$/,
Expand Down
13 changes: 11 additions & 2 deletions packages/osd-charts/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"roots": ["<rootDir>/src"],
"roots": [
"<rootDir>/src"
],
"preset": "ts-jest",
"testEnvironment": "jest-environment-jsdom-fourteen",
"setupFilesAfterEnv": ["<rootDir>/scripts/setup_enzyme.ts"]
"setupFilesAfterEnv": [
"<rootDir>/scripts/setup_enzyme.ts"
],
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.jest.json"
}
}
}
4 changes: 2 additions & 2 deletions packages/osd-charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"cz": "git-cz",
"build:clean": "rm -rf ./dist",
"build:ts": "tsc -p ./tsconfig.json",
"build:ts": "tsc -p ./tsconfig.lib.json",
"build:sass": "node-sass src/theme_light.scss dist/theme_light.css --output-style compressed && node-sass src/theme_dark.scss dist/theme_dark.css --output-style compressed && node-sass src/theme_only_light.scss dist/theme_only_light.css --output-style compressed && node-sass src/theme_only_dark.scss dist/theme_only_dark.css --output-style compressed",
"concat:sass": "node scripts/concat_sass.js",
"build": "yarn build:clean && yarn build:ts && yarn build:sass && yarn concat:sass",
Expand All @@ -27,7 +27,7 @@
"watch": "yarn test --watch",
"semantic-release": "semantic-release",
"typecheck:src": "yarn build:ts --noEmit",
"typecheck:all": "tsc -p ./tsconfig.all.json --noEmit",
"typecheck:all": "tsc -p ./tsconfig.json --noEmit",
"playground": "cd .playground && webpack-dev-server"
},
"files": [
Expand Down
Loading

0 comments on commit 64e9451

Please sign in to comment.