Skip to content

Commit

Permalink
feat/use ts for tw and postcss configs (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykKuniczak authored Sep 1, 2024
1 parent 90f7a42 commit 5a4b977
Show file tree
Hide file tree
Showing 36 changed files with 156 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dist
node_modules
tailwind.config.js
tailwind.config.ts
2 changes: 1 addition & 1 deletion packages/tailwind-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "@extension/tailwindcss-config",
"version": "0.3.1",
"description": "Tailwind CSS configuration for boilerplate",
"main": "./tailwind.config.js",
"main": "tailwind.config.ts",
"private": true
}
9 changes: 0 additions & 9 deletions packages/tailwind-config/tailwind.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/tailwind-config/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Config } from 'tailwindcss/types/config';

export default {
theme: {
extend: {},
},
plugins: [],
} as Omit<Config, 'content'>;
11 changes: 5 additions & 6 deletions packages/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ Then, run `pnpm install`.
pnpm install
```

Add the following to the `tailwind.config.js` file.
Add the following to the `tailwind.config.ts` file.

```js
const baseConfig = require('@extension/tailwindcss-config');
const { withUI } = require('@extension/ui');
```ts
import baseConfig from '@extension/tailwindcss-config';
import { withUI } from '@extension/ui';

/** @type {import('tailwindcss').Config} */
module.exports = withUI({
export default withUI({
...baseConfig,
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
});
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as fs from 'fs';
import { resolve } from 'node:path';

/**
* @type { import("esbuild").BuildOptions }
* @type { import('esbuild').BuildOptions }
*/
const buildOptions = {
entryPoints: ['./index.ts', './tailwind.config.ts', './lib/**/*.ts', './lib/**/*.tsx'],
entryPoints: ['./index.ts', './lib/**/*.ts', './lib/**/*.tsx'],
tsconfig: './tsconfig.json',
bundle: false,
target: 'es6',
Expand Down
14 changes: 5 additions & 9 deletions packages/ui/lib/withUI.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import deepmerge from 'deepmerge';
import type { Config } from 'tailwindcss';
import config from '../tailwind.config';
import type { Config } from 'tailwindcss/types/config';

export function withUI(tailwindConfig: Config) {
return deepmerge(
tailwindConfig,
deepmerge(config, {
content: ['./node_modules/@extension/ui/lib/**/*.{tsx,ts,js,jsx}'],
}),
);
export function withUI(tailwindConfig: Config): Config {
return deepmerge(tailwindConfig, {
content: ['./node_modules/@extension/ui/lib/**/*.{tsx,ts,js,jsx}'],
});
}
6 changes: 0 additions & 6 deletions packages/ui/tailwind.config.ts

This file was deleted.

8 changes: 0 additions & 8 deletions pages/content-ui/tailwind.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions pages/content-ui/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import baseConfig from '@extension/tailwindcss-config';
import { withUI } from '@extension/ui';

export default withUI({
...baseConfig,
content: ['src/**/*.{ts,tsx}'],
});
3 changes: 2 additions & 1 deletion pages/devtools-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@extension/tailwindcss-config": "workspace:*",
"@extension/tsconfig": "workspace:*",
"@extension/vite-config": "workspace:*"
"@extension/vite-config": "workspace:*",
"postcss-load-config": "^6.0.1"
}
}
6 changes: 0 additions & 6 deletions pages/devtools-panel/postcss.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions pages/devtools-panel/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Config } from 'postcss-load-config';

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
} as Config;
7 changes: 0 additions & 7 deletions pages/devtools-panel/tailwind.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions pages/devtools-panel/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import baseConfig from '@extension/tailwindcss-config';
import type { Config } from 'tailwindcss/types/config';

export default {
...baseConfig,
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
} as Config;
3 changes: 2 additions & 1 deletion pages/new-tab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@extension/tailwindcss-config": "workspace:*",
"@extension/tsconfig": "workspace:*",
"@extension/vite-config": "workspace:*",
"sass": "1.77.8"
"sass": "1.77.8",
"postcss-load-config": "^6.0.1"
}
}
6 changes: 0 additions & 6 deletions pages/new-tab/postcss.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions pages/new-tab/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Config } from 'postcss-load-config';

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
} as Config;
8 changes: 0 additions & 8 deletions pages/new-tab/tailwind.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions pages/new-tab/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import baseConfig from '@extension/tailwindcss-config';
import { withUI } from '@extension/ui';

export default withUI({
...baseConfig,
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
});
3 changes: 2 additions & 1 deletion pages/options/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"devDependencies": {
"@extension/tailwindcss-config": "workspace:*",
"@extension/tsconfig": "workspace:*",
"@extension/vite-config": "workspace:*"
"@extension/vite-config": "workspace:*",
"postcss-load-config": "^6.0.1"
}
}
6 changes: 0 additions & 6 deletions pages/options/postcss.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions pages/options/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Config } from 'postcss-load-config';

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
} as Config;
8 changes: 0 additions & 8 deletions pages/options/tailwind.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions pages/options/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import baseConfig from '@extension/tailwindcss-config';
import { withUI } from '@extension/ui';

export default withUI({
...baseConfig,
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
});
3 changes: 2 additions & 1 deletion pages/popup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"devDependencies": {
"@extension/tailwindcss-config": "workspace:*",
"@extension/tsconfig": "workspace:*",
"@extension/vite-config": "workspace:*"
"@extension/vite-config": "workspace:*",
"postcss-load-config": "^6.0.1"
}
}
6 changes: 0 additions & 6 deletions pages/popup/postcss.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions pages/popup/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Config } from 'postcss-load-config';

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
} as Config;
7 changes: 0 additions & 7 deletions pages/popup/tailwind.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions pages/popup/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import baseConfig from '@extension/tailwindcss-config';
import type { Config } from 'tailwindcss/types/config';

export default {
...baseConfig,
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
} as Config;
3 changes: 2 additions & 1 deletion pages/side-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"devDependencies": {
"@extension/tailwindcss-config": "workspace:*",
"@extension/tsconfig": "workspace:*",
"@extension/vite-config": "workspace:*"
"@extension/vite-config": "workspace:*",
"postcss-load-config": "^6.0.1"
}
}
6 changes: 0 additions & 6 deletions pages/side-panel/postcss.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions pages/side-panel/postcss.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Config } from 'postcss-load-config';

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
} as Config;
7 changes: 0 additions & 7 deletions pages/side-panel/tailwind.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions pages/side-panel/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import baseConfig from '@extension/tailwindcss-config';
import type { Config } from 'tailwindcss/types/config';

export default {
...baseConfig,
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
} as Config;
Loading

0 comments on commit 5a4b977

Please sign in to comment.