Skip to content
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

feat(gatsby-cli): Remove one of package-lock.json and yarn.lock on gatsby new #13225

Merged

Conversation

frinyvonnick
Copy link
Contributor

Description

I made a first implementation that asks user with prompts which package manager he wants to use.

Related Issues

Related to issue #13210

@frinyvonnick frinyvonnick requested a review from a team as a code owner April 8, 2019 19:24
@frinyvonnick frinyvonnick changed the title ✨ Ask user which package manager he wants to use feat(gatsby-cli): Asks user which package manager he wants to use Apr 8, 2019
@frinyvonnick frinyvonnick changed the title feat(gatsby-cli): Asks user which package manager he wants to use feat(gatsby-cli): Remove one of package-lock.json and yarn.lock on gatsby new Apr 8, 2019
Copy link
Contributor

@sidharthachatterjee sidharthachatterjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great so far @frinyvonnick

Thank you for picking this up! Left a few comments

packages/gatsby-cli/src/init-starter.js Show resolved Hide resolved
packages/gatsby-cli/src/init-starter.js Outdated Show resolved Hide resolved
packages/gatsby-cli/src/init-starter.js Show resolved Hide resolved
@frinyvonnick
Copy link
Contributor Author

Thank you for your review @sidharthachatterjee 👍

yarn.lock Outdated Show resolved Hide resolved
@frinyvonnick
Copy link
Contributor Author

Thank for your review @wardpeet 👍

@frinyvonnick
Copy link
Contributor Author

Can't make e2e tests locally even on master last commit I always have the same tests failing. @wardpeet @sidharthachatterjee do you have some pointer to help me getting rid of this ?

@frinyvonnick
Copy link
Contributor Author

Thanks for your review @jamo 👍

}
conf.set(`package_manager`, response)
if (response.includes(`yarn`)) {
fs.unlinkSync(`package-lock.json`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async removal of files has better support on windows as it retries if it fails on the first try

Suggested change
fs.unlinkSync(`package-lock.json`)
await fs.remove(`package-lock.json`)

https://github.com/jprichardson/node-fs-extra/blob/master/lib/remove/rimraf.js#L45-L51

if (response.includes(`yarn`)) {
fs.unlinkSync(`package-lock.json`)
} else {
fs.unlinkSync(`yarn.lock`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment above

Suggested change
fs.unlinkSync(`yarn.lock`)
await fs.remove(`yarn.lock`)

@wardpeet
Copy link
Contributor

wardpeet commented Apr 11, 2019

This looks great! just a few remarks on fs.unlinksync but after that this is good to merge!

@wardpeet wardpeet self-assigned this Apr 11, 2019
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated code for my own review so we can get this shipped! Thank you for your hard work!

@wardpeet wardpeet added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Apr 11, 2019
@wardpeet wardpeet merged commit 3510a46 into gatsbyjs:master Apr 11, 2019
@ivanoats
Copy link
Contributor

How would we resolve this issue regarding using the starters, their own repos, and how they might be updated?

For example, right now I am trying gatsby new hello-world-test old starter repo that is in the docs and see it still has both yarn and package.json in it's own repo. But the starter does not have yarn.lock in this main repo.

I see this is being covered on #16135 so I guess I'm just leaving this comment here to help other people out who might be running into this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants