Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions bin/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env node

import { exec } from "child_process";
import { detect } from "package-manager-detector/detect";

const packages = [
"@evilmartians/agent-prism-data",
"@evilmartians/agent-prism-types",
"@radix-ui/react-collapsible",
"@radix-ui/react-tabs",
"classnames",
"lucide-react",
"react-json-pretty",
].join(" ");

function execCommand(command, config) {
const { errorPrefix = "Error while executing command" } = config;

exec(command, (error) => {
if (error) {
console.error(`${errorPrefix}: ${error}`);
process.exit(-1);
}
});
}

function installPackages(command) {
execCommand(`${command} ${packages}`, {
errorPrefix: "Error while installing packages",
});
console.log("All packages installed. Happy using AgentPrism!");
}

execCommand(
"npx degit evilmartians/agent-prism/packages/ui/src/components src/components/agent-prism",
{
errorPrefix: "Error while cloning components",
},
);

console.log("Components cloned successfully. Installing packages...");

const pm = await detect();

if (pm === "pnpm") {
installPackages("pnpm add");
}

if (pm === "yarn") {
installPackages("yarn add");
}

installPackages("npm install");
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default defineConfig([
"packages/core/dist",
"packages/demo-app/dist",
"packages/storybook/storybook-static",
"bin",
],
},
{
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@evilmartians/agent-prism",
"private": true,
"type": "module",
"engines": {
"node": ">=24.0.0",
"pnpm": ">=10.0.0"
Expand Down Expand Up @@ -31,6 +32,10 @@
"typescript-eslint": "^8.38.0"
},
"dependencies": {
"classnames": "2.5.1"
"classnames": "2.5.1",
"package-manager-detector": "^1.5.0"
},
"bin": {
"init": "./bin/init.js"
}
}
Loading