-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: package manager feature #33
fix: package manager feature #33
Conversation
actions/new.action.ts
Outdated
const installNpm = (): void => { | ||
try { | ||
const currentPlatform = platform(); | ||
if (currentPlatform === 'win32') { | ||
// Windows installation command for npm via Node.js installer | ||
console.log('Downloading and installing Node.js which includes npm...'); | ||
execSync('powershell -Command "Invoke-WebRequest -Uri https://nodejs.org/dist/v18.16.1/node-v18.16.1-x64.msi -OutFile nodejs.msi; Start-Process msiexec.exe -ArgumentList \'/i nodejs.msi /quiet\' -Wait; Remove-Item nodejs.msi"', { stdio: 'inherit' }); | ||
} else { | ||
// Linux/macOS installation command for npm | ||
execSync('curl -L https://www.npmjs.com/install.sh | sh', { stdio: 'inherit' }); | ||
} | ||
console.log('npm has been installed.'); | ||
} catch (error) { | ||
console.error('Failed to install npm:', error); | ||
process.exit(1); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this.
actions/new.action.ts
Outdated
const checkIfPackageManagerIsAvailable = (cmd: string): boolean => { | ||
try { | ||
execSync(`command -v ${cmd}`, { stdio: 'ignore' }); | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to npm specific command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const checkIfPackageManagerIsAvailable = (cmd: string): boolean => { | |
try { | |
execSync(`command -v ${cmd}`, { stdio: 'ignore' }); | |
return true; | |
} catch (error) { | |
return false; | |
} | |
}; | |
execSync(`${cmd} -v`, { stdio: 'ignore' }); |
Issue : #29
Functionality added :
stencil new
will check for installed package managers and then ask user to choose from only those which are installed.Default case: it'll ask to install
npm
.Does this PR introduce a breaking change?
Other information