-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Adds Support for Yarn Install If Supported #2537
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
Adds Support for Yarn Install If Supported #2537
Conversation
gulpfile.js
Outdated
@@ -148,7 +148,9 @@ gulp.task('installFixtures', function() { | |||
}, 1 * 1000); | |||
shell.cd('test/fixtures'); | |||
|
|||
execAsync('npm install --quiet', {cwd: '../fixtures'}).then(() => { | |||
execAsync('type yarn &> /dev/null | yarn install || npm install --quiet', { |
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 should be checking if the user is on Windows, and using the proper Windows commands if so
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.
I'm not on windows and don't have access to it atm.
I found this: https://superuser.com/questions/175466/determine-if-command-is-recognized-in-a-batch-file
Hence we could use: WHERE yarn >nul 2>nul; IF %ERRORLEVEL% EQU 0 yarn install ELSE npm install --quiet;
Can you or sb. confirm that this works please?
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.
This worked for me:
yarn --version >nul 2>&1 && ( yarn install ) || ( npm install --quiet )
We should be able to use process.platform to figure out what the user is on.
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.
Updated. Tested regular install on macOS.
Tried running: gulp installFixtures
but that doesn't work.
Can you test on Windows too please?
The Windows check fails, since |
Gotta, I thought there might be win64, changed it to win32 now though ;) |
Yeah, that would make sense, but the process docs only has Anyhow, your code will still not work on Windows, since You can either use |
checks if yarn is available and runs yarn install on setup. falls back to npm if yarn is not installed.
updated. |
checks if yarn is available and runs yarn install on setup. falls back to npm if yarn is not
installed.
generator-angular-fullstack$ npm test
)