Skip to content

Commit

Permalink
v1.4.0-alpha.1
Browse files Browse the repository at this point in the history
  • Loading branch information
programming-with-ia committed Sep 16, 2024
1 parent 8252a1f commit 77e5cdc
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
20 changes: 14 additions & 6 deletions package-lock.json

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

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "shadcn-theme-editor",
"version": "1.3.3",
"version": "1.4.0-alpha.1",
"description": "Shadcn Theme Editor",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"repository": {
Expand Down Expand Up @@ -37,8 +36,11 @@
"author": "immi",
"license": "MIT",
"peerDependencies": {
"next-themes": "^0.3.0",
"react": "^18.3.1"
"class-variance-authority": "*",
"clsx": "*",
"next-themes": "*",
"react": "*",
"react-dom": "*"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^26.0.1",
Expand All @@ -60,8 +62,6 @@
},
"dependencies": {
"@radix-ui/react-slot": "^1.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"colord": "^2.9.3",
"emittor": "^0.1.0",
"lodash.debounce": "^4.0.8",
Expand Down
36 changes: 22 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,34 @@ import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import terser from "@rollup/plugin-terser";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import banner2 from 'rollup-plugin-banner2'
import banner2 from "rollup-plugin-banner2";
// import {} from "rollup";
// import { preserveDirectives } from "rollup-plugin-preserve-directives"

import tailwindcss from 'tailwindcss';
import tailwindcss from "tailwindcss";

import postcss from "rollup-plugin-postcss";
// document.createElement('style');
const packageJson = require("./package.json");
const tailwindConfig = require('./tailwind.config.js');

// document.createElement('style');
// import packageJson from './package.json' assert { type: 'json' };
// const tailwindConfig = (await import('./tailwind.config.js')).default;

export default [
{
input: "src/index.ts",
output: [
{
file: packageJson.main,
format: "cjs",
sourcemap: true,
},
// {
// file: packageJson.main,
// format: "cjs",
// sourcemap: true,
// },
{
file: packageJson.module,
format: "esm",
sourcemap: true,
// sourcemap: true,
},

],
plugins: [
peerDepsExternal(),
Expand All @@ -39,16 +41,22 @@ export default [
terser(),
postcss({
plugins: [tailwindcss(tailwindConfig)],
extract: true
extract: true,
}),
banner2(()=>`"use client";\nimport "./index.css";\n`), // or use: https://github.com/Ephem/rollup-plugin-preserve-directives
banner2(() => `"use client";\nimport "./index.css";\n`), // or use: https://github.com/Ephem/rollup-plugin-preserve-directives
// preserveDirectives(),
],
external: ["react", "react-dom", 'next-themes'],
external: [
"react",
"react-dom",
"next-themes",
"clsx",
"class-variance-authority",
],
},
{
input: "src/index.ts",
output: [{ file: packageJson.types }],
output: [{ file: "dist/index.d.ts" }],
plugins: [dts.default()],
external: [/\.css$/],
},
Expand Down
11 changes: 5 additions & 6 deletions update-css-file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
file_path = "dist/index.css"
selector = "#shadcn-theme-editor"


def leading_spaces(s):
# Strip leading spaces and compare length with original length
return len(s) - len(s.lstrip(' '))
return len(s) - len(s.lstrip(" "))

try:
with open(file_path) as file:
Expand All @@ -16,12 +16,11 @@ def leading_spaces(s):
if line.strip().startswith("."):
line = f"{' '*leading_spaces(line)}{selector} {line.lstrip()}"
new_lines.append(line)
# print(new_lines)
# exit()

with open(file_path, 'w') as file:
with open(file_path, "w") as file:
file.writelines(new_lines)

print("css file updated")

except Exception as e:
print("!error: ", e)
print("!error: ", e)

0 comments on commit 77e5cdc

Please sign in to comment.