diff --git a/apps/docs/.storybook/preview.ts b/apps/docs/.storybook/preview.ts index 2160782..b27acc8 100644 --- a/apps/docs/.storybook/preview.ts +++ b/apps/docs/.storybook/preview.ts @@ -1,5 +1,5 @@ import type { Preview } from "@storybook/react"; -import "../node_modules/@themeless-ui/style/dist/style.css"; +import "../node_modules/@themeless-ui/style/dist/index.css"; const preview: Preview = { parameters: { diff --git a/apps/nextjs-example/app/index.css b/apps/nextjs-example/app/index.css index cb62530..df912b3 100644 --- a/apps/nextjs-example/app/index.css +++ b/apps/nextjs-example/app/index.css @@ -1,4 +1,4 @@ -@import "../node_modules/@themeless-ui/style/dist/style.css"; +@import "../node_modules/@themeless-ui/style/dist/index.css"; html, body { diff --git a/apps/react-example/src/index.css b/apps/react-example/src/index.css index 1f1a054..38fdd7a 100644 --- a/apps/react-example/src/index.css +++ b/apps/react-example/src/index.css @@ -1,4 +1,4 @@ -@import "../node_modules/@themeless-ui/style/dist/style.css"; +@import "../node_modules/@themeless-ui/style/dist/index.css"; /* Comment below to show only default theme diff --git a/packages/style/.eslintignore b/packages/style/.eslintignore deleted file mode 100644 index a890d4d..0000000 --- a/packages/style/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -.turbo -dist -reports diff --git a/packages/style/.eslintrc.json b/packages/style/.eslintrc.json deleted file mode 100644 index 05f8985..0000000 --- a/packages/style/.eslintrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "root": true, - "extends": ["@themeless-ui/eslint-config/react.json"], - "env": { - "browser": true, - "es2022": true - } -} diff --git a/packages/style/package.json b/packages/style/package.json index 6a49350..8aaca0b 100644 --- a/packages/style/package.json +++ b/packages/style/package.json @@ -14,16 +14,6 @@ "url": "https://github.com/jtiala/themeless-ui", "directory": "packages/style" }, - "type": "module", - "module": "./dist/index.js", - "main": "./dist/index.umd.cjs", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "import": "./dist/index.js", - "require": "./dist/index.umd.cjs" - } - }, "files": [ "dist", "CHANGELOG.md" @@ -31,14 +21,11 @@ "packageManager": "pnpm@8.7.6", "scripts": { "build": "vite build", - "lint": "pnpm run lint:tsc && pnpm run lint:eslint && pnpm run lint:stylelint", - "lint:report": "pnpm run lint:tsc:report && pnpm run lint:eslint:report && pnpm run lint:stylelint:report", - "lint:fix": "pnpm run lint:eslint:fix && pnpm run lint:stylelint:fix", + "lint": "pnpm run lint:tsc && pnpm run lint:stylelint", + "lint:report": "pnpm run lint:tsc:report && pnpm run lint:stylelint:report", + "lint:fix": "pnpm run lint:stylelint:fix", "lint:tsc": "tsc", "lint:tsc:report": "mkdir -p ./reports && tsc > ./reports/lint-report-tsc.txt", - "lint:eslint": "eslint \"**/*.{ts,tsx}\"", - "lint:eslint:report": "eslint -f json -o ./reports/lint-report-eslint.json \"**/*.{ts,tsx}\"", - "lint:eslint:fix": "eslint --fix \"**/*.{ts,tsx}\"", "lint:stylelint": "stylelint \"**/*.css\"", "lint:stylelint:report": "stylelint -f json -o ./reports/lint-report-stylelint.json \"**/*.css\"", "lint:stylelint:fix": "stylelint \"**/*.css\" --fix", @@ -49,10 +36,8 @@ "@themeless-ui/theme-default": "workspace:*" }, "devDependencies": { - "@themeless-ui/eslint-config": "workspace:*", "@themeless-ui/stylelint-config": "workspace:*", "@themeless-ui/typescript-config": "workspace:*", - "eslint": "8.50.0", "stylelint": "15.10.3", "typescript": "5.2.2", "vite": "4.4.9" diff --git a/packages/style/src/components.css b/packages/style/src/components.css new file mode 100644 index 0000000..c97d1b7 --- /dev/null +++ b/packages/style/src/components.css @@ -0,0 +1,10 @@ +@import "./components/anchor.css"; +@import "./components/blockquote.css"; +@import "./components/button.css"; +@import "./components/heading.css"; +@import "./components/input.css"; +@import "./components/list.css"; +@import "./components/paragraph.css"; +@import "./components/stack.css"; +@import "./components/text.css"; +@import "./components/textarea.css"; diff --git a/packages/style/src/index.css b/packages/style/src/index.css index 2423bdf..e3823a3 100644 --- a/packages/style/src/index.css +++ b/packages/style/src/index.css @@ -1,19 +1,3 @@ -/* Default theme */ @import "../node_modules/@themeless-ui/theme-default/dist/theme-default.css"; - -/* Tokens */ -@import "./tokens/spacing.css"; -@import "./tokens/typography.css"; -@import "./tokens/colors.css"; - -/* Components */ -@import "./components/anchor.css"; -@import "./components/blockquote.css"; -@import "./components/button.css"; -@import "./components/heading.css"; -@import "./components/input.css"; -@import "./components/list.css"; -@import "./components/paragraph.css"; -@import "./components/stack.css"; -@import "./components/text.css"; -@import "./components/textarea.css"; +@import "./tokens.css"; +@import "./components.css"; diff --git a/packages/style/src/index.ts b/packages/style/src/index.ts deleted file mode 100644 index 3a29aed..0000000 --- a/packages/style/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -import "./index.css"; diff --git a/packages/style/src/tokens.css b/packages/style/src/tokens.css new file mode 100644 index 0000000..7b0a154 --- /dev/null +++ b/packages/style/src/tokens.css @@ -0,0 +1,3 @@ +@import "./tokens/spacing.css"; +@import "./tokens/typography.css"; +@import "./tokens/colors.css"; diff --git a/packages/style/tsconfig.json b/packages/style/tsconfig.json index e04e37d..617ee1e 100644 --- a/packages/style/tsconfig.json +++ b/packages/style/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "@themeless-ui/typescript-config/vite-react.json", - "include": ["src"] + "extends": "@themeless-ui/typescript-config/vite-react.json" } diff --git a/packages/style/vite.config.ts b/packages/style/vite.config.ts index 5a11d8f..6d4596c 100644 --- a/packages/style/vite.config.ts +++ b/packages/style/vite.config.ts @@ -1,13 +1,29 @@ /// +import fs from "fs"; import { defineConfig } from "vite"; +const componentsDirectory = "./src/components"; +const componentInputs = fs + .readdirSync(componentsDirectory) + .map((file) => `${componentsDirectory}/${file}`); + +const tokensDirectory = "./src/tokens"; +const tokenInputs = fs + .readdirSync(tokensDirectory) + .map((file) => `${tokensDirectory}/${file}`); + +const otherInputs = ["src/index.css", "src/tokens.css", "src/components.css"]; + export default defineConfig({ build: { - lib: { - entry: "src/index.ts", - name: "style", - fileName: "index", + rollupOptions: { + input: [...componentInputs, ...tokenInputs, ...otherInputs], + output: { + assetFileNames: () => { + return "[name].[ext]"; + }, + }, }, }, }); diff --git a/packages/theme-default/.eslintignore b/packages/theme-default/.eslintignore deleted file mode 100644 index a890d4d..0000000 --- a/packages/theme-default/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -.turbo -dist -reports diff --git a/packages/theme-default/.eslintrc.json b/packages/theme-default/.eslintrc.json deleted file mode 100644 index 05f8985..0000000 --- a/packages/theme-default/.eslintrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "root": true, - "extends": ["@themeless-ui/eslint-config/react.json"], - "env": { - "browser": true, - "es2022": true - } -} diff --git a/packages/theme-default/package.json b/packages/theme-default/package.json index 764b3ba..be4d806 100644 --- a/packages/theme-default/package.json +++ b/packages/theme-default/package.json @@ -14,16 +14,6 @@ "url": "https://github.com/jtiala/themeless-ui", "directory": "packages/theme-default" }, - "type": "module", - "module": "./dist/index.js", - "main": "./dist/index.umd.cjs", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "import": "./dist/index.js", - "require": "./dist/index.umd.cjs" - } - }, "files": [ "dist", "CHANGELOG.md" @@ -31,14 +21,11 @@ "packageManager": "pnpm@8.7.6", "scripts": { "build": "vite build", - "lint": "pnpm run lint:tsc && pnpm run lint:eslint && pnpm run lint:stylelint", - "lint:report": "pnpm run lint:tsc:report && pnpm run lint:eslint:report && pnpm run lint:stylelint:report", - "lint:fix": "pnpm run lint:eslint:fix && pnpm run lint:stylelint:fix", + "lint": "pnpm run lint:tsc && pnpm run lint:stylelint", + "lint:report": "pnpm run lint:tsc:report && pnpm run lint:stylelint:report", + "lint:fix": "pnpm run lint:stylelint:fix", "lint:tsc": "tsc", "lint:tsc:report": "mkdir -p ./reports && tsc > ./reports/lint-report-tsc.txt", - "lint:eslint": "eslint \"**/*.{ts,tsx}\"", - "lint:eslint:report": "eslint -f json -o ./reports/lint-report-eslint.json \"**/*.{ts,tsx}\"", - "lint:eslint:fix": "eslint --fix \"**/*.{ts,tsx}\"", "lint:stylelint": "stylelint \"**/*.css\"", "lint:stylelint:report": "stylelint -f json -o ./reports/lint-report-stylelint.json \"**/*.css\"", "lint:stylelint:fix": "stylelint \"**/*.css\" --fix", @@ -46,10 +33,8 @@ "publish:npm": "pnpm publish --access public" }, "devDependencies": { - "@themeless-ui/eslint-config": "workspace:*", "@themeless-ui/stylelint-config": "workspace:*", "@themeless-ui/typescript-config": "workspace:*", - "eslint": "8.50.0", "stylelint": "15.10.3", "typescript": "5.2.2", "vite": "4.4.9" diff --git a/packages/theme-default/src/index.ts b/packages/theme-default/src/index.ts deleted file mode 100644 index 3a29aed..0000000 --- a/packages/theme-default/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -import "./index.css"; diff --git a/packages/theme-default/tsconfig.json b/packages/theme-default/tsconfig.json index e04e37d..617ee1e 100644 --- a/packages/theme-default/tsconfig.json +++ b/packages/theme-default/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "@themeless-ui/typescript-config/vite-react.json", - "include": ["src"] + "extends": "@themeless-ui/typescript-config/vite-react.json" } diff --git a/packages/theme-default/vite.config.ts b/packages/theme-default/vite.config.ts index 0e153ef..5748210 100644 --- a/packages/theme-default/vite.config.ts +++ b/packages/theme-default/vite.config.ts @@ -4,19 +4,11 @@ import { defineConfig } from "vite"; export default defineConfig({ build: { - lib: { - entry: "src/index.ts", - name: "theme-default", - fileName: "index", - }, rollupOptions: { + input: "src/index.css", output: { - assetFileNames: (assetInfo) => { - if (assetInfo.name === "style.css") { - return "theme-default.css"; - } - - return assetInfo.name || ""; + assetFileNames: () => { + return "theme-default.css"; }, }, }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7ae1217..50f1503 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -352,18 +352,12 @@ importers: specifier: workspace:* version: link:../theme-default devDependencies: - '@themeless-ui/eslint-config': - specifier: workspace:* - version: link:../eslint-config '@themeless-ui/stylelint-config': specifier: workspace:* version: link:../stylelint-config '@themeless-ui/typescript-config': specifier: workspace:* version: link:../typescript-config - eslint: - specifier: 8.50.0 - version: 8.50.0 stylelint: specifier: 15.10.3 version: 15.10.3 @@ -388,18 +382,12 @@ importers: packages/theme-default: devDependencies: - '@themeless-ui/eslint-config': - specifier: workspace:* - version: link:../eslint-config '@themeless-ui/stylelint-config': specifier: workspace:* version: link:../stylelint-config '@themeless-ui/typescript-config': specifier: workspace:* version: link:../typescript-config - eslint: - specifier: 8.50.0 - version: 8.50.0 stylelint: specifier: 15.10.3 version: 15.10.3