diff options
author | 2019-01-08 21:41:11 +0100 | |
---|---|---|
committer | 2019-01-08 21:41:11 +0100 | |
commit | 6aab4ab890c0ca2f99bc615b7048533774f6ff68 (patch) | |
tree | 088d86001efa2a6d825ad51259a2df9b62b201fe /packages/theme | |
parent | wip (diff) | |
download | ferdium-app-6aab4ab890c0ca2f99bc615b7048533774f6ff68.tar.gz ferdium-app-6aab4ab890c0ca2f99bc615b7048533774f6ff68.tar.zst ferdium-app-6aab4ab890c0ca2f99bc615b7048533774f6ff68.zip |
Make packages work in electron, node and web
Diffstat (limited to 'packages/theme')
-rw-r--r-- | packages/theme/package-lock.json | 26 | ||||
-rw-r--r-- | packages/theme/src/index.ts | 10 | ||||
-rw-r--r-- | packages/theme/src/themes/dark/index.ts | 2 | ||||
-rw-r--r-- | packages/theme/src/themes/default/index.ts | 2 | ||||
-rw-r--r-- | packages/theme/webpack.config.js | 21 |
5 files changed, 11 insertions, 50 deletions
diff --git a/packages/theme/package-lock.json b/packages/theme/package-lock.json index 3da6e2b7f..e03ce42e3 100644 --- a/packages/theme/package-lock.json +++ b/packages/theme/package-lock.json | |||
@@ -1,33 +1,9 @@ | |||
1 | { | 1 | { |
2 | "name": "@meetfranz/theme", | 2 | "name": "@meetfranz/theme", |
3 | "version": "0.0.0", | 3 | "version": "1.0.0", |
4 | "lockfileVersion": 1, | 4 | "lockfileVersion": 1, |
5 | "requires": true, | 5 | "requires": true, |
6 | "dependencies": { | 6 | "dependencies": { |
7 | "@types/color": { | ||
8 | "version": "3.0.0", | ||
9 | "resolved": "https://registry.npmjs.org/@types/color/-/color-3.0.0.tgz", | ||
10 | "integrity": "sha512-5qqtNia+m2I0/85+pd2YzAXaTyKO8j+svirO5aN+XaQJ5+eZ8nx0jPtEWZLxCi50xwYsX10xUHetFzfb1WEs4Q==", | ||
11 | "dev": true, | ||
12 | "requires": { | ||
13 | "@types/color-convert": "*" | ||
14 | } | ||
15 | }, | ||
16 | "@types/color-convert": { | ||
17 | "version": "1.9.0", | ||
18 | "resolved": "https://registry.npmjs.org/@types/color-convert/-/color-convert-1.9.0.tgz", | ||
19 | "integrity": "sha512-OKGEfULrvSL2VRbkl/gnjjgbbF7ycIlpSsX7Nkab4MOWi5XxmgBYvuiQ7lcCFY5cPDz7MUNaKgxte2VRmtr4Fg==", | ||
20 | "dev": true, | ||
21 | "requires": { | ||
22 | "@types/color-name": "*" | ||
23 | } | ||
24 | }, | ||
25 | "@types/color-name": { | ||
26 | "version": "1.1.0", | ||
27 | "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.0.tgz", | ||
28 | "integrity": "sha512-gZ/Rb+MFXF0pXSEQxdRoPMm5jeO3TycjOdvbpbcpHX/B+n9AqaHFe5q6Ga9CsZ7ir/UgIWPfrBzUzn3F19VH/w==", | ||
29 | "dev": true | ||
30 | }, | ||
31 | "color": { | 7 | "color": { |
32 | "version": "3.1.0", | 8 | "version": "3.1.0", |
33 | "resolved": "https://registry.npmjs.org/color/-/color-3.1.0.tgz", | 9 | "resolved": "https://registry.npmjs.org/color/-/color-3.1.0.tgz", |
diff --git a/packages/theme/src/index.ts b/packages/theme/src/index.ts index ce077e817..423fa0385 100644 --- a/packages/theme/src/index.ts +++ b/packages/theme/src/index.ts | |||
@@ -1,17 +1,17 @@ | |||
1 | import * as darkThemeConfig from './themes/dark'; | ||
2 | import * as defaultThemeConfig from './themes/default'; | ||
3 | |||
1 | export enum ThemeType { | 4 | export enum ThemeType { |
2 | default = 'default', | 5 | default = 'default', |
3 | dark = 'dark', | 6 | dark = 'dark', |
4 | } | 7 | } |
5 | 8 | ||
6 | import * as darkThemeConfig from './themes/dark'; | 9 | export function theme(themeId: ThemeType) { |
7 | import * as defaultThemeConfig from './themes/default'; | ||
8 | |||
9 | export default (themeId: ThemeType) => { | ||
10 | if (themeId === ThemeType.dark) { | 10 | if (themeId === ThemeType.dark) { |
11 | return Object.assign({}, defaultThemeConfig, darkThemeConfig); | 11 | return Object.assign({}, defaultThemeConfig, darkThemeConfig); |
12 | } | 12 | } |
13 | 13 | ||
14 | return Object.assign({}, defaultThemeConfig); | 14 | return Object.assign({}, defaultThemeConfig); |
15 | }; | 15 | } |
16 | 16 | ||
17 | export type Theme = typeof defaultThemeConfig; | 17 | export type Theme = typeof defaultThemeConfig; |
diff --git a/packages/theme/src/themes/dark/index.ts b/packages/theme/src/themes/dark/index.ts index 3c17d03ae..7eac5a3c3 100644 --- a/packages/theme/src/themes/dark/index.ts +++ b/packages/theme/src/themes/dark/index.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as color from 'color'; | 1 | import color from 'color'; |
2 | 2 | ||
3 | import * as legacyStyles from '../legacy'; | 3 | import * as legacyStyles from '../legacy'; |
4 | 4 | ||
diff --git a/packages/theme/src/themes/default/index.ts b/packages/theme/src/themes/default/index.ts index f7d58a375..b22730413 100644 --- a/packages/theme/src/themes/default/index.ts +++ b/packages/theme/src/themes/default/index.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import * as color from 'color'; | 1 | import color from 'color'; |
2 | 2 | ||
3 | import * as legacyStyles from '../legacy'; | 3 | import * as legacyStyles from '../legacy'; |
4 | 4 | ||
diff --git a/packages/theme/webpack.config.js b/packages/theme/webpack.config.js index f7311109d..8ad7ee3b6 100644 --- a/packages/theme/webpack.config.js +++ b/packages/theme/webpack.config.js | |||
@@ -1,25 +1,10 @@ | |||
1 | const path = require('path'); | 1 | const path = require('path'); |
2 | const baseConfig = require('../../webpack.config.base')(__dirname); | ||
2 | 3 | ||
3 | console.log(__dirname); | 4 | module.exports = Object.assign({}, baseConfig, { |
4 | |||
5 | module.exports = { | ||
6 | context: __dirname, | ||
7 | entry: path.join(__dirname, '/src/index.ts'), | ||
8 | output: { | 5 | output: { |
9 | filename: 'index.js', | 6 | filename: 'index.js', |
10 | path: path.join(__dirname, 'lib'), | 7 | path: path.join(__dirname, 'lib'), |
11 | libraryTarget: 'commonjs2', | 8 | libraryTarget: 'commonjs2', |
12 | }, | 9 | }, |
13 | module: { | 10 | }); |
14 | rules: [{ | ||
15 | test: /\.tsx?$/, | ||
16 | loader: 'ts-loader', | ||
17 | exclude: /node_modules/, | ||
18 | }], | ||
19 | }, | ||
20 | resolve: { | ||
21 | extensions: ['.tsx', '.ts', '.js'], | ||
22 | }, | ||
23 | devtool: 'inline-source-map', | ||
24 | mode: process.env.NODE_ENV === 'development' ? 'development' : 'production', | ||
25 | }; | ||