fix: windows compatibility

This commit is contained in:
veganbeef 2025-05-08 10:49:15 -07:00
parent eda896e478
commit f3f8924fa9
No known key found for this signature in database
5 changed files with 44 additions and 14 deletions

View File

@ -224,9 +224,20 @@ export async function init() {
try { try {
console.log(`\nCloning repository from ${REPO_URL}...`); console.log(`\nCloning repository from ${REPO_URL}...`);
// Use separate commands for better cross-platform compatibility // Use separate commands for better cross-platform compatibility
execSync(`git clone ${REPO_URL} "${projectPath}"`, { stdio: 'inherit' }); execSync(`git clone ${REPO_URL} "${projectPath}"`, {
execSync('git fetch origin main', { cwd: projectPath, stdio: 'inherit' }); stdio: 'inherit',
execSync('git reset --hard origin/main', { cwd: projectPath, stdio: 'inherit' }); shell: process.platform === 'win32'
});
execSync('git fetch origin main', {
cwd: projectPath,
stdio: 'inherit',
shell: process.platform === 'win32'
});
execSync('git reset --hard origin/main', {
cwd: projectPath,
stdio: 'inherit',
shell: process.platform === 'win32'
});
} catch (error) { } catch (error) {
console.error('\n❌ Error: Failed to create project directory.'); console.error('\n❌ Error: Failed to create project directory.');
console.error('Please make sure you have write permissions and try again.'); console.error('Please make sure you have write permissions and try again.');
@ -353,8 +364,16 @@ export async function init() {
// Install dependencies // Install dependencies
console.log('\nInstalling dependencies...'); console.log('\nInstalling dependencies...');
execSync('npm cache clean --force', { cwd: projectPath, stdio: 'inherit' }); execSync('npm cache clean --force', {
execSync('npm install', { cwd: projectPath, stdio: 'inherit' }); cwd: projectPath,
stdio: 'inherit',
shell: process.platform === 'win32'
});
execSync('npm install', {
cwd: projectPath,
stdio: 'inherit',
shell: process.platform === 'win32'
});
// Remove the bin directory // Remove the bin directory
console.log('\nRemoving bin directory...'); console.log('\nRemoving bin directory...');

View File

@ -1,6 +1,6 @@
{ {
"name": "@neynar/create-farcaster-mini-app", "name": "@neynar/create-farcaster-mini-app",
"version": "1.2.19", "version": "1.2.21",
"type": "module", "type": "module",
"private": false, "private": false,
"access": "public", "access": "public",

View File

@ -388,7 +388,12 @@ async function main() {
// Run next build // Run next build
console.log('\nBuilding Next.js application...'); console.log('\nBuilding Next.js application...');
execSync('next build', { cwd: projectRoot, stdio: 'inherit' }); const nextBin = path.normalize(path.join(projectRoot, 'node_modules', '.bin', 'next'));
execSync(`"${nextBin}" build`, {
cwd: projectRoot,
stdio: 'inherit',
shell: process.platform === 'win32'
});
console.log('\n✨ Build complete! Your frame is ready for deployment. 🪐'); console.log('\n✨ Build complete! Your frame is ready for deployment. 🪐');
console.log('📝 Make sure to configure the environment variables from .env in your hosting provider'); console.log('📝 Make sure to configure the environment variables from .env in your hosting provider');

View File

@ -245,7 +245,10 @@ async function getGitRemote() {
async function checkVercelCLI() { async function checkVercelCLI() {
try { try {
execSync('vercel --version', { stdio: 'ignore' }); execSync('vercel --version', {
stdio: 'ignore',
shell: process.platform === 'win32'
});
return true; return true;
} catch (error) { } catch (error) {
return false; return false;
@ -254,7 +257,10 @@ async function checkVercelCLI() {
async function installVercelCLI() { async function installVercelCLI() {
console.log('Installing Vercel CLI...'); console.log('Installing Vercel CLI...');
execSync('npm install -g vercel', { stdio: 'inherit' }); execSync('npm install -g vercel', {
stdio: 'inherit',
shell: process.platform === 'win32'
});
} }
async function loginToVercel() { async function loginToVercel() {
@ -383,7 +389,8 @@ async function deployToVercel(useGitHub = false) {
console.log('\n⚠ Note: choosing a longer, more unique project name will help avoid conflicts with other existing domains\n'); console.log('\n⚠ Note: choosing a longer, more unique project name will help avoid conflicts with other existing domains\n');
execSync('vercel', { execSync('vercel', {
cwd: projectRoot, cwd: projectRoot,
stdio: 'inherit' stdio: 'inherit',
shell: process.platform === 'win32'
}); });
// Load project info from .vercel/project.json // Load project info from .vercel/project.json

View File

@ -128,14 +128,13 @@ async function startDev() {
} }
// Start next dev with appropriate configuration // Start next dev with appropriate configuration
const nextBin = process.platform === 'win32' const nextBin = path.normalize(path.join(projectRoot, 'node_modules', '.bin', 'next'));
? path.join(projectRoot, 'node_modules', '.bin', 'next.cmd')
: path.join(projectRoot, 'node_modules', '.bin', 'next');
nextDev = spawn(nextBin, ['dev'], { nextDev = spawn(nextBin, ['dev'], {
stdio: 'inherit', stdio: 'inherit',
env: { ...process.env, NEXT_PUBLIC_URL: frameUrl, NEXTAUTH_URL: frameUrl }, env: { ...process.env, NEXT_PUBLIC_URL: frameUrl, NEXTAUTH_URL: frameUrl },
cwd: projectRoot cwd: projectRoot,
shell: process.platform === 'win32' // Add shell option for Windows
}); });
// Handle cleanup // Handle cleanup