Skip to content

Commit

Permalink
Bundle css
Browse files Browse the repository at this point in the history
  • Loading branch information
tedspare committed Oct 2, 2024
1 parent 7aeae15 commit 5fdda7e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- [2024-10-02] [Bundle css](https://github.com/RubricLab/ui/commit/343655090d6f68bf065807a4552a655a5b660517)
- [2024-10-02] [Bundle index.ts](https://github.com/RubricLab/ui/commit/1b141ca0383cd61cd0d481a3008f3b122cdb3544)
- [2024-10-02] [Bundle in components](https://github.com/RubricLab/ui/commit/82009ba695e187560eb4a833a6dc3b25baf67fe3)
- [2024-10-02] [Bundle index.ts](https://github.com/RubricLab/ui/commit/4de8280c96873fb326fea0b68f83b33cbb4842c8)
Expand Down
12 changes: 6 additions & 6 deletions build.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { rm, rename, readdir } from "node:fs/promises";
import path from "node:path";

const distDir = "./dist";
const outdir = "./dist";

// Clean dist directory before building
await rm(distDir, {
await rm(outdir, {
recursive: true,
force: true,
});
Expand All @@ -14,7 +14,7 @@ try {
// Run build
await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
outdir,
minify: true,
external: ["react", "react-dom"],
});
Expand All @@ -24,10 +24,10 @@ try {
}

// Rename the generated CSS file to index.css
const files = await readdir(distDir);
const files = await readdir(outdir);
const cssFile = files.find((file) => file.endsWith(".css"));
if (cssFile) {
const oldPath = path.join(distDir, cssFile);
const newPath = path.join(distDir, "index.css");
const oldPath = path.join(outdir, cssFile);
const newPath = path.join(outdir, "index.css");
await rename(oldPath, newPath);
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rubriclab/ui",
"version": "5.0.7",
"version": "5.0.8",
"main": "dist/index.js",
"types": "src/index.ts",
"description": "UI package by Rubric Labs",
Expand All @@ -23,7 +23,7 @@
"dist/*.js",
"dist/*.d.ts",
"dist/*.css",
"src/**/*.{ts,tsx}",
"src/**/*.tsx",
"bin/commands",
"bin/config"
],
Expand Down

0 comments on commit 5fdda7e

Please sign in to comment.