Skip to content

Commit 7ab0c57

Browse files
authored
feat: delete source.designSystem config (#7654)
1 parent 29678b4 commit 7ab0c57

File tree

18 files changed

+16
-307
lines changed

18 files changed

+16
-307
lines changed

packages/cli/plugin-tailwind/src/cli.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
22
import { getTailwindConfig, loadConfigFile } from './config';
3-
import { designTokenPlugin } from './design-token/cli';
43
import { checkTwinMacroExist, getTwinMacroMajorVersion } from './macro';
54
import { getTailwindPath, getTailwindVersion } from './utils';
65

@@ -11,15 +10,8 @@ export const tailwindcssPlugin = (
1110
): CliPlugin<AppTools> => ({
1211
name: '@modern-js/plugin-tailwindcss',
1312

14-
// support designSystem.supportStyledComponents
15-
usePlugins: [
16-
designTokenPlugin({
17-
pluginName,
18-
}),
19-
],
20-
2113
setup: async api => {
22-
const { appDirectory, internalDirectory } = api.getAppContext();
14+
const { appDirectory } = api.getAppContext();
2315
// When reinstalling dependencies, most of the time the project will be restarted
2416
const haveTwinMacro = await checkTwinMacroExist(appDirectory);
2517
const tailwindPath = getTailwindPath(appDirectory);
@@ -52,8 +44,7 @@ export const tailwindcssPlugin = (
5244
if (
5345
tailwindVersion === '3' &&
5446
userTailwindConfig.content &&
55-
!modernConfig?.tools?.tailwindcss &&
56-
!modernConfig?.source?.designSystem
47+
!modernConfig?.tools?.tailwindcss
5748
) {
5849
// Prefer to use user's tailwind config file,
5950
// this is faster then passing the config object to `tailwindcss()`.
@@ -67,7 +58,6 @@ export const tailwindcssPlugin = (
6758
tailwindVersion,
6859
userConfig: userTailwindConfig,
6960
extraConfig: modernConfig?.tools?.tailwindcss,
70-
designSystem: modernConfig?.source?.designSystem,
7161
});
7262
}
7363
}

packages/cli/plugin-tailwind/src/config.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import path from 'path';
22
import { bundleRequire } from '@modern-js/node-bundle-require';
33
import { fs, applyOptionsChain, findExists } from '@modern-js/utils';
4-
import { cloneDeep } from '@modern-js/utils/lodash';
5-
import type {
6-
DesignSystem,
7-
ExtraTailwindConfig,
8-
TailwindConfig,
9-
} from './types';
4+
import type { ExtraTailwindConfig, TailwindConfig } from './types';
105

116
function getDefaultContent(appDirectory: string) {
127
const defaultContent = ['./src/**/*.{js,jsx,ts,tsx}'];
@@ -23,12 +18,6 @@ function getDefaultContent(appDirectory: string) {
2318
return defaultContent;
2419
}
2520

26-
const getPureDesignSystemConfig = (config: DesignSystem) => {
27-
const pureConfig = cloneDeep(config);
28-
delete pureConfig.supportStyledComponents;
29-
return pureConfig;
30-
};
31-
3221
const getV2PurgeConfig = (content: string[]) => ({
3322
enabled: process.env.NODE_ENV === 'production',
3423
layers: ['utilities'],
@@ -57,20 +46,18 @@ export async function loadConfigFile(appDirectory: string) {
5746

5847
/**
5948
* Config priority:
60-
* `source.designSystem` > `tools.tailwindcss` (extraConfig) > `tailwind.config.*` (userConfig) > `defaultConfig`
49+
* `tools.tailwindcss` (extraConfig) > `tailwind.config.*` (userConfig) > `defaultConfig`
6150
*/
6251
const getTailwindConfig = ({
6352
tailwindVersion,
6453
appDirectory,
6554
userConfig,
6655
extraConfig,
67-
designSystem,
6856
}: {
6957
tailwindVersion: '2' | '3';
7058
appDirectory: string;
7159
userConfig: TailwindConfig;
7260
extraConfig?: ExtraTailwindConfig;
73-
designSystem?: DesignSystem;
7461
}) => {
7562
const content = getDefaultContent(appDirectory);
7663

@@ -85,13 +72,6 @@ const getTailwindConfig = ({
8572
? applyOptionsChain(tailwindConfig, extraConfig)
8673
: tailwindConfig;
8774

88-
const designSystemConfig = getPureDesignSystemConfig(designSystem ?? {});
89-
90-
// if designSystem config is used, it will override the theme config of tailwind
91-
if (designSystemConfig && Object.keys(designSystemConfig).length > 0) {
92-
tailwindConfig.theme = designSystemConfig;
93-
}
94-
9575
return tailwindConfig;
9676
};
9777

packages/cli/plugin-tailwind/src/design-token/cli/index.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

packages/cli/plugin-tailwind/src/design-token/global.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/cli/plugin-tailwind/src/design-token/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/cli/plugin-tailwind/src/design-token/postcss-plugin/index.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/cli/plugin-tailwind/src/design-token/runtime/index.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/cli/plugin-tailwind/src/design-token/runtime/plugin.tsx

Lines changed: 0 additions & 64 deletions
This file was deleted.

packages/cli/plugin-tailwind/src/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
export type DesignSystem = TailwindConfig & {
2-
supportStyledComponents?: boolean;
3-
};
4-
51
export type TailwindConfig = Record<string, any>;
62

73
export type ExtraTailwindConfig =

packages/cli/plugin-tailwind/tests/design-token/__snapshots__/postcss.test.ts.snap

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)