Skip to content

fix: installation failed and roocommander version updated #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
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
5 changes: 2 additions & 3 deletions npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"main": "./dist/index.js",
"scripts": {
"build": "esbuild ./bin/roo-cli.ts --bundle --outfile=dist/bin/roo-cli.js --platform=node --format=esm --external:./package.json",
"build": "esbuild ./bin/roo-cli.ts --bundle --outfile=dist/bin/roo-cli.js --platform=node --format=esm --main-fields=module,main --conditions=node --banner:js=\"import { createRequire } from 'module';const require = createRequire(import.meta.url);\" --external:fs-extra --external:chalk --external:inquirer --external:node:* && node ./scripts/copy-templates.mjs",
"start": "node ./dist/bin/roo-cli.js",
"dev": "tsc --watch",
"prepare:publish": "node ./scripts/prepare-publish.mjs",
Expand All @@ -33,8 +33,7 @@
"files": [
"dist",
"README.md",
"LICENSE",
"templates"
"LICENSE"
],
"dependencies": {
"commander": "^13.1.0",
Expand Down
28 changes: 28 additions & 0 deletions npm/scripts/copy-templates.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import fs from 'fs-extra';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const sourceRooDir = path.resolve(__dirname, '..', '..', '.roo');
const sourceRuruDir = path.resolve(__dirname, '..', '..', '.ruru');

const targetBaseDir = path.resolve(__dirname, '..', 'dist', 'templates');
const targetRooDir = path.join(targetBaseDir, '.roo');
const targetRuruDir = path.join(targetBaseDir, '.ruru');

try {
fs.ensureDirSync(targetBaseDir); // Ensure the base 'templates' directory exists

console.log(`Copying from ${sourceRooDir} to ${targetRooDir}`);
fs.copySync(sourceRooDir, targetRooDir);

console.log(`Copying from ${sourceRuruDir} to ${targetRuruDir}`);
fs.copySync(sourceRuruDir, targetRuruDir);

console.log('Successfully copied .roo and .ruru template directories.');
} catch (err) {
console.error('Error copying template directories:', err);
process.exit(1); // Exit with error code if copy fails
}
2 changes: 1 addition & 1 deletion npm/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function handleInitCommand(): Promise<void> {

// Source paths relative to the compiled JS file in dist/commands/
// Go up three levels to reach the project root where templates/ should be
const templateBaseDir = path.resolve(__dirname, '..', '..', 'templates'); // Go up from dist/commands/ to package root, then into templates
const templateBaseDir = path.resolve(__dirname, '..', 'templates'); // Path relative to dist/commands/, assuming templates is in dist/templates/
const rooSource = path.join(templateBaseDir, '.roo');
const ruruSource = path.join(templateBaseDir, '.ruru');

Expand Down