Skip to content

Commit

Permalink
switch to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
benlife5 committed Nov 8, 2024
1 parent 82fb81c commit 14497cf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 490 deletions.
9 changes: 5 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
buildConfiguration:
buildCommand: cd src/components/puck/registry && npm run generate
buildCommand: pnpm run generate-registry
installDependenciesStep:
command: cd src/components/puck/registry && npm install
command: npm install -g pnpm && pnpm i --ignore-scripts
requiredFiles:
- src/components/puck/registry/package.json
- src/components/puck/registry/package-lock.json
- package.json
- pnpm-lock.yaml
- tsconfig.json
livePreviewConfiguration:
setupCommand: ":"
2 changes: 1 addition & 1 deletion src/components/puck/registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add a new object to `ui` in `components.ts`.

## Running shadcn locally

Useful for debugging the our registry with the shadcn CLI.
Useful for debugging our registry with the shadcn CLI.

1. `git clone https://github.com/shadcn-ui/ui.git`
2. `pnpm i`
Expand Down
10 changes: 7 additions & 3 deletions src/components/puck/registry/build-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import path from "path";
import { registryComponents } from "./registry.ts";
import { registryItemFileSchema } from "./schema.ts";

const DIST_DIR = `../../../../dist`;
const DIST_DIR = `./dist`;
const SLUG = `components`;
const COLOR_PATH = `${DIST_DIR}/${SLUG}/colors`;
const ICONS_PATH = `${DIST_DIR}/${SLUG}/icons`;
const THEMES_PATH = `${DIST_DIR}/${SLUG}/styles`;
const COMPONENT_PATH = `${THEMES_PATH}/default`;
const COMPONENTS_SRC_PATH = `./src/components/puck`;

// matches import { ... } from "..." where the import path starts with ../../
const IMPORT_PATTERN = /from "(\.\.\/\.\.\/[^"]+)"/g;
Expand Down Expand Up @@ -60,7 +61,7 @@ async function writeFileRecursive(filePath: string, data: string) {
const getComponentFiles = async (files: File[]) => {
const filesArrayPromises = (files ?? []).map(async (file) => {
if (typeof file === "string") {
const filePath = `../${file}`;
const filePath = `${COMPONENTS_SRC_PATH}/${file}`;
const fileContent = await readFile(filePath, "utf-8");
return {
type: "registry:component",
Expand Down Expand Up @@ -96,7 +97,10 @@ export const buildRegistry = async () => {
await writeFile(`${COLOR_PATH}/neutral.json`, JSON.stringify(colorIndex));
await writeFile(`${ICONS_PATH}/index.json`, JSON.stringify(iconsIndex));
await writeFile(`${THEMES_PATH}/index.json`, JSON.stringify(themeIndex));
await copyFile(`../registry/artifacts.json`, `${DIST_DIR}/artifacts.json`);
await copyFile(
`${COMPONENTS_SRC_PATH}/registry/artifacts.json`,
`${DIST_DIR}/artifacts.json`
);

const componentNames = ["index"];

Expand Down
Loading

0 comments on commit 14497cf

Please sign in to comment.