Skip to content

Commit

Permalink
Merge pull request #17 from jtiala/publish-each-components-css
Browse files Browse the repository at this point in the history
Publish each component's css as it's own file
  • Loading branch information
jtiala authored Sep 30, 2023
2 parents adf6be6 + 16d8380 commit 670a0c5
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 114 deletions.
2 changes: 1 addition & 1 deletion apps/docs/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs-example/app/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../node_modules/@themeless-ui/style/dist/style.css";
@import "../node_modules/@themeless-ui/style/dist/index.css";

html,
body {
Expand Down
2 changes: 1 addition & 1 deletion apps/react-example/src/index.css
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions packages/style/.eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions packages/style/.eslintrc.json

This file was deleted.

21 changes: 3 additions & 18 deletions packages/style/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,18 @@
"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"
],
"packageManager": "[email protected]",
"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",
Expand All @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions packages/style/src/components.css
Original file line number Diff line number Diff line change
@@ -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";
20 changes: 2 additions & 18 deletions packages/style/src/index.css
Original file line number Diff line number Diff line change
@@ -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";
1 change: 0 additions & 1 deletion packages/style/src/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/style/src/tokens.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import "./tokens/spacing.css";
@import "./tokens/typography.css";
@import "./tokens/colors.css";
3 changes: 1 addition & 2 deletions packages/style/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"extends": "@themeless-ui/typescript-config/vite-react.json",
"include": ["src"]
"extends": "@themeless-ui/typescript-config/vite-react.json"
}
24 changes: 20 additions & 4 deletions packages/style/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
/// <reference types="vite/client" />

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]";
},
},
},
},
});
4 changes: 0 additions & 4 deletions packages/theme-default/.eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions packages/theme-default/.eslintrc.json

This file was deleted.

21 changes: 3 additions & 18 deletions packages/theme-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,27 @@
"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"
],
"packageManager": "[email protected]",
"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",
"clean": "rm -rf dist reports node_modules .turbo",
"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"
Expand Down
1 change: 0 additions & 1 deletion packages/theme-default/src/index.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/theme-default/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"extends": "@themeless-ui/typescript-config/vite-react.json",
"include": ["src"]
"extends": "@themeless-ui/typescript-config/vite-react.json"
}
14 changes: 3 additions & 11 deletions packages/theme-default/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
},
},
},
Expand Down
12 changes: 0 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 670a0c5

Please sign in to comment.