Skip to content

Commit

Permalink
feat: include icons in main library package
Browse files Browse the repository at this point in the history
  • Loading branch information
abelflopes committed Dec 13, 2024
1 parent 15622a3 commit 53c7e8b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion packages/library/react-ck/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
src
src
icons
1 change: 1 addition & 0 deletions packages/library/react-ck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"sass": "src/styles/index.scss",
"files": [
"/dist",
"/icons",
"/src/styles"
],
"homepage": "https://github.com/abelflopes/react-ck/tree/master/packages/library/react-ck#readme",
Expand Down
12 changes: 9 additions & 3 deletions packages/library/react-ck/scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ export const projectRoot = path.resolve(__dirname, "../../../../");

export const rootPackageLock = path.resolve(projectRoot, "./package-lock.json");

export const packagesRoot = path.resolve(projectRoot, "packages");

export const currPackagePath = path.resolve(__dirname, "../package.json");

export const packagesRoot = path.resolve(__dirname, "../../../");
export const currPackageFolder = path.dirname(currPackagePath);

export const destTsFile = path.resolve(currPackageFolder, "src/index.ts");

export const destScssFile = path.resolve(currPackageFolder, "src/styles/index.scss");

export const destTsFile = path.resolve(__dirname, "../src/index.ts");
export const sourceIconsFolder = path.resolve(packagesRoot, "components/icon/icons");

export const destScssFile = path.resolve(__dirname, "../src/styles/index.scss");
export const destIconsFolder = path.resolve(currPackageFolder, "icons");

// Util

Expand Down
8 changes: 8 additions & 0 deletions packages/library/react-ck/scripts/prebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { globSync } from "glob";
import { execSync } from "child_process";
import {
currPackagePath,
destIconsFolder,
destScssFile,
destTsFile,
logger,
packagesRoot,
projectRoot,
sourceIconsFolder,
} from "./common";

// Util
Expand Down Expand Up @@ -164,6 +166,12 @@ fs.writeFileSync(destScssFile, scssFileContents, {
encoding: "utf-8",
});

// Copy Icons

logger.info("Copying icons...");

fs.cpSync(sourceIconsFolder, destIconsFolder, { recursive: true });

// Finished

logger.info("Done");

0 comments on commit 53c7e8b

Please sign in to comment.